|
@@ -299,6 +299,7 @@ public class DataDashboardService {
|
|
|
obj.setStrategy(dateStrategy.get(date));
|
|
|
}
|
|
|
setObjAvgInfo(article, obj, avgInfo);
|
|
|
+ setObjHisRateInfo(article, obj, hisArticleMap, accountAvgInfoIndexMap, hisArticleDetailInfoMap);
|
|
|
result.add(obj);
|
|
|
// aigc 数据
|
|
|
PublishAccount publishAccount = publishAccountMap.get(article.getGhId());
|
|
@@ -375,45 +376,6 @@ public class DataDashboardService {
|
|
|
if (Objects.nonNull(sourceProducePlan)) {
|
|
|
obj.setSourceProducePlanName(sourceProducePlan.getName());
|
|
|
}
|
|
|
- List<Article> hisArticles = hisArticleMap.getOrDefault(article.getTitle(), new ArrayList<>());
|
|
|
- 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;
|
|
|
- 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();
|
|
|
- }
|
|
|
- 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 (readCount > 0) {
|
|
|
- obj.setHisFirstReadRate(firstCount / (double) readCount);
|
|
|
- }
|
|
|
- if (firstCount > 0) {
|
|
|
- obj.setHisFission0FirstRate(fission0Count / (double) firstCount);
|
|
|
- }
|
|
|
}
|
|
|
result.sort(Comparator.comparing(NewSortStrategyExport::getDateStr).reversed()
|
|
|
.thenComparing(NewSortStrategyExport::getGhId).thenComparing(NewSortStrategyExport::getPosition));
|
|
@@ -432,6 +394,51 @@ public class DataDashboardService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private void setObjHisRateInfo(Article article, NewSortStrategyExport obj,
|
|
|
+ Map<String, List<Article>> hisArticleMap,
|
|
|
+ Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap,
|
|
|
+ Map<String, List<ArticleDetailInfo>> hisArticleDetailInfoMap) {
|
|
|
+ List<Article> hisArticles = hisArticleMap.getOrDefault(article.getTitle(), new ArrayList<>());
|
|
|
+ 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;
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ 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 (readCount > 0) {
|
|
|
+ obj.setHisFirstReadRate(firstCount / (double) readCount);
|
|
|
+ }
|
|
|
+ if (firstCount > 0) {
|
|
|
+ obj.setHisFission0FirstRate(fission0Count / (double) firstCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void setObjBaseInfo(Article article, NewSortStrategyExport obj, String date) {
|
|
|
obj.setGhId(article.getGhId());
|
|
|
obj.setAccountName(article.getAccountName());
|