|
@@ -122,11 +122,11 @@ public class RankV16Strategy implements RankStrategy {
|
|
|
}
|
|
|
RankService.printSortLog(param.getStrategy(), param.getAccountName(), "头条", pool1);
|
|
|
if (CollectionUtils.isNotEmpty(pool1)) {
|
|
|
- if (pool1.get(0).getProducePlanId().equals(topProducePlanId)) {
|
|
|
- int i = RandomUtils.nextInt(0, 1);
|
|
|
+ if (topProducePlanId.equals(pool1.get(0).getProducePlanId())) {
|
|
|
+ int i = RandomUtils.nextInt(0, 2);
|
|
|
if (i == 0) {
|
|
|
for (Content content : pool1) {
|
|
|
- if (!content.getProducePlanId().equals(topProducePlanId)) {
|
|
|
+ if (!topProducePlanId.equals(content.getProducePlanId())) {
|
|
|
result.add(content);
|
|
|
break;
|
|
|
}
|
|
@@ -148,17 +148,19 @@ public class RankV16Strategy implements RankStrategy {
|
|
|
// 3-8
|
|
|
// RankService.commonAdd38Content(param, result, contentPools, contentMap, param.getStrategy());
|
|
|
List<Content> pool = contentMap.get(contentPools[2]);
|
|
|
- Integer videoSourceType = PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal();
|
|
|
- Queue<Content> videoPoolQueue = pool.stream().filter(o -> Objects.equals(o.getSourceType(), videoSourceType))
|
|
|
- .collect(Collectors.toCollection(LinkedList::new));
|
|
|
- Queue<Content> otherPoolQueue = pool.stream().filter(o -> !Objects.equals(o.getSourceType(), videoSourceType))
|
|
|
- .collect(Collectors.toCollection(LinkedList::new));
|
|
|
- for (int i = 3; i < param.getSize() + 1; i++) {
|
|
|
- Integer sourceType = RankService.getStrategyPoolSourceType(param.getStrategy(), i);
|
|
|
- if (Objects.equals(sourceType, videoSourceType) && !videoPoolQueue.isEmpty()) {
|
|
|
- result.add(videoPoolQueue.poll());
|
|
|
- } else if (!otherPoolQueue.isEmpty()) {
|
|
|
- result.add(otherPoolQueue.poll());
|
|
|
+ if (CollectionUtils.isNotEmpty(pool)) {
|
|
|
+ Integer videoSourceType = PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal();
|
|
|
+ Queue<Content> videoPoolQueue = pool.stream().filter(o -> Objects.equals(o.getSourceType(), videoSourceType))
|
|
|
+ .collect(Collectors.toCollection(LinkedList::new));
|
|
|
+ Queue<Content> otherPoolQueue = pool.stream().filter(o -> !Objects.equals(o.getSourceType(), videoSourceType))
|
|
|
+ .collect(Collectors.toCollection(LinkedList::new));
|
|
|
+ for (int i = 3; i < param.getSize() + 1; i++) {
|
|
|
+ Integer sourceType = RankService.getStrategyPoolSourceType(param.getStrategy(), i);
|
|
|
+ if (Objects.equals(sourceType, videoSourceType) && !videoPoolQueue.isEmpty()) {
|
|
|
+ result.add(videoPoolQueue.poll());
|
|
|
+ } else if (!otherPoolQueue.isEmpty()) {
|
|
|
+ result.add(otherPoolQueue.poll());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|