فهرست منبع

中间指标导出修改

wangyunpeng 6 ماه پیش
والد
کامیت
19e6f8fcf0

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

@@ -338,7 +338,6 @@ public class DataDashboardService {
         for (Article article : articleList) {
             DatastatSortStrategy obj = new DatastatSortStrategy();
             obj.setType(articleType);
-            obj.setPublishTimestamp(article.getPublishTimestamp());
             List<ArticleDetailInfo> articleDetailInfos = articleDetailInfoMap.get(article.getWxSn());
             setObjArticleDetailInfo(article, obj, articleDetailInfos);
             Article firstArticle = articleMap.get(article.getGhId()).get(article.getAppMsgId()).get(1);
@@ -570,6 +569,7 @@ public class DataDashboardService {
         obj.setDateStr(date);
         obj.setPublishTime(DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "HH:mm:ss"));
         obj.setWxSn(article.getWxSn());
+        obj.setPublishTimestamp(article.getPublishTimestamp());
     }
 
     private void setObjArticleDetailInfo(Article article, DatastatSortStrategy obj, List<ArticleDetailInfo> articleDetailInfos) {
@@ -888,29 +888,22 @@ public class DataDashboardService {
     @XxlJob("scheduleExportIntermediateIndicators")
     public ReturnT<String> scheduleIntermediateIndicatorsExport(String param) {
         List<String> dateStrList = DateUtils.getBeforeDays(null, null, 3);
-        for (String date : dateStrList) {
-            exportFeishuIntermediateIndicators(date, dateStrList, sheetToken, "OuaLWV");
-        }
+        exportFeishuIntermediateIndicators(dateStrList, sheetToken, "OuaLWV");
         return ReturnT.SUCCESS;
     }
 
     public void intermediateIndicatorsExport(String beginDate, String endDate) {
         List<String> dateStrList = DateUtils.getBeforeDays(beginDate, endDate, 3);
-        for (String date : dateStrList) {
-            exportFeishuIntermediateIndicators(date, dateStrList, sheetToken, "OuaLWV");
-        }
+        exportFeishuIntermediateIndicators(dateStrList, sheetToken, "OuaLWV");
     }
 
-    private void exportFeishuIntermediateIndicators(String dateStr, List<String> dateStrList, String sheetToken, String sheetId) {
-        List<IntermediateIndicatorsExport> newContentsYesData = intermediateIndicatorsData(dateStr);
-        if (CollectionUtil.isEmpty(newContentsYesData)) {
-            return;
+    private void exportFeishuIntermediateIndicators(List<String> dateStrList, String sheetToken, String sheetId) {
+        List<IntermediateIndicatorsExport> newContentsYesData = new ArrayList<>();
+        for (String dateStr : dateStrList) {
+            newContentsYesData.addAll(intermediateIndicatorsData(dateStr));
         }
-        long dateStrLong = DateUtils.dateStrToTimestamp(dateStr, "yyyyMMdd");
-        List<String> dateStrs = dateStrList.stream().filter(o -> {
-            long date = DateUtils.dateStrToTimestamp(o, "yyyyMMdd");
-            return date >= dateStrLong;
-        }).collect(Collectors.toList());
+        newContentsYesData.sort(Comparator.comparing(IntermediateIndicatorsExport::getDateStr).reversed()
+                .thenComparing((o1, o2) -> -o1.getType().compareTo(o2.getType())));
         int rowNum = newContentsYesData.size();
         List<List<Object>> rows = new ArrayList<>();
         Field[] fields = IntermediateIndicatorsExport.class.getDeclaredFields();
@@ -966,7 +959,7 @@ public class DataDashboardService {
                         Pair.of("BP", "0.00%")
                 );
 
-        doSendFeishuSheet(dateStrs, sheetToken, sheetId, rowNum, rows, 3, styles, null);
+        doSendFeishuSheet(dateStrList, sheetToken, sheetId, rowNum, rows, 3, styles, null);
     }
 
     public List<IntermediateIndicatorsExport> intermediateIndicatorsData(String dateStr) {
@@ -1121,7 +1114,7 @@ public class DataDashboardService {
                                              Map<String, ArticlePoolPromotionSource> promotionSourceMap,
                                              Map<String, List<Article>> futurePublishMap,
                                              List<String> small) {
-        int futurePoolLevel = getPromotionPoolLevel(data.getGhId(), data.getTitle(), promotionSourceMap, small);
+        int futurePoolLevel = getPromotionPoolLevel(data.getGhId(), data, promotionSourceMap, small);
         if (futurePoolLevel > poolLevel) {
             if (futurePoolLevel == 2) {
                 item.setPromotionCountL2(item.getPromotionCountL2() + 1);
@@ -1228,13 +1221,16 @@ public class DataDashboardService {
 //        item.setT3PlusDayViewBase(item.getT3PlusDayViewBase());
     }
 
-    private int getPromotionPoolLevel(String ghId, String title,
+    private int getPromotionPoolLevel(String ghId, DatastatSortStrategy data,
                                       Map<String, ArticlePoolPromotionSource> promotionSourceMap,
                                       List<String> small) {
-        ArticlePoolPromotionSource promotionSource = promotionSourceMap.get(title);
+        ArticlePoolPromotionSource promotionSource = promotionSourceMap.get(data.getTitle());
         if (Objects.isNull(promotionSource)) {
             return 1;
         }
+        if (data.getPublishTimestamp() > (promotionSource.getCreateTimestamp() / 1000)) {
+            return 1;
+        }
         if (promotionSource.getLevel().equals(ContentPoolEnum.autoArticlePoolLevel1.getContentPool())) {
             if (small.contains(ghId)) {
                 return 3;