|
@@ -35,7 +35,7 @@ public abstract class AbstractFilterService {
|
|
|
@Autowired
|
|
|
private ViewedService viewedService;
|
|
|
|
|
|
- private ExecutorService pool = ThreadPoolFactory.filterPool();
|
|
|
+ private final ExecutorService pool = ThreadPoolFactory.filterPool();
|
|
|
|
|
|
@Value("${newFilterGlobalSwitch:false}")
|
|
|
private boolean newFilterGlobalSwitch;
|
|
@@ -68,9 +68,10 @@ public abstract class AbstractFilterService {
|
|
|
videoIds = filterByPreViewed(param.getAppType(), param.getMid(), videoIds);
|
|
|
}
|
|
|
if (param.isConcurrent()) {
|
|
|
- videoIds = filterByViewedConcurrent(param.getAppType(), param.getMid(), param.getUid(), videoIds, param.getRegionCode());
|
|
|
+ videoIds = filterByViewedConcurrent(param.getAppType(), param.getMid(), param.getUid(), videoIds,
|
|
|
+ param.getCityCode());
|
|
|
} else {
|
|
|
- videoIds = filterByViewed(param.getAppType(), param.getMid(), param.getUid(), videoIds, param.getRegionCode());
|
|
|
+ videoIds = filterByViewed(param.getAppType(), param.getMid(), param.getUid(), videoIds, param.getCityCode());
|
|
|
}
|
|
|
return videoIds;
|
|
|
}
|
|
@@ -96,7 +97,7 @@ public abstract class AbstractFilterService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<Long> filterByViewedConcurrent(int appType, String mid, String uid, List<Long> videoIds, String regionCode) {
|
|
|
+ private List<Long> filterByViewedConcurrent(int appType, String mid, String uid, List<Long> videoIds, String cityCode) {
|
|
|
// TODO uid为空时,还需要过滤么?
|
|
|
if (StringUtils.isBlank(mid)
|
|
|
|| CollectionUtils.isEmpty(videoIds)) {
|
|
@@ -118,7 +119,7 @@ public abstract class AbstractFilterService {
|
|
|
List<Future<List<Long>>> futures = new ArrayList<>();
|
|
|
for (final List<Long> ids : chunks) {
|
|
|
Future<List<Long>> future = pool.submit(() ->
|
|
|
- viewedService.filterViewedVideo(appType, mid, uid, ids, regionCode));
|
|
|
+ viewedService.filterViewedVideo(appType, mid, uid, ids, cityCode));
|
|
|
futures.add(future);
|
|
|
}
|
|
|
try {
|
|
@@ -142,13 +143,13 @@ public abstract class AbstractFilterService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private List<Long> filterByViewed(int appType, String mid, String uid, List<Long> videoIds, String regionCode) {
|
|
|
+ private List<Long> filterByViewed(int appType, String mid, String uid, List<Long> videoIds, String cityCode) {
|
|
|
// TODO uid为空时,还需要过滤么?
|
|
|
if (StringUtils.isBlank(mid)
|
|
|
|| CollectionUtils.isEmpty(videoIds)) {
|
|
|
return videoIds;
|
|
|
}
|
|
|
- return viewedService.filterViewedVideo(appType, mid, uid, videoIds, regionCode);
|
|
|
+ return viewedService.filterViewedVideo(appType, mid, uid, videoIds, cityCode);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -177,10 +178,7 @@ public abstract class AbstractFilterService {
|
|
|
// 1 判断是否过滤,不展示的app+区域列表。
|
|
|
boolean filterFlag;
|
|
|
if (rules.containsKey(appType)) {
|
|
|
- filterFlag = false;
|
|
|
- if (rules.get(appType).contains(regionCode)) {
|
|
|
- filterFlag = true;
|
|
|
- }
|
|
|
+ filterFlag = rules.get(appType).contains(regionCode);
|
|
|
} else {
|
|
|
filterFlag = true;
|
|
|
}
|