소스 검색

Merge branch 'wyp/1223-rankV15' of Server/long-article-recommend into master

wangyunpeng 6 달 전
부모
커밋
e4dc4d580a

+ 8 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/RankService.java

@@ -144,12 +144,17 @@ public class RankService implements InitializingBean {
     public static List<Content> contentSourceTypeFilter(String strategy, List<Content> pool, Integer index) {
         Integer sourceType = getStrategyPoolSourceType(strategy, index);
         Integer videoSourceType = PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal();
+        List<Content> videoPool = pool.stream().filter(o -> Objects.equals(o.getSourceType(), videoSourceType)).collect(Collectors.toList());
+        List<Content> otherPool = pool.stream().filter(o ->!Objects.equals(o.getSourceType(), videoSourceType)).collect(Collectors.toList());
         if (Objects.nonNull(sourceType) && sourceType.equals(videoSourceType)) {
-            pool = pool.stream().filter(o -> Objects.equals(o.getSourceType(), videoSourceType)).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(videoPool)) {
+                return videoPool;
+            } else {
+                return otherPool;
+            }
         } else {
-            pool = pool.stream().filter(o -> !Objects.equals(o.getSourceType(), videoSourceType)).collect(Collectors.toList());
+            return otherPool;
         }
-        return pool;
     }
 
     public static void commonAdd38Content(RankParam param, List<Content> result, String[] contentPools,

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV15Strategy.java

@@ -121,6 +121,7 @@ public class RankV15Strategy implements RankStrategy {
             RankStrategy.sendFeishuFirstPoolEmpty(param, contentPools[0]);
             return new RankResult(result);
         }
+
         // 次
         RankService.commonAddSecondContent(param, result, publishPool, contentPools, contentMap,
                 indexReplacePoolConfigMap, param.getStrategy());