Selaa lähdekoodia

中间指标导出修改

wangyunpeng 6 kuukautta sitten
vanhempi
commit
7803d6eef3

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

@@ -829,7 +829,7 @@ public class DataDashboardService {
     }
 
     public static void delFeishuSheet(HttpHeaders httpHeaders, String sheetId, Integer startRowIndex,
-                                       List<String> delDateStrList) {
+                                      List<String> delDateStrList) {
         if (CollectionUtil.isEmpty(delDateStrList)) {
             return;
         }
@@ -1013,6 +1013,7 @@ public class DataDashboardService {
         Map<String, Map<Integer, List<String>>> titleTypePoolMap = new HashMap<>();
         Map<String, Set<String>> wxsnHisDistinctSetMap = new HashMap<>();
         Map<String, List<String>> fansAccountTypeMap = new HashMap<>();
+        Map<String, List<String>> futurePromotionDistinctMap = new HashMap<>();
         for (DatastatSortStrategy data : newSortStrategyExportList) {
             String type = getArticleType(data, small);
             Article article = articleMap.get(data.getWxSn());
@@ -1049,7 +1050,7 @@ public class DataDashboardService {
             setPublishSourcePerformance(item, data, article, accountAvgInfoIndexMap, articleDetailInfoMap, publishSortLogMap,
                     type, scoreHisPublishTimeMap, wxsnHisDistinctSetMap, list, poolLevel, small, hisPublishMap);
             // 发布未来表现
-            setPublishFuturePerformance(item, data, poolLevel, promotionSourceMap, futurePublishMap, small);
+            setPublishFuturePerformance(item, data, poolLevel, promotionSourceMap, futurePublishMap, small, futurePromotionDistinctMap);
 
             titles.add(data.getTitle());
             poolTitles.add(data.getTitle());
@@ -1113,18 +1114,23 @@ public class DataDashboardService {
     private void setPublishFuturePerformance(IntermediateIndicatorsExport item, DatastatSortStrategy data, Integer poolLevel,
                                              Map<String, ArticlePoolPromotionSource> promotionSourceMap,
                                              Map<String, List<Article>> futurePublishMap,
-                                             List<String> small) {
+                                             List<String> small,
+                                             Map<String, List<String>> futurePromotionDistinctMap) {
         int futurePoolLevel = getPromotionPoolLevel(data.getGhId(), data, promotionSourceMap, small);
         if (futurePoolLevel > poolLevel) {
-            if (futurePoolLevel == 2) {
-                item.setPromotionCountL2(item.getPromotionCountL2() + 1);
-                item.setPromotionRateL2((item.getPromotionCountL2() * 1.0) / item.getActualArticleReleaseCount());
-            } else if (futurePoolLevel == 3) {
-                item.setPromotionCountL3(item.getPromotionCountL3() + 1);
-                item.setPromotionRateL3((item.getPromotionCountL3() * 1.0) / item.getActualArticleReleaseCount());
-            } else if (futurePoolLevel == 4) {
-                item.setPromotionCountL4(item.getPromotionCountL4() + 1);
-                item.setPromotionRateL4((item.getPromotionCountL4() * 1.0) / item.getActualArticleReleaseCount());
+            if (!futurePromotionDistinctMap.containsKey(item.getType())
+                    || !futurePromotionDistinctMap.get(item.getType()).contains(data.getTitle())) {
+                if (futurePoolLevel == 2) {
+                    item.setPromotionCountL2(item.getPromotionCountL2() + 1);
+                    item.setPromotionRateL2((item.getPromotionCountL2() * 1.0) / item.getActualArticleReleaseCount());
+                } else if (futurePoolLevel == 3) {
+                    item.setPromotionCountL3(item.getPromotionCountL3() + 1);
+                    item.setPromotionRateL3((item.getPromotionCountL3() * 1.0) / item.getActualArticleReleaseCount());
+                } else if (futurePoolLevel == 4) {
+                    item.setPromotionCountL4(item.getPromotionCountL4() + 1);
+                    item.setPromotionRateL4((item.getPromotionCountL4() * 1.0) / item.getActualArticleReleaseCount());
+                }
+                futurePromotionDistinctMap.computeIfAbsent(item.getType(), k -> new ArrayList<>()).add(data.getTitle());
             }
         }
         List<Article> futurePublishList = futurePublishMap.get(data.getTitle());
@@ -1245,8 +1251,8 @@ public class DataDashboardService {
     }
 
     private List<DatastatSortStrategy> getNewSortStrategyExportList(List<Article> todayPublish,
-                                                                     Map<String, List<ArticleDetailInfo>> articleDetailInfoMap,
-                                                                     Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap) {
+                                                                    Map<String, List<ArticleDetailInfo>> articleDetailInfoMap,
+                                                                    Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap) {
         List<DatastatSortStrategy> result = new ArrayList<>();
         for (Article article : todayPublish) {
             DatastatSortStrategy obj = new DatastatSortStrategy();

+ 1 - 1
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/DataDashboardTest.java

@@ -21,7 +21,7 @@ public class DataDashboardTest {
 
     @Test
     public void test() {
-        List<IntermediateIndicatorsExport> result = dataDashboardService.intermediateIndicatorsData("20241129");
+        List<IntermediateIndicatorsExport> result = dataDashboardService.intermediateIndicatorsData("20241225");
         log.info(JSONObject.toJSONString(result));
     }