|
@@ -26,6 +26,7 @@ import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRe
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleDetailInfoRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.PublishSortLogRepository;
|
|
|
+import com.tzld.longarticle.recommend.server.service.score.ScoreStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import com.tzld.longarticle.recommend.server.util.MapBuilder;
|
|
|
import com.tzld.longarticle.recommend.server.util.feishu.FeiShu;
|
|
@@ -124,9 +125,12 @@ public class DataDashboardService {
|
|
|
Pair.of("AD", "0.00%"),
|
|
|
Pair.of("AE", "0.00%"),
|
|
|
Pair.of("AF", "0.00%"),
|
|
|
- Pair.of("AL", "0.00%"),
|
|
|
- Pair.of("AM", "0.00%"),
|
|
|
- Pair.of("AN", "0.00%")
|
|
|
+ Pair.of("AG", "0.00%"),
|
|
|
+ Pair.of("AH", "0.00%"),
|
|
|
+ Pair.of("AI", "0.00%"),
|
|
|
+ Pair.of("AO", "0.00%"),
|
|
|
+ Pair.of("AP", "0.00%"),
|
|
|
+ Pair.of("AQ", "0.00%")
|
|
|
);
|
|
|
|
|
|
doSendFeishuSheet(dateStrList, sheetToken, sheetId, rowNum, rows, 2, styles);
|
|
@@ -135,7 +139,7 @@ public class DataDashboardService {
|
|
|
private List<NewSortStrategyExport> newSortStrategyData(String dateStr) {
|
|
|
long timestamp = DateUtils.dateStrToTimestamp(dateStr, "yyyyMMdd");
|
|
|
String dateStrS = DateUtils.timestampToYMDStr(timestamp, "yyyy-MM-dd");
|
|
|
- List<AccountAvgInfo> accountAvgInfoList = accountAvgInfoRepository.getAllByUpdateTimeGreaterThanEqual(dateStrS);
|
|
|
+ List<AccountAvgInfo> accountAvgInfoList = accountAvgInfoRepository.findAll();
|
|
|
List<String> ghIds = accountAvgInfoList.stream().map(AccountAvgInfo::getGhId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeGreaterThanAndTypeEquals(ghIds, timestamp, "9");
|
|
@@ -251,6 +255,23 @@ public class DataDashboardService {
|
|
|
// 源生成计划
|
|
|
List<String> titleList = articleList.stream().map(Article::getTitle).distinct().collect(Collectors.toList());
|
|
|
Map<String, ProducePlan> sourceTitlePlanMap = getTitleSourceProducePlanMap(titleList);
|
|
|
+ // 历史发布情况
|
|
|
+ List<String> titleMd5List = articleList.stream().map(Article::getTitleMd5).distinct().collect(Collectors.toList());
|
|
|
+ List<Article> hisArticleList = new ArrayList<>();
|
|
|
+ List<List<String>> titleMd5Partition = Lists.partition(new ArrayList<>(titleMd5List), 1000);
|
|
|
+ for (List<String> titleMd5s : titleMd5Partition) {
|
|
|
+ hisArticleList.addAll(articleRepository.getByTitleMd5InAndTypeEqualsAndStatusEquals(titleMd5s, "9", 1));
|
|
|
+ }
|
|
|
+ Map<String, List<Article>> hisArticleMap = hisArticleList.stream().collect(Collectors.groupingBy(Article::getTitle));
|
|
|
+ Set<String> hisWxSnList = hisArticleList.stream().map(Article::getWxSn).collect(Collectors.toSet());
|
|
|
+ List<ArticleDetailInfo> hisArticleDetailInfoList = new ArrayList<>();
|
|
|
+ List<List<String>> hisSnPartition = Lists.partition(new ArrayList<>(hisWxSnList), 1000);
|
|
|
+ for (List<String> sns : hisSnPartition) {
|
|
|
+ hisArticleDetailInfoList.addAll(articleDetailInfoRepository.getAllByWxSnIn(sns));
|
|
|
+ }
|
|
|
+ Map<String, List<ArticleDetailInfo>> hisArticleDetailInfoMap = hisArticleDetailInfoList.stream()
|
|
|
+ .collect(Collectors.groupingBy(ArticleDetailInfo::getWxSn));
|
|
|
+
|
|
|
// result
|
|
|
List<NewSortStrategyExport> result = new ArrayList<>();
|
|
|
for (Article article : articleList) {
|
|
@@ -435,6 +456,47 @@ public class DataDashboardService {
|
|
|
if (Objects.nonNull(sourceProducePlan)) {
|
|
|
obj.setSourceProducePlanName(sourceProducePlan.getName());
|
|
|
}
|
|
|
+ List<Article> hisArticles = hisArticleMap.get(article.getTitle());
|
|
|
+ hisArticles = hisArticles.stream().filter(o -> o.getUpdateTime() < (article.getUpdateTime() - 3600 * 8)
|
|
|
+ && (1 == o.getItemIndex() || 2 == o.getItemIndex())
|
|
|
+ && !ScoreStrategy.hisContentLateFilter(o.getUpdateTime())).collect(Collectors.toList());
|
|
|
+ Integer readCount = 0;
|
|
|
+ Double readAvgCount = 0.0;
|
|
|
+ Integer fansCount = 0;
|
|
|
+ int firstCount = 0;
|
|
|
+ int fission0Count = 0;
|
|
|
+ for (Article hisArticle : hisArticles) {
|
|
|
+ readCount += hisArticle.getShowViewCount();
|
|
|
+ AccountAvgInfo accountAvgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, hisArticle.getGhId(),
|
|
|
+ hisArticle.getUpdateTime(), hisArticle.getItemIndex());
|
|
|
+ if (Objects.nonNull(accountAvgInfo)) {
|
|
|
+ readAvgCount += accountAvgInfo.getReadAvg();
|
|
|
+ fansCount += accountAvgInfo.getFans();
|
|
|
+ }
|
|
|
+ List<ArticleDetailInfo> hisADIList = hisArticleDetailInfoMap.get(hisArticle.getWxSn());
|
|
|
+ if (CollectionUtil.isNotEmpty(hisADIList)) {
|
|
|
+ Date hisMinDate = hisADIList.stream().map(ArticleDetailInfo::getRecallDt).min(Date::compareTo).orElse(new Date());
|
|
|
+ for (ArticleDetailInfo articleDetailInfo : hisADIList) {
|
|
|
+ if (articleDetailInfo.getRecallDt().equals(hisMinDate)) {
|
|
|
+ if (Objects.nonNull(articleDetailInfo.getFirstLevel())) {
|
|
|
+ firstCount += articleDetailInfo.getFirstLevel();
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(articleDetailInfo.getFission0())) {
|
|
|
+ fission0Count += articleDetailInfo.getFission0();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (readAvgCount > 0) {
|
|
|
+ obj.setHisReadRate(readCount / readAvgCount);
|
|
|
+ }
|
|
|
+ if (fansCount > 0) {
|
|
|
+ obj.setHisFirstFansRate(firstCount / (double) fansCount);
|
|
|
+ }
|
|
|
+ if (firstCount > 0) {
|
|
|
+ obj.setHisFission0FirstRate(fission0Count / (double) firstCount);
|
|
|
+ }
|
|
|
}
|
|
|
result.sort(Comparator.comparing(NewSortStrategyExport::getDateStr).reversed()
|
|
|
.thenComparing(NewSortStrategyExport::getGhId).thenComparing(NewSortStrategyExport::getPosition));
|