|
@@ -1,7 +1,11 @@
|
|
|
package com.tzld.piaoquan.recommend.server.service.recall.strategy;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.tzld.piaoquan.recommend.server.model.Video;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.filter.FilterResult;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.filter.FilterService;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.recall.FilterParamFactory;
|
|
|
import com.tzld.piaoquan.recommend.server.service.recall.RecallParam;
|
|
|
import com.tzld.piaoquan.recommend.server.service.recall.RecallStrategy;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -29,6 +33,9 @@ public abstract class AbstractFlowPoolTopRecallStrategy implements RecallStrateg
|
|
|
@Value("${flow.pool.recent.top.video.daily.time.range:}")
|
|
|
private String timeRangeJson;
|
|
|
|
|
|
+ @Resource
|
|
|
+ protected FilterService filterService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<Video> recall(RecallParam param) {
|
|
|
boolean checkIfInTimeRange = checkIfInTimeRange();
|
|
@@ -45,13 +52,17 @@ public abstract class AbstractFlowPoolTopRecallStrategy implements RecallStrateg
|
|
|
}
|
|
|
try {
|
|
|
List<Long> videoIdList = JSONObject.parseArray(result.toString(), Long.class);
|
|
|
- return videoIdList.stream().map(vid -> {
|
|
|
- Video recallData = new Video();
|
|
|
- recallData.setVideoId(vid);
|
|
|
- recallData.setAbCode(param.getAbCode());
|
|
|
- recallData.setPushFrom(pushFrom());
|
|
|
- return recallData;
|
|
|
- }).limit(5).collect(Collectors.toList());
|
|
|
+ FilterResult filterResult = filterService.filter(FilterParamFactory.create(param, Lists.newArrayList(videoIdList)));
|
|
|
+ if (filterResult != null && CollectionUtils.isNotEmpty(filterResult.getVideoIds())) {
|
|
|
+ return filterResult.getVideoIds().stream().map(vid -> {
|
|
|
+ Video recallData = new Video();
|
|
|
+ recallData.setVideoId(vid);
|
|
|
+ recallData.setAbCode(param.getAbCode());
|
|
|
+ recallData.setPushFrom(pushFrom());
|
|
|
+ return recallData;
|
|
|
+ }).limit(5).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
log.error("recall error, key={}, result={}", key, result, e);
|
|
|
}
|