|
@@ -1,5 +1,6 @@
|
|
|
package com.tzld.longarticle.recommend.server.service.score.strategy;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.tzld.longarticle.recommend.server.model.Content;
|
|
|
import com.tzld.longarticle.recommend.server.model.ContentHisPublishArticle;
|
|
@@ -83,9 +84,12 @@ public class FlowCtlDecreaseStrategy implements ScoreStrategy {
|
|
|
|| !indexTotalAvgReadCountBase.containsKey(String.valueOf(index))) {
|
|
|
return 0;
|
|
|
}
|
|
|
- if (hisPublishedContentMap.containsKey(content.getTitle())) {
|
|
|
+ if (hisPublishedContentMap.containsKey(content.getTitle()) || CollectionUtil.isNotEmpty(content.getHisPublishArticleList())) {
|
|
|
List<PublishSortLog> publishContents = hisPublishedContentMap.get(content.getTitle());
|
|
|
- double sumViewCount = publishContents.stream().mapToDouble(PublishSortLog::getIndexAvgCount).sum();
|
|
|
+ double sumViewCount = 0;
|
|
|
+ if (CollectionUtil.isNotEmpty(publishContents)) {
|
|
|
+ sumViewCount = publishContents.stream().mapToDouble(PublishSortLog::getIndexAvgCount).sum();
|
|
|
+ }
|
|
|
int hisViewCountSum = content.getHisPublishArticleList().stream().filter(ContentHisPublishArticle::isInnerAccount)
|
|
|
.mapToInt(ContentHisPublishArticle::getAvgViewCount).sum();
|
|
|
if ((sumViewCount + hisViewCountSum) > indexTotalAvgReadCountBase.get(String.valueOf(index))) {
|