wangyunpeng 1 месяц назад
Родитель
Сommit
4c3effea8e

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

@@ -702,19 +702,28 @@ public class ContentPlatformDatastatJob {
         }
         dataStatMapperExt.deleteQwDatastatReplyTotal(dt);
         Map<String, ContentPlatformQwDataStatSubChannel> saveMap = new HashMap<>();
-        String outSql = String.format("SELECT * FROM loghubods.qw_out_touliu_behavior_total WHERE dt=%s and 推送方式 = '自动回复';", dt);
+        String outSql = String.format("SELECT channel, subchannel, first_uv FROM loghubods.qw_out_channel_mid_first_total WHERE dt=%s;", dt);
         List<Record> outDataList = OdpsUtil.getOdpsData(outSql);
+        List<ContentPlatformAccount> accountList = getAllAccount();
+        Map<String, ContentPlatformAccount> accountMap = accountList.stream()
+                .collect(Collectors.toMap(ContentPlatformAccount::getChannel, account -> account));
         Long now = System.currentTimeMillis();
         if (CollectionUtils.isNotEmpty(outDataList)) {
             for (Record record : outDataList) {
-                String channel = (String) record.get(33);
-                int firstLevelCount = Integer.parseInt((String) record.get(6));
+                String channel = (String) record.get(0);
+                String subChannel = (String) record.get(1);
+                int firstLevelCount = Integer.parseInt((String) record.get(2));
                 if (firstLevelCount == 0) {
                     continue;
                 }
                 ContentPlatformQwDataStatSubChannel item = saveMap.getOrDefault(channel, new ContentPlatformQwDataStatSubChannel());
                 item.setDateStr(dt);
-                item.setSubChannel(channel);
+                ContentPlatformAccount account = accountMap.get(channel);
+                if (Objects.isNull(account)) {
+                    continue;
+                }
+                item.setCreateAccountId(account.getId());
+                item.setSubChannel(subChannel);
                 if (item.getFirstLevelCount() == null) {
                     item.setFirstLevelCount(0);
                 }