Selaa lähdekoodia

Merge remote-tracking branch 'remotes/ctop/master' into test_performance2

hcst_sunzhen 5 vuotta sitten
vanhempi
commit
cddb641496
31 muutettua tiedostoa jossa 722 lisäystä ja 189 poistoa
  1. 8 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  2. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java
  3. 19 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyLoadFileJob.java
  4. 2 19
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHistoryLoadFileJob.java
  5. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java
  6. 1 1
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  7. 6 9
      jeecg-boot-module-system/src/main/resources/application-test.yml
  8. 19 0
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  9. 3 2
      module-common/src/main/java/cn/com/ctop/common/module/utils/JsonUtil.java
  10. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouDailyReportTaskService.java
  11. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java
  12. 4 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  13. 23 12
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  14. 122 65
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccount.java
  15. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java
  16. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCampaignMapper.java
  17. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java
  18. 427 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  19. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCampaignMapper.xml
  20. 25 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml
  21. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyGroupMapper.xml
  22. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAccountService.java
  23. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCampaignService.java
  24. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCreativeService.java
  25. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyGroupService.java
  26. 0 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAccountServiceImpl.java
  27. 0 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCampaignServiceImpl.java
  28. 0 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCreativeServiceImpl.java
  29. 0 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyGroupServiceImpl.java
  30. 1 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/utils/DownloadUtils.java
  31. 41 40
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/MaterialReportMapper.xml

+ 8 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -2,10 +2,7 @@ package org.jeecg.modules.ctop.controller;
 
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
-import cn.com.ctop.common.module.service.IMaterialAscriptionService;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
-import cn.com.ctop.common.module.service.IMaterialParameterService;
-import cn.com.ctop.common.module.service.IMaterialTagService;
+import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.JsonUtil;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -76,6 +73,8 @@ public class MaterialInfoController {
     private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
     @Autowired
     private IKuaiShouCleanMaterialReportService kuaiShouCleanMaterialReportService;
+    @Autowired
+    private IVideoWatermarkTaskService watermarkTaskService;
 
     @GetMapping(value = "/report")
     public JSONObject report(String userId) {
@@ -333,6 +332,7 @@ public class MaterialInfoController {
 
     }
 
+
     /**
      * 通过id删除
      *
@@ -347,10 +347,13 @@ public class MaterialInfoController {
             materialInfoService.removeById(id);
             Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("material_id", id);
-
             materialAscriptionService.removeByMap(deleteMap);
             materialParameterService.removeByMap(deleteMap);
             materialTagService.removeByMap(deleteMap);
+            Map<String, Object> deleteWatermarkMap = new HashMap<>();
+            deleteWatermarkMap.put("video_id", id);
+            watermarkTaskService.removeByMap(deleteWatermarkMap);
+
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java

@@ -58,6 +58,7 @@ public class AccountCpaBidJob implements Job {
 
                         });
                     }
+                    executorService.shutdown();
 
                 }
             }

+ 19 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyLoadFileJob.java

@@ -12,6 +12,7 @@ import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.List;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -27,6 +28,7 @@ public class KuaishouDailyLoadFileJob implements Job {
     @Autowired
     private ICtopOauthTokenService tokenService;
     static ExecutorService executorService = null;
+    static CountDownLatch countDownLatch = null;
     @Autowired
     private IKuaiShouDailyReportTaskService dailyReportTaskService;
 
@@ -44,17 +46,33 @@ public class KuaishouDailyLoadFileJob implements Job {
                     return;
                 }
                 executorService = Executors.newFixedThreadPool(3);
+                countDownLatch = new CountDownLatch(tokens.size());
                 for (CtopOauthToken token : tokens) {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
-                            dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), statDate);
+                            try {
+                                dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), statDate);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
+                                countDownLatch.countDown();
+                            }
                         }
                     });
                 }
+                executorService.shutdown();
             }
         };
         thread.start();
 
     }
+
+
+    public static void main(String[] args) {
+        String nowDate = DateUtils.getDate("yyyy-MM-dd");
+        String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -1);
+
+        System.err.println(statDate);
+    }
 }

+ 2 - 19
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHistoryLoadFileJob.java

@@ -1,8 +1,6 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
@@ -10,9 +8,7 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.List;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 /**
  * 获取文件状态并下载入库
@@ -32,22 +28,9 @@ public class KuaishouHistoryLoadFileJob implements Job {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                //  查询快手token
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-                if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取快手数据异常:未获取到可用的token");
-                    return;
-                }
-                executorService = Executors.newFixedThreadPool(3);
-                for (CtopOauthToken token : tokens) {
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            historyReportTaskService.getTaskList();
-                        }
-                    });
-                }
+                historyReportTaskService.getTaskList();
             }
+
         };
         thread.start();
 

+ 1 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java

@@ -40,13 +40,12 @@ public class WatermarkVideoJob implements Job {
 
                             try {
                                 String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-                                //                        String localPath = LoadFileUtil.downLoadFromUrl(url,"D:/video/");
-                                String md5 = LoadFileUtil.getMD5(localPath);
                                 LoadFileUtil.delFile(localPath);
                                 QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
                                 materialInfoQueryWrapper.eq("watermark_code", job.getJobId());
                                 MaterialInfo materialInfo = materialInfoService.getOne(materialInfoQueryWrapper);
                                 if (Check.isNull(materialInfo)) {
+                                    videoWaterMarkService.removeById(videoWatermarkTask.getId());
                                     continue;
 
                                 }

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -100,7 +100,7 @@ spring:
         poolPreparedStatements: true
         maxPoolPreparedStatementPerConnectionSize: 20
         # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
-        filters: stat,wall,slf4j
+        filters: stat,slf4j
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:

+ 6 - 9
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -1,5 +1,6 @@
 server:
   port: 8080
+  ip: 39.106.184.70
   servlet:
     context-path: /jeecg-boot
     compression:
@@ -14,7 +15,7 @@ management:
 
 spring:
   rabbitmq:
-    host: 127.0.0.1
+    host: 39.106.184.70
     port: 5672
     username: guest
     password: guest
@@ -64,10 +65,6 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-    username: hcst
-    password: test@20190531
-    driver-class-name: com.mysql.jdbc.Driver
     druid:
       stat-view-servlet:
         enabled: true
@@ -98,14 +95,14 @@ spring:
         poolPreparedStatements: true
         maxPoolPreparedStatementPerConnectionSize: 20
         # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
-        filters: stat,wall,slf4j
+        filters: stat,slf4j
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
           url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: root
-          password: hcst2019
+          username: hcst
+          password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:
@@ -171,4 +168,4 @@ oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: /mnt/file/video/
+    download: /mnt/file/video/

+ 19 - 0
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,9 +1,12 @@
 package org.jeecg;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
@@ -12,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -22,14 +26,29 @@ import java.util.concurrent.Executors;
 @SpringBootTest
 @Slf4j
 public class SampleTest {
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
 
 
     @Autowired
     private IKuaiShouHistoryReportTaskService reportTaskService;
+    @Autowired
+    private CtopOauthTokenMapper tokenMapper;
+
 
     @Test
     public void kuaisShouReport() {
         try {
+
+            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id",3727345L);
+            CtopOauthToken token = tokenMapper.selectOne(queryWrapper);
+
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date parse = simpleDateFormat.parse("2020-03-12");
+            kuaishouInterfaceService.getAdvertiserReportDaily(token,parse,parse);
+
+
 //            reportTaskService.createTask(3727345L, "871fc2c248782a94ad2962c941555abc", "");
 //            reportTaskService.getTaskList();
 

+ 3 - 2
module-common/src/main/java/cn/com/ctop/common/module/utils/JsonUtil.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.utils;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JavaType;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -42,9 +43,9 @@ public class JsonUtil {
      * @param jsonData json数据
      * @return
      */
-    public static <T> T jsonToObj(String jsonData, Class<T> beanType) {
+    public static <T> T jsonToObj(JSONObject jsonData, Class<T> beanType) {
         try {
-            T t = MAPPER.readValue(jsonData, beanType);
+            T t = MAPPER.readValue(jsonData.toJSONString(), beanType);
             return t;
         } catch (Exception e) {
             e.printStackTrace();

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouDailyReportTaskService.java

@@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @date 2020-03-12
  */
 public interface IKuaiShouDailyReportTaskService extends IService<KuaiShouDailyReportTask> {
+    void formatCreativeDailyReportData(Long accountId, String statDate);
+
     void getTaskList(Long accountId, String token, String statDate);
 
 }

+ 11 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java

@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -47,6 +48,11 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
     @Autowired
     private KuaishouReportDailyCreativeMapper reportDailyCreativeMapper;
 
+    @Override
+    public void formatCreativeDailyReportData(Long accountId, String statDate) {
+        reportDailyCreativeMapper.formatCreativeDailyReportData(accountId, statDate);
+    }
+
     /**
      * 获取任务列表
      */
@@ -88,6 +94,7 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
                                             loadFile(token, task);
                                         } else if (taskStatus == 3) {
                                             task.setTaskStatus(3);
+                                            task.setUpdateTime(new Date());
                                             this.updateById(task);
                                         }
                                     }
@@ -122,13 +129,17 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
 
                 } else if (task.getViewType() == 4) {
                     reportDailyCreativeMapper.loadCreativeDailyReport(task.getAccountId(), localPath);
+                    Thread.sleep(1 * 1000);
+                    reportDailyCreativeMapper.formatCreativeDailyReportData(task.getAccountId(), task.getStatDate());
                 }
             }
+
             task.setTaskStatus(4);
         } catch (Exception e) {
             e.printStackTrace();
             task.setTaskStatus(5);
         }
+        task.setUpdateTime(new Date());
         this.updateById(task);
     }
 

+ 4 - 9
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -26,8 +26,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 /**
  * 快手历史数据任务记录
@@ -43,8 +41,6 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     private String downloadPath;
     static List<Integer> historyTypeList;
     static List<Integer> dailyTypeList;
-    static ExecutorService executorService = Executors.newFixedThreadPool(3);
-
     @Autowired
     private ICtopOauthTokenService ctopOauthTokenService;
     @Autowired
@@ -85,7 +81,6 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                 for (int i = 0; i < dailyTypeList.size(); i++) {
                     Integer type = dailyTypeList.get(i);
                     String taskName = accountId + "_" + type + "_" + System.currentTimeMillis();
-                    log.info("任务名称:{}", taskName);
                     param.put("task_name", taskName);
                     taskParams.put("view_type", type);
                     param.put("task_params", taskParams);
@@ -115,13 +110,12 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                 for (int i = 0; i < historyTypeList.size(); i++) {
                     Integer type = historyTypeList.get(i);
                     String taskName = accountId + "_" + type + "_" + System.currentTimeMillis();
-                    log.info("任务名称:{}", taskName);
                     param.put("task_name", taskName);
                     taskParams.put("view_type", type);
                     param.put("task_params", taskParams);
                     String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
                     JSONObject resultJson = JSONObject.parseObject(result);
-                    System.err.println(resultJson);
+                    log.info("请求状态返回数据:{}", resultJson);
                     if (!Check.isNull(resultJson)) {
                         Integer code = resultJson.getInteger("code");
                         if (code == 0) {
@@ -152,6 +146,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
      */
     @Override
     public void getTaskList() {
+        log.info("开始历史数据文件检查下载");
         QueryWrapper<KuaiShouHistoryReportTask> taskQueryWrapper = new QueryWrapper<>();
         taskQueryWrapper.eq("task_status", 0);
         taskQueryWrapper.orderByDesc("create_time");
@@ -171,7 +166,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                     param.put("task_ids", taskIds);
                     String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
                     JSONObject resultJson = JSONObject.parseObject(result);
-                    System.err.println(resultJson);
+                    log.info("请求状态返回数据:{}", resultJson);
                     if (!Check.isNull(resultJson)) {
                         Integer code = resultJson.getInteger("code");
                         if (code == 0) {
@@ -222,7 +217,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
                 } else if (task.getViewType() == 4) {
                     reportDailyCreativeMapper.loadCreativeDailyReport(task.getAccountId(), localPath);
-
+                    reportDailyCreativeMapper.formatCreativeDailyReportData(task.getAccountId(), null);
                 }
             }
             task.setTaskStatus(4);

+ 23 - 12
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -14,6 +14,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.entity.*;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
 import cn.com.ctop.kuaishou.modules.report.service.*;
 import com.alibaba.fastjson.JSONArray;
@@ -109,6 +110,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private KuaiShouTargetingTagsMapper targetingTagsMapper;
 
+    @Autowired
+    private KuaishouReportDailyAccountMapper dailyAccountMapper;
+
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
         getAdvertiserReportHourlyByPage(token, startDate, endDate, 1);
@@ -372,15 +376,22 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
 
         for (int i = 0; i < details.size(); i++) {
-            var detailJson = details.getJSONObject(i);
-            var show = detailJson.getLong("show");
-            detailJson.put("photo_show", show);
-            var like = detailJson.getLong("like");
-            detailJson.put("photo_like", like);
-            var kuaishouReportDailyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportDailyAccount.class);
-            kuaishouReportDailyAccount.setAccountId(token.getAccountId());
-            kuaishouReportDailyAccount.setId("" + token.getAccountId() + kuaishouReportDailyAccount.getStatDate());
-            dailyAccountService.saveOrUpdate(kuaishouReportDailyAccount);
+            JSONObject detailJson = details.getJSONObject(i);
+            if (!Check.isNull(detailJson)) {
+                detailJson.put("photo_share", detailJson.getString("share"));
+                detailJson.put("photo_comment", detailJson.getString("comment"));
+                detailJson.put("photo_like", detailJson.getString("like"));
+                detailJson.put("photo_show", detailJson.getString("show"));
+                detailJson.remove("share");
+                detailJson.remove("comment");
+                detailJson.remove("like");
+                detailJson.remove("show");
+                detailJson.remove("adScene");
+                detailJson.remove("stat_hour");
+                KuaishouReportDailyAccount kuaishouReportDailyAccount = JsonUtil.jsonToObj(detailJson, KuaishouReportDailyAccount.class);
+                kuaishouReportDailyAccount.setAccountId(token.getAccountId());
+                dailyAccountMapper.insertSelective(kuaishouReportDailyAccount);
+            }
         }
         getAccountDailyReportByPage(token, startDate, endDate, page + 1);
     }
@@ -422,7 +433,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                             KuaishouReportDailyAccount kuaishouReportDailyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportDailyAccount.class);
                             kuaishouReportDailyAccount.setAccountId(advertiserId);
                             kuaishouReportDailyAccount.setId("" + advertiserId + kuaishouReportDailyAccount.getStatDate());
-                            dailyAccountService.saveOrUpdate(kuaishouReportDailyAccount);
+                            //dailyAccountService.saveOrUpdate(kuaishouReportDailyAccount);
                         }
                     }
                 }
@@ -1974,8 +1985,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     }
 
                     creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
-                    creative.setCreativeCreateTime(detailJson.get("create_time")==null?null:detailJson.getDate("create_time"));
-                    creative.setCreativeUpdateTime(detailJson.get("update_time")==null?null:detailJson.getDate("update_time"));
+                    creative.setCreativeCreateTime(detailJson.get("create_time") == null ? null : detailJson.getDate("create_time"));
+                    creative.setCreativeUpdateTime(detailJson.get("update_time") == null ? null : detailJson.getDate("update_time"));
 
                     creative.setCreateTime(new Date());
                     creative.setUpdateTime(new Date());

+ 122 - 65
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccount.java

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.report.entity;
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -19,106 +18,164 @@ public class KuaishouReportDailyAccount implements Serializable {
 
     private Long accountId;
 
-    @JsonProperty("stat_date")
-    private String statDate;
-
-    @JsonProperty
+    @JsonProperty("charge")
     private BigDecimal charge;
 
-    @JsonProperty
+    @JsonProperty("photo_show")
     private Long photoShow;
 
-    @JsonProperty("photo_click")
-    private Long photoClick;
-
-    @JsonProperty
+    @JsonProperty("aclick")
     private Long aclick;
-    @JsonProperty
+
+    @JsonProperty("bclick")
     private Long bclick;
-    @JsonProperty
-    private Long share;
-    @JsonProperty
-    private Long comment;
-    @JsonProperty
+
+    @JsonProperty("photo_share")
+    private Long photoShare;
+
+    @JsonProperty("photo_comment")
+    private Long photoComment;
+
+    @JsonProperty("photo_like")
     private Long photoLike;
-    @JsonProperty
+
+    @JsonProperty("follow")
     private Long follow;
+
     @JsonProperty("cancel_follow")
     private Long cancelFollow;
-    @JsonProperty
+
+    @JsonProperty("report")
     private Long report;
-    @JsonProperty
+
+    @JsonProperty("block")
     private Long block;
-    @JsonProperty
+
+    @JsonProperty("negative")
     private Long negative;
-    @JsonProperty
-    private Long submit;
+
     @JsonProperty("download_started")
     private Long downloadStarted;
+
     @JsonProperty("download_completed")
     private Long downloadCompleted;
-    @JsonProperty
+
+    @JsonProperty("activation")
     private Long activation;
 
-    @JsonProperty
-    private BigDecimal photoClickRatio;
-    @JsonProperty
-    private BigDecimal actionRatio;
+    @JsonProperty("submit")
+    private Long submit;
+
+    @JsonProperty("stat_date")
+    private String statDate;
+
+    @JsonProperty("photo_click")
+    private Long photoClick;
+
+    @JsonProperty("photo_click_ratio")
+    private Double photoClickRatio;
+
+    @JsonProperty("action_ratio")
+    private Double actionRatio;
+
     @JsonProperty("impression_1k_cost")
-    @TableField("impression_1k_cost")
     private BigDecimal impression1kCost;
-    @JsonProperty
+
+    @JsonProperty("photo_click_cost")
     private BigDecimal photoClickCost;
-    @JsonProperty
+
+    @JsonProperty("action_cost")
     private BigDecimal actionCost;
-    @JsonProperty
+
+    @JsonProperty("event_pay_first_day")
     private Long eventPayFirstDay;
-    @JsonProperty
-    private BigDecimal eventPayFirstDayRoi;
-    @JsonProperty
-    private BigDecimal eventPay;
-    @JsonProperty
+
+    @JsonProperty("event_pay_purchase_amount_first_day")
+    private BigDecimal eventPayPurchaseAmountFirstDay;
+
+    @JsonProperty("event_pay_first_day_roi")
+    private Double eventPayFirstDayRoi;
+
+    @JsonProperty("event_pay")
+    private Long eventPay;
+
+    @JsonProperty("event_pay_purchase_amount")
     private BigDecimal eventPayPurchaseAmount;
-    @JsonProperty
-    private BigDecimal eventPayRoi;
-    @JsonProperty
+
+    @JsonProperty("event_pay_roi")
+    private Double eventPayRoi;
+
+    @JsonProperty("event_register")
     private Long eventRegister;
-    @JsonProperty
+
+    @JsonProperty("event_register_cost")
     private BigDecimal eventRegisterCost;
-    @JsonProperty
+
+    @JsonProperty("event_register_ratio")
+    private Double eventRegisterRatio;
+
+    @JsonProperty("event_jin_jian_app")
     private Long eventJinJianApp;
-    @JsonProperty
+
+    @JsonProperty("event_jin_jian_app_cost")
     private BigDecimal eventJinJianAppCost;
-    @JsonProperty
-    private BigDecimal eventPayPurchaseAmountFirstDay;
-    @JsonProperty
+
+    @JsonProperty("event_credit_grant_app")
     private Long eventCreditGrantApp;
-    @JsonProperty
+
+    @JsonProperty("event_credit_grant_app_cost")
     private BigDecimal eventCreditGrantAppCost;
-    @JsonProperty
-    private BigDecimal eventCreditGrantAppRatio;
-    @JsonProperty
-    private BigDecimal eventOrderPaid;
-    @JsonProperty
+
+    @JsonProperty("event_credit_grant_app_ratio")
+    private Double eventCreditGrantAppRatio;
+
+    @JsonProperty("event_order_paid")
+    private Long eventOrderPaid;
+
+    @JsonProperty("event_order_paid_purchase_amount")
     private BigDecimal eventOrderPaidPurchaseAmount;
-    @JsonProperty
-    private BigDecimal eventOrderPaidCost;
-    @JsonProperty
-    private Long formCount;
-    @JsonProperty
-    private BigDecimal formCost;
-    @JsonProperty
-    private BigDecimal formActionRatio;
-    @JsonProperty
+
+    @JsonProperty("event_jin_jian_landing_page")
     private Long eventJinJianLandingPage;
-    @JsonProperty
+
+    @JsonProperty("event_jin_jian_landing_page_cost")
     private BigDecimal eventJinJianLandingPageCost;
-    @JsonProperty
+
+    @JsonProperty("event_credit_grant_landing_page")
     private Long eventCreditGrantLandingPage;
-    @JsonProperty
+
+    @JsonProperty("event_credit_grant_landing_page_cost")
     private BigDecimal eventCreditGrantLandingPageCost;
-    @JsonProperty
+
+    @JsonProperty("event_credit_grant_landing_ratio")
+    private Double eventCreditGrantLandingRatio;
+
+    @JsonProperty("event_next_day_stay_cost")
+    private BigDecimal eventNextDayStayCost;
+
+    @JsonProperty("event_next_day_stay_ratio")
+    private Long eventNextDayStayRatio;
+
+    @JsonProperty("form_action_ratio")
+    private Double formActionRatio;
+
+    @JsonProperty("event_order_paid_cost")
+    private BigDecimal eventOrderPaidCost;
+
+    @JsonProperty("event_next_day_stay")
+    private Long eventNextDayStay;
+
+    @JsonProperty("form_cost")
+    private BigDecimal formCost;
+
+    @JsonProperty("form_count")
+    private Long formCount;
+
+    @JsonProperty("play_3s_ratio")
+    private Double play3sRatio;
+
     private Date createTime;
-    @JsonProperty
+
     private Date updateTime;
 }
+

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java

@@ -6,4 +6,6 @@ import org.apache.ibatis.annotations.Param;
 
 public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouReportDailyAccount> {
     void loadAccountDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
+
+    void insertSelective(KuaishouReportDailyAccount dailyAccount);
 }

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCampaignMapper.java

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java

@@ -6,4 +6,6 @@ import org.apache.ibatis.annotations.Param;
 
 public interface KuaishouReportDailyCreativeMapper extends BaseMapper<KuaishouReportDailyCreative> {
     void loadCreativeDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
+
+    void formatCreativeDailyReportData(@Param("accountId") Long accountId, @Param("statDate") String statDate);
 }

+ 427 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -1,9 +1,435 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper">
+
+    <resultMap id="BaseResultMap" type="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="account_id" property="account_id" jdbcType="BIGINT"/>
+        <result column="charge" property="charge" jdbcType="DECIMAL"/>
+        <result column="photo_show" property="photo_show" jdbcType="BIGINT"/>
+        <result column="aclick" property="aclick" jdbcType="BIGINT"/>
+        <result column="bclick" property="bclick" jdbcType="BIGINT"/>
+        <result column="photo_share" property="photo_share" jdbcType="BIGINT"/>
+        <result column="photo_comment" property="photo_comment" jdbcType="BIGINT"/>
+        <result column="photo_like" property="photo_like" jdbcType="BIGINT"/>
+        <result column="follow" property="follow" jdbcType="BIGINT"/>
+        <result column="cancel_follow" property="cancel_follow" jdbcType="BIGINT"/>
+        <result column="report" property="report" jdbcType="BIGINT"/>
+        <result column="block" property="block" jdbcType="BIGINT"/>
+        <result column="negative" property="negative" jdbcType="BIGINT"/>
+        <result column="download_started" property="download_started" jdbcType="BIGINT"/>
+        <result column="download_completed" property="download_completed" jdbcType="BIGINT"/>
+        <result column="activation" property="activation" jdbcType="BIGINT"/>
+        <result column="submit" property="submit" jdbcType="BIGINT"/>
+        <result column="stat_date" property="stat_date" jdbcType="VARCHAR"/>
+        <result column="photo_click" property="photo_click" jdbcType="BIGINT"/>
+        <result column="photo_click_ratio" property="photo_click_ratio" jdbcType="DOUBLE"/>
+        <result column="action_ratio" property="action_ratio" jdbcType="DOUBLE"/>
+        <result column="impression_1k_cost" property="impression_1k_cost" jdbcType="DECIMAL"/>
+        <result column="photo_click_cost" property="photo_click_cost" jdbcType="DECIMAL"/>
+        <result column="action_cost" property="action_cost" jdbcType="DECIMAL"/>
+        <result column="event_pay_first_day" property="event_pay_first_day" jdbcType="BIGINT"/>
+        <result column="event_pay_purchase_amount_first_day" property="event_pay_purchase_amount_first_day"
+                jdbcType="DECIMAL"/>
+        <result column="event_pay_first_day_roi" property="event_pay_first_day_roi" jdbcType="DOUBLE"/>
+        <result column="event_pay" property="event_pay" jdbcType="BIGINT"/>
+        <result column="event_pay_purchase_amount" property="event_pay_purchase_amount" jdbcType="DECIMAL"/>
+        <result column="event_pay_roi" property="event_pay_roi" jdbcType="DOUBLE"/>
+        <result column="event_register" property="event_register" jdbcType="BIGINT"/>
+        <result column="event_register_cost" property="event_register_cost" jdbcType="DECIMAL"/>
+        <result column="event_register_ratio" property="event_register_ratio" jdbcType="DOUBLE"/>
+        <result column="event_jin_jian_app" property="event_jin_jian_app" jdbcType="BIGINT"/>
+        <result column="event_jin_jian_app_cost" property="event_jin_jian_app_cost" jdbcType="DECIMAL"/>
+        <result column="event_credit_grant_app" property="event_credit_grant_app" jdbcType="BIGINT"/>
+        <result column="event_credit_grant_app_cost" property="event_credit_grant_app_cost" jdbcType="DECIMAL"/>
+        <result column="event_credit_grant_app_ratio" property="event_credit_grant_app_ratio" jdbcType="DOUBLE"/>
+        <result column="event_order_paid" property="event_order_paid" jdbcType="BIGINT"/>
+        <result column="event_order_paid_purchase_amount" property="event_order_paid_purchase_amount"
+                jdbcType="DECIMAL"/>
+        <result column="event_jin_jian_landing_page" property="event_jin_jian_landing_page" jdbcType="BIGINT"/>
+        <result column="event_jin_jian_landing_page_cost" property="event_jin_jian_landing_page_cost"
+                jdbcType="DECIMAL"/>
+        <result column="event_credit_grant_landing_page" property="event_credit_grant_landing_page" jdbcType="BIGINT"/>
+        <result column="event_credit_grant_landing_page_cost" property="event_credit_grant_landing_page_cost"
+                jdbcType="DECIMAL"/>
+        <result column="event_credit_grant_landing_ratio" property="event_credit_grant_landing_ratio"
+                jdbcType="DOUBLE"/>
+        <result column="event_next_day_stay_cost" property="event_next_day_stay_cost" jdbcType="DECIMAL"/>
+        <result column="event_next_day_stay_ratio" property="event_next_day_stay_ratio" jdbcType="BIGINT"/>
+        <result column="form_action_ratio" property="form_action_ratio" jdbcType="DOUBLE"/>
+        <result column="event_order_paid_cost" property="event_order_paid_cost" jdbcType="DECIMAL"/>
+        <result column="event_next_day_stay" property="event_next_day_stay" jdbcType="BIGINT"/>
+        <result column="form_cost" property="form_cost" jdbcType="DECIMAL"/>
+        <result column="form_count" property="form_count" jdbcType="BIGINT"/>
+        <result column="play_3s_ratio" property="play_3s_ratio" jdbcType="DOUBLE"/>
+        <result column="create_time" property="create_time" jdbcType="TIMESTAMP"/>
+        <result column="update_time" property="update_time" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+    id, account_id, charge, photo_show, aclick, bclick, photo_share, photo_comment, photo_like,
+    follow, cancel_follow, report, block, negative, download_started, download_completed,
+    activation, submit, stat_date, photo_click, photo_click_ratio, action_ratio, impression_1k_cost,
+    photo_click_cost, action_cost, event_pay_first_day, event_pay_purchase_amount_first_day,
+    event_pay_first_day_roi, event_pay, event_pay_purchase_amount, event_pay_roi, event_register,
+    event_register_cost, event_register_ratio, event_jin_jian_app, event_jin_jian_app_cost,
+    event_credit_grant_app, event_credit_grant_app_cost, event_credit_grant_app_ratio,
+    event_order_paid, event_order_paid_purchase_amount, event_jin_jian_landing_page,
+    event_jin_jian_landing_page_cost, event_credit_grant_landing_page, event_credit_grant_landing_page_cost,
+    event_credit_grant_landing_ratio, event_next_day_stay_cost, event_next_day_stay_ratio,
+    form_action_ratio, event_order_paid_cost, event_next_day_stay, form_cost, form_count,
+    play_3s_ratio, create_time, update_time
+  </sql>
+
+
+    <insert id="insertSelective" parameterType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount">
+        replace into ctop_kuaishou_report_daily_account
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="accountId != null">
+                account_id,
+            </if>
+            <if test="charge != null">
+                charge,
+            </if>
+            <if test="photoShow != null">
+                photo_show,
+            </if>
+            <if test="aclick != null">
+                aclick,
+            </if>
+            <if test="bclick != null">
+                bclick,
+            </if>
+            <if test="photoShare != null">
+                photo_share,
+            </if>
+            <if test="photoComment != null">
+                photo_comment,
+            </if>
+            <if test="photoLike != null">
+                photo_like,
+            </if>
+            <if test="follow != null">
+                follow,
+            </if>
+            <if test="cancelFollow != null">
+                cancel_follow,
+            </if>
+            <if test="report != null">
+                report,
+            </if>
+            <if test="block != null">
+                block,
+            </if>
+            <if test="negative != null">
+                negative,
+            </if>
+            <if test="downloadStarted != null">
+                download_started,
+            </if>
+            <if test="downloadCompleted != null">
+                download_completed,
+            </if>
+            <if test="activation != null">
+                activation,
+            </if>
+            <if test="submit != null">
+                submit,
+            </if>
+            <if test="statDate != null">
+                stat_date,
+            </if>
+            <if test="photoClick != null">
+                photo_click,
+            </if>
+            <if test="photoClickRatio != null">
+                photo_click_ratio,
+            </if>
+            <if test="actionRatio != null">
+                action_ratio,
+            </if>
+            <if test="impression1kCost != null">
+                impression_1k_cost,
+            </if>
+            <if test="photoClickCost != null">
+                photo_click_cost,
+            </if>
+            <if test="actionCost != null">
+                action_cost,
+            </if>
+            <if test="eventPayFirstDay != null">
+                event_pay_first_day,
+            </if>
+            <if test="eventPayPurchaseAmountFirstDay != null">
+                event_pay_purchase_amount_first_day,
+            </if>
+            <if test="eventPayFirstDayRoi != null">
+                event_pay_first_day_roi,
+            </if>
+            <if test="eventPay != null">
+                event_pay,
+            </if>
+            <if test="eventPayPurchaseAmount != null">
+                event_pay_purchase_amount,
+            </if>
+            <if test="eventPayRoi != null">
+                event_pay_roi,
+            </if>
+            <if test="eventRegister != null">
+                event_register,
+            </if>
+            <if test="eventRegisterCost != null">
+                event_register_cost,
+            </if>
+            <if test="eventRegisterRatio != null">
+                event_register_ratio,
+            </if>
+            <if test="eventJinJianApp != null">
+                event_jin_jian_app,
+            </if>
+            <if test="eventJinJianAppCost != null">
+                event_jin_jian_app_cost,
+            </if>
+            <if test="eventCreditGrantApp != null">
+                event_credit_grant_app,
+            </if>
+            <if test="eventCreditGrantAppCost != null">
+                event_credit_grant_app_cost,
+            </if>
+            <if test="eventCreditGrantAppRatio != null">
+                event_credit_grant_app_ratio,
+            </if>
+            <if test="eventOrderPaid != null">
+                event_order_paid,
+            </if>
+            <if test="eventOrderPaidPurchaseAmount != null">
+                event_order_paid_purchase_amount,
+            </if>
+            <if test="eventJinJianLandingPage != null">
+                event_jin_jian_landing_page,
+            </if>
+            <if test="eventJinJianLandingPageCost != null">
+                event_jin_jian_landing_page_cost,
+            </if>
+            <if test="eventCreditGrantLandingPage != null">
+                event_credit_grant_landing_page,
+            </if>
+            <if test="eventCreditGrantLandingPageCost != null">
+                event_credit_grant_landing_page_cost,
+            </if>
+            <if test="eventCreditGrantLandingRatio != null">
+                event_credit_grant_landing_ratio,
+            </if>
+            <if test="eventNextDayStayCost != null">
+                event_next_day_stay_cost,
+            </if>
+            <if test="eventNextDayStayRatio != null">
+                event_next_day_stay_ratio,
+            </if>
+            <if test="formActionRatio != null">
+                form_action_ratio,
+            </if>
+            <if test="eventOrderPaidCost != null">
+                event_order_paid_cost,
+            </if>
+            <if test="eventNextDayStay != null">
+                event_next_day_stay,
+            </if>
+            <if test="formCost != null">
+                form_cost,
+            </if>
+            <if test="formCount != null">
+                form_count,
+            </if>
+            <if test="play3sRatio != null">
+                play_3s_ratio,
+            </if>
+            <if test="createTime != null">
+                create_time,
+            </if>
+            <if test="updateTime != null">
+                update_time,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=BIGINT},
+            </if>
+            <if test="accountId != null">
+                #{accountId,jdbcType=BIGINT},
+            </if>
+            <if test="charge != null">
+                #{charge,jdbcType=DECIMAL},
+            </if>
+            <if test="photoShow != null">
+                #{photoShow,jdbcType=BIGINT},
+            </if>
+            <if test="aclick != null">
+                #{aclick,jdbcType=BIGINT},
+            </if>
+            <if test="bclick != null">
+                #{bclick,jdbcType=BIGINT},
+            </if>
+            <if test="photoShare != null">
+                #{photoShare,jdbcType=BIGINT},
+            </if>
+            <if test="photoComment != null">
+                #{photoComment,jdbcType=BIGINT},
+            </if>
+            <if test="photoLike != null">
+                #{photoLike,jdbcType=BIGINT},
+            </if>
+            <if test="follow != null">
+                #{follow,jdbcType=BIGINT},
+            </if>
+            <if test="cancelFollow != null">
+                #{cancelFollow,jdbcType=BIGINT},
+            </if>
+            <if test="report != null">
+                #{report,jdbcType=BIGINT},
+            </if>
+            <if test="block != null">
+                #{block,jdbcType=BIGINT},
+            </if>
+            <if test="negative != null">
+                #{negative,jdbcType=BIGINT},
+            </if>
+            <if test="downloadStarted != null">
+                #{downloadStarted,jdbcType=BIGINT},
+            </if>
+            <if test="downloadCompleted != null">
+                #{downloadCompleted,jdbcType=BIGINT},
+            </if>
+            <if test="activation != null">
+                #{activation,jdbcType=BIGINT},
+            </if>
+            <if test="submit != null">
+                #{submit,jdbcType=BIGINT},
+            </if>
+            <if test="statDate != null">
+                #{statDate,jdbcType=VARCHAR},
+            </if>
+            <if test="photoClick != null">
+                #{photoClick,jdbcType=BIGINT},
+            </if>
+            <if test="photoClickRatio != null">
+                #{photoClickRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="actionRatio != null">
+                #{actionRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="impression1kCost != null">
+                #{impression1kCost,jdbcType=DECIMAL},
+            </if>
+            <if test="photoClickCost != null">
+                #{photoClickCost,jdbcType=DECIMAL},
+            </if>
+            <if test="actionCost != null">
+                #{actionCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventPayFirstDay != null">
+                #{eventPayFirstDay,jdbcType=BIGINT},
+            </if>
+            <if test="eventPayPurchaseAmountFirstDay != null">
+                #{eventPayPurchaseAmountFirstDay,jdbcType=DECIMAL},
+            </if>
+            <if test="eventPayFirstDayRoi != null">
+                #{eventPayFirstDayRoi,jdbcType=DOUBLE},
+            </if>
+            <if test="eventPay != null">
+                #{eventPay,jdbcType=BIGINT},
+            </if>
+            <if test="eventPayPurchaseAmount != null">
+                #{eventPayPurchaseAmount,jdbcType=DECIMAL},
+            </if>
+            <if test="eventPayRoi != null">
+                #{eventPayRoi,jdbcType=DOUBLE},
+            </if>
+            <if test="eventRegister != null">
+                #{eventRegister,jdbcType=BIGINT},
+            </if>
+            <if test="eventRegisterCost != null">
+                #{eventRegisterCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventRegisterRatio != null">
+                #{eventRegisterRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="eventJinJianApp != null">
+                #{eventJinJianApp,jdbcType=BIGINT},
+            </if>
+            <if test="eventJinJianAppCost != null">
+                #{eventJinJianAppCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventCreditGrantApp != null">
+                #{eventCreditGrantApp,jdbcType=BIGINT},
+            </if>
+            <if test="eventCreditGrantAppCost != null">
+                #{eventCreditGrantAppCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventCreditGrantAppRatio != null">
+                #{eventCreditGrantAppRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="eventOrderPaid != null">
+                #{eventOrderPaid,jdbcType=BIGINT},
+            </if>
+            <if test="eventOrderPaidPurchaseAmount != null">
+                #{eventOrderPaidPurchaseAmount,jdbcType=DECIMAL},
+            </if>
+            <if test="eventJinJianLandingPage != null">
+                #{eventJinJianLandingPage,jdbcType=BIGINT},
+            </if>
+            <if test="eventJinJianLandingPageCost != null">
+                #{eventJinJianLandingPageCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventCreditGrantLandingPage != null">
+                #{eventCreditGrantLandingPage,jdbcType=BIGINT},
+            </if>
+            <if test="eventCreditGrantLandingPageCost != null">
+                #{eventCreditGrantLandingPageCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventCreditGrantLandingRatio != null">
+                #{eventCreditGrantLandingRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="eventNextDayStayCost != null">
+                #{eventNextDayStayCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventNextDayStayRatio != null">
+                #{eventNextDayStayRatio,jdbcType=BIGINT},
+            </if>
+            <if test="formActionRatio != null">
+                #{formActionRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="eventOrderPaidCost != null">
+                #{eventOrderPaidCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventNextDayStay != null">
+                #{eventNextDayStay,jdbcType=BIGINT},
+            </if>
+            <if test="formCost != null">
+                #{formCost,jdbcType=DECIMAL},
+            </if>
+            <if test="formCount != null">
+                #{formCount,jdbcType=BIGINT},
+            </if>
+            <if test="play3sRatio != null">
+                #{play3sRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="createTime != null">
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateTime != null">
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+        </trim>
+    </insert>
+
+
     <insert id="loadAccountDailyReport">
 		LOAD DATA local INFILE  #{localPath}
-		INTO TABLE ctop_kuaishou_report_daily_account_new CHARACTER SET utf8
+		REPLACE INTO TABLE ctop_kuaishou_report_daily_account CHARACTER SET utf8mb4
 		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
 		IGNORE 1 LINES
 		(@ad_scene,

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCampaignMapper.xml

@@ -5,7 +5,7 @@
 
     <insert id="loadCampaignDailyReport">
 		LOAD DATA local INFILE  #{localPath}
-		INTO TABLE ctop_kuaishou_report_daily_campaign_new CHARACTER SET utf8
+	    REPLACE INTO TABLE ctop_kuaishou_report_daily_campaign CHARACTER SET utf8mb4
 		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
 		IGNORE 1 LINES
 		(campaign_id,

+ 25 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml

@@ -5,7 +5,7 @@
 
     <insert id="loadCreativeDailyReport">
 		LOAD DATA local INFILE  #{localPath}
-		INTO TABLE ctop_kuaishou_report_daily_creative_new CHARACTER SET utf8
+		REPLACE INTO TABLE ctop_kuaishou_report_daily_creative CHARACTER SET utf8mb4
 		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
 		IGNORE 1 LINES
 		(
@@ -73,5 +73,28 @@
         )
           set account_id = #{accountId}
     </insert>
+    <update id="formatCreativeDailyReportData">
+        UPDATE
+        ctop_kuaishou_report_daily_creative t1
+        SET
+        t1.signature = (
+        SELECT
+        DISTINCT t3.signature
+        FROM
+        ctop_kuaishou_creative t2
+        LEFT JOIN
+        ctop_kuaishou_video_get t3 ON t2.photo_id = t3.photo_id
+        WHERE
+        t2.creative_id = t1.creative_id
+        )
+        WHERE
+        1=1
+        <if test="accountId != null">
+            and t1.account_id = #{accountId}
+        </if>
+        <if test="statDate != null">
+            and t1.stat_date = #{statDate}
+        </if>
+    </update>
 
-</mapper>
+</mapper>

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyGroupMapper.xml

@@ -4,7 +4,7 @@
 
     <insert id="loadGroupDailyReport">
 		LOAD DATA local INFILE  #{localPath}
-		INTO TABLE ctop_kuaishou_report_daily_group_new CHARACTER SET utf8
+		REPLACE INTO TABLE ctop_kuaishou_report_daily_group CHARACTER SET utf8mb4
 		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
 		IGNORE 1 LINES
 		(

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAccountService.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 public interface IKuaishouReportDailyAccountService extends IService<KuaishouReportDailyAccount> {

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCampaignService.java

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
 import com.baomidou.mybatisplus.extension.service.IService;
 

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCreativeService.java

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
 import com.baomidou.mybatisplus.extension.service.IService;
 

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyGroupService.java

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
 import com.baomidou.mybatisplus.extension.service.IService;
 

+ 0 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAccountServiceImpl.java

@@ -1,11 +1,8 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportHourlyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyAccountService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 

+ 0 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCampaignServiceImpl.java

@@ -1,10 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCampaignService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;

+ 0 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCreativeServiceImpl.java

@@ -1,10 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;

+ 0 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyGroupServiceImpl.java

@@ -1,10 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;

+ 1 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/utils/DownloadUtils.java

@@ -32,7 +32,7 @@ public class DownloadUtils {
             URL url = new URL(urlStr + "?" + postBody);
             HttpURLConnection conn = (HttpURLConnection) url.openConnection();
             //设置超时间为3秒
-            conn.setConnectTimeout(10 * 1000);
+            conn.setConnectTimeout(120 * 1000);
             //防止屏蔽程序抓取而返回403错误
             conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
             conn.setRequestProperty("Access-Token", token);
@@ -45,7 +45,6 @@ public class DownloadUtils {
             byte[] getData = readInputStream(inputStream);
 
             //文件保存位置
-            System.err.println(downloadPath);
             File saveDir = new File(downloadPath);
             if (!saveDir.exists()) {
                 saveDir.mkdirs();

+ 41 - 40
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/MaterialReportMapper.xml

@@ -206,6 +206,9 @@
 
 
     <select id="selectDailyByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+
+
+
         SELECT
         sum(t2.charge) cost, -- 花费
         sum(t2.photo_show) photoShow, -- 封面曝光数
@@ -265,13 +268,13 @@
         ELSE 0
         END
         ) conversionPrice, -- 转化单价
-
-        t2.url url, -- 视频url
+        ( SELECT url from ctop_kuaishou_video_get WHERE signature = t2.signature limit 1) url,
+        -- t2.url url, -- 视频url
         t2.signature signature -- 视频md5
         from
         ctop_user_allocation t1
         left join
-        ctop_kuaishou_report_daily_creative_statistic t2
+        ctop_kuaishou_report_daily_creative t2
         on t1.account_id = t2.account_id
         <where>
             <if test="userId != null">
@@ -279,7 +282,7 @@
             </if>
             and t1.media_id = '2'
             and t1.account_id != ''
-            and t2.signature != ''
+            and t2.signature is not null
             <if test="startDate != null">
                 and t2.stat_date &lt;= #{startDate}
             </if>
@@ -290,6 +293,7 @@
         group by t2.signature
         order by sum(t2.charge) desc
         limit 100
+
     </select>
 
 
@@ -354,7 +358,7 @@
         END
         ) conversionPrice -- 转化单价
         from
-        ctop_kuaishou_report_daily_creative_statistic
+        ctop_kuaishou_report_daily_creative
         <where>
             <if test="signature != null">
                 and signature = #{signature}
@@ -467,90 +471,87 @@
 
     <select id="selectDayMaterialList" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        sum(t2.charge) cost, -- 花费
-        sum(t2.photo_show) photoShow, -- 封面曝光数
-        sum(t2.photo_click) photoClick, -- 封面点击数
-        sum(t2.aclick) aclick, -- 素材曝光数
-        sum(t2.bclick) bclick, -- 行为数
+        sum(charge) cost, -- 花费
+        sum(photo_show) photoShow, -- 封面曝光数
+        sum(photo_click) photoClick, -- 封面点击数
+        sum(aclick) aclick, -- 素材曝光数
+        sum(bclick) bclick, -- 行为数
         (case
         when sum(photo_show) != 0
-        then (sum(t2.photo_click) / sum(photo_show))
+        then (sum(photo_click) / sum(photo_show))
         else 0
         end
         ) photoClickRatio, -- 封面点击率
 
         (case
         when sum(aclick) != 0
-        then (sum(t2.bclick) / sum(aclick))
+        then (sum(bclick) / sum(aclick))
         else 0
         end
         ) actionRatio, -- 行为率
 
         (case
-        when sum(t2.photo_show) != 0
-        then ((sum(t2.charge) / sum(t2.photo_show)) * 1000)
+        when sum(photo_show) != 0
+        then ((sum(charge) / sum(photo_show)) * 1000)
         else 0
         end
         ) impression1kCost, -- 均千次封面曝光花费
 
         (case
-        when sum(t2.photo_click) != 0
-        then (sum(t2.charge) / sum(t2.photo_click))
+        when sum(photo_click) != 0
+        then (sum(charge) / sum(photo_click))
         else 0
         end
         ) photoClickCost, -- 平均封面点击单价
 
         (CASE
-        WHEN sum(t2.photo_click) != 0
-        THEN (sum(t2.charge) / sum(t2.photo_click))
+        WHEN sum(photo_click) != 0
+        THEN (sum(charge) / sum(photo_click))
         ELSE 0
         end
         ) actionCost, -- 平均行为单价
 
         (case
-        WHEN sum(t2.form_count) != 0
-        THEN sum(t2.form_count)
-        WHEN sum(t2.activation) != 0
-        THEN sum(t2.activation)
+        WHEN sum(form_count) != 0
+        THEN sum(form_count)
+        WHEN sum(activation) != 0
+        THEN sum(activation)
         ELSE 0
         END
         ) conversions, -- 转化数
 
         (
         CASE
-        WHEN sum(t2.form_count) != 0
-        THEN (sum(t2.charge) / sum(t2.form_count))
-        WHEN sum(t2.activation) != 0
-        THEN (sum(t2.charge) / sum(t2.activation))
+        WHEN sum(form_count) != 0
+        THEN (sum(charge) / sum(form_count))
+        WHEN sum(activation) != 0
+        THEN (sum(charge) / sum(activation))
         ELSE 0
         END
         ) conversionPrice, -- 转化单价
 
-        t2.url url, -- 视频url
-        t2.signature signature, -- 视频md5
-        t2.account_id accountId
+        ( SELECT url from ctop_kuaishou_video_get WHERE signature = signature limit 1) url,
+        signature signature, -- 视频md5
+        account_id accountId
         from
-        ctop_oauth_token t1
-        left join
-        ctop_kuaishou_report_daily_creative_statistic t2
-        on t1.id = t2.account_id
-        where t1.id in
+        ctop_kuaishou_report_daily_creative
+        where  account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        and t1.media_id = '2'
+
 
         <if test="startDate != null">
-            and t2.stat_date &gt;= #{startDate}
+            and stat_date &gt;= #{startDate}
         </if>
 
         <if test="endDate != null">
-            and t2.stat_date &lt;= #{endDate}
+            and stat_date &lt;= #{endDate}
         </if>
-        and t2.signature != ''
-        GROUP BY t2.signature
-        order by sum(t2.charge) desc
+        and signature is not null
+        GROUP BY signature
+        order by sum(charge) desc
         limit 100
     </select>