Browse Source

中间指标 L1层 发布依赖表现仅计算3-8的内容

wangyunpeng 9 months ago
parent
commit
f91fe511f4

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

@@ -715,7 +715,7 @@ public class DataDashboardService {
             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);
+            Integer poolLevel = getArticlePoolLevel(data.getGhId(), 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<>());
@@ -726,7 +726,7 @@ public class DataDashboardService {
             setPublishPerformance(item, data, publishSortLogMap);
             // 发布依赖表现
             setPublishSourcePerformance(item, accountAvgInfoIndexMap, articleDetailInfoMap, publishSortLogMap,
-                    type, scoreHisPublishTimeMap, wxsnHisDistinctSetMap, list);
+                    type, scoreHisPublishTimeMap, wxsnHisDistinctSetMap, list, poolLevel, small, hisPublishMap);
             // 发布未来表现
             setPublishFuturePerformance(item, data, poolLevel, futurePublishMap, publishSortLogMap, small);
 
@@ -745,7 +745,7 @@ public class DataDashboardService {
         if (CollectionUtils.isEmpty(futurePublishList)) {
             return;
         }
-        int futurePoolLevel = getArticlePoolLevel(data, futurePublishList, small);
+        int futurePoolLevel = getArticlePoolLevel(data.getGhId(), futurePublishList, small);
         if (futurePoolLevel > poolLevel) {
             if (futurePoolLevel == 2) {
                 item.setPromotionCountL2(item.getPromotionCountL2() + 1);
@@ -959,11 +959,23 @@ public class DataDashboardService {
                                              String type,
                                              Map<String, Integer> scoreHisPublishTimeMap,
                                              Map<String, Set<String>> wxsnHisDistinctSetMap,
-                                             List<Article> hisPublish) {
+                                             List<Article> hisPublish,
+                                             Integer poolLevel,
+                                             List<String> small,
+                                             Map<String, List<Article>> hisPublishMap) {
         Long hisMinDate = hisPublish.stream().mapToLong(Article::getUpdateTime).min().orElse(0);
         int scorePublishTime = scoreHisPublishTimeMap.computeIfAbsent(type, k -> 0);
         Set<String> wxsnHisDistinctSet = wxsnHisDistinctSetMap.computeIfAbsent(type, k -> new HashSet<>());
         for (Article publish : hisPublish) {
+            if (poolLevel == 1) {
+                List<Article> list = hisPublishMap.get(publish.getTitle());
+                list = list.stream().filter(o -> o.getUpdateTime() < (publish.getUpdateTime() - 3600 * 8))
+                        .collect(Collectors.toList());
+                Integer hisPublishPoolLevel = getArticlePoolLevel(publish.getGhId(), list, small);
+                if (hisPublishPoolLevel > poolLevel) {
+                    continue;
+                }
+            }
             Map<String, Map<String, AccountAvgInfo>> dateAvgMap = accountAvgInfoIndexMap.get(publish.getGhId());
             String hisPublishDate = DateUtils.timestampToYMDStr(publish.getUpdateTime(), "yyyy-MM-dd");
             AccountAvgInfo avgInfo = null;
@@ -1144,10 +1156,10 @@ public class DataDashboardService {
         }
     }
 
-    private Integer getArticlePoolLevel(NewSortStrategyExport data, List<Article> list, List<String> small) {
+    private Integer getArticlePoolLevel(String ghId, List<Article> list, List<String> small) {
         int minPosition = list.stream().mapToInt(Article::getItemIndex).min().orElse(8);
         if (minPosition == 1) {
-            if (small.contains(data.getGhId())) {
+            if (small.contains(ghId)) {
                 return 3;
             } else {
                 return 4;

+ 3 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/filter/strategy/HistoryTitleStrategy.java

@@ -49,8 +49,9 @@ public class HistoryTitleStrategy implements FilterStrategy {
         List<Content> filterContents = new ArrayList<>();
         List<Article> allArticleList = articleListRemoteService.articleList(param.getAccountName(), allIndex);
         List<String> allTitleList = allArticleList.stream().map(Article::getTitle).distinct().collect(Collectors.toList());
-        List<Article> firstSecondArticleList = allArticleList.stream().filter(article -> firstSecondIndex.contains(article.getItemIndex())).collect(Collectors.toList());
-        List<String> firstSecondTitleList = firstSecondArticleList.stream().map(Article::getTitle).distinct().collect(Collectors.toList());
+        List<String> firstSecondTitleList = allArticleList.stream()
+                .filter(article -> firstSecondIndex.contains(article.getItemIndex()))
+                .map(Article::getTitle).distinct().collect(Collectors.toList());
 
         List<String> firstSecondContentPool = new ArrayList<>();
         String[] contentPoolConfig = accountContentPoolConfigService.getContentPools(param.getAccountName());