浏览代码

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

zhaoxian 4 年之前
父节点
当前提交
115a2ab46b
共有 48 个文件被更改,包括 2297 次插入212 次删除
  1. 6 0
      jeecg-boot-module-system/pom.xml
  2. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 13 30
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  4. 2 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  5. 2 0
      jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml
  6. 265 0
      jeecg-boot-module-system/src/main/resources/application-preprod.yml
  7. 2 0
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  8. 2 0
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  9. 2 0
      jeecg-boot-module-system/src/main/resources/application-test.yml
  10. 2 1
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  11. 103 37
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  12. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  13. 5 5
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  14. 794 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/ConverterUtils.java
  15. 8 4
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  16. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java
  17. 18 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java
  18. 16 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceEtlVideoJob.java
  19. 7 0
      module-job-kuaishou/pom.xml
  20. 9 4
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiCreativeJob.java
  21. 6 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java
  22. 10 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java
  23. 5 0
      module-job-kuaishou/src/main/resources/application-dev.yml
  24. 5 1
      module-job-kuaishou/src/main/resources/application-jiaoyang.yml
  25. 239 0
      module-job-kuaishou/src/main/resources/application-preprod.yml
  26. 3 1
      module-job-kuaishou/src/main/resources/application-prod.yml
  27. 4 0
      module-job-kuaishou/src/main/resources/application-test.yml
  28. 18 10
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java
  29. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java
  30. 123 87
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  31. 35 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  32. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTemplate.java
  33. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  34. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  35. 7 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  36. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  37. 194 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  38. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java
  39. 32 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  40. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java
  41. 23 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java
  42. 2 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/service/impl/BytedanceAreaInfoServiceImpl.java
  43. 14 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/EtlBytedanceReportVideoDailyMapper.java
  44. 3 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
  45. 194 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/EtlBytedanceReportVideoDailyMapper.xml
  46. 6 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IEtlBytedanceReportVideoDailyService.java
  47. 78 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/EtlBytedanceReportVideoDailyServiceImpl.java
  48. 8 2
      pom.xml

+ 6 - 0
jeecg-boot-module-system/pom.xml

@@ -259,6 +259,12 @@
             </properties>
             </properties>
         </profile>
         </profile>
         <profile>
         <profile>
+            <id>preprod</id>
+            <properties>
+                <activatedProperties>preprod</activatedProperties>
+            </properties>
+        </profile>
+        <profile>
             <id>wps</id>
             <id>wps</id>
             <properties>
             <properties>
                 <activatedProperties>wps</activatedProperties>
                 <activatedProperties>wps</activatedProperties>

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

@@ -149,7 +149,8 @@ public class MaterialInfoController {
     public Result<Object> watermarkVideo(@RequestParam(name = "id") String id, @RequestParam(name = "watermarkTemplateId") Long watermarkTemplateId) {
     public Result<Object> watermarkVideo(@RequestParam(name = "id") String id, @RequestParam(name = "watermarkTemplateId") Long watermarkTemplateId) {
         Result<Object> result = new Result<>();
         Result<Object> result = new Result<>();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId());
+        Thread thread = new Thread(()-> materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId()));
+        thread.start();
         result.setCode(200);
         result.setCode(200);
         result.setSuccess(true);
         result.setSuccess(true);
         result.setMessage("水印合成任务执行成功,请稍后查看");
         result.setMessage("水印合成任务执行成功,请稍后查看");

+ 13 - 30
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -40,6 +40,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.JobExecutionException;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -136,8 +137,14 @@ public class TestController {
     @Autowired
     @Autowired
     private IMaterialUploadService materialUploadService;
     private IMaterialUploadService materialUploadService;
 
 
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
+
     @GetMapping("/uploadVideo")
     @GetMapping("/uploadVideo")
     public String uploadVideo(Long projectId) {
     public String uploadVideo(Long projectId) {
+
+        System.err.println(jobUrl + "/jeecg-boot/ai/create/customCreativeLimit");
+
         //  832
         //  832
         JSONArray idList = materialInfoService.getIdListByProject(832L);
         JSONArray idList = materialInfoService.getIdListByProject(832L);
         JSONArray accountArray = new JSONArray();
         JSONArray accountArray = new JSONArray();
@@ -148,7 +155,6 @@ public class TestController {
         accountArray.add(9825207L);
         accountArray.add(9825207L);
 
 
 
 
-
         materialUploadService.uploadAccount("2", idList, accountArray, "2e3b982046a44b5faadaa77a7c0da114", true);
         materialUploadService.uploadAccount("2", idList, accountArray, "2e3b982046a44b5faadaa77a7c0da114", true);
         return "success";
         return "success";
     }
     }
@@ -1015,39 +1021,17 @@ public class TestController {
     }
     }
 
 
 
 
-    @GetMapping(value = "/createTask")
-    public String createTask(Long accountId) {
-        Result<String> result = new Result<String>();
-        try {
-            QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
-            oauthTokenQueryWrapper.eq("media_id", 2);
-            oauthTokenQueryWrapper.eq("account_id", accountId);
-            oauthTokenQueryWrapper.last("limit 1");
-            CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
-            String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-            String startDate = DateUtils.addMonth(endDateStr, -6);
-            historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            result.setSuccess(false);
-        }
-        return "success";
-    }
-
-
     @GetMapping(value = "/getHistoryData")
     @GetMapping(value = "/getHistoryData")
-    public String getHistoryData() {
+    public String getHistoryData(String startDate, String endDate) {
         Result<String> result = new Result<>();
         Result<String> result = new Result<>();
         try {
         try {
-            String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-            String startDate = DateUtils.addMonth(endDateStr, -6);
+
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             tokenQueryWrapper.eq("media_id", 2);
             List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
             List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
                 for (CtopOauthToken token : ctopOauthTokens) {
-                    historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-01", "2020-10-01", CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
+                    historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
                 }
                 }
 
 
             }
             }
@@ -1060,17 +1044,16 @@ public class TestController {
 
 
 
 
     @GetMapping(value = "/getHistoryDataByAccountId")
     @GetMapping(value = "/getHistoryDataByAccountId")
-    public String getHistoryDataByAccountId(Long accountId) {
+    public String getHistoryDataByAccountId(Long accountId, String startDte, String endDate) {
         Result<String> result = new Result<>();
         Result<String> result = new Result<>();
         try {
         try {
-            String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-            String startDate = DateUtils.addMonth(endDateStr, -6);
+
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             tokenQueryWrapper.eq("media_id", 2);
             tokenQueryWrapper.eq("account_id", accountId);
             tokenQueryWrapper.eq("account_id", accountId);
             CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
             CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
             if (!Check.isNull(ctopOauthTokens)) {
-                historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
+                historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDte, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
 
 
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -290,3 +290,5 @@ ai:
   callback:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml

@@ -261,3 +261,5 @@ ai:
   callback:
   callback:
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 265 - 0
jeecg-boot-module-system/src/main/resources/application-preprod.yml

@@ -0,0 +1,265 @@
+server:
+  port: 8807
+  ip: 39.97.120.42
+  servlet:
+    context-path: /jeecg-boot
+    compression:
+      enabled: true
+      mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
+management:
+  endpoints:
+    web:
+      exposure:
+        include: metrics,httptrace
+spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
+  mail:
+    host: smtp.exmail.qq.com
+    username: notice@c-top.com.cn
+    password: Hcst@2019
+    properties:
+      mail:
+        smtp:
+          ssl.enable: enable
+          auth: true
+          starttls:
+            enable: true
+            required: true
+    ## quartz定时任务,采用数据库方式
+    #quartz:
+    #job-store-type: jdbc
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  jpa:
+    open-in-view: false
+  activiti:
+    check-process-definitions: false
+    #启用作业执行器
+    async-executor-activate: false
+    #启用异步执行器
+    job-executor-activate: false
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    username: hcst
+    password: hcst@2020
+    driver-class-name: com.mysql.jdbc.Driver
+    druid:
+      stat-view-servlet:
+        loginUsername: admin
+        loginPassword: hcst20161
+        enabled: true
+      web-stat-filter:
+        enabled: true
+    #      remove-abandoned: false
+    dynamic:
+      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        connection-init-sql: set names utf8mb4
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,wall,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: hcst@2020
+          driver-class-name: com.mysql.jdbc.Driver
+          # 多数据源配置
+          #multi-datasource1:
+          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
+          #username: root
+          #password: root
+          #driver-class-name: com.mysql.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    host: 172.30.0.17
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+    password: foobared
+    port: 6379
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: 4
+      # 默认数据库表下划线命名
+      table-underline: true
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#jeecg专用配置
+jeecg:
+  #积木报表设置
+  jmreport:
+    mode: dev
+    #是否需要校验token
+    is_verify_token: false
+    #必须校验方法
+    verify_methods: remove,delete,save,add,update
+  elasticsearch:
+    cluster-nodes:
+    check-enabled: false
+  uploadType:
+  oss:
+    endpoint:
+    accessKey:
+    secretKey:
+    bucketName:
+    staticDomain:
+  sms:
+    accessKeyId:
+    accessKeySecret:
+  minio:
+    minio_url:
+    minio_name:
+    minio_pass:
+    bucketName:
+  ffmpeg:
+    bin: ffmpeg
+  path:
+    #文件上传根目录 设置
+    upload: /data/upload
+    #webapp文件路径
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/upload/image/
+    kuaishou-agent-image: /data/upload/image/temp.png
+    kuaishou-account-captcha-image: /data/upload/image/captcha.png
+    chrome-driver: /usr/bin/chromedriver
+    csv-upload: /data/upload/csv/
+    bak-database-file: /data/data/bak/
+    report-history: /data/upload/report/history/
+    report-daily: /data/upload/report/daily/
+kuaishou:
+  api-url: https://ad.e.kuaishou.com
+  auth-url: https://ad.e.kuaishou.com
+  appid: 27
+  third-appid: 328
+  oauth-type: agent
+  secret: QovprB1tNhXptgDc
+  third-secret: 1iFTBiMdohkyEQQs
+  callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
+  third-callback-url: http://callback.shyouteng.com.cn/kuaishou
+  apk-sava-path: /mnt/file/apk
+  image-sava-path: /mnt/file/image
+  video-sava-path: /mnt/file/video
+  model-video-src-path: /mnt/data/src/
+  model-video-fill-path: /mnt/data/fill/
+  model-video-final-path: /mnt/data/final/
+  group-control:
+    path: http://39.106.184.70
+    port: 4723
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml
+chrome:
+  script:
+    clean: sh /data/webapp/cleanProcess.sh
+cas:
+  prefixUrl:
+oss:
+  replace:
+    replace-value: oss-cn-beijing
+    replace-old-value: oss-cn-beijing
+    download: /data/file/video/
+
+zip:
+  local:
+    download-path: /data/unzip/
+bytedance:
+  appId: 1635316529903624
+  secret: 0c51523e90d6166418fc8421a4896808e90e26f4
+  url:
+    auth-prefix: https://ad.oceanengine.com/openapi
+    api-prefix: https://ad.oceanengine.com/open_api
+    callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
+    refresh-token: /oauth2/refresh_token
+    advertiser-info: /2/advertiser/public_info/
+    ad-get: /2/ad/get/
+    ad-create: /2/ad/create/
+    ad-update: /2/ad/update/
+    ad-update-status: /2/ad/update/status/
+    ad-update-bid: /2/ad/update/bid/
+    ad-update-budget: /2/ad/update/budget/
+    ad-update-reject-reason: 2/ad/reject_reason/
+    campaign-get: /2/campaign/get/
+    campaign-create: /2/campaign/create/
+    campaign-update-status: /2/campaign/update/status/
+    campaign-update: /2/campaign/update/
+    dmp-custom-audience-select: /2/dmp/custom_audience/select/
+    file-video-ad: /2/file/video/ad/
+    file-image-ad: /2/file/image/ad/
+    creative-update-status: /2/creative/update/status/
+    creative-material-get: /2/creative/material/read/
+    creative-create-v2: /2/creative/create_v2/
+    creative-get: /2/creative/get/
+    creative-read: /2/creative/read_v2/
+    creative-update: /2/creative/update_v2/
+    creative-reject-reason: /2/creative/reject_reason/
+    advertiser-report-get: /2/report/advertiser/get/
+    campaign-report-get: /2/report/campaign/get/
+    ad-report-get: /2/report/ad/get/
+    ad-creative-get: /2/report/creative/get/
+    advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
+    callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

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

@@ -261,3 +261,5 @@ ai:
   callback:
   callback:
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-prod2.yml

@@ -253,3 +253,5 @@ ai:
   callback:
   callback:
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
     callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -250,3 +250,5 @@ ai:
   callback:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

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

@@ -248,4 +248,5 @@ ai:
   callback:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
-
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 103 - 37
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -2,26 +2,22 @@ package org.jeecg;
 
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
-import cn.com.ctop.kuaishou.modules.report.service.*;
-import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
-import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
 import cn.com.ctop.toutiao.modules.report.service.*;
 import cn.com.ctop.toutiao.modules.report.service.*;
+import com.csvreader.CsvReader;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
 import org.junit.Test;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,8 +26,10 @@ import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 import org.springframework.test.context.junit4.SpringRunner;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.io.IOException;
+import java.nio.charset.Charset;
 import java.text.ParseException;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -39,8 +37,6 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Executors;
 
 
-import static org.jeecg.common.util.DateUtils.getAnotherDay;
-
 @RunWith(SpringRunner.class)
 @RunWith(SpringRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
 @ActiveProfiles("wps")
 @ActiveProfiles("wps")
@@ -52,19 +48,53 @@ public class SampleTest {
     private IBindAccountLoginService bindAccountLoginService;
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
     @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private RedisUtil redisUtil;
 
 
     @Test
     @Test
-    public void loadKuaishouCookie() {
-        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
-        if (list != null && !list.isEmpty()) {
-            int i = 0;
-            for (BindAccountLogin login : list) {
-                if (null == login.getCookie() || "".equals(login.getCookie().trim())) {
-                    kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
-                    i++;
-                }
+    public void loadKuaishouCookie() throws ParseException {
+
+        redisUtil.set("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1","hahahaha",5);
+        Object o = redisUtil.get("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1");
+        System.err.println(o);
+
+
+        /*try {
+            // 用来保存数据
+            ArrayList<String[]> csvFileList = new ArrayList<String[]>();
+            // 定义一个CSV路径
+            String csvFilePath = "D:\\test\\123.csv";
+            // 创建CSV读对象 例如:CsvReader(文件路径,分隔符,编码格式);
+            CsvReader reader = new CsvReader(csvFilePath, ',', Charset.forName("UTF-8"));
+            // 跳过表头 如果需要表头的话,这句可以忽略
+            reader.readHeaders();
+            // 逐行读入除表头的数据
+            while (reader.readRecord()) {
+                System.out.println(reader.getRawRecord());
+                csvFileList.add(reader.getValues());
             }
             }
-        }
+            reader.close();
+
+            // 遍历读取的CSV文件
+            for (int row = 0; row < csvFileList.size(); row++) {
+                // 取得第row行第0列的数据
+                String cell = csvFileList.get(row)[0];
+                System.out.println("------------>" + cell);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }*/
+
+
+
+
+
+       /* CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(9792526L);
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = dateFormat.parse("2021-04-02");
+        kuaishouInterfaceService.getAdvertiserReportDaily(tokenByAccountId, parse, parse, null);*/
     }
     }
 
 
 
 
@@ -96,32 +126,29 @@ public class SampleTest {
             log.info("快手删评论所用时长:{}毫秒", end - start);
             log.info("快手删评论所用时长:{}毫秒", end - start);
         }
         }
     }
     }
+
     @Autowired
     @Autowired
     private IBytedanceReportService bytedanceReportService;
     private IBytedanceReportService bytedanceReportService;
 
 
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+
     @Test
     @Test
     public void loadBytedanceVideoReportData() {
     public void loadBytedanceVideoReportData() {
-        String startDate = "2021-04-01";
-        String endDate = "2021-04-26";
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        Long start = System.currentTimeMillis();
-
-        tokens.forEach(token->{
-            bytedanceReportService.bytedanceVideoMaterialReport(token, startDate, endDate);
-        });
-        Long end = System.currentTimeMillis();
-        log.info("查询素材消耗用时:{}毫秒", end - start);
+        CtopOauthToken token = tokenService.getTokenByAccountId(1696831659659278L);
+        advertiserDataService.getMaterialList(token);
     }
     }
 
 
     @Autowired
     @Autowired
     private IWechatNoListService wechatNoListService;
     private IWechatNoListService wechatNoListService;
     @Autowired
     @Autowired
     private IETLReportBytedanceVideoService bytedanceVideoService;
     private IETLReportBytedanceVideoService bytedanceVideoService;
+
     @Test
     @Test
-    public void etlBytedanceVideoInfo(){
+    public void etlBytedanceVideoInfo() {
         String startDate = "2021-02-01";
         String startDate = "2021-02-01";
-        for(int i=0;i<100;i++){
-            bytedanceVideoService.cleanData(DateUtils.addDay(startDate,i));
+        for (int i = 0; i < 100; i++) {
+            bytedanceVideoService.cleanData(DateUtils.addDay(startDate, i));
         }
         }
     }
     }
 
 
@@ -162,6 +189,7 @@ public class SampleTest {
     IKuaishouReportDailyImageService kuaishouReportDailyImageService;
     IKuaishouReportDailyImageService kuaishouReportDailyImageService;
     @Autowired
     @Autowired
     IRuleByteDanceAccountService ruleByteDanceAccountService;
     IRuleByteDanceAccountService ruleByteDanceAccountService;
+
     @Test
     @Test
     public void loadBDAccoutData() {
     public void loadBDAccoutData() {
         Date startDate = DateUtils.addDay(new Date(), -2000);
         Date startDate = DateUtils.addDay(new Date(), -2000);
@@ -170,6 +198,7 @@ public class SampleTest {
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
         }
         }
     }
     }
+
     @Resource
     @Resource
     private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
     private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
 
 
@@ -177,14 +206,51 @@ public class SampleTest {
     public void etlKuaishouVideoInfo() {
     public void etlKuaishouVideoInfo() {
         etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
         etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
     }
     }
+
     @Autowired
     @Autowired
     private IByteDanceCampaignService campaignService;
     private IByteDanceCampaignService campaignService;
+
     @Test
     @Test
-    public void testLoadBytedanceCampaign(){
-        List<CtopOauthToken>tokens = tokenService.selectToutiaoToken();
-        for(CtopOauthToken token :tokens){
+    public void testLoadBytedanceCampaign() {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        for (CtopOauthToken token : tokens) {
             campaignService.getAdvertiserCampaign(token, null, null);
             campaignService.getAdvertiserCampaign(token, null, null);
         }
         }
     }
     }
 
 
+    @Autowired
+    private IEtlBytedanceReportVideoDailyService etlBytedanceReportVideoDailyService;
+
+    @Test
+    public void etlBytedanceVideoReportInfo()throws Exception{
+        etlBytedanceReportVideoDailyService.etlBytedanceVideo();
+    }
+
+    @Autowired
+    private IReportService reportService;
+
+    @Test
+    public void loadBytedanceAccountReport(){
+        /**
+         * 1692555408132110
+         * 1692555631713287
+         * 1696734332089352
+         * 1696734333251598
+         */
+        CtopOauthToken token1 = tokenService.getTokenByAccountId(1692555408132110L);
+        reportService.getAdvertiserReport(token1, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        CtopOauthToken token2 = tokenService.getTokenByAccountId(1692555631713287L);
+        reportService.getAdvertiserReport(token2, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        CtopOauthToken token3 = tokenService.getTokenByAccountId(1696734332089352L);
+        reportService.getAdvertiserReport(token3, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        CtopOauthToken token4 = tokenService.getTokenByAccountId(1696734333251598L);
+        reportService.getAdvertiserReport(token4, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+
+        CtopOauthToken token5 = tokenService.getTokenByAccountId(10129666L);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token5, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        CtopOauthToken token6 = tokenService.getTokenByAccountId(10097961L);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token6, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        CtopOauthToken token7 = tokenService.getTokenByAccountId(10098039L);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token7, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+    }
 }
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -51,7 +51,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     private String imageUploadPath;
     private String imageUploadPath;
     @Value("${jeecg.path.video-upload}")
     @Value("${jeecg.path.video-upload}")
     private String videoUploadPath;
     private String videoUploadPath;
-    @Autowired
+    @Resource
     FileInfoMapper fileInfoMapper;
     FileInfoMapper fileInfoMapper;
     @Resource
     @Resource
     private ICtopOauthTokenService ctopOauthTokenService;
     private ICtopOauthTokenService ctopOauthTokenService;

+ 5 - 5
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -55,13 +55,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private ITencentWatermarkTemplateService tencentWatermarkTemplateService;
     private ITencentWatermarkTemplateService tencentWatermarkTemplateService;
     @Resource
     @Resource
     private IVideoWatermarkTaskService videoWatermarkTaskService;
     private IVideoWatermarkTaskService videoWatermarkTaskService;
-    @Autowired
+    @Resource
     private MaterialInfoMapper materialInfoMapper;
     private MaterialInfoMapper materialInfoMapper;
-    @Autowired
+    @Resource
     private MaterialParameterMapper materialParameterMapper;
     private MaterialParameterMapper materialParameterMapper;
-    @Autowired
+    @Resource
     private MaterialAscriptionMapper materialAscriptionMapper;
     private MaterialAscriptionMapper materialAscriptionMapper;
-    @Autowired
+    @Resource
     private MaterialTagMapper materialTagMapper;
     private MaterialTagMapper materialTagMapper;
     @Resource
     @Resource
     private IMaterialCutFrameService materialCutFrameService;
     private IMaterialCutFrameService materialCutFrameService;
@@ -508,7 +508,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setProjectId(projectId);
             info.setProjectId(projectId);
             info.setWatermarkCode(json.getString("watermarkCode"));
             info.setWatermarkCode(json.getString("watermarkCode"));
             info.setStatus(0);
             info.setStatus(0);
-            info.setMaterialName(json.getString("materialName"));
+            info.setMaterialName(StringUtils.getFileNameNoEx(json.getString("materialName")));
             info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
             info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
             info.setMaterialDescribe(json.getString("materialDescribe"));
             info.setMaterialDescribe(json.getString("materialDescribe"));
             info.setCreateTime(new Date());
             info.setCreateTime(new Date());

+ 794 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/ConverterUtils.java

@@ -0,0 +1,794 @@
+package cn.com.ctop.common.module.utils;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.NumberFormat;
+import java.text.ParseException;
+
+/**
+ * A simple object converter
+ * <br>
+ * 一个简单的数据类型转换工具类
+ */
+public class ConverterUtils {
+
+    public static void main(String[] args) {
+        Long asLong = ConverterUtils.getAsLong("12121.3444");
+        System.err.println(asLong);
+    }
+
+
+    /**
+     * Gets a String from a Object in a null-safe manner.
+     * <p>
+     * The String is obtained via <code>toString</code>.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a String, <code>null</code> if null object input
+     */
+    public static String getAsString(final Object obj) {
+        if (obj != null) {
+            return obj.toString();
+        }
+        return null;
+    }
+
+    /**
+     * Gets a String from a Object in a null-safe manner.
+     * <p>
+     * The String is obtained via <code>toString</code>.
+     *
+     * @param obj          the object to use
+     * @param defaultValue what to return if the value is null or if the conversion fails
+     * @return the value of the Object as a String, <code>defaultValue</code> if null object input
+     */
+    public static String getAsString(final Object obj, final String defaultValue) {
+        String answer = getAsString(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a Number from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Number</code> it is returned directly.
+     * If the value is a <code>String</code> it is converted using
+     * {@link NumberFormat#parse(String)} on the system default formatter
+     * returning <code>null</code> if the conversion fails.
+     * Otherwise, <code>null</code> is returned.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Number, <code>null</code> if null object input
+     */
+    public static Number getAsNumber(final Object obj) {
+        if (obj != null) {
+            if (obj instanceof Number) {
+                return (Number) obj;
+            } else if (obj instanceof Boolean) {
+                return ((Boolean) obj) ? 1 : 0;
+            } else if (obj instanceof String) {
+                try {
+                    return NumberFormat.getInstance().parse((String) obj);
+                } catch (final ParseException e) {
+                    throw new NumberFormatException("For input string: \"" + obj + "\"");
+                }
+            } else {
+                throw new UnsupportedOperationException();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Converting the Object into a number,
+     * using the default value if the the conversion fails.
+     *
+     * @param obj          the object to use
+     * @param defaultValue what to return if the value is null or if the conversion fails
+     * @return the value of the object as a number, or defaultValue if the
+     * original value is null, the object is null or the number conversion
+     * fails
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends Number> R getAsNumber(final Object obj, R defaultValue) {
+        Number answer = getAsNumber(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return (R) answer;
+    }
+
+    /**
+     * Gets a Boolean from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Boolean</code> it is returned directly.
+     * If the value is a <code>String</code> and it equals 'true' ignoring case
+     * then <code>true</code> is returned, otherwise <code>false</code>.
+     * If the value is a <code>Number</code> an integer zero value returns
+     * <code>false</code> and non-zero returns <code>true</code>.
+     * Otherwise, <code>null</code> is returned.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Boolean, <code>null</code> if null object input
+     */
+    public static Boolean getAsBoolean(final Object obj) {
+        if (obj != null) {
+            if (obj instanceof Boolean) {
+                return (Boolean) obj;
+            } else if (obj instanceof String) {
+                return Boolean.valueOf((String) obj);
+            } else if (obj instanceof Number) {
+                final Number n = (Number) obj;
+                return (n.intValue() != 0) ? Boolean.TRUE : Boolean.FALSE;
+            } else {
+                throw new UnsupportedOperationException();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Gets a Boolean from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Boolean</code> it is returned directly.
+     * If the value is a <code>String</code> and it equals 'true' ignoring case
+     * then <code>true</code> is returned, otherwise <code>false</code>.
+     * If the value is a <code>Number</code> an integer zero value returns
+     * <code>false</code> and non-zero returns <code>true</code>.
+     * Otherwise, <code>null</code> is returned.
+     *
+     * @param obj          the object to use
+     * @param defaultValue what to return if the value is null or if the conversion fails
+     * @return the value of the Object as a Boolean, <code>defaultValue</code> if null object input
+     */
+    public static Boolean getAsBoolean(final Object obj, final Boolean defaultValue) {
+        Boolean answer = getAsBoolean(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a boolean from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Boolean</code> its value is returned.
+     * If the value is a <code>String</code> and it equals 'true' ignoring case
+     * then <code>true</code> is returned, otherwise <code>false</code>.
+     * If the value is a <code>Number</code> an integer zero value returns
+     * <code>false</code> and non-zero returns <code>true</code>.
+     * Otherwise, <code>false</code> is returned.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Boolean, <code>false</code> if null object input
+     */
+    public static boolean getAsBooleanValue(final Object obj) {
+        final Boolean booleanObject = getAsBoolean(obj);
+        if (booleanObject == null) {
+            return false;
+        }
+        return booleanObject.booleanValue();
+    }
+
+    /**
+     * Gets a boolean from a Object in a null-safe manner.
+     * <p>
+     * If the value is a <code>Boolean</code> its value is returned.
+     * If the value is a <code>String</code> and it equals 'true' ignoring case
+     * then <code>true</code> is returned, otherwise <code>false</code>.
+     * If the value is a <code>Number</code> an integer zero value returns
+     * <code>false</code> and non-zero returns <code>true</code>.
+     * Otherwise, <code>false</code> is returned.
+     *
+     * @param obj          the object to use
+     * @param defaultValue what to return if the value is null or if the conversion fails
+     * @return the value in the Map as a Boolean, <code>defaultValue</code> if null object input
+     */
+    public static boolean getAsBooleanValue(final Object obj, final boolean defaultValue) {
+        final Boolean booleanObject = getAsBoolean(obj);
+        if (booleanObject == null) {
+            return defaultValue;
+        }
+        return booleanObject.booleanValue();
+    }
+
+    /**
+     * Gets a Byte from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Byte is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a Byte, <code>null</code> if null object input
+     */
+    public static Byte getAsByte(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (answer == null) {
+            return null;
+        } else if (answer instanceof Byte) {
+            return (Byte) answer;
+        }
+        return Byte.valueOf(answer.byteValue());
+    }
+
+    /**
+     * Gets a Byte from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Byte is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Byte, <code>defaultValue</code> if null object input
+     */
+    public static Byte getAsByte(final Object obj, final Byte defaultValue) {
+        Byte answer = getAsByte(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a byte from a Object in a null-safe manner.
+     * <p>
+     * The byte is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a byte, <code>0</code> if null object input
+     */
+    public static byte getAsByteValue(final Object obj) {
+        final Byte byteObject = getAsByte(obj);
+        if (byteObject == null) {
+            return 0;
+        }
+        return byteObject.byteValue();
+    }
+
+    /**
+     * Gets a byte from a Object in a null-safe manner.
+     * <p>
+     * The byte is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of the Object as a byte, <code>defaultValue</code> if null object input
+     */
+    public static byte getAsByteValue(final Object obj, final byte defaultValue) {
+        final Byte byteObject = getAsByte(obj);
+        if (byteObject == null) {
+            return defaultValue;
+        }
+        return byteObject.byteValue();
+    }
+
+    /**
+     * Gets a Short from a Object in a null-safe manner.
+     * <p>
+     * The Short is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Short, <code>null</code> if null object input
+     */
+    public static Short getAsShort(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (answer == null) {
+            return null;
+        } else if (answer instanceof Short) {
+            return (Short) answer;
+        }
+        return Short.valueOf(answer.shortValue());
+    }
+
+    /**
+     * Gets a Short from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Short is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Short, <code>defaultValue</code> if null object input
+     */
+    public static Short getAsShort(final Object obj, final Short defaultValue) {
+        Short answer = getAsShort(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a short from a Object in a null-safe manner.
+     * <p>
+     * The short is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a short, <code>0</code> if null object input
+     */
+    public static short getAsShortValue(final Object obj) {
+        final Short shortObject = getAsShort(obj);
+        if (shortObject == null) {
+            return 0;
+        }
+        return shortObject.shortValue();
+    }
+
+    /**
+     * Gets a short from a Object in a null-safe manner.
+     * <p>
+     * The short is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of the Object as a short, <code>defaultValue</code> if null object input
+     */
+    public static short getAsShortValue(final Object obj, final short defaultValue) {
+        final Short shortObject = getAsShort(obj);
+        if (shortObject == null) {
+            return defaultValue;
+        }
+        return shortObject.shortValue();
+    }
+
+    /**
+     * Gets a Integer from a Object in a null-safe manner.
+     * <p>
+     * The Integer is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Integer, <code>null</code> if null object input
+     */
+    public static Integer getAsInteger(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (Check.isNull(answer)) {
+            return null;
+        } else if (answer instanceof Integer) {
+            return (Integer) answer;
+        }
+        return Integer.valueOf(answer.intValue());
+    }
+
+    /**
+     * Gets a Integer from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Integer is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Integer, <code>defaultValue</code> if null object input
+     */
+    public static Integer getAsInteger(final Object obj, final Integer defaultValue) {
+        Integer answer = getAsInteger(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a int from a Object in a null-safe manner.
+     * <p>
+     * The int is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a int, <code>0</code> if null object input
+     */
+    public static int getAsIntValue(final Object obj) {
+        final Integer integerObject = getAsInteger(obj);
+        if (integerObject == null) {
+            return 0;
+        }
+        return integerObject.intValue();
+    }
+
+    /**
+     * Gets a int from a Object in a null-safe manner.
+     * <p>
+     * The int is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of the Object as a int, <code>defaultValue</code> if null object input
+     */
+    public static int getAsIntValue(final Object obj, final int defaultValue) {
+        final Integer integerObject = getAsInteger(obj);
+        if (integerObject == null) {
+            return defaultValue;
+        }
+        return integerObject.intValue();
+    }
+
+    /**
+     * Gets a Long from a Object in a null-safe manner.
+     * <p>
+     * The Long is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Long, <code>null</code> if null object input
+     */
+    public static Long getAsLong(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (Check.isNull(answer)) {
+            return null;
+        } else if (answer instanceof Long) {
+            return (Long) answer;
+        }
+        return Long.valueOf(answer.longValue());
+    }
+
+    /**
+     * Gets a Long from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Long is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Long, <code>defaultValue</code> if null object input
+     */
+    public static Long getAsLong(final Object obj, final Long defaultValue) {
+        Long answer = getAsLong(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a long from a Object in a null-safe manner.
+     * <p>
+     * The long is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a long, <code>0L</code> if null object input
+     */
+    public static long getAsLongValue(final Object obj) {
+        final Long longObject = getAsLong(obj);
+        if (longObject == null) {
+            return 0L;
+        }
+        return longObject.longValue();
+    }
+
+    /**
+     * Gets a long from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The long is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a long, <code>defaultValue</code> if null object input
+     */
+    public static long getAsLongValue(final Object obj, final long defaultValue) {
+        final Long longObject = getAsLong(obj);
+        if (longObject == null) {
+            return defaultValue;
+        }
+        return longObject.longValue();
+    }
+
+    /**
+     * Gets a Float from a Object in a null-safe manner.
+     * <p>
+     * The Float is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Float, <code>null</code> if null object input
+     */
+    public static Float getAsFloat(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (answer == null) {
+            return null;
+        } else if (answer instanceof Float) {
+            return (Float) answer;
+        }
+        return Float.valueOf(answer.floatValue());
+    }
+
+    /**
+     * Gets a Float from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Float is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Float, <code>defaultValue</code> if null object input
+     */
+    public static Float getAsFloat(final Object obj, final Float defaultValue) {
+        Float answer = getAsFloat(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a float from a Object in a null-safe manner.
+     * <p>
+     * The float is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a float, <code>0.0F</code> if null object input
+     */
+    public static float getAsFloatValue(final Object obj) {
+        final Float floatObject = getAsFloat(obj);
+        if (floatObject == null) {
+            return 0f;
+        }
+        return floatObject.floatValue();
+    }
+
+    /**
+     * Gets a float from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The float is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a float, <code>defaultValue</code> if null object input
+     */
+    public static float getAsFloatValue(final Object obj, final float defaultValue) {
+        final Float floatObject = getAsFloat(obj);
+        if (floatObject == null) {
+            return defaultValue;
+        }
+        return floatObject.floatValue();
+    }
+
+    /**
+     * Gets a Double from a Object in a null-safe manner.
+     * <p>
+     * The Double is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of the Object as a Double, <code>null</code> if null object input
+     */
+    public static Double getAsDouble(final Object obj) {
+        final Number answer = getAsNumber(obj);
+        if (Check.isNull(answer)) {
+            return null;
+        } else if (answer instanceof Double) {
+            return (Double) answer;
+        }
+        return Double.valueOf(answer.doubleValue());
+    }
+
+    /**
+     * Gets a Double from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The Double is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a Double, <code>defaultValue</code> if null object input
+     */
+    public static Double getAsDouble(final Object obj, final Double defaultValue) {
+        Double answer = getAsDouble(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return answer;
+    }
+
+    /**
+     * Gets a double from a Object in a null-safe manner.
+     * <p>
+     * The double is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a double, <code>0.0</code> if null object input
+     */
+    public static double getAsDoubleValue(final Object obj) {
+        final Double doubleObject = getAsDouble(obj);
+        if (doubleObject == null) {
+            return 0d;
+        }
+        return doubleObject.doubleValue();
+    }
+
+    /**
+     * Gets a double from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The double is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a double, <code>defaultValue</code> if null object input
+     */
+    public static double getAsDoubleValue(final Object obj, final double defaultValue) {
+        final Double doubleObject = getAsDouble(obj);
+        if (doubleObject == null) {
+            return defaultValue;
+        }
+        return doubleObject.doubleValue();
+    }
+
+    /**
+     * Gets a BigInteger from a Object in a null-safe manner.
+     * <p>
+     * The BigInteger is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a BigInteger, <code>0</code> if null object input
+     */
+    public static BigInteger getAsBigInteger(final Object obj) {
+        if (obj != null) {
+            if (obj instanceof BigInteger) {
+                return (BigInteger) obj;
+            } else if (obj instanceof String) {
+                return new BigInteger((String) obj);
+            } else if (obj instanceof Number || obj instanceof Boolean) {
+                final Number answer = getAsNumber(obj);
+                if (answer != null) {
+                    return BigInteger.valueOf(answer.longValue());
+                }
+            } else {
+                throw new UnsupportedOperationException();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Gets a BigInteger from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The BigInteger is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a BigInteger, <code>defaultValue</code> if null object input
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends BigInteger> R getAsBigInteger(final Object obj, final R defaultValue) {
+        BigInteger answer = getAsBigInteger(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return (R) answer;
+    }
+
+    /**
+     * Gets a BigDecimal from a Object in a null-safe manner.
+     * <p>
+     * The BigDecimal is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj the object to use
+     * @return the value of Object as a BigDecimal, <code>0</code> if null object input
+     */
+    public static BigDecimal getAsBigDecimal(final Object obj) {
+        if (!Check.isNull(obj)) {
+            if (obj instanceof BigDecimal) {
+                return (BigDecimal) obj;
+            } else if (obj instanceof String) {
+                return new BigDecimal((String) obj);
+            } else if (obj instanceof Number || obj instanceof Boolean) {
+                final Number answer = getAsNumber(obj);
+                if (answer != null) {
+                    return BigDecimal.valueOf(answer.doubleValue());
+                }
+            } else {
+                throw new UnsupportedOperationException();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Gets a BigDecimal from a Object in a null-safe manner,
+     * using the default value if the the conversion fails.
+     * <p>
+     * The BigDecimal is obtained from the results of {@link #getAsNumber(Object)}.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return the value of Object as a BigDecimal, <code>defaultValue</code> if null object input
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends BigDecimal> R getAsBigDecimal(final Object obj, final R defaultValue) {
+        BigDecimal answer = getAsBigDecimal(obj);
+        if (answer == null) {
+            answer = defaultValue;
+        }
+        return (R) answer;
+    }
+
+    /**
+     * This method is mainly used to provide data type conversion services.
+     *
+     * @param obj the object to use
+     * @param clz the type for conversion
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <R> R cast(final Object obj, final Class<R> clz) {
+        if (obj == null) {
+            throw new IllegalArgumentException("'obj' must not be null");
+        }
+        if (clz == null) {
+            throw new IllegalArgumentException("'clz' must not be null");
+        }
+        R result = null;
+        if (Boolean.class.equals(clz) || boolean.class.equals(clz)) {
+            result = (R) getAsBoolean(obj);
+        } else if (Byte.class.equals(clz) || byte.class.equals(clz)) {
+            result = (R) getAsByte(obj);
+        } else if (Short.class.equals(clz) || short.class.equals(clz)) {
+            result = (R) getAsShort(obj);
+        } else if (Integer.class.equals(clz) || int.class.equals(clz)) {
+            result = (R) getAsInteger(obj);
+        } else if (Long.class.equals(clz) || long.class.equals(clz)) {
+            result = (R) getAsLong(obj);
+        } else if (Float.class.equals(clz) || float.class.equals(clz)) {
+            result = (R) getAsFloat(obj);
+        } else if (Double.class.equals(clz) || double.class.equals(clz)) {
+            result = (R) getAsDouble(obj);
+        } else if (String.class.equals(clz)) {
+            result = (R) getAsString(obj);
+        } else if (BigInteger.class.isAssignableFrom(clz)) {
+            result = (R) getAsBigInteger(obj);
+        } else if (BigDecimal.class.isAssignableFrom(clz)) {
+            result = (R) getAsBigDecimal(obj);
+        } else if (Number.class.isAssignableFrom(clz)) {
+            result = (R) getAsNumber(obj);
+        } else {
+            throw new UnsupportedOperationException();
+        }
+        return result;
+    }
+
+    /**
+     * This method is mainly used to provide data type conversion services.
+     *
+     * @param obj          the object to use
+     * @param defaultValue return if the value is null or if the conversion fails
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <R> R cast(final Object obj, final R defaultValue) {
+        if (obj == null) {
+            throw new IllegalArgumentException("'obj' must not be null");
+        }
+        if (defaultValue == null) {
+            throw new IllegalArgumentException("'defaultValue' must not be null");
+        }
+        R result = null;
+        final Class<?> clz = defaultValue.getClass();
+        if (Boolean.class.equals(clz) || boolean.class.equals(clz)) {
+            result = (R) getAsBoolean(obj, (Boolean) defaultValue);
+        } else if (Byte.class.equals(clz) || byte.class.equals(clz)) {
+            result = (R) getAsByte(obj, (Byte) defaultValue);
+        } else if (Short.class.equals(clz) || short.class.equals(clz)) {
+            result = (R) getAsShort(obj, (Short) defaultValue);
+        } else if (Integer.class.equals(clz) || int.class.equals(clz)) {
+            result = (R) getAsInteger(obj, (Integer) defaultValue);
+        } else if (Long.class.equals(clz) || long.class.equals(clz)) {
+            result = (R) getAsLong(obj, (Long) defaultValue);
+        } else if (Float.class.equals(clz) || float.class.equals(clz)) {
+            result = (R) getAsFloat(obj, (Float) defaultValue);
+        } else if (Double.class.equals(clz) || double.class.equals(clz)) {
+            result = (R) getAsDouble(obj, (Double) defaultValue);
+        } else if (String.class.equals(clz)) {
+            result = (R) getAsString(obj, (String) defaultValue);
+        } else if (BigInteger.class.isAssignableFrom(clz)) {
+            result = (R) getAsBigInteger(obj, (BigInteger) defaultValue);
+        } else if (BigDecimal.class.isAssignableFrom(clz)) {
+            result = (R) getAsBigDecimal(obj, (BigDecimal) defaultValue);
+        } else if (Number.class.isAssignableFrom(clz)) {
+            result = (R) getAsNumber(obj, (Number) defaultValue);
+        } else {
+            throw new UnsupportedOperationException();
+        }
+        return result;
+    }
+
+}

+ 8 - 4
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -104,6 +104,10 @@ public class KuaishouInterfaceConstant {
      * 创建广告获取应用列表(新版本)
      * 创建广告获取应用列表(新版本)
      */
      */
     public static final String APP_LIST_v2 = "/rest/openapi/v2/file/ad/app/list";
     public static final String APP_LIST_v2 = "/rest/openapi/v2/file/ad/app/list";
+    /**
+     * 获取app名称
+     */
+    public static final String APP_NAME = "/rest/openapi/v1/tool/keyword/query";
 
 
     /**
     /**
      * 账户日预算查询
      * 账户日预算查询
@@ -322,19 +326,19 @@ public class KuaishouInterfaceConstant {
      * 频库-视频关联创意数查询
      * 频库-视频关联创意数查询
      */
      */
     public static final String VIDEO_RELATE_CREATIVES = "/rest/openapi/v1/file/ad/video/relate/creatives";
     public static final String VIDEO_RELATE_CREATIVES = "/rest/openapi/v1/file/ad/video/relate/creatives";
-/**
+    /**
      * 查询加速探索信息接口
      * 查询加速探索信息接口
      */
      */
     public static final String UNIT_EXPLORE_INFO_GET = "/rest/openapi/v1/ad_unit/explore/info/get";
     public static final String UNIT_EXPLORE_INFO_GET = "/rest/openapi/v1/ad_unit/explore/info/get";
-/**
+    /**
      * 广告组的加速探索预算设置
      * 广告组的加速探索预算设置
      */
      */
     public static final String UNIT_EXPLORE_BUDGET_UPDATE = "/rest/openapi/v1/ad_unit/explore/budget/update";
     public static final String UNIT_EXPLORE_BUDGET_UPDATE = "/rest/openapi/v1/ad_unit/explore/budget/update";
-/**
+    /**
      * 暂停广告组的加速探索预算
      * 暂停广告组的加速探索预算
      */
      */
     public static final String UNIT_EXPLORE_STATUS_PAUSE = "/rest/openapi/v1/ad_unit/explore/status/pause";
     public static final String UNIT_EXPLORE_STATUS_PAUSE = "/rest/openapi/v1/ad_unit/explore/status/pause";
-/**
+    /**
      * 查询广告组的加速探索报表接口
      * 查询广告组的加速探索报表接口
      */
      */
     public static final String QUERY_SPEED_EXPLORE_REPORT = "/rest/openapi/v1/report/speed_explore";
     public static final String QUERY_SPEED_EXPLORE_REPORT = "/rest/openapi/v1/report/speed_explore";

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java

@@ -21,6 +21,16 @@ public class StringUtils {
         return list;
         return list;
     }
     }
 
 
+    public static String getFileNameNoEx(String filename) {
+        if ((filename != null) && (filename.length() > 0)) {
+            int dot = filename.lastIndexOf('.');
+            if ((dot >-1) && (dot < (filename.length()))) {
+                return filename.substring(0, dot);
+            }
+        }
+        return filename;
+    }
+
     /**
     /**
      * 将下划线风格转换为驼峰风格
      * 将下划线风格转换为驼峰风格
      * @param inputString
      * @param inputString

+ 18 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class BytedanceAiCreateJob {
+    private static final String URLPREFIX = "http://118.24.244.213:8080/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/autoCreateCreative?hour=";
+    @XxlJob("bytedanceAutoCreateJob")
+    public void execute() throws Exception {
+        String hour = DateUtils.getNowHour(new Date());
+        HttpUtils.httpGet(URLPREFIX + hour, null, null);
+    }
+}

+ 16 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceEtlVideoJob.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.job.bytedance.handler;
 package cn.com.ctop.job.bytedance.handler;
 
 
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoEtlInfoService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoEtlInfoService;
+import cn.com.ctop.toutiao.modules.report.service.IEtlBytedanceReportVideoDailyService;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,10 @@ public class BytedanceEtlVideoJob {
 
 
     @Autowired
     @Autowired
     private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
     private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
+
+    @Autowired
+    private IEtlBytedanceReportVideoDailyService etlBytedanceReportVideoDailyService;
+
     @XxlJob("bytedanceEtlVideoJob")
     @XxlJob("bytedanceEtlVideoJob")
     public void execute() throws Exception {
     public void execute() throws Exception {
         Date startDate = DateUtils.addDay(new Date(),-2);
         Date startDate = DateUtils.addDay(new Date(),-2);
@@ -30,4 +35,15 @@ public class BytedanceEtlVideoJob {
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfoByProjectId(getDate);
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfoByProjectId(getDate);
         }
         }
     }
     }
+
+
+    @XxlJob("updBytedanceVideoJob")
+    public void updBytedanceVideoJob() throws Exception {
+        etlBytedanceReportVideoDailyService.updBytedanceVideo();
+    }
+
+    @XxlJob("etlBytedanceVideoJob")
+    public void etlBytedanceVideoJob() throws Exception {
+        etlBytedanceReportVideoDailyService.etlBytedanceVideo();
+    }
 }
 }

+ 7 - 0
module-job-kuaishou/pom.xml

@@ -210,6 +210,13 @@
             </properties>
             </properties>
         </profile>
         </profile>
         <profile>
         <profile>
+            <id>preprod</id>
+            <properties>
+                <activatedProperties>preprod</activatedProperties>
+            </properties>
+        </profile>
+
+        <profile>
             <id>jiaoyang</id>
             <id>jiaoyang</id>
             <properties>
             <properties>
                 <activatedProperties>jiaoyang</activatedProperties>
                 <activatedProperties>jiaoyang</activatedProperties>

+ 9 - 4
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiCreativeJob.java

@@ -9,6 +9,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.text.ParseException;
 import java.text.ParseException;
@@ -23,6 +24,10 @@ import java.util.Map;
 @Component
 @Component
 @Slf4j
 @Slf4j
 public class KuaishouAiCreativeJob {
 public class KuaishouAiCreativeJob {
+
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
+
     @Autowired
     @Autowired
     private IAiKuaishouAdvertiserStrategyService strategyService;
     private IAiKuaishouAdvertiserStrategyService strategyService;
 
 
@@ -35,7 +40,7 @@ public class KuaishouAiCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
         if (null == strategies || strategies.isEmpty()) {
             return;
             return;
         }
         }
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/ai/create/customCreativeLimit";
+        String url = jobUrl + "/jeecg-boot/ai/create/customCreativeLimit";
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 1) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 1) {
                 Map<String, Object> requestMap = new HashMap<>();
                 Map<String, Object> requestMap = new HashMap<>();
@@ -68,7 +73,7 @@ public class KuaishouAiCreativeJob {
             return;
             return;
         }
         }
         try {
         try {
-            String url = "http://api.tjyourong.com.cn/jeecg-boot/ai/create/kuaishouCustomCreativeSupplement";
+            String url = jobUrl + "/jeecg-boot/ai/create/kuaishouCustomCreativeSupplement";
             int hour = DateUtils.getNowHour();
             int hour = DateUtils.getNowHour();
             for (AiKuaishouAdvertiserStrategy strategy : strategies) {
             for (AiKuaishouAdvertiserStrategy strategy : strategies) {
                 if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 1) {
                 if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 1) {
@@ -105,7 +110,7 @@ public class KuaishouAiCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
         if (null == strategies || strategies.isEmpty()) {
             return;
             return;
         }
         }
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/ai/create/kuaishouProgramCreativeAuto";
+        String url = jobUrl + "/jeecg-boot/ai/create/kuaishouProgramCreativeAuto";
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 0) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 0) {
                 long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
                 long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
@@ -141,7 +146,7 @@ public class KuaishouAiCreativeJob {
         if (null == strategies || strategies.isEmpty()) {
         if (null == strategies || strategies.isEmpty()) {
             return;
             return;
         }
         }
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/ai/create/autoCreateProgramHistoryTopCreative";
+        String url = jobUrl + "/jeecg-boot/ai/create/autoCreateProgramHistoryTopCreative";
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
         for (AiKuaishouAdvertiserStrategy strategy : strategies) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 0) {
             if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 0) {
                 long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
                 long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;

+ 6 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java

@@ -6,6 +6,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
@@ -18,16 +19,19 @@ public class KuaishouCreateUnitJob {
 
 
     @Autowired
     @Autowired
     private IKuaiShouGroupTemplateService groupTemplateService;
     private IKuaiShouGroupTemplateService groupTemplateService;
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
 
 
     @XxlJob("kuaihouCreateUnit")
     @XxlJob("kuaihouCreateUnit")
     public void execute() {
     public void execute() {
-
+        String url = jobUrl + "/jeecg-boot/batch/kuaiShouGroupTemplate/createUnit";
+        System.err.println("请求地址:" + url);
         List<Long> idList = groupTemplateService.getIdList();
         List<Long> idList = groupTemplateService.getIdList();
         if (Check.isNull(idList)) {
         if (Check.isNull(idList)) {
             XxlJobHelper.log("批量2.0暂时没有未创建的组");
             XxlJobHelper.log("批量2.0暂时没有未创建的组");
             return;
             return;
         }
         }
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/batch/kuaiShouGroupTemplate/createUnit";
+    //    String url = jobUrl + "/jeecg-boot/batch/kuaiShouGroupTemplate/createUnit";
         for (int i = 0; i < idList.size(); i++) {
         for (int i = 0; i < idList.size(); i++) {
             Long id = idList.get(i);
             Long id = idList.get(i);
             Map<String, Object> requestMap = new HashMap<>();
             Map<String, Object> requestMap = new HashMap<>();

+ 10 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java

@@ -2,6 +2,7 @@ package cn.com.ctop.job.kuaishou.handler;
 
 
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
 import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
@@ -17,9 +18,10 @@ public class KuaishouEtlVideoJob {
     @Autowired
     @Autowired
     private IKuaiShouVideoGetService videoGetService;
     private IKuaiShouVideoGetService videoGetService;
     @Autowired
     @Autowired
+    private IEtlKuaishouAccountMaterialReportDailyService materialReportDailyService;
+    @Autowired
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
 
 
-
     @XxlJob("kuaishouEtlVideoJob")
     @XxlJob("kuaishouEtlVideoJob")
     public void execute() throws Exception {
     public void execute() throws Exception {
         Date startDate = DateUtils.addDay(new Date(), -2);
         Date startDate = DateUtils.addDay(new Date(), -2);
@@ -51,5 +53,11 @@ public class KuaishouEtlVideoJob {
             videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
             videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
         }
         }
     }
     }
-
+    @XxlJob("etlKuaishouAccountMaterialReportInfo")
+    public void etlKuaishouAccountMaterialReportInfo(){
+        Date startDate = new Date();
+        for(int i=1;i<=2;i++){
+            materialReportDailyService.etlKuaishouAccountMaterialReportInfo(DateUtils.formatDate(DateUtils.addDay(new Date(),-i)));
+        }
+    }
 }
 }

+ 5 - 0
module-job-kuaishou/src/main/resources/application-dev.yml

@@ -183,6 +183,7 @@ bytedance:
     ad-report-get: /2/report/ad/get/
     ad-report-get: /2/report/ad/get/
     ad-creative-get: /2/report/creative/get/
     ad-creative-get: /2/report/creative/get/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+
 xxl:
 xxl:
   job:
   job:
     accessToken:
     accessToken:
@@ -194,4 +195,8 @@ xxl:
       logretentiondays: 30
       logretentiondays: 30
     admin:
     admin:
       addresses: 127.0.0.1:8090/xxl-job-admin/
       addresses: 127.0.0.1:8090/xxl-job-admin/
+xxl-job:
+  requestUrl: http://localhost:8080
+
+
 
 

+ 5 - 1
module-job-kuaishou/src/main/resources/application-jiaoyang.yml

@@ -234,4 +234,8 @@ ai:
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
 zip:
 zip:
   local:
   local:
-    download-path: /data/unzip/
+    download-path: /data/unzip/
+xxl-job:
+    requestUrl: http://jiaoyangapi.shyouteng.com.cn
+
+

+ 239 - 0
module-job-kuaishou/src/main/resources/application-preprod.yml

@@ -0,0 +1,239 @@
+management:
+  endpoints:
+    web:
+      exposure:
+        include: metrics,httptrace
+spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
+  mail:
+    host: smtp.163.com
+    username: jeecgos@163.com
+    password: ??
+    properties:
+      mail:
+        smtp:
+          auth: true
+          starttls:
+            enable: true
+            required: true
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    username: hcst
+    password: hcst@2020
+    driver-class-name: com.mysql.jdbc.Driver
+    druid:
+      stat-view-servlet:
+        loginUsername: admin
+        loginPassword: hcst2016
+        enabled: true
+      web-stat-filter:
+        enabled: true
+    #      remove-abandoned: false
+    dynamic:
+      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        connection-init-sql: set names utf8mb4
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: hcst@2020
+          driver-class-name: com.mysql.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    host: 172.30.0.17
+#    host: 127.0.0.1
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+    password: foobared
+    port: 6379
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: 4
+      # 默认数据库表下划线命名
+      table-underline: true
+#jeecg专用配置
+jeecg:
+  elasticsearch:
+    cluster-nodes:
+    check-enabled: false
+  uploadType:
+  oss:
+    endpoint:
+    accessKey:
+    secretKey:
+    bucketName:
+    staticDomain:
+  sms:
+    accessKeyId:
+    accessKeySecret:
+  minio:
+    minio_url:
+    minio_name:
+    minio_pass:
+    bucketName:
+  ffmpeg:
+    bin: ffmpeg
+  path:
+    #文件上传根目录 设置
+    upload: /data/upload
+    #webapp文件路径
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/upload/image/
+    chrome-driver: /usr/bin/chromedriver
+    csv-upload: /data/upload/csv/
+    bak-database-file: /data/data/bak/
+    report-history: /data/upload/report/history/
+    report-daily: /data/upload/report/daily/
+    kuaishou-agent-image: /data/upload/image/temp.png
+    kuaishou-account-captcha-image: /data/upload/image/captcha.png
+kuaishou:
+  api-url: https://ad.e.kuaishou.com
+  auth-url: https://ad.e.kuaishou.com
+  appid: 27
+  third-appid: 328
+  oauth-type: agent
+  secret: QovprB1tNhXptgDc
+  third-secret: 1iFTBiMdohkyEQQs
+  callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
+  third-callback-url: http://callback.shyouteng.com.cn/kuaishou
+  apk-sava-path: /mnt/file/apk
+  image-sava-path: /mnt/file/image
+  video-sava-path: /mnt/file/video
+  model-video-src-path: /mnt/data/src/
+  model-video-fill-path: /mnt/data/fill/
+  model-video-final-path: /mnt/data/final/
+  group-control:
+    path: http://39.106.184.70
+    port: 4723
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml
+chrome:
+  script:
+    clean: sh /data/webapp/cleanProcess.sh
+oss:
+  replace:
+    replace-value: oss-cn-beijing-internal
+    replace-old-value: oss-cn-beijing
+    download: /data/file/video/
+bytedance:
+  appId: 1635316529903624
+  secret: 0c51523e90d6166418fc8421a4896808e90e26f4
+  url:
+    auth-prefix: https://ad.oceanengine.com/openapi
+    api-prefix: https://ad.oceanengine.com/open_api
+    callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
+    refresh-token: /oauth2/refresh_token
+    advertiser-info: /2/advertiser/public_info/
+    ad-get: /2/ad/get/
+    ad-create: /2/ad/create/
+    ad-update: /2/ad/update/
+    ad-update-status: /2/ad/update/status/
+    ad-update-bid: /2/ad/update/bid/
+    ad-update-budget: /2/ad/update/budget/
+    ad-update-reject-reason: 2/ad/reject_reason/
+    campaign-get: /2/campaign/get/
+    campaign-create: /2/campaign/create/
+    campaign-update-status: /2/campaign/update/status/
+    campaign-update: /2/campaign/update/
+    dmp-custom-audience-select: /2/dmp/custom_audience/select/
+    file-video-ad: /2/file/video/ad/
+    file-image-ad: /2/file/image/ad/
+    creative-update-status: /2/creative/update/status/
+    creative-material-get: /2/creative/material/read/
+    creative-create-v2: /2/creative/create_v2/
+    creative-get: /2/creative/get/
+    creative-read: /2/creative/read_v2/
+    creative-update: /2/creative/update_v2/
+    creative-reject-reason: /2/creative/reject_reason/
+    advertiser-report-get: /2/report/advertiser/get/
+    campaign-report-get: /2/report/campaign/get/
+    ad-report-get: /2/report/ad/get/
+    ad-creative-get: /2/report/creative/get/
+    advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+xxl:
+  job:
+    accessToken:
+    executor:
+      appname: module-job-kuaishou
+      port: 9998
+      ip:
+      logpath: /data/applogs/xxl-job/jobhandler
+      logretentiondays: 30
+    admin:
+      addresses: http://139.186.29.76:8090/xxl-job-admin
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+zip:
+  local:
+    download-path: /data/unzip/
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 3 - 1
module-job-kuaishou/src/main/resources/application-prod.yml

@@ -234,4 +234,6 @@ ai:
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
 zip:
 zip:
   local:
   local:
-    download-path: /data/unzip/
+    download-path: /data/unzip/
+xxl-job:
+  requestUrl: http://api.tjyourong.com.cn

+ 4 - 0
module-job-kuaishou/src/main/resources/application-test.yml

@@ -212,3 +212,7 @@ xxl:
       logretentiondays: 30
       logretentiondays: 30
     admin:
     admin:
       addresses: http://127.0.0.1:8090/xxl-job-admin
       addresses: http://127.0.0.1:8090/xxl-job-admin
+xxl-job:
+  requestUrl:
+
+

+ 18 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java

@@ -82,13 +82,17 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(hour)) {
             if (Check.isNull(hour)) {
                 throw new Exception("小时数据为空");
                 throw new Exception("小时数据为空");
             }
             }
-            kuaishouCustomCreativeSupplementExecutorService.submit(() -> {
-                try {
-                    createCreativeService.customCreativeSupplement(strategy, hour);
-                } catch (ParseException e) {
-                    e.printStackTrace();
-                }
-            });
+            if (strategy.getHistoryTop() == 0) {
+                kuaishouCustomCreativeSupplementExecutorService.submit(() -> {
+                    try {
+                        createCreativeService.customCreativeSupplement(strategy, hour);
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                });
+            } else {
+                log.info("高质量暂停搭建,accountId:{}", strategy.getAccountId());
+            }
             returnJson.put("code", 0);
             returnJson.put("code", 0);
             returnJson.put("message", "异步创建中");
             returnJson.put("message", "异步创建中");
         } catch (Exception e) {
         } catch (Exception e) {
@@ -155,9 +159,13 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(videoCnt)) {
             if (Check.isNull(videoCnt)) {
                 throw new Exception("视频数量不能为空");
                 throw new Exception("视频数量不能为空");
             }
             }
-            kuaishouProgramTopCreativeAutoService.submit(() -> {
-                createCreativeService.autoCreateProgramCreative(strategy, 2, videoCnt);
-            });
+            if (strategy.getHistoryTop() == 0) {
+                kuaishouProgramTopCreativeAutoService.submit(() -> {
+                    createCreativeService.autoCreateProgramCreative(strategy, 2, videoCnt);
+                });
+            } else {
+                log.info("历史高质量暂停搭建,accountId:{}", strategy.getAccountId());
+            }
             returnJson.put("code", 0);
             returnJson.put("code", 0);
             returnJson.put("message", "异步创建中");
             returnJson.put("message", "异步创建中");
         } catch (Exception e) {
         } catch (Exception e) {

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java

@@ -375,6 +375,7 @@ public class AiKuaishouAdvertiserStrategy {
     private Long customUnitCnt;
     private Long customUnitCnt;
     private Long programUnitCnt;
     private Long programUnitCnt;
     private String materialKeyword;
     private String materialKeyword;
+    private Integer historyTop;
 
 
     @TableField(exist = false)
     @TableField(exist = false)
     private String authName;
     private String authName;

+ 123 - 87
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -126,8 +127,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         }
                         }
                         unitCnt++;
                         unitCnt++;
                         //开始创建组+创意
                         //开始创建组+创意
-                        String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, unitCnt, videoItem.getPhotoName());
+                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, videoItem.getPhotoName(), "unit", newCampaignId);
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Integer unitCode = (Integer) unitCreateResult.get("code");
                         Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -184,8 +184,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     continue;
                     continue;
                 }
                 }
                 unitCnt++;
                 unitCnt++;
-                String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, unitCnt, videoItem.getPhotoName());
+                String unitName = getName(strategy.getGroupName(), strategy, createType, null, videoItem.getPhotoName(), "unit", newCampaignId);
 
 
                 Long appId = null;
                 Long appId = null;
                 if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
                 if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
@@ -199,6 +198,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                 AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                 BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                 BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                 unitLevelOperationRecord.setGroupName(unitName);
                 unitLevelOperationRecord.setGroupName(unitName);
+                if (!Check.isNull(strategy.getCpaBid())) {
+                    unitLevelOperationRecord.setCpaBid(Integer.valueOf(strategy.getCpaBid() + ""));
+                }
+                if (!Check.isNull(strategy.getBid())) {
+                    unitLevelOperationRecord.setBid(Integer.valueOf(strategy.getBid() + ""));
+                }
                 unitLevelOperationRecord.setCreateTime(new Date());
                 unitLevelOperationRecord.setCreateTime(new Date());
                 unitLevelOperationRecord.setStatus(unitCode);
                 unitLevelOperationRecord.setStatus(unitCode);
                 unitLevelOperationRecord.setMessage(unitMessage);
                 unitLevelOperationRecord.setMessage(unitMessage);
@@ -294,8 +299,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
                     List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
                     for (int j = 1; j < splitVideos.size() + 1; j++) {
                     for (int j = 1; j < splitVideos.size() + 1; j++) {
                         //创建组
                         //创建组
-                        String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, null, null);
+                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, null, "unit", newCampaignId);
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Integer unitCode = (Integer) unitCreateResult.get("code");
                         Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -337,8 +341,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
             List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
             for (int j = 1; j < splitVideos.size() + 1; j++) {
             for (int j = 1; j < splitVideos.size() + 1; j++) {
                 //创建组
                 //创建组
-                String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, null, null);
+                String unitName = getName(strategy.getGroupName(), strategy, createType, null, null, "unit", newCampaignId);
                 String appIdString = strategy.getAppIdArray();
                 String appIdString = strategy.getAppIdArray();
                 Long appId = null;
                 Long appId = null;
                 if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
                 if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
@@ -374,7 +377,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
 
     @Override
     @Override
     public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException {
     public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException {
-
         Long customUnitCnt = strategy.getCustomUnitCnt();
         Long customUnitCnt = strategy.getCustomUnitCnt();
         if (Check.isNull(customUnitCnt)) {
         if (Check.isNull(customUnitCnt)) {
             Integer imageCnt = strategy.getImageCnt();
             Integer imageCnt = strategy.getImageCnt();
@@ -614,23 +616,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
 
 
 
     private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
     private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
-        //  JSONArray campaignList;
-        String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-        /*if ("ALL_CAMPAIGN".equals(checkType)) {
-            campaignList = kuaishouInterfaceService.getCampaignList(token, null, null, 1);
-        } else {
-            timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-            campaignList = kuaishouInterfaceService.getCampaignList(token, new Date(), new Date(), 1);
-        }*/
-
-       /* if (!Check.isNull(campaignList)){
-            for (int i = 0; i < campaignList.size(); i++) {
-                JSONObject jsonObject = campaignList.getJSONObject(i);
-                if (jsonObject.getString("campaign_name").contains(replaceString)) {
-                    return jsonObject.getLong("campaign_id");
-                }
-            }
-        }*/
         Long campaignId = null;
         Long campaignId = null;
         if ("ALL_CAMPAIGN".equals(checkType)) {
         if ("ALL_CAMPAIGN".equals(checkType)) {
             campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
             campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
@@ -645,7 +630,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 不存在“上新”计划,则创建一个计划
         // 不存在“上新”计划,则创建一个计划
         JSONObject campaignParams = new JSONObject();
         JSONObject campaignParams = new JSONObject();
         campaignParams.put("advertiser_id", token.getAccountId());
         campaignParams.put("advertiser_id", token.getAccountId());
-        String campaignName = getName(strategy.getCampaignName(), strategy, createType, appInfo, timestamp, null, null);
+        String campaignName = getName(strategy.getCampaignName(), strategy, createType, appInfo, null, "plan", null);
         campaignParams.put("campaign_name", campaignName);
         campaignParams.put("campaign_name", campaignName);
         campaignParams.put("type", strategy.getCampaignType());
         campaignParams.put("type", strategy.getCampaignType());
         if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
         if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
@@ -674,8 +659,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 拼装创建组的入参 json
         // 拼装创建组的入参 json
         JSONObject unitParams = new JSONObject();
         JSONObject unitParams = new JSONObject();
         Integer unitType = strategy.getUnitType();
         Integer unitType = strategy.getUnitType();
-
-
         //创意制作方式
         //创意制作方式
         unitParams.put("unit_type", unitType);
         unitParams.put("unit_type", unitType);
         unitParams.put("advertiser_id", token.getAccountId());
         unitParams.put("advertiser_id", token.getAccountId());
@@ -691,9 +674,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             unitParams.put("day_budget", 0);
             unitParams.put("day_budget", 0);
         }
         }
         //应用商店列表
         //应用商店列表
-
         unitParams.put("ocpx_action_type", strategy.getOcpxActionType());
         unitParams.put("ocpx_action_type", strategy.getOcpxActionType());
-
         //出价
         //出价
         if (null != strategy.getBid() && strategy.getBid() != 0) {
         if (null != strategy.getBid() && strategy.getBid() != 0) {
             unitParams.put("bid", strategy.getBid());
             unitParams.put("bid", strategy.getBid());
@@ -721,7 +702,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getDeepConversionBid())) {
         if (!Check.isNull(strategy.getDeepConversionBid())) {
             unitParams.put("deep_conversion_bid", strategy.getDeepConversionBid());
             unitParams.put("deep_conversion_bid", strategy.getDeepConversionBid());
         }
         }
-
         Integer sceneId = null;
         Integer sceneId = null;
         String scenceIdString = strategy.getSceneId();
         String scenceIdString = strategy.getSceneId();
 
 
@@ -730,13 +710,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             sceneId = scenceArray.getInteger(0);
             sceneId = scenceArray.getInteger(0);
             unitParams.put("scene_id", scenceArray);
             unitParams.put("scene_id", scenceArray);
         }
         }
-
         Integer campaignType = strategy.getCampaignType();
         Integer campaignType = strategy.getCampaignType();
         if (campaignType == 2) { // 提升应用安装
         if (campaignType == 2) { // 提升应用安装
             //应用ID
             //应用ID
             if (!Check.isNull(appId)) {
             if (!Check.isNull(appId)) {
                 unitParams.put("app_id", appId);
                 unitParams.put("app_id", appId);
             }
             }
+            // 直达链接
+            if (!Check.isNull(strategy.getSchemaUri())) {
+                unitParams.put("schema_uri", strategy.getSchemaUri());
+            }
             // 优先从系统应用商店下载
             // 优先从系统应用商店下载
             if (null != strategy.getUseAppMarket()) {
             if (null != strategy.getUseAppMarket()) {
                 unitParams.put("use_app_market", strategy.getUseAppMarket());
                 unitParams.put("use_app_market", strategy.getUseAppMarket());
@@ -745,16 +728,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
                 unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
             }
             }
         } else if (campaignType == 3) { //  获取电商下单
         } else if (campaignType == 3) { //  获取电商下单
-
             //url类型
             //url类型
             if (!Check.isNull(strategy.getUrlType())) {
             if (!Check.isNull(strategy.getUrlType())) {
                 unitParams.put("url_type", strategy.getUrlType());
                 unitParams.put("url_type", strategy.getUrlType());
             }
             }
-
             if (!Check.isNull(strategy.getUrl())) {
             if (!Check.isNull(strategy.getUrl())) {
                 unitParams.put("url", strategy.getUrl());
                 unitParams.put("url", strategy.getUrl());
             }
             }
-
         } else if (campaignType == 5) { //收集销售线索
         } else if (campaignType == 5) { //收集销售线索
             //url类型
             //url类型
             if (!Check.isNull(strategy.getWebUriType())) {
             if (!Check.isNull(strategy.getWebUriType())) {
@@ -764,7 +744,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (!Check.isNull(strategy.getUrl())) {
             if (!Check.isNull(strategy.getUrl())) {
                 unitParams.put("url", strategy.getUrl());
                 unitParams.put("url", strategy.getUrl());
             }
             }
-
         } else if (campaignType == 7) { //  提高应用活跃
         } else if (campaignType == 7) { //  提高应用活跃
             //  appId
             //  appId
             if (!Check.isNull(appId)) {
             if (!Check.isNull(appId)) {
@@ -780,7 +759,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 unitParams.put("schema_uri", strategy.getSchemaUri());
                 unitParams.put("schema_uri", strategy.getSchemaUri());
             }
             }
         }
         }
-
         //投放开始时间
         //投放开始时间
         if (!Check.isNull(strategy.getBeginTime())) {
         if (!Check.isNull(strategy.getBeginTime())) {
             unitParams.put("begin_time", strategy.getBeginTime());
             unitParams.put("begin_time", strategy.getBeginTime());
@@ -799,8 +777,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getConvertId())) {
         if (!Check.isNull(strategy.getConvertId())) {
             unitParams.put("convert_id", strategy.getConvertId());
             unitParams.put("convert_id", strategy.getConvertId());
         }
         }
-
-
         //创意展现方式
         //创意展现方式
         if (!Check.isNull(strategy.getShowMode())) {
         if (!Check.isNull(strategy.getShowMode())) {
             unitParams.put("show_mode", strategy.getShowMode());
             unitParams.put("show_mode", strategy.getShowMode());
@@ -821,7 +797,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getAutoCreatePhoto())) {
         if (!Check.isNull(strategy.getAutoCreatePhoto())) {
             unitParams.put("auto_create_photo", strategy.getAutoCreatePhoto());
             unitParams.put("auto_create_photo", strategy.getAutoCreatePhoto());
         }
         }
-
         if (unitType == 7) {
         if (unitType == 7) {
             //是否开启智能抽帧
             //是否开启智能抽帧
             if (!Check.isNull(strategy.getSmartCover())) {
             if (!Check.isNull(strategy.getSmartCover())) {
@@ -851,8 +826,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             // 定向数据
             // 定向数据
             unitParams.put("target", target);
             unitParams.put("target", target);
         }
         }
-
-
         // 设置定向内容
         // 设置定向内容
         JSONObject targetJsonObject = new JSONObject();
         JSONObject targetJsonObject = new JSONObject();
         if (null != strategy.getRegion() && !"".equals(strategy.getRegion())) {
         if (null != strategy.getRegion() && !"".equals(strategy.getRegion())) {
@@ -882,31 +855,53 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (null != strategy.getDevicePrice() && !"".equals(strategy.getDevicePrice()) && !"[]".equals(strategy.getDevicePrice())) {
         if (null != strategy.getDevicePrice() && !"".equals(strategy.getDevicePrice()) && !"[]".equals(strategy.getDevicePrice())) {
             targetJsonObject.put("device_price", JSON.parseArray(strategy.getDevicePrice()));
             targetJsonObject.put("device_price", JSON.parseArray(strategy.getDevicePrice()));
         }
         }
-        if (null != strategy.getPopulation() && !"".equals(strategy.getPopulation())) {
-            JSONArray population = JSON.parseArray(strategy.getPopulation());
-            targetJsonObject.put("population", population);
+        if (sceneId != 5) {
+            if (null != strategy.getFilterConvertedLevel() && strategy.getFilterConvertedLevel() != 0) {
+                targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
+            }
+        }
+
+        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+        if (!Check.isNull(appInterest)) {
+            targetJsonObject.put("app_interest", appInterest);
         }
         }
-        if (null != strategy.getFilterConvertedLevel() && strategy.getFilterConvertedLevel() != 0) {
-            targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
+        // APP行为-按APP名称
+        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+        if (!Check.isNull(appIds)) {
+            targetJsonObject.put("app_ids", appIds);
         }
         }
-        if (null != strategy.getExcludePopulation() && !"".equals(strategy.getExcludePopulation())) {
-            JSONArray excludePopulation = JSON.parseArray(strategy.getExcludePopulation());
-            targetJsonObject.put("exclude_population", excludePopulation);
+        // 人群包定向
+        JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());
+        if (!Check.isNull(populationString)) {
+            targetJsonObject.put("population", populationString);
         }
         }
+        // 人群包排除
+        JSONArray excludePopulationString = JSONArray.parseArray(strategy.getExcludePopulation());
+        if (!Check.isNull(excludePopulationString)) {
+            targetJsonObject.put("exclude_population", excludePopulationString);
+        }
+        // 付费人群包id
+        JSONArray paidAudienceString = JSONArray.parseArray(strategy.getPaidAudience());
+        if (!Check.isNull(paidAudienceString)) {
+            targetJsonObject.put("paid_audience", paidAudienceString);
+        }
+
         //是否开启智能扩量
         //是否开启智能扩量
-        if (null != strategy.getIsOpen() && strategy.getIsOpen().equals(1)) {
-            JSONObject intelliExtend = new JSONObject();
-            intelliExtend.put("is_open", 1);
-            if (null != strategy.getNoAgeBreak() && strategy.getNoAgeBreak().equals(1)) {
-                intelliExtend.put("no_age_break", 1);
-            }
-            if (null != strategy.getNoGenderBreak() && strategy.getNoGenderBreak().equals(1)) {
-                intelliExtend.put("no_gender_break", 1);
-            }
-            if (null != strategy.getNoAreaBreak() && strategy.getNoAreaBreak().equals(1)) {
-                intelliExtend.put("no_area_break", 1);
+        if (sceneId != 5) {
+            if (null != strategy.getIsOpen() && strategy.getIsOpen().equals(1)) {
+                JSONObject intelliExtend = new JSONObject();
+                intelliExtend.put("is_open", 1);
+                if (null != strategy.getNoAgeBreak() && strategy.getNoAgeBreak().equals(1)) {
+                    intelliExtend.put("no_age_break", 1);
+                }
+                if (null != strategy.getNoGenderBreak() && strategy.getNoGenderBreak().equals(1)) {
+                    intelliExtend.put("no_gender_break", 1);
+                }
+                if (null != strategy.getNoAreaBreak() && strategy.getNoAreaBreak().equals(1)) {
+                    intelliExtend.put("no_area_break", 1);
+                }
+                targetJsonObject.put("intelli_extend", intelliExtend);
             }
             }
-            targetJsonObject.put("intelli_extend", intelliExtend);
         }
         }
         unitParams.put("target", targetJsonObject);
         unitParams.put("target", targetJsonObject);
         log.info("广告组创建参数:{}", unitParams.toJSONString());
         log.info("广告组创建参数:{}", unitParams.toJSONString());
@@ -1039,30 +1034,30 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
 
         }
         }
         // APP行为-按分类
         // APP行为-按分类
-        String appInterestString = strategy.getAppInterest();
-        if (null != appInterestString && !"".equals(appInterestString.trim())) {
-            target.put("app_interest", JSON.parseArray(appInterestString));
+        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+        if (!Check.isNull(appInterest)) {
+            target.put("app_interest", appInterest);
         }
         }
         // APP行为-按APP名称
         // APP行为-按APP名称
-        String appIdsString = strategy.getAppIds();
-        if (null != appIdsString && !"".equals(appIdsString.trim())) {
-            target.put("app_ids", JSON.parseArray(appIdsString));
+        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+        if (!Check.isNull(appIds)) {
+            target.put("app_ids", appIds);
         }
         }
 
 
         // 人群包定向
         // 人群包定向
-        String populationString = strategy.getPopulation();
-        if (null != populationString && !"".equals(populationString.trim())) {
-            target.put("population", JSON.parseArray(populationString));
+        JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());
+        if (!Check.isNull(populationString)) {
+            target.put("population", populationString);
         }
         }
         // 人群包排除
         // 人群包排除
-        String excludePopulationString = strategy.getExcludePopulation();
-        if (null != excludePopulationString && !"".equals(excludePopulationString.trim())) {
-            target.put("exclude_population", JSON.parseArray(excludePopulationString));
+        JSONArray excludePopulationString = JSONArray.parseArray(strategy.getExcludePopulation());
+        if (!Check.isNull(excludePopulationString)) {
+            target.put("exclude_population", excludePopulationString);
         }
         }
         // 付费人群包id
         // 付费人群包id
-        String paidAudienceString = strategy.getPaidAudience();
-        if (null != paidAudienceString && !"".equals(paidAudienceString.trim())) {
-            target.put("paid_audience", JSON.parseArray(paidAudienceString));
+        JSONArray paidAudienceString = JSONArray.parseArray(strategy.getPaidAudience());
+        if (!Check.isNull(paidAudienceString)) {
+            target.put("paid_audience", paidAudienceString);
         }
         }
         if (Check.isNull(strategy.getBehaviorInterest())) {
         if (Check.isNull(strategy.getBehaviorInterest())) {
             target.put("behavior_interest", JSON.parseObject(strategy.getBehaviorInterest()));
             target.put("behavior_interest", JSON.parseObject(strategy.getBehaviorInterest()));
@@ -1187,7 +1182,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
      * @param strategy 账户id
      * @param strategy 账户id
      * @return
      * @return
      */
      */
-    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String timestamp, Integer cnt, String materialName) {
+    @Autowired
+    private RedisUtil redisUtil;
+
+    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String materialName, String type, Long campaignId) {
         if (wildcard.contains("{{应用包名}}")) {
         if (wildcard.contains("{{应用包名}}")) {
             String appName = "";
             String appName = "";
             if (null != appInfo) {
             if (null != appInfo) {
@@ -1196,8 +1194,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             wildcard = wildcard.replace("{{应用包名}}", appName);
             wildcard = wildcard.replace("{{应用包名}}", appName);
         }
         }
         if (wildcard.contains("{{创意制作方式}}")) {
         if (wildcard.contains("{{创意制作方式}}")) {
-//            String creatype = KuaishouCreativeCreateTypeEnum.getNameByType(strategy.getOpenProgramCreate());
-//            wildcard = wildcard.replace("{{创意制作方式}}",creatype);
             if (strategy.getUnitType() == 4) {
             if (strategy.getUnitType() == 4) {
                 wildcard = wildcard.replace("{{创意制作方式}}", "自定义");
                 wildcard = wildcard.replace("{{创意制作方式}}", "自定义");
             } else if (strategy.getUnitType() == 7) {
             } else if (strategy.getUnitType() == 7) {
@@ -1215,22 +1211,52 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             } else {
             } else {
                 wildcard = wildcard.replace("{{素材名称}}", materialName);
                 wildcard = wildcard.replace("{{素材名称}}", materialName);
             }
             }
-
         }
         }
         if (!wildcard.contains("{{自定义}}")) {
         if (!wildcard.contains("{{自定义}}")) {
             wildcard = wildcard + "{{自定义}}";
             wildcard = wildcard + "{{自定义}}";
         }
         }
+        Date date = new Date();
+        String nowDate = DateUtils.formatDate(date, "yy-MMdd");
+        if (type.equals("plan")) {
+            if (wildcard.contains("{{日期}}")) {
+                wildcard = wildcard.replace("{{日期}}", nowDate);
+            } else {
+                wildcard = wildcard + "-" + nowDate;
+            }
+        } else if ("unit".equals(type)) {
+            wildcard = wildcard.replace("{{日期}}", nowDate);
+        }
+
         String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
         String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
         if (null != appInfo) {
         if (null != appInfo) {
             targetName = appInfo.getAppVersion() + "-" + targetName;
             targetName = appInfo.getAppVersion() + "-" + targetName;
         }
         }
         wildcard = wildcard.replace("{{自定义}}", targetName);
         wildcard = wildcard.replace("{{自定义}}", targetName);
 
 
-        if (null != timestamp && !"".equals(timestamp.trim())) {
-            wildcard = wildcard + "-" + timestamp;
-        }
-        if (null != cnt) {
-            wildcard = wildcard + "-" + cnt.toString();
+        if (!Check.isNull(campaignId)) {
+            Integer count = null;
+            if (null != strategy.getSingleAppid() && strategy.getSingleAppid() == 0) {
+                String redisKey = strategy.getAccountId() + "_" + campaignId;
+                Object redisValue = redisUtil.get(redisKey);
+                if (Check.isNull(redisValue)) {
+                    count = 1;
+                    redisUtil.set(redisKey, count);
+                } else {
+                    count = (Integer) redisValue + 1;
+                    redisUtil.set(redisKey, count);
+                }
+            } else {
+                String redisKey = strategy.getAccountId() + "_" + campaignId + nowDate;
+                Object redisValue = redisUtil.get(redisKey);
+                if (Check.isNull(redisValue)) {
+                    count = 1;
+                    redisUtil.set(redisKey, count, 100000L);
+                } else {
+                    count = (Integer) redisValue + 1;
+                    redisUtil.set(redisKey, count, 100000L);
+                }
+            }
+            wildcard = wildcard + "-" + count;
         }
         }
         wildcard = wildcard.replace("--", "-");
         wildcard = wildcard.replace("--", "-");
         if (wildcard.startsWith("-")) {
         if (wildcard.startsWith("-")) {
@@ -1256,4 +1282,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         }
         return adsence.substring(0, adsence.length() - 1);
         return adsence.substring(0, adsence.length() - 1);
     }
     }
+
+
+    public static void main(String[] args) {
+        Date date = new Date();
+        String s = DateUtils.formatDate(date, "yy-MMdd");
+        String timestamp = DateUtils.formatDate(new Date(), "HHmmss");
+        System.err.println(timestamp);
+    }
+
+
 }
 }

+ 35 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -2418,4 +2418,39 @@ public class BatchController {
     }
     }
 
 
 
 
+    /**
+     * 获取可选的深度类型
+     *
+     * @return
+     */
+    @PostMapping(value = "/getAppNames")
+    public Result<JSONArray> getAppNames(@RequestBody JSONObject requestJson) {
+        Result result = new Result<JSONArray>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取授权信息");
+            }
+            JSONArray appIds = requestJson.getJSONArray("appIds");
+
+            if (!Check.isNull(appIds)) {
+                JSONArray appNames = iKuaishouInterfaceService.getAppNames(accountId, token.getAccessToken(), appIds);
+                result.setResult(appNames);
+            } else {
+                result.setResult(new JSONArray());
+            }
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+
+    }
+
+
 }
 }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTemplate.java

@@ -216,6 +216,7 @@ public class KuaiShouGroupTemplate {
     private String creativeReviewDetail;
     private String creativeReviewDetail;
     private Integer createType;
     private Integer createType;
     private String photoIds;
     private String photoIds;
+    private String schemaUri;
 
 
     /**
     /**
      * 创建时间
      * 创建时间

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

@@ -17,11 +17,13 @@ public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouRe
 
 
     List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap);
     List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap);
 
 
-    void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate,String temporalGranularity, Integer page);
+    void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, String temporalGranularity, Integer page);
 
 
     List<KuaiShouReportDailyMaterial> getSignatureByDate(String date);
     List<KuaiShouReportDailyMaterial> getSignatureByDate(String date);
 
 
-    KuaiShouReportDailyMaterial getEtlDataByParams(String signature, String date,Long projectId);
+    KuaiShouReportDailyMaterial getEtlDataByParams(String signature, String date, Long projectId);
 
 
     List<KuaiShouReportDailyMaterial> getSignatureByDateGroupByProjectId(String date);
     List<KuaiShouReportDailyMaterial> getSignatureByDateGroupByProjectId(String date);
+
+    List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList);
 }
 }

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

@@ -468,6 +468,7 @@ public interface IKuaishouInterfaceService {
 
 
     void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds);
     void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds);
 
 
+    JSONArray getAppNames(Long accountId, String accessToken, JSONArray appIds);
 }
 }
 
 
 
 

+ 7 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -228,6 +228,9 @@ public class BatchServiceImpl implements IBatchService {
         if (!Check.isNull(requestJson.getString("url"))) {
         if (!Check.isNull(requestJson.getString("url"))) {
             unitJson.put("url", requestJson.getString("url"));
             unitJson.put("url", requestJson.getString("url"));
         }
         }
+        if (!Check.isNull(requestJson.getString("schemaUri"))) {
+            unitJson.put("schema_uri", requestJson.getString("schemaUri"));
+        }
         // appId
         // appId
         if (!Check.isNull(requestJson.getLong("appId"))) {
         if (!Check.isNull(requestJson.getLong("appId"))) {
             unitJson.put("app_id", requestJson.getLong("appId"));
             unitJson.put("app_id", requestJson.getLong("appId"));
@@ -820,6 +823,10 @@ public class BatchServiceImpl implements IBatchService {
                 if (!Check.isNull(group.getUrl())) {
                 if (!Check.isNull(group.getUrl())) {
                     unitJson.put("url", group.getUrl());
                     unitJson.put("url", group.getUrl());
                 }
                 }
+                //  吊起链接
+                if (!Check.isNull(group.getSchemaUri())) {
+                    unitJson.put("schema_uri", group.getSchemaUri());
+                }
                 // appId
                 // appId
                 if (!Check.isNull(group.getAppId())) {
                 if (!Check.isNull(group.getAppId())) {
                     unitJson.put("app_id", group.getAppId());
                     unitJson.put("app_id", group.getAppId());
@@ -848,8 +855,6 @@ public class BatchServiceImpl implements IBatchService {
                     // 自定义年龄段
                     // 自定义年龄段
                     Integer ageMin = groupTarget.getAgeMin();
                     Integer ageMin = groupTarget.getAgeMin();
                     Integer ageMax = groupTarget.getAgeMax();
                     Integer ageMax = groupTarget.getAgeMax();
-
-
                     JSONObject ageJson = new JSONObject();
                     JSONObject ageJson = new JSONObject();
                     if (!Check.isNull(ageMin)) {
                     if (!Check.isNull(ageMin)) {
                         ageJson.put("min", ageMin);
                         ageJson.put("min", ageMin);

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

@@ -118,6 +118,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         String action_bar_text = requestJson.getString("actionBarText");
         String action_bar_text = requestJson.getString("actionBarText");
         String description = requestJson.getString("description");
         String description = requestJson.getString("description");
         Long site_id = requestJson.getLong("siteId");
         Long site_id = requestJson.getLong("siteId");
+        String schema_uri = requestJson.getString("schemaUri");
 
 
 
 
         List<KuaiShouGroupTemplate> templates = new ArrayList<>();
         List<KuaiShouGroupTemplate> templates = new ArrayList<>();
@@ -194,6 +195,9 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             if (!Check.isNull(url)) {
             if (!Check.isNull(url)) {
                 template.setUrl(url);
                 template.setUrl(url);
             }
             }
+            if (!Check.isNull(schema_uri)) {
+                template.setSchemaUri(schema_uri);
+            }
             if (!Check.isNull(app_id)) {
             if (!Check.isNull(app_id)) {
                 template.setAppId(app_id);
                 template.setAppId(app_id);
             }
             }
@@ -368,6 +372,10 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         if (!Check.isNull(template.getUrl())) {
         if (!Check.isNull(template.getUrl())) {
             createUnitJson.put("url", template.getUrl()); // 投放链接
             createUnitJson.put("url", template.getUrl()); // 投放链接
         }
         }
+        if (!Check.isNull(template.getSchemaUri())) {
+            createUnitJson.put("schema_uri", template.getSchemaUri()); // 吊起链接
+        }
+
         if (!Check.isNull(template.getAppId())) {
         if (!Check.isNull(template.getAppId())) {
             createUnitJson.put("app_id", template.getAppId()); // 应用ID
             createUnitJson.put("app_id", template.getAppId()); // 应用ID
         }
         }

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

@@ -9,19 +9,24 @@ import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouHistoryReportTaskMapper
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
 import cn.com.ctop.kuaishou.modules.report.mapper.*;
 import cn.com.ctop.kuaishou.modules.report.mapper.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.csvreader.CsvReader;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.io.IOException;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -62,6 +67,10 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
 
     @Autowired
     @Autowired
     private KuaiShouReportDailyMaterialMapper kuaishouReportDailyMaterialMapper;
     private KuaiShouReportDailyMaterialMapper kuaishouReportDailyMaterialMapper;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService reportDailyMaterialService;
+    @Autowired
+    private KuaiShouReportDailyMaterialMapper dailyMaterialMapper;
 
 
     @Override
     @Override
     public void createTask(Long accountId, String token, String startDate, String endDate, String taskType) {
     public void createTask(Long accountId, String token, String startDate, String endDate, String taskType) {
@@ -213,7 +222,166 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
             requestMap.put("advertiser_id", task.getAccountId());
             requestMap.put("advertiser_id", task.getAccountId());
             requestMap.put("task_id", task.getTaskId());
             requestMap.put("task_id", task.getTaskId());
             String localPath = LoadFileUtil.downloadByUrl(requestMap, downloadPath, url, token, fileName);
             String localPath = LoadFileUtil.downloadByUrl(requestMap, downloadPath, url, token, fileName);
-            if (!Check.isNull(localPath)) {
+            ArrayList<String[]> reportList = getReportList(localPath);
+            if (task.getViewType() == 1) {
+                if (!Check.isNull(reportList)) {
+                    List<KuaishouReportDailyAccount> reportDailyAccounts = new ArrayList<>();
+                    for (int row = 0; row < reportList.size(); row++) {
+                        if (Check.isNull(row)) {
+                            continue;
+                        }
+                        KuaishouReportDailyAccount reportDailyAccount = new KuaishouReportDailyAccount();
+                        reportDailyAccount.setAccountId(task.getAccountId());
+                        reportDailyAccount.setCharge(ConverterUtils.getAsBigDecimal(reportList.get(row)[1]));
+                        reportDailyAccount.setAdScene(reportList.get(row)[0]);
+                        reportDailyAccount.setPhotoShow(ConverterUtils.getAsLong(reportList.get(row)[2]));
+                        reportDailyAccount.setAclick(ConverterUtils.getAsLong(reportList.get(row)[3]));
+                        reportDailyAccount.setBclick(ConverterUtils.getAsLong(reportList.get(row)[4]));
+                        reportDailyAccount.setPhotoShare(ConverterUtils.getAsLong(reportList.get(row)[5]));
+                        reportDailyAccount.setPhotoComment(ConverterUtils.getAsLong(reportList.get(row)[6]));
+                        reportDailyAccount.setPhotoLike(ConverterUtils.getAsLong(reportList.get(row)[7]));
+                        reportDailyAccount.setFollow(ConverterUtils.getAsLong(reportList.get(row)[8]));
+                        reportDailyAccount.setCancelFollow(ConverterUtils.getAsLong(reportList.get(row)[9]));
+                        reportDailyAccount.setReport(ConverterUtils.getAsLong(reportList.get(row)[10]));
+                        reportDailyAccount.setBlock(ConverterUtils.getAsLong(reportList.get(row)[11]));
+                        reportDailyAccount.setNegative(ConverterUtils.getAsLong(reportList.get(row)[12]));
+                        reportDailyAccount.setDownloadStarted(ConverterUtils.getAsLong(reportList.get(row)[13]));
+                        reportDailyAccount.setDownloadCompleted(ConverterUtils.getAsLong(reportList.get(row)[14]));
+                        reportDailyAccount.setActivation(ConverterUtils.getAsLong(reportList.get(row)[15]));
+                        reportDailyAccount.setSubmit(ConverterUtils.getAsLong(reportList.get(row)[16]));
+                        reportDailyAccount.setStatDate(reportList.get(row)[17]);
+                        reportDailyAccount.setPhotoClick(ConverterUtils.getAsLong(reportList.get(row)[19]));
+                        reportDailyAccount.setPhotoClickRatio(ConverterUtils.getAsDouble(reportList.get(row)[20]));
+                        reportDailyAccount.setActionRatio(ConverterUtils.getAsDouble(reportList.get(row)[21]));
+                        reportDailyAccount.setImpression1kCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[22]));
+                        reportDailyAccount.setPhotoClickCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[23]));
+                        reportDailyAccount.setActionCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[25]));
+                        reportDailyAccount.setEventPayFirstDay(ConverterUtils.getAsLong(reportList.get(row)[26]));
+                        reportDailyAccount.setEventPayPurchaseAmountFirstDay(ConverterUtils.getAsBigDecimal(reportList.get(row)[27]));
+                        reportDailyAccount.setEventPayFirstDayRoi(ConverterUtils.getAsDouble(reportList.get(row)[28]));
+                        reportDailyAccount.setEventPay(ConverterUtils.getAsLong(reportList.get(row)[29]));
+                        reportDailyAccount.setEventPayPurchaseAmount(ConverterUtils.getAsBigDecimal(reportList.get(row)[30]));
+                        reportDailyAccount.setEventPayRoi(ConverterUtils.getAsDouble(reportList.get(row)[31]));
+                        reportDailyAccount.setEventRegister(ConverterUtils.getAsLong(reportList.get(row)[32]));
+                        reportDailyAccount.setEventRegisterCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[33]));
+                        reportDailyAccount.setEventRegisterRatio(ConverterUtils.getAsDouble(reportList.get(row)[34]));
+                        reportDailyAccount.setEventJinJianApp(ConverterUtils.getAsLong(reportList.get(row)[35]));
+                        reportDailyAccount.setEventJinJianAppCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[36]));
+                        reportDailyAccount.setEventCreditGrantApp(ConverterUtils.getAsLong(reportList.get(row)[37]));
+                        reportDailyAccount.setEventCreditGrantAppCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[38]));
+                        reportDailyAccount.setEventCreditGrantAppRatio(ConverterUtils.getAsDouble(reportList.get(row)[39]));
+                        reportDailyAccount.setEventOrderPaid(ConverterUtils.getAsLong(reportList.get(row)[40]));
+                        reportDailyAccount.setEventOrderPaidPurchaseAmount(ConverterUtils.getAsBigDecimal(reportList.get(row)[41]));
+                        reportDailyAccount.setEventOrderPaidCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[42]));
+                        reportDailyAccount.setFormCount(ConverterUtils.getAsLong(reportList.get(row)[43]));
+                        reportDailyAccount.setFormCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[44]));
+                        reportDailyAccount.setFormActionRatio(ConverterUtils.getAsDouble(reportList.get(row)[45]));
+                        reportDailyAccount.setEventJinJianLandingPage(ConverterUtils.getAsLong(reportList.get(row)[46]));
+                        reportDailyAccount.setEventJinJianLandingPageCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[47]));
+                        reportDailyAccount.setEventCreditGrantLandingPage(ConverterUtils.getAsLong(reportList.get(row)[48]));
+                        reportDailyAccount.setEventCreditGrantLandingPageCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[49]));
+                        reportDailyAccount.setEventCreditGrantLandingRatio(ConverterUtils.getAsDouble(reportList.get(row)[50]));
+                        reportDailyAccount.setEventNextDayStayCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[51]));
+                        reportDailyAccount.setEventNextDayStayRatio(ConverterUtils.getAsBigDecimal(reportList.get(row)[52]));
+                        reportDailyAccount.setEventNextDayStay(ConverterUtils.getAsLong(reportList.get(row)[53]));
+                        reportDailyAccount.setPlay3sRatio(ConverterUtils.getAsDouble(reportList.get(row)[54]));
+                        reportDailyAccount.setEventNewUserPay(ConverterUtils.getAsLong(reportList.get(row)[63]));
+                        reportDailyAccount.setEventNewUserPayCost(ConverterUtils.getAsBigDecimal(reportList.get(row)[64]));
+                        reportDailyAccount.setEventNewUserPayRatio(ConverterUtils.getAsBigDecimal(reportList.get(row)[65]));
+                        reportDailyAccounts.add(reportDailyAccount);
+                    }
+                    if (!Check.isNull(reportDailyAccounts)) {
+                        reportDailyAccountMapper.replaceBatch(reportDailyAccounts);
+                    }
+                }
+            } else if (task.getViewType() == 5) {
+                if (!Check.isNull(reportList)) {
+                    List<KuaiShouReportDailyMaterial> materialList = new ArrayList<>();
+                    List<Long> photoIdList = new ArrayList<>();
+                    for (int row = 0; row < reportList.size(); row++) {
+                        String[] strings = reportList.get(row);
+                        if (Check.isNull(strings)) {
+                            continue;
+                        }
+                        KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
+                        material.setAccountId(task.getAccountId());
+                        material.setPhotoId(ConverterUtils.getAsLong(strings[0]));
+                        photoIdList.add(ConverterUtils.getAsLong(strings[0]));
+                        material.setImageToken(strings[1]);
+                        material.setCoverUrl(strings[2]);
+                        material.setPhotoUrl(strings[3]);
+                        // 4
+                        material.setCreativeMaterialTypeString(strings[5]);
+                        material.setAdScene(strings[6]);
+                        material.setCharge(ConverterUtils.getAsBigDecimal(strings[7]));
+                        material.setPhotoShow(ConverterUtils.getAsLong(strings[8]));
+                        material.setAclick(ConverterUtils.getAsLong(strings[9]));
+                        material.setBclick(ConverterUtils.getAsLong(strings[10]));
+                        material.setPhotoShare(ConverterUtils.getAsInteger(strings[11]));
+                        material.setPhotoComment(ConverterUtils.getAsInteger(strings[12]));
+                        material.setPhotoLike(ConverterUtils.getAsInteger(strings[13]));
+                        material.setFollow(ConverterUtils.getAsInteger(strings[14]));
+                        material.setCancelFollow(ConverterUtils.getAsInteger(strings[15]));
+                        material.setReport(ConverterUtils.getAsInteger(strings[16]));
+                        material.setBlock(ConverterUtils.getAsInteger(strings[17]));
+                        material.setNegative(ConverterUtils.getAsInteger(strings[18]));
+                        material.setDownloadStarted(ConverterUtils.getAsInteger(strings[19]));
+                        material.setDownloadCompleted(ConverterUtils.getAsInteger(strings[20]));
+                        material.setActivation(ConverterUtils.getAsInteger(strings[21]));
+                        material.setSubmit(ConverterUtils.getAsInteger(strings[22]));
+                        material.setStatDate(strings[23]);
+                        // 24
+                        material.setPhotoClick(ConverterUtils.getAsLong(strings[25]));
+                        material.setPhotoClickRatio(ConverterUtils.getAsDouble(strings[26]));
+                        material.setActionRatio(ConverterUtils.getAsDouble(strings[27]));
+                        material.setImpression1kCost(ConverterUtils.getAsBigDecimal(strings[28]));
+                        material.setPhotoClickCost(ConverterUtils.getAsBigDecimal(strings[29]));
+                        // material.setClick1(ConverterUtils.getAsBigDecimal(strings[30]));
+                        material.setActionCost(ConverterUtils.getAsBigDecimal(strings[31]));
+                        material.setEventPayFirstDay(ConverterUtils.getAsInteger(strings[32]));
+                        material.setEventPayPurchaseAmountFirstDay(ConverterUtils.getAsBigDecimal(strings[33]));
+                        material.setEventPayFirstDayRoi(ConverterUtils.getAsDouble(strings[34]));
+                        material.setEventPay(ConverterUtils.getAsInteger(strings[35]));
+                        material.setEventPayPurchaseAmount(ConverterUtils.getAsBigDecimal(strings[36]));
+                        material.setEventPayRoi(ConverterUtils.getAsDouble(strings[37]));
+                        material.setEventRegister(ConverterUtils.getAsInteger(strings[38]));
+                        material.setEventRegisterCost(ConverterUtils.getAsBigDecimal(strings[39]));
+                        material.setEventRegisterRatio(ConverterUtils.getAsDouble(strings[40]));
+                        material.setEventJinJianApp(ConverterUtils.getAsInteger(strings[41]));
+                        material.setEventJinJianAppCost(ConverterUtils.getAsBigDecimal(strings[42]));
+                        material.setEventCreditGrantApp(ConverterUtils.getAsInteger(strings[43]));
+                        material.setEventCreditGrantAppCost(ConverterUtils.getAsBigDecimal(strings[44]));
+                        material.setEventCreditGrantAppRatio(ConverterUtils.getAsDouble(strings[45]));
+                        material.setEventOrderPaid(ConverterUtils.getAsInteger(strings[46]));
+                        material.setEventOrderPaidPurchaseAmount(ConverterUtils.getAsBigDecimal(strings[47]));
+                        material.setEventOrderPaidCost(ConverterUtils.getAsBigDecimal(strings[48]));
+                        material.setFormCount(ConverterUtils.getAsInteger(strings[49]));
+                        material.setFormCost(ConverterUtils.getAsBigDecimal(strings[50]));
+                        material.setFormActionRatio(ConverterUtils.getAsDouble(strings[51]));
+                        material.setEventJinJianLandingPage(ConverterUtils.getAsInteger(strings[52]));
+                        material.setEventJinJianLandingPageCost(ConverterUtils.getAsBigDecimal(strings[53]));
+                        material.setEventCreditGrantLandingPage(ConverterUtils.getAsInteger(strings[54]));
+                        material.setEventCreditGrantLandingPageCost(ConverterUtils.getAsBigDecimal(strings[55]));
+                        material.setEventCreditGrantLandingRatio(ConverterUtils.getAsDouble(strings[56]));
+                        material.setEventNextDayStayCost(ConverterUtils.getAsBigDecimal(strings[57]));
+                        material.setEventNextDayStayRatio(ConverterUtils.getAsInteger(strings[58]));
+                        material.setEventNextDayStay(ConverterUtils.getAsInteger(strings[59]));
+                        material.setPlay3sRatio(ConverterUtils.getAsDouble(strings[60]));
+                        materialList.add(material);
+                    }
+                    if (!Check.isNull(materialList)) {
+                        List<KuaiShouReportDailyMaterial> videoInfoByList = reportDailyMaterialService.getVideoInfoByList(materialList, photoIdList);
+                        dailyMaterialMapper.batchReplace(videoInfoByList);
+
+                    }
+
+                }
+
+            }
+
+
+            //   System.err.println(reportList);
+          /*  if (!Check.isNull(localPath)) {
                 Map<String, Object> deleteMap = new HashMap<>();
                 Map<String, Object> deleteMap = new HashMap<>();
                 deleteMap.put("account_id", task.getAccountId());
                 deleteMap.put("account_id", task.getAccountId());
 
 
@@ -263,7 +431,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                 }
                 }
 
 
 
 
-            }
+            }*/
             task.setTaskStatus(4);
             task.setTaskStatus(4);
 
 
         } catch (Exception e) {
         } catch (Exception e) {
@@ -274,6 +442,24 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
 
     }
     }
 
 
+
+    private ArrayList<String[]> getReportList(String localPath) throws IOException {
+        ArrayList<String[]> csvFileList = new ArrayList<String[]>();
+        // 定义一个CSV路径
+        // 创建CSV读对象 例如:CsvReader(文件路径,分隔符,编码格式);
+        CsvReader reader = new CsvReader(localPath, ',', Charset.forName("UTF-8"));
+        // 跳过表头 如果需要表头的话,这句可以忽略
+        reader.readHeaders();
+        // 逐行读入除表头的数据
+        while (reader.readRecord()) {
+            //  System.out.println(reader.getRawRecord());
+            csvFileList.add(reader.getValues());
+        }
+        reader.close();
+        return csvFileList;
+
+    }
+
     @Autowired
     @Autowired
     private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
     private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
 
 
@@ -282,12 +468,13 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
 
         historyTypeList = new ArrayList<>();
         historyTypeList = new ArrayList<>();
         historyTypeList.add(1);
         historyTypeList.add(1);
-        historyTypeList.add(2);
-        historyTypeList.add(3);
-        historyTypeList.add(4);
         historyTypeList.add(5);
         historyTypeList.add(5);
-        historyTypeList.add(7);
-        historyTypeList.add(10);
+      /*  historyTypeList.add(2);
+        historyTypeList.add(3);*/
+        // historyTypeList.add(4);
+        //
+        // historyTypeList.add(7);
+        //  historyTypeList.add(10);
 
 
 
 
     }
     }

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java

@@ -101,7 +101,8 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
         getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, temporalGranularity, page + 1);
         getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, temporalGranularity, page + 1);
     }
     }
 
 
-    private List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList) {
+    @Override
+    public List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList) {
         if (Check.isNull(photoIdList)) {
         if (Check.isNull(photoIdList)) {
             return null;
             return null;
         }
         }

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

@@ -791,18 +791,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         getGroupList(token, null, null);
         getGroupList(token, null, null);
         //获取全量创意数据
         //获取全量创意数据
         getCreativeList(token, null, null);
         getCreativeList(token, null, null);
-        //获取全量视频素材数据
-
-        //获取图片信息数据
-
-
         getAppList(token.getAccountId(), token.getAccessToken());
         getAppList(token.getAccountId(), token.getAccessToken());
-
         log.info("----------------开始历史数据获取,accountId:{}", token.getAccountId());
         log.info("----------------开始历史数据获取,accountId:{}", token.getAccountId());
-
         String endDateStr = DateUtils.getDate("yyyy-MM-dd");
         String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-        String startDate = DateUtils.addMonth(endDateStr, -6);
-
+        String startDate = DateUtils.addMonth(endDateStr, -1);
         historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
         historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
         getVideoList(token, null, null);
         getVideoList(token, null, null);
         //   getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
         //   getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
@@ -3206,4 +3198,35 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
     }
 
 
 
 
+    @Override
+    public JSONArray getAppNames(Long accountId, String accessToken, JSONArray appIds) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_NAME;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", " application/json");
+        JSONObject json = new JSONObject();
+        json.put("advertiser_id", accountId);
+        json.put("type", 1);
+        json.put("ids", appIds);
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, json.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (!Check.isNull(resultJson)) {
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                JSONObject data = resultJson.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray keyword = data.getJSONArray("keyword");
+                    if (!Check.isNull(keyword)) {
+                        return keyword;
+
+                    }
+                }
+            }
+
+        }
+        return new JSONArray();
+
+    }
+
+
 }
 }

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

@@ -12,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IEtlKuaishouAccountMaterialReportDailyService extends IService<EtlKuaishouAccountMaterialReportDaily> {
 public interface IEtlKuaishouAccountMaterialReportDailyService extends IService<EtlKuaishouAccountMaterialReportDaily> {
 
 
     void etlKuaishouAccountMaterialReportDailyData(String date);
     void etlKuaishouAccountMaterialReportDailyData(String date);
+
+    void etlKuaishouAccountMaterialReportInfo(String formatDate);
 }
 }

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

@@ -30,6 +30,7 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
     @Autowired
     @Autowired
     private ICtopOauthTokenService tokenService;
     private ICtopOauthTokenService tokenService;
     static ExecutorService executorService = Executors.newFixedThreadPool(10);
     static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    static ExecutorService etlExecutorService = Executors.newFixedThreadPool(10);
     @Override
     @Override
     public void etlKuaishouAccountMaterialReportDailyData(String date){
     public void etlKuaishouAccountMaterialReportDailyData(String date){
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
@@ -51,4 +52,26 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
         }
         }
         log.info("{}数据获取完成",date);
         log.info("{}数据获取完成",date);
     }
     }
+
+    @Override
+    public void etlKuaishouAccountMaterialReportInfo(String formatDate) {
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
+        tokens.forEach(token -> etlExecutorService.submit(()->{
+            try {
+                List<EtlKuaishouAccountMaterialReportDaily> getList = etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyList(formatDate,token.getAccountId());
+                etlKuaishouAccountMaterialReportDailyMapper.replaceBatch(getList);
+            }catch (Exception e){
+                e.printStackTrace();
+            }finally {
+                countDownLatch.countDown();
+            }
+        }));
+        try {
+            countDownLatch.await();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        log.info("{}数据获取完成",formatDate);
+    }
 }
 }

+ 2 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/service/impl/BytedanceAreaInfoServiceImpl.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
@@ -21,7 +22,7 @@ import java.util.List;
  */
  */
 @Service
 @Service
 public class BytedanceAreaInfoServiceImpl extends ServiceImpl<BytedanceAreaInfoMapper, BytedanceAreaInfo> implements IBytedanceAreaInfoService {
 public class BytedanceAreaInfoServiceImpl extends ServiceImpl<BytedanceAreaInfoMapper, BytedanceAreaInfo> implements IBytedanceAreaInfoService {
-    @Autowired
+    @Resource
     private BytedanceAreaInfoMapper bytedanceAreaInfoMapper;
     private BytedanceAreaInfoMapper bytedanceAreaInfoMapper;
     @Override
     @Override
     public boolean hasChild(BytedanceAreaInfo areaInfo) {
     public boolean hasChild(BytedanceAreaInfo areaInfo) {

+ 14 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/EtlBytedanceReportVideoDailyMapper.java

@@ -1,7 +1,13 @@
 package cn.com.ctop.toutiao.modules.report.mapper;
 package cn.com.ctop.toutiao.modules.report.mapper;
 
 
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
+import cn.com.ctop.toutiao.modules.material.entity.EtlBytedanceVideoInfo;
 import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 头条视频分日报表信息
  * 头条视频分日报表信息
@@ -11,4 +17,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
  */
 public interface EtlBytedanceReportVideoDailyMapper extends BaseMapper<EtlBytedanceReportVideoDaily> {
 public interface EtlBytedanceReportVideoDailyMapper extends BaseMapper<EtlBytedanceReportVideoDaily> {
 
 
+    List<Map<String,Object>> getBytedanceVideoInfo();
+
+    void updBytedanceVideoByMd5(String md5,String coverUrl,String url);
+
+
+    List<ETLReportBytedanceVideo> etlBytedanceVideoInfo(@Param(value = "date") String date);
+
+    void replaceEtlVideoInfo(@Param(value = "videoInfo") ETLReportBytedanceVideo videoInfo);
 }
 }

+ 3 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -5,7 +5,9 @@
     <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
     <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         SELECT
         t1.md5 signature,
         t1.md5 signature,
-        IFNULL(t1.toutiao_url, '') AS url,
+        (case when t1.toutiao_url != ''  then t1.toutiao_url
+            when t1.url !='' then t1.url
+            else ''  end ) AS url,
         t1.cover_url AS converUrl,
         t1.cover_url AS converUrl,
         t1.clip_name AS clip,
         t1.clip_name AS clip,
         t1.shot_name AS shot,
         t1.shot_name AS shot,

+ 194 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/EtlBytedanceReportVideoDailyMapper.xml

@@ -2,4 +2,198 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper">
 <mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper">
 
 
+
+    <select id="getBytedanceVideoInfo" resultType="java.util.Map">
+        SELECT
+            IF
+                ( poster_url = '素材所属主体与开发者主体不一致无法获取URL', '', poster_url ) AS posterUrl,
+            poster_url,
+            video_url AS videoUrl,
+            a.md5,
+            count( 1 ) AS total
+        FROM
+            etl_report_bytedance_video a
+                LEFT JOIN ( SELECT DISTINCT signature, poster_url, video_url FROM ctop_bytedance_video_info ) b ON b.signature = a.md5
+                LEFT JOIN ( SELECT DISTINCT CODE, url FROM ctop_material_info ) c ON c.CODE = a.md5
+        WHERE
+            a.url = ''
+          AND a.toutiao_url = ''
+          AND a.md5 != ''
+        GROUP BY
+            a.md5
+        ORDER BY
+            total DESC;
+    </select>
+    <select id="etlBytedanceVideoInfo"
+            resultType="cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo">
+             select
+                      (case when cmi.url is not null then cmi.url else '' end) 'url',
+                          (CASE when cmi.cover_url is null then ''
+                                ELSE cmi.cover_url end) 'cover_url',
+                          (case when cmi.material_name is null then '' else cmi.material_name end)  'material_name',
+                          (case when cbvi.signature is null then '' else cbvi.signature end)'md5',
+                          report.material_id 'material_id',
+                          cp.project_name 'project_name',
+                          case when etlVideo.clip_name is null then '' else etlVideo.clip_name end 'clip_name',
+                          case when etlVideo.plan_name is null then '' else etlVideo.plan_name end 'plan_name',
+                          case when etlVideo.shot_name is null then '' else etlVideo.shot_name end 'shot_name',
+                          case when cmi.create_time is not null then cmi.create_time else '' end 'material_create_time',
+                          sum(report.cost) 'cost',
+                          sum(report.click) 'click_material',
+                          (case when sum(report.show_material)>0 and sum(report.click)>0 then round(sum(report.click)/sum(report.show_material)*100) else 0 end) 'ctr',
+                          sum(report.show_material) 'show_material',
+                          sum(report.convert_material) 'convert_material',
+                          (case when sum(report.convert_material)>0 and sum(report.click)>0 then round(sum(report.convert_material)/sum(report.click)*100) else 0 end) 'convert_rate',
+                          (case when sum(report.cost) >0 and sum(report.show_material)>0 then round(sum(report.cost)/sum(report.show_material)*1000,2) else 0 end) 'cpm',
+                          (case when sum(report.cost) >0 and sum(report.click)>0 then round(sum(report.cost)/sum(report.click),2) else 0 end) 'cpc',
+                          (case when sum(report.cost) >0 and sum(report.convert_material)>0 then round(sum(report.cost)/sum(report.convert_material),2) else 0 end) 'convert_cost',
+                          sum(report.download_start) 'download_start',
+                          sum(report.download_finish) 'download_finish',
+                          sum(report.active) 'active',
+                          sum(report.register) 'register',
+                          sum(report.next_day_open) 'next_day_open',
+                          sum(report.pay_count) 'active_pay_amount',
+                          (case when sum(report.cost) >0 and sum(report.pay_count)>0 then round(sum(report.cost)/sum(report.pay_count),2) else 0 end)  'active_pay_cost',
+                          (case when sum(report.cost) >0 and sum(report.next_day_open)>0 then round(sum(report.cost)/sum(report.next_day_open),2) else 0 end) 'next_day_open_cost',
+                          (case when sum(report.cost) >0 and sum(report.register)>0 then round(sum(report.cost)/sum(report.register),2) else 0 end) 'active_register_cost',
+                          (case when sum(report.cost) >0 and sum(report.active)>0 then round(sum(report.cost)/sum(report.active),2) else 0 end) 'active_cost',
+                          (case when sum(report.cost) >0 and sum(report.download_finish)>0 then round(sum(report.cost)/sum(report.download_finish),2) else 0 end) 'download_finish_cost',
+                          (case when sum(report.cost) >0 and sum(report.download_start)>0 then round(sum(report.cost)/sum(report.download_start),2) else 0 end) 'download_start_cost',
+                          (case when sum(report.download_start) >0 and sum(report.click)>0 then round(sum(report.download_start)/sum(report.click)*100,2) else 0 end) 'download_start_rate',
+                          (case when sum(report.download_finish) >0 and sum(report.download_start)>0 then round(sum(report.download_finish)/sum(report.download_start)*100,2) else 0 end) 'download_finish_rate',
+                          (case when sum(report.active) >0 and sum(report.click)>0 then round(sum(report.active)/sum(report.click)*100,2) else 0 end) 'active_rate',
+                          (case when sum(report.register) >0 and sum(report.active)>0 then round(sum(report.register)/sum(report.active)*100,2) else 0 end) 'active_register_rate',
+                          (case when sum(report.active) >0 and sum(report.next_day_open)>0 then round(sum(report.next_day_open)/sum(report.active)*100,2) else 0 end) 'next_day_open_rate',
+                          sum(report.form) 'form',
+                          (case when sum(report.cost) >0 and sum(report.valid_play)>0 then round(sum(report.cost)/sum(report.valid_play),2) else 0 end) 'valid_play_cost',
+                          sum(report.play75_feed_break) 'play75_feed_break',
+                          sum(report.play100_feed_break) 'play100_feed_break',
+                          sum(report.play25_feed_break) 'play25_feed_break',
+                          sum(report.play50_feed_break) 'play50_feed_break',
+                          sum(report.share_material) 'share_material',
+                          sum(report.follow) 'follow',
+                          sum(report.like_material) 'like_material',
+                          report.stat_datetime 'stat_datetime',
+                      report.account_id 'account_id'
+  from ctop_bytedance_report_material_daily report
+           left join ctop_user_allocation cua on cua.account_id = report.account_id
+           left join (select distinct account_id,material_id,signature from ctop_bytedance_video_info ) cbvi
+                     on report.account_id = cbvi.account_id and report.material_id = cbvi.material_id
+           left join ctop_bytedance_video_etl_info etlVideo on etlVideo.video_code = cbvi.signature
+           left join ctop_material_info cmi on cmi.code = cbvi.signature and cmi.project_id = cua.project_id
+           left join ctop_project cp on cp.id = cua.project_id
+  where 1 = 1
+    and report.stat_datetime = #{date}
+  group by report.material_id,report.account_id;
+    </select>
+    <select id="replaceEtlVideoInfo">
+        REPLACE INTO etl_report_bytedance_video(
+            url,
+            cover_url,
+            material_name,
+            md5,
+            material_id,
+            project_name ,
+            clip_name,
+            plan_name,
+            shot_name,
+            material_create_time,
+            cost,
+            click,
+            ctr,
+            material_show,
+            convert_material,
+            convert_rate,
+            cpm,
+            cpc,
+            convert_cost,
+            download_start,
+            download_finish,
+            active,
+            register,
+            next_day_open,
+            pay_count,
+            active_pay_cost,
+            next_day_open_cost,
+            active_register_cost,
+            active_cost,
+            download_finish_cost,
+            download_start_cost,
+            download_start_rate,
+            download_finish_rate,
+            active_rate,
+            active_register_rate,
+            next_day_open_rate,
+            form,
+            valid_play_cost,
+            play75_feed_break,
+            play100_feed_break,
+            play25_feed_break,
+            play50_feed_break,
+            share_material,
+            follow,
+            like_material,
+            stat_datetime,
+            account_id)
+    values (
+            #{videoInfo.url},
+            #{videoInfo.coverUrl},
+            #{videoInfo.materialName},
+            #{videoInfo.md5},
+            #{videoInfo.materialId},
+            #{videoInfo.projectName },
+            #{videoInfo.clipName},
+            #{videoInfo.planName},
+            #{videoInfo.shotName},
+            #{videoInfo.materialCreateTime},
+            #{videoInfo.cost},
+            #{videoInfo.click},
+            #{videoInfo.ctr},
+            #{videoInfo.materialShow},
+            #{videoInfo.convertMaterial},
+            #{videoInfo.convertRate},
+            #{videoInfo.cpm},
+            #{videoInfo.cpc},
+            #{videoInfo.convertCost},
+            #{videoInfo.downloadStart},
+            #{videoInfo.downloadFinish},
+            #{videoInfo.active},
+            #{videoInfo.register},
+            #{videoInfo.nextDayOpen},
+            #{videoInfo.payCount},
+            #{videoInfo.activePayCost},
+            #{videoInfo.nextDayOpenCost},
+            #{videoInfo.activeRegisterCost},
+            #{videoInfo.activeCost},
+            #{videoInfo.downloadFinishCost},
+            #{videoInfo.downloadStartCost},
+            #{videoInfo.downloadStartRate},
+            #{videoInfo.downloadFinishRate},
+            #{videoInfo.activeRate},
+            #{videoInfo.activeRegisterRate},
+            #{videoInfo.nextDayOpenRate},
+            #{videoInfo.form},
+            #{videoInfo.validPlayCost},
+            #{videoInfo.play75FeedBreak},
+            #{videoInfo.play100FeedBreak},
+            #{videoInfo.play25FeedBreak},
+            #{videoInfo.play50FeedBreak},
+            #{videoInfo.shareMaterial},
+            #{videoInfo.follow},
+            #{videoInfo.likeMaterial},
+            #{videoInfo.statDatetime},
+            #{videoInfo.accountId})
+    </select>
+
+
+    <update id="updBytedanceVideoByMd5">
+        UPDATE etl_report_bytedance_video
+        SET cover_url = #{coverUrl},
+            url = #{url}
+        WHERE
+            md5 = #{md5};
+    </update>
+
+
+
 </mapper>
 </mapper>

+ 6 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IEtlBytedanceReportVideoDailyService.java

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.report.service;
 
 
 import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
 
 
 /**
 /**
  * @Description: 头条视频分日报表信息
  * @Description: 头条视频分日报表信息
@@ -11,4 +12,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface IEtlBytedanceReportVideoDailyService extends IService<EtlBytedanceReportVideoDaily> {
 public interface IEtlBytedanceReportVideoDailyService extends IService<EtlBytedanceReportVideoDaily> {
 
 
+
+    Result updBytedanceVideo() throws Exception;
+
+
+    void etlBytedanceVideo() throws Exception;
 }
 }

+ 78 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/EtlBytedanceReportVideoDailyServiceImpl.java

@@ -1,18 +1,95 @@
 package cn.com.ctop.toutiao.modules.report.service.impl;
 package cn.com.ctop.toutiao.modules.report.service.impl;
 
 
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
+import cn.com.ctop.toutiao.modules.material.entity.EtlBytedanceVideoInfo;
 import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import cn.com.ctop.toutiao.modules.report.entity.EtlBytedanceReportVideoDaily;
 import cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper;
 import cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper;
 import cn.com.ctop.toutiao.modules.report.service.IEtlBytedanceReportVideoDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IEtlBytedanceReportVideoDailyService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.api.client.util.Data;
+import com.google.common.base.Function;
+import lombok.extern.slf4j.Slf4j;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.function.BiFunction;
+
 /**
 /**
  * 头条视频分日报表信息
  * 头条视频分日报表信息
+ *
  * @author jeecg-boot
  * @author jeecg-boot
- * @date   2021-02-20
  * @version V1.0
  * @version V1.0
+ * @date 2021-02-20
  */
  */
 @Service
 @Service
+@Slf4j
 public class EtlBytedanceReportVideoDailyServiceImpl extends ServiceImpl<EtlBytedanceReportVideoDailyMapper, EtlBytedanceReportVideoDaily> implements IEtlBytedanceReportVideoDailyService {
 public class EtlBytedanceReportVideoDailyServiceImpl extends ServiceImpl<EtlBytedanceReportVideoDailyMapper, EtlBytedanceReportVideoDaily> implements IEtlBytedanceReportVideoDailyService {
 
 
+
+    @Resource
+    private EtlBytedanceReportVideoDailyMapper etlBytedanceReportVideoDailyMapper;
+
+    @Override
+    public Result updBytedanceVideo() throws Exception{
+        CompletableFuture future = CompletableFuture.supplyAsync(()->{
+           return etlBytedanceReportVideoDailyMapper.getBytedanceVideoInfo();
+        }).handle(new BiFunction<List<Map<String, Object>>, Throwable, Object>() {
+            @Override
+            public Object apply(List<Map<String, Object>> list, Throwable throwable) {
+                if (throwable != null){
+                    return Result.error(throwable.getMessage());
+                }
+                list.forEach(map ->{
+                    String coverUrl = map.get("posterUrl")+"";
+                    String url = map.get("videoUrl")+"";
+                    String md5 = map.get("md5")+"";
+                    etlBytedanceReportVideoDailyMapper.updBytedanceVideoByMd5(md5,coverUrl,url);
+                });
+                return Result.ok("修改成功。");
+            }
+        });
+        return Result.ok(future.get());
+    }
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(20);
+    static CountDownLatch countDownLatch = null;
+    @Override
+    public void etlBytedanceVideo()throws Exception {
+        String date = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
+        List<ETLReportBytedanceVideo> list = etlBytedanceReportVideoDailyMapper.etlBytedanceVideoInfo(date);
+        if (null != list && !list.isEmpty()) {
+            countDownLatch = new CountDownLatch(list.size());
+            list.forEach(videoInfo -> executorService.submit(() -> {
+                try {
+                    etlBytedanceReportVideoDailyMapper.replaceEtlVideoInfo(videoInfo);
+                } catch (Exception e) {
+                } finally {
+                    countDownLatch.countDown();
+                }
+            }));
+
+            try {
+                countDownLatch.await();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            log.info("数据清洗完成");
+        }
+    }
+
+
+
+
 }
 }

+ 8 - 2
pom.xml

@@ -43,10 +43,10 @@
     </distributionManagement>
     </distributionManagement>
 
 
     <repositories>
     <repositories>
-        <repository>
+       <!-- <repository>
             <id>bintray-americanexpress-maven</id>
             <id>bintray-americanexpress-maven</id>
             <url>https://dl.bintray.com/americanexpress/maven</url>
             <url>https://dl.bintray.com/americanexpress/maven</url>
-        </repository>
+        </repository>-->
         <repository>
         <repository>
             <id>aliyun</id>
             <id>aliyun</id>
             <name>aliyun Repository</name>
             <name>aliyun Repository</name>
@@ -150,6 +150,12 @@
             <artifactId>commons-lang</artifactId>
             <artifactId>commons-lang</artifactId>
             <version>${commons.version}</version>
             <version>${commons.version}</version>
         </dependency>
         </dependency>
+
+        <dependency>
+            <groupId>net.sourceforge.javacsv</groupId>
+            <artifactId>javacsv</artifactId>
+            <version>2.0</version>
+        </dependency>
         <dependency>
         <dependency>
             <groupId>com.google.guava</groupId>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
             <artifactId>guava</artifactId>