|
@@ -150,7 +150,7 @@ public class RecallService implements ApplicationContextAware {
|
|
|
return content;
|
|
return content;
|
|
|
}
|
|
}
|
|
|
// 标题历史均值
|
|
// 标题历史均值
|
|
|
- setTitleAvgViewCount(content, param.getGhId());
|
|
|
|
|
|
|
+ setTitleAvgViewCount(content, param.getGhId(), param.getType());
|
|
|
// category 查询
|
|
// category 查询
|
|
|
setContentCategory(content);
|
|
setContentCategory(content);
|
|
|
return content;
|
|
return content;
|
|
@@ -210,7 +210,7 @@ public class RecallService implements ApplicationContextAware {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void setTitleAvgViewCount(List<Content> contentList, String ghId) {
|
|
|
|
|
|
|
+ public void setTitleAvgViewCount(List<Content> contentList, String ghId, String type) {
|
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
|
// 获取账号相关性
|
|
// 获取账号相关性
|
|
|
List<AccountCorrelation> accountCorrelationList = accountCorrelationRepository.findByGhIdAndStatus(ghId, 1);
|
|
List<AccountCorrelation> accountCorrelationList = accountCorrelationRepository.findByGhIdAndStatus(ghId, 1);
|
|
@@ -225,7 +225,7 @@ public class RecallService implements ApplicationContextAware {
|
|
|
List<Article> hisArticleList = new ArrayList<>();
|
|
List<Article> hisArticleList = new ArrayList<>();
|
|
|
List<List<String>> titleMd5Partition = Lists.partition(new ArrayList<>(titleMd5List), 1000);
|
|
List<List<String>> titleMd5Partition = Lists.partition(new ArrayList<>(titleMd5List), 1000);
|
|
|
for (List<String> titleMd5s : titleMd5Partition) {
|
|
for (List<String> titleMd5s : titleMd5Partition) {
|
|
|
- hisArticleList.addAll(articleRepository.getByTitleMd5InAndTypeEqualsAndStatusEquals(titleMd5s, ArticleTypeEnum.QUNFA.getVal(), 1));
|
|
|
|
|
|
|
+ hisArticleList.addAll(articleRepository.getByTitleMd5InAndTypeEqualsAndStatusEquals(titleMd5s, type, 1));
|
|
|
}
|
|
}
|
|
|
Map<String, Map<Integer, List<Article>>> map = hisArticleList.stream()
|
|
Map<String, Map<Integer, List<Article>>> map = hisArticleList.stream()
|
|
|
.collect(Collectors.groupingBy(Article::getTitle, Collectors.groupingBy(Article::getItemIndex)));
|
|
.collect(Collectors.groupingBy(Article::getTitle, Collectors.groupingBy(Article::getItemIndex)));
|
|
@@ -240,7 +240,8 @@ public class RecallService implements ApplicationContextAware {
|
|
|
// 获取历史已发布文章所属头条内容
|
|
// 获取历史已发布文章所属头条内容
|
|
|
Set<String> ghIds = hisArticleList.stream().map(Article::getGhId).collect(Collectors.toSet());
|
|
Set<String> ghIds = hisArticleList.stream().map(Article::getGhId).collect(Collectors.toSet());
|
|
|
Set<String> appMsgIds = hisArticleList.stream().map(Article::getAppMsgId).collect(Collectors.toSet());
|
|
Set<String> appMsgIds = hisArticleList.stream().map(Article::getAppMsgId).collect(Collectors.toSet());
|
|
|
- List<Article> firstIndexHisArticleList = articleRepository.getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEqualsAndStatusEquals(ghIds, appMsgIds, 1, ArticleTypeEnum.QUNFA.getVal(), 1);
|
|
|
|
|
|
|
+ List<Article> firstIndexHisArticleList = articleRepository.getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEqualsAndStatusEquals(
|
|
|
|
|
+ ghIds, appMsgIds, 1, type, 1);
|
|
|
Map<String, Map<String, Article>> firstIndexHisArticleMap = firstIndexHisArticleList.stream()
|
|
Map<String, Map<String, Article>> firstIndexHisArticleMap = firstIndexHisArticleList.stream()
|
|
|
.collect(Collectors.groupingBy(Article::getGhId, Collectors.toMap(Article::getAppMsgId, o -> o)));
|
|
.collect(Collectors.groupingBy(Article::getGhId, Collectors.toMap(Article::getAppMsgId, o -> o)));
|
|
|
// 获取发布账号 位置历史均值
|
|
// 获取发布账号 位置历史均值
|
|
@@ -301,12 +302,14 @@ public class RecallService implements ApplicationContextAware {
|
|
|
avgViewCount = Optional.ofNullable(indexMap.get(hisArticle.getItemIndex().toString()).getReadAvg())
|
|
avgViewCount = Optional.ofNullable(indexMap.get(hisArticle.getItemIndex().toString()).getReadAvg())
|
|
|
.orElse(0.0).intValue();
|
|
.orElse(0.0).intValue();
|
|
|
} else {
|
|
} else {
|
|
|
- FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.RECOMMEND.getRobotId(),
|
|
|
|
|
- "历史表现阅读均值获取失败\n"
|
|
|
|
|
- + "ghId: " + hisArticle.getGhId() + "\n"
|
|
|
|
|
- + "账号名称: " + hisArticle.getAccountName() + "\n"
|
|
|
|
|
- + "日期: " + hisPublishDate + "\n"
|
|
|
|
|
- + "位置: " + hisArticle.getItemIndex());
|
|
|
|
|
|
|
+ if (ArticleTypeEnum.QUNFA.getVal().equals(type)) {
|
|
|
|
|
+ FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.RECOMMEND.getRobotId(),
|
|
|
|
|
+ "历史表现阅读均值获取失败\n"
|
|
|
|
|
+ + "ghId: " + hisArticle.getGhId() + "\n"
|
|
|
|
|
+ + "账号名称: " + hisArticle.getAccountName() + "\n"
|
|
|
|
|
+ + "日期: " + hisPublishDate + "\n"
|
|
|
|
|
+ + "位置: " + hisArticle.getItemIndex());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
article.setAvgViewCount(avgViewCount);
|
|
article.setAvgViewCount(avgViewCount);
|