wangyunpeng пре 9 месеци
родитељ
комит
48fa11b2f6

+ 11 - 7
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/DataDashboardService.java

@@ -632,6 +632,7 @@ public class DataDashboardService {
                         Collectors.toMap(AccountAvgInfo::getPosition, o -> o))));
         List<String> ghIds = accountAvgInfoList.stream().map(AccountAvgInfo::getGhId).distinct().collect(Collectors.toList());
         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());
         Map<String, List<Article>> hisPublishMap = articleList.stream().collect(Collectors.groupingBy(Article::getTitle));
         List<String> wxSnList = articleList.stream().map(Article::getWxSn).distinct().collect(Collectors.toList());
@@ -656,22 +657,26 @@ public class DataDashboardService {
         Map<String, Map<Integer, List<String>>> titleTypePoolMap = new HashMap<>();
         for (NewSortStrategyExport data : newSortStrategyExportList) {
             String type = getArticleType(data, small);
+            Article article = articleMap.get(data.getWxSn());
             IntermediateIndicatorsExport item = resultMap.get(type);
             List<Article> list = hisPublishMap.get(data.getTitle());
+            list = list.stream().filter(publish -> publish.getUpdateTime() < (article.getUpdateTime() - 3600 * 8))
+                    .collect(Collectors.toList());
             Integer poolLevel = getArticlePoolLevel(data, list, small);
+            List<String> titles = titleTypeMap.computeIfAbsent(type, k -> new ArrayList<>());
+            Map<Integer, List<String>> titlePoolMap = titleTypePoolMap.computeIfAbsent(type, k -> new HashMap<>());
+            List<String> poolTitles = titlePoolMap.computeIfAbsent(poolLevel, k -> new ArrayList<>());
+
             // 发布情况
             setPublishSituation(item, type, titleTypeMap, titleTypePoolMap, poolLevel, data);
             // 发布表现
             setPublishPerformance(item, data, publishSortLogMap);
             // 发布依赖表现
-            setPublishSourcePerformance(item, data, accountAvgInfoIndexMap, articleDetailInfoMap, hisPublishMap, small);
+            setPublishSourcePerformance(item, accountAvgInfoIndexMap, articleDetailInfoMap, list, small);
             // 发布未来表现 todo
             setPublishFuturePerformance(item, data, poolLevel, futurePublishMap, small);
 
-            List<String> titles = titleTypeMap.computeIfAbsent(type, k -> new ArrayList<>());
             titles.add(data.getTitle());
-            Map<Integer, List<String>> titlePoolMap = titleTypePoolMap.computeIfAbsent(type, k -> new HashMap<>());
-            List<String> poolTitles = titlePoolMap.computeIfAbsent(poolLevel, k -> new ArrayList<>());
             poolTitles.add(data.getTitle());
         }
 
@@ -806,11 +811,10 @@ public class DataDashboardService {
         return result;
     }
 
-    private void setPublishSourcePerformance(IntermediateIndicatorsExport item, NewSortStrategyExport data,
+    private void setPublishSourcePerformance(IntermediateIndicatorsExport item,
                                              Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap,
                                              Map<String, List<ArticleDetailInfo>> articleDetailInfoMap,
-                                             Map<String, List<Article>> hisPublishMap, List<String> small) {
-        List<Article> hisPublish = hisPublishMap.get(data.getTitle());
+                                             List<Article> hisPublish, List<String> small) {
         for (Article publish : hisPublish) {
             Map<String, Map<String, AccountAvgInfo>> dateAvgMap = accountAvgInfoIndexMap.get(publish.getGhId());
             String hisPublishDate = DateUtils.timestampToYMDStr(publish.getUpdateTime(), "yyyy-MM-dd");