|
@@ -912,11 +912,9 @@ public class DataDashboardService {
|
|
|
.collect(Collectors.groupingBy(ArticleDetailInfo::getWxSn));
|
|
|
String lessDateStr = DateUtils.getBeforeDayStr(dateStr, "yyyyMMdd", 7);
|
|
|
List<PublishSortLog> publishSortLogList = publishSortLogRepository.findByDateStrGreaterThanEqual(lessDateStr);
|
|
|
- Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap = publishSortLogList.stream()
|
|
|
+ Map<String, Map<String, Map<Integer, List<PublishSortLog>>>> publishSortLogMap = publishSortLogList.stream()
|
|
|
.collect(Collectors.groupingBy(PublishSortLog::getGhId,
|
|
|
- Collectors.groupingBy(PublishSortLog::getDateStr, Collectors.toMap(
|
|
|
- PublishSortLog::getIndex, o -> o, (existing, replacement) -> replacement
|
|
|
- ))));
|
|
|
+ Collectors.groupingBy(PublishSortLog::getDateStr, Collectors.groupingBy(PublishSortLog::getIndex))));
|
|
|
List<NewSortStrategyExport> newSortStrategyExportList = getNewSortStrategyExportList(todayPublish,
|
|
|
articleDetailInfoMap, accountAvgInfoIndexMap);
|
|
|
|
|
@@ -965,10 +963,10 @@ public class DataDashboardService {
|
|
|
// 发布表现
|
|
|
setPublishPerformance(item, data, publishSortLogMap);
|
|
|
// 发布依赖表现
|
|
|
- setPublishSourcePerformance(item, accountAvgInfoIndexMap, articleDetailInfoMap, publishSortLogMap,
|
|
|
+ setPublishSourcePerformance(item, data, article, accountAvgInfoIndexMap, articleDetailInfoMap, publishSortLogMap,
|
|
|
type, scoreHisPublishTimeMap, wxsnHisDistinctSetMap, list, poolLevel, small, hisPublishMap);
|
|
|
// 发布未来表现
|
|
|
- setPublishFuturePerformance(item, data, poolLevel, promotionSourceMap, futurePublishMap, publishSortLogMap, small);
|
|
|
+ setPublishFuturePerformance(item, data, poolLevel, promotionSourceMap, futurePublishMap, small);
|
|
|
|
|
|
titles.add(data.getTitle());
|
|
|
poolTitles.add(data.getTitle());
|
|
@@ -978,15 +976,19 @@ public class DataDashboardService {
|
|
|
}
|
|
|
|
|
|
private boolean checkIsAigcPublish(Article article,
|
|
|
- Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap) {
|
|
|
- Map<String, Map<Integer, PublishSortLog>> dateSortMap = publishSortLogMap.get(article.getGhId());
|
|
|
+ Map<String, Map<String, Map<Integer, List<PublishSortLog>>>> publishSortLogMap) {
|
|
|
+ Map<String, Map<Integer, List<PublishSortLog>>> dateSortMap = publishSortLogMap.get(article.getGhId());
|
|
|
if (Objects.nonNull(dateSortMap)) {
|
|
|
for (String dateStr : dateSortMap.keySet()) {
|
|
|
- Map<Integer, PublishSortLog> indexMap = dateSortMap.get(dateStr);
|
|
|
+ Map<Integer, List<PublishSortLog>> indexMap = dateSortMap.get(dateStr);
|
|
|
if (Objects.nonNull(indexMap)) {
|
|
|
- PublishSortLog log = indexMap.get(article.getItemIndex());
|
|
|
- if (Objects.nonNull(log) && log.getTitle().equals(article.getTitle())) {
|
|
|
- return true;
|
|
|
+ List<PublishSortLog> logs = indexMap.get(article.getItemIndex());
|
|
|
+ if (CollectionUtil.isNotEmpty(logs)) {
|
|
|
+ for (PublishSortLog log : logs) {
|
|
|
+ if (log.getTitle().equals(article.getTitle())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1013,7 +1015,6 @@ public class DataDashboardService {
|
|
|
private void setPublishFuturePerformance(IntermediateIndicatorsExport item, NewSortStrategyExport data, Integer poolLevel,
|
|
|
Map<String, ArticlePoolPromotionSource> promotionSourceMap,
|
|
|
Map<String, List<Article>> futurePublishMap,
|
|
|
- Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap,
|
|
|
List<String> small) {
|
|
|
int futurePoolLevel = getPromotionPoolLevel(data.getGhId(), data.getTitle(), promotionSourceMap, small);
|
|
|
if (futurePoolLevel > poolLevel) {
|
|
@@ -1161,9 +1162,11 @@ public class DataDashboardService {
|
|
|
}
|
|
|
|
|
|
private void setPublishSourcePerformance(IntermediateIndicatorsExport item,
|
|
|
+ NewSortStrategyExport data,
|
|
|
+ Article article,
|
|
|
Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap,
|
|
|
Map<String, List<ArticleDetailInfo>> articleDetailInfoMap,
|
|
|
- Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap,
|
|
|
+ Map<String, Map<String, Map<Integer, List<PublishSortLog>>>> publishSortLogMap,
|
|
|
String type,
|
|
|
Map<String, Integer> scoreHisPublishTimeMap,
|
|
|
Map<String, Set<String>> wxsnHisDistinctSetMap,
|
|
@@ -1235,36 +1238,45 @@ public class DataDashboardService {
|
|
|
(item.getActualArticleReleaseCount() - 1) + firstLayerFissionToViewBaseRatio) / item.getActualArticleReleaseCount();
|
|
|
}
|
|
|
item.setAverageFirstLayerFissionToViewBaseRatio(averageFirstLayerFissionToViewBaseRatio);
|
|
|
- Map<String, Map<Integer, PublishSortLog>> dateSortMap = publishSortLogMap.get(publish.getGhId());
|
|
|
+ Map<String, Map<Integer, List<PublishSortLog>>> dateSortMap = publishSortLogMap.get(publish.getGhId());
|
|
|
if (Objects.nonNull(dateSortMap)) {
|
|
|
String publishDateStr = DateUtils.timestampToYMDStr(publish.getPublishTimestamp(), "yyyyMMdd");
|
|
|
- Map<Integer, PublishSortLog> indexMap = dateSortMap.get(publishDateStr);
|
|
|
+ Map<Integer, List<PublishSortLog>> indexMap = dateSortMap.get(publishDateStr);
|
|
|
if (Objects.nonNull(indexMap)) {
|
|
|
- PublishSortLog log = indexMap.get(publish.getItemIndex());
|
|
|
- double scoreAvg = item.getRedundantAccountArticleRelevanceAvg();
|
|
|
- double score = 0.0;
|
|
|
- if (Objects.nonNull(log) && Objects.nonNull(log.getScore())) {
|
|
|
- JSONObject scoreMap = JSONObject.parseObject(log.getScoreMap());
|
|
|
- if (scoreMap.containsKey("SimilarityStrategy")) {
|
|
|
- score = scoreMap.getDoubleValue("SimilarityStrategy");
|
|
|
+ List<PublishSortLog> logs = indexMap.get(publish.getItemIndex());
|
|
|
+ if (CollectionUtil.isNotEmpty(logs)) {
|
|
|
+ for (PublishSortLog log : logs) {
|
|
|
+ if (log.getTitle().equals(data.getTitle())) {
|
|
|
+ double scoreAvg = item.getRedundantAccountArticleRelevanceAvg();
|
|
|
+ double score = 0.0;
|
|
|
+ if (Objects.nonNull(log.getScore())) {
|
|
|
+ JSONObject scoreMap = JSONObject.parseObject(log.getScoreMap());
|
|
|
+ if (scoreMap.containsKey("SimilarityStrategy")) {
|
|
|
+ score = scoreMap.getDoubleValue("SimilarityStrategy");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ scorePublishTime++;
|
|
|
+ scoreAvg = (scoreAvg * (scorePublishTime - 1) + score) / scorePublishTime;
|
|
|
+ item.setRedundantAccountArticleRelevanceAvg(scoreAvg);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- scorePublishTime++;
|
|
|
- scoreAvg = (scoreAvg * (scorePublishTime - 1) + score) / scorePublishTime;
|
|
|
- item.setRedundantAccountArticleRelevanceAvg(scoreAvg);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ if (hisMinDate > 0) {
|
|
|
double firstExplorationIntervalAvg = Double.isNaN(item.getFirstExplorationIntervalAvg()) ? 0.0 : item.getFirstExplorationIntervalAvg();
|
|
|
- double explorationInterval = (publish.getPublishTimestamp() - hisMinDate) / 86400.0;
|
|
|
- firstExplorationIntervalAvg = (firstExplorationIntervalAvg * (item.getTotalArticleReleaseCountNonInfinite() - 1)
|
|
|
- + explorationInterval) / item.getTotalArticleReleaseCountNonInfinite();
|
|
|
+ double explorationInterval = (article.getPublishTimestamp() - hisMinDate) / 86400.0;
|
|
|
+ firstExplorationIntervalAvg = (firstExplorationIntervalAvg * (item.getActualArticleReleaseCount() - 1)
|
|
|
+ + explorationInterval) / item.getActualArticleReleaseCount();
|
|
|
item.setFirstExplorationIntervalAvg(firstExplorationIntervalAvg);
|
|
|
}
|
|
|
scoreHisPublishTimeMap.put(type, scorePublishTime);
|
|
|
}
|
|
|
|
|
|
private void setPublishPerformance(IntermediateIndicatorsExport item, NewSortStrategyExport data,
|
|
|
- Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap) {
|
|
|
+ Map<String, Map<String, Map<Integer, List<PublishSortLog>>>> publishSortLogMap) {
|
|
|
if (Objects.isNull(data.getFirstLevel())) {
|
|
|
return;
|
|
|
}
|
|
@@ -1296,21 +1308,28 @@ public class DataDashboardService {
|
|
|
if (item.getT0FissionCount() + item.getT1FissionCount() + item.getT2FissionCount() > 0 && item.getViewBase() > 0) {
|
|
|
item.setT2CumulativeFissionRate((item.getT0FissionCount() + item.getT1FissionCount() + item.getT2FissionCount()) / (double) item.getFirstLayerUV());
|
|
|
}
|
|
|
- Map<String, Map<Integer, PublishSortLog>> dateSortMap = publishSortLogMap.get(data.getGhId());
|
|
|
+ Map<String, Map<Integer, List<PublishSortLog>>> dateSortMap = publishSortLogMap.get(data.getGhId());
|
|
|
if (Objects.nonNull(dateSortMap)) {
|
|
|
- Map<Integer, PublishSortLog> indexMap = dateSortMap.get(item.getDateStr());
|
|
|
+ Map<Integer, List<PublishSortLog>> indexMap = dateSortMap.get(item.getDateStr());
|
|
|
if (Objects.nonNull(indexMap)) {
|
|
|
- PublishSortLog log = indexMap.get(data.getPosition());
|
|
|
- double scoreAvg = item.getAccountArticleRelevanceAvg();
|
|
|
- double score = 0.0;
|
|
|
- if (Objects.nonNull(log) && Objects.nonNull(log.getScore())) {
|
|
|
- JSONObject scoreMap = JSONObject.parseObject(log.getScoreMap());
|
|
|
- if (scoreMap.containsKey("SimilarityStrategy")) {
|
|
|
- score = scoreMap.getDoubleValue("SimilarityStrategy");
|
|
|
+ List<PublishSortLog> logs = indexMap.get(data.getPosition());
|
|
|
+ if (CollectionUtil.isNotEmpty(logs)) {
|
|
|
+ for (PublishSortLog log : logs) {
|
|
|
+ if (log.getTitle().equals(data.getTitle())) {
|
|
|
+ double scoreAvg = item.getAccountArticleRelevanceAvg();
|
|
|
+ double score = 0.0;
|
|
|
+ if (Objects.nonNull(log.getScore())) {
|
|
|
+ JSONObject scoreMap = JSONObject.parseObject(log.getScoreMap());
|
|
|
+ if (scoreMap.containsKey("SimilarityStrategy")) {
|
|
|
+ score = scoreMap.getDoubleValue("SimilarityStrategy");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ scoreAvg = (scoreAvg * (item.getActualArticleReleaseCount() - 1) + score) / item.getActualArticleReleaseCount();
|
|
|
+ item.setAccountArticleRelevanceAvg(scoreAvg);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- scoreAvg = (scoreAvg * (item.getActualArticleReleaseCount() - 1) + score) / item.getActualArticleReleaseCount();
|
|
|
- item.setAccountArticleRelevanceAvg(scoreAvg);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1494,6 +1513,7 @@ public class DataDashboardService {
|
|
|
Collectors.toMap(AccountAvgInfo::getPosition, o -> o))));
|
|
|
|
|
|
String title = "";
|
|
|
+ List<DatastatScore> saveList = new ArrayList<>();
|
|
|
for (PublishSortLog publishSortLog : sortLogList) {
|
|
|
Map<String, Map<Integer, Article>> dateArticleMap = articleMap.get(publishSortLog.getGhId());
|
|
|
if (Objects.isNull(dateArticleMap)) {
|
|
@@ -1559,40 +1579,44 @@ public class DataDashboardService {
|
|
|
item.setFirstExplorationIntervalAvg(explorationInterval);
|
|
|
}
|
|
|
result.add(item);
|
|
|
+ saveList.add(buildDatastatScore(publishSortLog, item));
|
|
|
}
|
|
|
- saveDatastatScore(dateStrList, result);
|
|
|
+ saveDatastatScore(dateStrList, saveList);
|
|
|
result = result.stream().filter(o -> o.getIndex() == 1).collect(Collectors.toList());
|
|
|
result.sort(Comparator.comparing(FirstContentScoreExport::getDateStr).reversed()
|
|
|
.thenComparing(FirstContentScoreExport::getGhId));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private void saveDatastatScore(List<String> dateStrList, List<FirstContentScoreExport> result) {
|
|
|
- if (CollectionUtils.isNotEmpty(result)) {
|
|
|
+ private DatastatScore buildDatastatScore(PublishSortLog publishSortLog, FirstContentScoreExport value) {
|
|
|
+ DatastatScore item = new DatastatScore();
|
|
|
+ item.setDt(value.getDateStr());
|
|
|
+ item.setGhId(value.getGhId());
|
|
|
+ item.setAccountName(value.getAccountName());
|
|
|
+ item.setIndex(value.getIndex());
|
|
|
+ item.setTitle(value.getTitle());
|
|
|
+ item.setCategory(value.getCategory());
|
|
|
+ item.setStrategy(value.getStrategy());
|
|
|
+ item.setScore(value.getScore());
|
|
|
+ item.setHisFissionAvgReadRateRate(value.getHisFissionAvgReadRateRateStrategy());
|
|
|
+ item.setHisFissionAvgReadSumRate(value.getHisFissionAvgReadSumRateStrategy());
|
|
|
+ item.setSimilarity(value.getSimilarityStrategy());
|
|
|
+ item.setCategoryScore(value.getCategoryStrategy());
|
|
|
+ item.setViewCountRate(value.getViewCountRateStrategy());
|
|
|
+ item.setHisFissionDeWeightAvgReadSumRate(value.getHisFissionDeWeightAvgReadSumRateStrategy());
|
|
|
+ item.setReadCount(value.getReadCount());
|
|
|
+ item.setReadAvg(value.getReadAvg());
|
|
|
+ item.setReadAvgRate(value.getReadAvgRate());
|
|
|
+ item.setFirstPubInterval(value.getFirstExplorationIntervalAvg());
|
|
|
+ item.setPublishContentId(publishSortLog.getPublishContentId());
|
|
|
+ item.setCrawlerChannelContentId(publishSortLog.getCrawlerChannelContentId());
|
|
|
+ item.setSourceId(publishSortLog.getSourceId());
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void saveDatastatScore(List<String> dateStrList, List<DatastatScore> saveList) {
|
|
|
+ if (CollectionUtils.isNotEmpty(saveList)) {
|
|
|
longArticleBaseMapper.deleteDatastatScoreByDtIn(dateStrList);
|
|
|
- List<DatastatScore> saveList = new ArrayList<>();
|
|
|
- for (FirstContentScoreExport value : result) {
|
|
|
- DatastatScore item = new DatastatScore();
|
|
|
- item.setDt(value.getDateStr());
|
|
|
- item.setGhId(value.getGhId());
|
|
|
- item.setAccountName(value.getAccountName());
|
|
|
- item.setIndex(value.getIndex());
|
|
|
- item.setTitle(value.getTitle());
|
|
|
- item.setCategory(value.getCategory());
|
|
|
- item.setStrategy(value.getStrategy());
|
|
|
- item.setScore(value.getScore());
|
|
|
- item.setHisFissionAvgReadRateRate(value.getHisFissionAvgReadRateRateStrategy());
|
|
|
- item.setHisFissionAvgReadSumRate(value.getHisFissionAvgReadSumRateStrategy());
|
|
|
- item.setSimilarity(value.getSimilarityStrategy());
|
|
|
- item.setCategoryScore(value.getCategoryStrategy());
|
|
|
- item.setViewCountRate(value.getViewCountRateStrategy());
|
|
|
- item.setHisFissionDeWeightAvgReadSumRate(value.getHisFissionDeWeightAvgReadSumRateStrategy());
|
|
|
- item.setReadCount(value.getReadCount());
|
|
|
- item.setReadAvg(value.getReadAvg());
|
|
|
- item.setReadAvgRate(value.getReadAvgRate());
|
|
|
- item.setFirstPubInterval(value.getFirstExplorationIntervalAvg());
|
|
|
- saveList.add(item);
|
|
|
- }
|
|
|
for (List<DatastatScore> saveListPartition : Lists.partition(saveList, 1000)) {
|
|
|
longArticleBaseMapper.batchInsertDatastatScore(saveListPartition);
|
|
|
}
|