|
@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.service.score.strategy;
|
|
|
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.tzld.longarticle.recommend.server.model.Content;
|
|
|
+import com.tzld.longarticle.recommend.server.model.ContentHisPublishArticle;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.PublishSortLogRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.entity.crawler.PublishSortLog;
|
|
|
import com.tzld.longarticle.recommend.server.service.AccountContentPoolConfigService;
|
|
@@ -55,7 +56,7 @@ public class ColdStartDecreaseStrategy implements ScoreStrategy {
|
|
|
Score score = new Score();
|
|
|
score.setStrategy(this);
|
|
|
score.setContentId(content.getId());
|
|
|
- Integer scoreVal = getContentScore(param.getAccountName(), hisPublishedContentMap, content.getCrawlerChannelContentId());
|
|
|
+ Integer scoreVal = getContentScore(param.getAccountName(), hisPublishedContentMap, content);
|
|
|
if (scoreVal != 0) {
|
|
|
score.setScore(scoreVal);
|
|
|
scores.add(score);
|
|
@@ -67,13 +68,15 @@ public class ColdStartDecreaseStrategy implements ScoreStrategy {
|
|
|
|
|
|
private Integer getContentScore(String accountName,
|
|
|
Map<String, List<PublishSortLog>> hisPublishedContentMap,
|
|
|
- String crawlerChannelContentId) {
|
|
|
+ Content content) {
|
|
|
Integer weight = getColdStartScoreDecreaseWeight(accountName);
|
|
|
Integer totalAvgReadCountBase = getAvgReadCountBase(accountName);
|
|
|
- if (hisPublishedContentMap.containsKey(crawlerChannelContentId)) {
|
|
|
- List<PublishSortLog> publishContents = hisPublishedContentMap.get(crawlerChannelContentId);
|
|
|
+ if (hisPublishedContentMap.containsKey(content.getCrawlerChannelContentId())) {
|
|
|
+ List<PublishSortLog> publishContents = hisPublishedContentMap.get(content.getCrawlerChannelContentId());
|
|
|
double sumViewCount = publishContents.stream().mapToDouble(PublishSortLog::getIndexAvgCount).sum();
|
|
|
- if (sumViewCount > totalAvgReadCountBase) {
|
|
|
+ int hisViewCountSum = content.getHisPublishArticleList().stream().filter(ContentHisPublishArticle::isInnerAccount)
|
|
|
+ .mapToInt(ContentHisPublishArticle::getAvgViewCount).sum();
|
|
|
+ if ((sumViewCount + hisViewCountSum) > totalAvgReadCountBase) {
|
|
|
return weight;
|
|
|
}
|
|
|
}
|