|
@@ -154,19 +154,17 @@ public class InfiniteRankStrategy implements RankStrategy {
|
|
|
// 4 选文章
|
|
// 4 选文章
|
|
|
String[] publishPool = Arrays.copyOf(contentPools, contentPools.length);
|
|
String[] publishPool = Arrays.copyOf(contentPools, contentPools.length);
|
|
|
|
|
|
|
|
- // 头 次 选取头条内容池 第11、12条内容 如果内容不足12条返回空
|
|
|
|
|
|
|
+ // 头 次 选取头条内容池 从上往下取前2条内容
|
|
|
List<Content> pool1 = contentMap.get(contentPools[0]);
|
|
List<Content> pool1 = contentMap.get(contentPools[0]);
|
|
|
if (CollectionUtils.isNotEmpty(pool1)) {
|
|
if (CollectionUtils.isNotEmpty(pool1)) {
|
|
|
pool1 = RankService.contentSourceTypeFilter(param.getStrategy(), pool1, 1);
|
|
pool1 = RankService.contentSourceTypeFilter(param.getStrategy(), pool1, 1);
|
|
|
}
|
|
}
|
|
|
RankService.printSortLog(param.getStrategy(), param.getAccountName(), "头条", pool1);
|
|
RankService.printSortLog(param.getStrategy(), param.getAccountName(), "头条", pool1);
|
|
|
- if (CollectionUtils.isNotEmpty(pool1) && pool1.size() >= 12) {
|
|
|
|
|
- // 选取第11、12条内容
|
|
|
|
|
- result.add(pool1.get(10));
|
|
|
|
|
- result.add(pool1.get(11));
|
|
|
|
|
- } else {
|
|
|
|
|
- RankStrategy.sendFeishuFirstPoolEmpty(param, contentPools[0]);
|
|
|
|
|
- return new RankResult(result);
|
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(pool1)) {
|
|
|
|
|
+ // 从上往下取前2条内容
|
|
|
|
|
+ for (int i = 0; i < Math.min(pool1.size(), 2); i++) {
|
|
|
|
|
+ result.add(pool1.get(i));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 3-8
|
|
// 3-8
|
|
@@ -179,7 +177,7 @@ public class InfiniteRankStrategy implements RankStrategy {
|
|
|
.collect(Collectors.toCollection(LinkedList::new));
|
|
.collect(Collectors.toCollection(LinkedList::new));
|
|
|
Queue<Content> otherPoolQueue = pool.stream().filter(o -> !Objects.equals(o.getSourceType(), videoSourceType))
|
|
Queue<Content> otherPoolQueue = pool.stream().filter(o -> !Objects.equals(o.getSourceType(), videoSourceType))
|
|
|
.collect(Collectors.toCollection(LinkedList::new));
|
|
.collect(Collectors.toCollection(LinkedList::new));
|
|
|
- for (int i = 3; i < param.getSize() + 1; i++) {
|
|
|
|
|
|
|
+ for (int i = result.size() + 1; i < param.getSize() + 1; i++) {
|
|
|
Integer sourceType = RankService.getStrategyPoolSourceType(param.getStrategy(), i);
|
|
Integer sourceType = RankService.getStrategyPoolSourceType(param.getStrategy(), i);
|
|
|
if (Objects.equals(sourceType, videoSourceType) && !videoPoolQueue.isEmpty()) {
|
|
if (Objects.equals(sourceType, videoSourceType) && !videoPoolQueue.isEmpty()) {
|
|
|
result.add(videoPoolQueue.poll());
|
|
result.add(videoPoolQueue.poll());
|
|
@@ -192,6 +190,8 @@ public class InfiniteRankStrategy implements RankStrategy {
|
|
|
rankService.checkPublishContentStatus(result, contentMap, publishPool);
|
|
rankService.checkPublishContentStatus(result, contentMap, publishPool);
|
|
|
RankStrategy.deduplication(result, contentMap, publishPool);
|
|
RankStrategy.deduplication(result, contentMap, publishPool);
|
|
|
|
|
|
|
|
|
|
+ result = result.subList(0, Math.min(result.size(), param.getSize()));
|
|
|
|
|
+
|
|
|
return new RankResult(result);
|
|
return new RankResult(result);
|
|
|
}
|
|
}
|
|
|
|
|
|