Explorar el Código

Merge branch '20250428-wyp-qwTotalData' of Server/growth-manager into master

wangyunpeng hace 2 meses
padre
commit
c993730f2c

+ 23 - 4
api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformDatastatJob.java

@@ -264,15 +264,22 @@ public class ContentPlatformDatastatJob {
         Long now = System.currentTimeMillis();
         if (CollectionUtils.isNotEmpty(outDataList)) {
             for (Record record : outDataList) {
-                ContentPlatformQwDataStatTotal item = new ContentPlatformQwDataStatTotal();
+                String type = (String) record.get(1);
+                if (!"社群".equals(type) && !"自动回复".equals(type)) {
+                    continue;
+                }
                 String channel = (String) record.get(33);
                 int firstLevelCount = Integer.parseInt((String) record.get(6));
                 if (firstLevelCount == 0) {
                     continue;
                 }
+                ContentPlatformQwDataStatTotal item = saveMap.getOrDefault(channel, new ContentPlatformQwDataStatTotal());
                 item.setDateStr(dt);
                 item.setChannel(channel);
-                item.setFirstLevelCount(firstLevelCount);
+                if (item.getFirstLevelCount() == null) {
+                    item.setFirstLevelCount(0);
+                }
+                item.setFirstLevelCount(item.getFirstLevelCount() + firstLevelCount);
                 item.setCreateTimestamp(now);
                 saveMap.put(channel, item);
             }
@@ -280,17 +287,29 @@ public class ContentPlatformDatastatJob {
         String out2Sql = String.format("SELECT * FROM loghubods.qw_out2_touliu_behavior_total WHERE dt=%s;", dt);
         List<Record> out2DataList = OdpsUtil.getOdpsData(out2Sql);
         if (CollectionUtils.isNotEmpty(out2DataList)) {
+            List<String> out2Channels = new ArrayList<>();
             for (Record record : out2DataList) {
-                ContentPlatformQwDataStatTotal item = new ContentPlatformQwDataStatTotal();
+                String type = (String) record.get(1);
+                if (!"社群".equals(type) && !"自动回复".equals(type)) {
+                    continue;
+                }
                 String channel = (String) record.get(33);
                 int firstLevelCount = Integer.parseInt((String) record.get(6));
                 if (firstLevelCount == 0) {
                     continue;
                 }
+                if (saveMap.containsKey(channel) && !out2Channels.contains(channel)) {
+                    saveMap.remove(channel);
+                }
+                ContentPlatformQwDataStatTotal item = saveMap.getOrDefault(channel, new ContentPlatformQwDataStatTotal());
                 item.setDateStr(dt);
                 item.setChannel(channel);
-                item.setFirstLevelCount(firstLevelCount);
+                if (item.getFirstLevelCount() == null) {
+                    item.setFirstLevelCount(0);
+                }
+                item.setFirstLevelCount(item.getFirstLevelCount() + firstLevelCount);
                 item.setCreateTimestamp(now);
+                out2Channels.add(channel);
                 saveMap.put(channel, item);
             }
         }