|
@@ -599,6 +599,8 @@ public class DataDashboardService {
|
|
|
|
|
|
List<Pair<String, String>> styles = Arrays
|
|
|
.asList(
|
|
|
+ Pair.of("AH", "#,##0.00"),
|
|
|
+ Pair.of("AM", "#,##0.00"),
|
|
|
Pair.of("F", "0.00%"),
|
|
|
Pair.of("O", "0.00%"),
|
|
|
Pair.of("P", "0.00%"),
|
|
@@ -620,7 +622,7 @@ public class DataDashboardService {
|
|
|
doSendFeishuSheet(dateStrs, sheetToken, sheetId, rowNum, rows, 3, styles);
|
|
|
}
|
|
|
|
|
|
- private List<IntermediateIndicatorsExport> intermediateIndicatorsData(String dateStr) {
|
|
|
+ public List<IntermediateIndicatorsExport> intermediateIndicatorsData(String dateStr) {
|
|
|
List<IntermediateIndicatorsExport> result = buildIntermediateIndicatorsData(dateStr);
|
|
|
Map<String, IntermediateIndicatorsExport> resultMap = result.stream().collect(Collectors.toMap(
|
|
|
IntermediateIndicatorsExport::getType, o -> o));
|
|
@@ -640,6 +642,9 @@ public class DataDashboardService {
|
|
|
List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeLessThanAndTypeEquals(ghIds, dateEnd, "9");
|
|
|
Map<String, Article> articleMap = articleList.stream().collect(Collectors.toMap(Article::getWxSn, o -> o));
|
|
|
List<Article> todayPublish = articleList.stream().filter(o -> o.getUpdateTime() > dateStart).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(todayPublish)) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
Map<String, List<Article>> hisPublishMap = articleList.stream().collect(Collectors.groupingBy(Article::getTitle));
|
|
|
List<String> wxSnList = articleList.stream().map(Article::getWxSn).distinct().collect(Collectors.toList());
|
|
|
List<ArticleDetailInfo> articleDetailInfoList = new ArrayList<>();
|
|
@@ -661,8 +666,9 @@ public class DataDashboardService {
|
|
|
Map<String, List<Article>> futurePublishMap = futurePublishList.stream().collect(Collectors.groupingBy(Article::getTitle));
|
|
|
|
|
|
Map<String, List<String>> titleTypeMap = new HashMap<>();
|
|
|
- Map<String, Integer> poolHisPublishTimeMap = new HashMap<>();
|
|
|
+ Map<String, Integer> scoreHisPublishTimeMap = new HashMap<>();
|
|
|
Map<String, Map<Integer, List<String>>> titleTypePoolMap = new HashMap<>();
|
|
|
+ Map<String, Set<String>> wxsnHisDistinctSetMap = new HashMap<>();
|
|
|
for (NewSortStrategyExport data : newSortStrategyExportList) {
|
|
|
String type = getArticleType(data, small);
|
|
|
Article article = articleMap.get(data.getWxSn());
|
|
@@ -680,8 +686,9 @@ public class DataDashboardService {
|
|
|
// 发布表现
|
|
|
setPublishPerformance(item, data, publishSortLogMap);
|
|
|
// 发布依赖表现
|
|
|
- setPublishSourcePerformance(item, accountAvgInfoIndexMap, articleDetailInfoMap, publishSortLogMap, poolHisPublishTimeMap, type, list, small);
|
|
|
- // 发布未来表现 todo
|
|
|
+ setPublishSourcePerformance(item, accountAvgInfoIndexMap, articleDetailInfoMap, publishSortLogMap,
|
|
|
+ type, scoreHisPublishTimeMap, wxsnHisDistinctSetMap, list);
|
|
|
+ // 发布未来表现
|
|
|
// setPublishFuturePerformance(item, data, poolLevel, futurePublishMap, publishSortLogMap, small);
|
|
|
|
|
|
titles.add(data.getTitle());
|
|
@@ -825,12 +832,14 @@ public class DataDashboardService {
|
|
|
Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap,
|
|
|
Map<String, List<ArticleDetailInfo>> articleDetailInfoMap,
|
|
|
Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap,
|
|
|
- Map<String, Integer> poolHisPublishTimeMap, String type,
|
|
|
- List<Article> hisPublish, List<String> small) {
|
|
|
+ String type,
|
|
|
+ Map<String, Integer> scoreHisPublishTimeMap,
|
|
|
+ Map<String, Set<String>> wxsnHisDistinctSetMap,
|
|
|
+ List<Article> hisPublish) {
|
|
|
Long hisMinDate = hisPublish.stream().mapToLong(Article::getUpdateTime).min().orElse(0);
|
|
|
- Integer publishTime = poolHisPublishTimeMap.computeIfAbsent(type, k -> 0);
|
|
|
+ int scorePublishTime = scoreHisPublishTimeMap.computeIfAbsent(type, k -> 0);
|
|
|
+ Set<String> wxsnHisDistinctSet = wxsnHisDistinctSetMap.computeIfAbsent(type, k -> new HashSet<>());
|
|
|
for (Article publish : hisPublish) {
|
|
|
- publishTime++;
|
|
|
Map<String, Map<String, AccountAvgInfo>> dateAvgMap = accountAvgInfoIndexMap.get(publish.getGhId());
|
|
|
String hisPublishDate = DateUtils.timestampToYMDStr(publish.getUpdateTime(), "yyyy-MM-dd");
|
|
|
AccountAvgInfo avgInfo = null;
|
|
@@ -842,9 +851,11 @@ public class DataDashboardService {
|
|
|
avgInfo = accountAvgInfoMap.get(publish.getItemIndex().toString());
|
|
|
}
|
|
|
}
|
|
|
- if (!(publish.getItemIndex() == 1 && !small.contains(publish.getGhId()))) {
|
|
|
- item.setTotalArticleReleaseCountNonInfinite(item.getTotalArticleReleaseCountNonInfinite() + 1);
|
|
|
+ if (wxsnHisDistinctSet.contains(publish.getWxSn())) {
|
|
|
+ continue;
|
|
|
}
|
|
|
+ wxsnHisDistinctSet.add(publish.getWxSn());
|
|
|
+ item.setTotalArticleReleaseCountNonInfinite(item.getTotalArticleReleaseCountNonInfinite() + 1);
|
|
|
item.setRedundantViewCount(item.getRedundantViewCount() + publish.getShowViewCount());
|
|
|
if (Objects.nonNull(avgInfo)) {
|
|
|
item.setRedundantViewBase(item.getRedundantViewBase() + avgInfo.getReadAvg());
|
|
@@ -890,16 +901,18 @@ public class DataDashboardService {
|
|
|
score = scoreMap.getDoubleValue("SimilarityStrategy");
|
|
|
}
|
|
|
}
|
|
|
- scoreAvg = (scoreAvg * (publishTime - 1) + score) / publishTime;
|
|
|
+ scorePublishTime++;
|
|
|
+ scoreAvg = (scoreAvg * (scorePublishTime - 1) + score) / scorePublishTime;
|
|
|
item.setRedundantAccountArticleRelevanceAvg(scoreAvg);
|
|
|
}
|
|
|
}
|
|
|
double firstExplorationIntervalAvg = Double.isNaN(item.getFirstExplorationIntervalAvg()) ? 0.0 : item.getFirstExplorationIntervalAvg();
|
|
|
double explorationInterval = (publish.getUpdateTime() - hisMinDate) / 86400.0;
|
|
|
- firstExplorationIntervalAvg = (firstExplorationIntervalAvg * (publishTime - 1) + explorationInterval) / publishTime;
|
|
|
+ firstExplorationIntervalAvg = (firstExplorationIntervalAvg * (item.getTotalArticleReleaseCountNonInfinite() - 1)
|
|
|
+ + explorationInterval) / item.getTotalArticleReleaseCountNonInfinite();
|
|
|
item.setFirstExplorationIntervalAvg(firstExplorationIntervalAvg);
|
|
|
}
|
|
|
- poolHisPublishTimeMap.put(type, publishTime);
|
|
|
+ scoreHisPublishTimeMap.put(type, scorePublishTime);
|
|
|
}
|
|
|
|
|
|
private void setPublishPerformance(IntermediateIndicatorsExport item, NewSortStrategyExport data,
|
|
@@ -1003,7 +1016,7 @@ public class DataDashboardService {
|
|
|
} else {
|
|
|
return 4;
|
|
|
}
|
|
|
- } else if (data.getPosition() == 2) {
|
|
|
+ } else if (minPosition == 2) {
|
|
|
return 2;
|
|
|
} else {
|
|
|
return 1;
|