|
|
@@ -0,0 +1,59 @@
|
|
|
+package com.tzld.piaoquan.recommend.server.service.rank.strategy;
|
|
|
+
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.tzld.piaoquan.recommend.server.common.enums.TabType;
|
|
|
+import com.tzld.piaoquan.recommend.server.model.Tab;
|
|
|
+import com.tzld.piaoquan.recommend.server.model.Video;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.rank.RankParam;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.rank.RankResult;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.rank.RankService;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.recall.strategy.CityRovnAllRovRecallStrategy;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.recall.strategy.CityRovnRecallStrategy;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.recall.strategy.RegionHRecallStrategy;
|
|
|
+import com.tzld.piaoquan.recommend.server.service.recall.strategy.RegionRealtimeRecallStrategyV1;
|
|
|
+import com.tzld.piaoquan.recommend.server.util.RecallUtils;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class RankSequenceStrategy extends RankService {
|
|
|
+
|
|
|
+ private static final List<String> territoryRecall = Lists.newArrayList(
|
|
|
+ CityRovnAllRovRecallStrategy.PUSH_FROM,
|
|
|
+ CityRovnRecallStrategy.PUSH_FROM,
|
|
|
+ RegionHRecallStrategy.PUSH_FORM,
|
|
|
+ RegionRealtimeRecallStrategyV1.PUSH_FORM
|
|
|
+ );
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Video> mergeAndRankRovRecall(RankParam param) {
|
|
|
+ List<Video> rovRecallRank = new ArrayList<>();
|
|
|
+ Tab tab = param.getTab();
|
|
|
+ if (Objects.nonNull(tab) && StringUtils.isNotBlank(tab.getType())) {
|
|
|
+ TabType type = TabType.getByType(tab.getType());
|
|
|
+ if (Objects.equals(TabType.territory, type)) {
|
|
|
+ this.extractRecall(param, territoryRecall, rovRecallRank);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 记录召回源中的视频
|
|
|
+ this.rankBeforePostProcessor(rovRecallRank);
|
|
|
+ return rovRecallRank;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void extractRecall(RankParam param, List<String> recalls, List<Video> videos) {
|
|
|
+ Set<Long> setVideo = new HashSet<>();
|
|
|
+ for (String recall : recalls) {
|
|
|
+ RecallUtils.extractRecall(10000, param, recall, setVideo, videos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RankResult mergeAndSort(RankParam param, List<Video> rovRecallRank, List<Video> flowPoolRank, List<Video> douHotFlowPoolRank) {
|
|
|
+ return new RankResult(rovRecallRank);
|
|
|
+ }
|
|
|
+}
|