ソースを参照

添加定时任务调度逻辑

syh 4 年 前
コミット
d8c6f6d8e8
39 ファイル変更507 行追加424 行削除
  1. 13 6
      xxl-job-admin/src/main/resources/application.properties
  2. 22 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/entity/JobDistributeInfo.java
  3. 11 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/mapper/JobDistributeInfoMapper.java
  4. 4 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/mapper/xml/JobDistributeInfoMapper.xml
  5. 10 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/service/IJobDistributeInfoService.java
  6. 26 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/service/impl/JobDistributeInfoServiceImpl.java
  7. 0 33
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/ByteDanceCleanMaterialJob.java
  8. 2 2
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/ByteDanceVideoReportJob.java
  9. 13 16
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceAdvertiserDailyReportLoadJob.java
  10. 21 13
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceAdvertiserHourlyReportLoadJob.java
  11. 23 14
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceAdvertisingDataLoadJob.java
  12. 16 17
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceCampaignDailyReportLoadJob.java
  13. 19 15
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceCampaignHourlyReportLoadJob.java
  14. 15 8
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceCreativeDailyReportLoadJob.java
  15. 21 16
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceCreativeHourlyReportLoadJob.java
  16. 18 38
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceDailyMaterialReportJob.java
  17. 1 11
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceDailyMaterialReportRetryJob.java
  18. 18 32
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceDailyPlayableReportJob.java
  19. 52 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceDistributeJob.java
  20. 14 6
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceFlowFundJob.java
  21. 13 24
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceMaterialsLoadJob.java
  22. 34 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanDailyReportETLJob.java
  23. 16 69
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanDailyReportLoadJob.java
  24. 30 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanHourlyReportETLJob.java
  25. 16 34
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanHourlyReportLoadJob.java
  26. 14 14
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanLoadJob.java
  27. 0 2
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanRealTimeLoadJob.java
  28. 15 4
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceSameDayCreativeLoadJob.java
  29. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceAdvertisePlanMapper.xml
  30. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceAdvertiserMapper.xml
  31. 2 2
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceAudiencePackageMapper.xml
  32. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceCampaignMapper.xml
  33. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceCreativeMapper.xml
  34. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceCreativeMaterialMapper.xml
  35. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceVideoInfoMapper.xml
  36. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/BytedanceEffectVideoInfoMapper.xml
  37. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/BytedanceImageInfoMapper.xml
  38. 38 38
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/report/mapper/xml/BytedanceCreativeDailyReportMapper.xml
  39. 2 2
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.yml

+ 13 - 6
xxl-job-admin/src/main/resources/application.properties

@@ -22,15 +22,22 @@ spring.freemarker.settings.number_format=0.##########
 mybatis.mapper-locations=classpath:/mybatis-mapper/*Mapper.xml
 #mybatis.type-aliases-package=com.xxl.job.admin.core.model
 
-### xxl-job, datasource
-spring.datasource.url=jdbc:mysql://139.186.27.96:3306/xxl-job-bytedance-test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
-spring.datasource.username=hcst
-spring.datasource.password=test@20190531
-#spring.datasource.url=jdbc:mysql://139.186.27.96:3306/xxl-job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
+### xxl-job, master
+#spring.datasource.url=jdbc:mysql://139.186.27.96:4000/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
+#spring.datasource.username=hcst
+#spring.datasource.password=hcst@2020
+### xxl-job, jiaoyang
+#spring.datasource.url=jdbc:mysql://139.186.27.96:4000/jiaoyang-xxl-job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
 #spring.datasource.username=hcst
-#spring.datasource.password=test@20190531
+#spring.datasource.password=hcst@2020
+#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+### xxl-job-datapull
+spring.datasource.url=jdbc:mysql://139.186.27.96:4000/datapull-xxl-job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
+spring.datasource.username=hcst
+spring.datasource.password=hcst@2020
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 
+
 ### datasource-pool
 spring.datasource.type=com.zaxxer.hikari.HikariDataSource
 spring.datasource.hikari.minimum-idle=10

+ 22 - 0
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/entity/JobDistributeInfo.java

@@ -0,0 +1,22 @@
+package com.xxl.job.executor.job.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@TableName("ctop_job_distribute_info")
+public class JobDistributeInfo implements Serializable {
+    private Long id;
+    private Long jobId;
+    private String jobType;
+    private String jobName;
+    private String mediaType;
+    private Integer status;
+    private Date createTime;
+    private Date updateTime;
+}

+ 11 - 0
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/mapper/JobDistributeInfoMapper.java

@@ -0,0 +1,11 @@
+package com.xxl.job.executor.job.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xxl.job.executor.job.entity.JobDistributeInfo;
+import com.xxl.job.executor.material.entity.ByteDanceAdvertisePlan;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+public interface JobDistributeInfoMapper extends BaseMapper<JobDistributeInfo> {
+}

+ 4 - 0
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/mapper/xml/JobDistributeInfoMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xxl.job.executor.job.mapper.JobDistributeInfoMapper">
+</mapper>

+ 10 - 0
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/service/IJobDistributeInfoService.java

@@ -0,0 +1,10 @@
+package com.xxl.job.executor.job.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xxl.job.executor.job.entity.JobDistributeInfo;
+
+import java.util.List;
+
+public interface IJobDistributeInfoService extends IService<JobDistributeInfo> {
+    List<JobDistributeInfo> selectByParams(String jobType, String mediaType);
+}

+ 26 - 0
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/job/service/impl/JobDistributeInfoServiceImpl.java

@@ -0,0 +1,26 @@
+package com.xxl.job.executor.job.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.executor.job.entity.JobDistributeInfo;
+import com.xxl.job.executor.job.mapper.JobDistributeInfoMapper;
+import com.xxl.job.executor.job.service.IJobDistributeInfoService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class JobDistributeInfoServiceImpl extends ServiceImpl<JobDistributeInfoMapper, JobDistributeInfo> implements IJobDistributeInfoService {
+    @Override
+    public List<JobDistributeInfo> selectByParams(String jobType, String mediaType) {
+        QueryWrapper<JobDistributeInfo>queryWrapper = new QueryWrapper<>();
+        if(null!=jobType&&!"".equals(jobType.trim())){
+            queryWrapper.eq("job_type",jobType);
+        }
+        if(null!=mediaType&&!"".equals(mediaType.trim())){
+            queryWrapper.eq("media_type",mediaType);
+        }
+        queryWrapper.eq("status",1);
+        return this.list(queryWrapper);
+    }
+}

+ 0 - 33
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/ByteDanceCleanMaterialJob.java

@@ -1,33 +0,0 @@
-package com.xxl.job.executor.jobhandler;
-
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import com.xxl.job.executor.report.service.IBytedanceCreativeDailyReportService;
-import com.xxl.job.executor.utils.Check;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 清洗素材报表
- *
- * @author 宋英豪
- */
-@Component
-public class ByteDanceCleanMaterialJob {
-    @Autowired
-    private IBytedanceCreativeDailyReportService creativeDailyReportService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(3);
-
-    @XxlJob("byteDanceCleanMaterial")
-    public void execute() throws Exception {
-        List<String> signatureList = creativeDailyReportService.getSignatureList();
-        if (Check.isNull(signatureList)) {
-            XxlJobHelper.log("头条素材数据获取为空");
-        }
-        signatureList.forEach(signature -> executorService.submit(() -> creativeDailyReportService.calculationMaterialReport(signature)));
-    }
-}

+ 2 - 2
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/ByteDanceVideoReportJob.java

@@ -15,12 +15,12 @@ import java.util.Date;
  * @author sunzhen
  */
 @Component
-public class ByteDanceVideoReportJob {
+public class ByteDanceVideoReportETLJob {
     @Autowired
     private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
 
     @XxlJob("byteDanceVideoReport")
-    public void execute() throws Exception {
+    public void execute() {
         String getDate2 = DateUtils.formatDate(DateUtils.addDay(new Date(), -2));
         XxlJobHelper.log("头条视频报表清洗数据定时任务开始, 执行时间为:" + getDate2);
         byteDanceVideoReportDailyService.videoInfoList(getDate2, getDate2);

+ 13 - 16
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceAdvertiserDailyReportLoadJob.java

@@ -27,28 +27,25 @@ public class BytedanceAdvertiserDailyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);;
 
     @XxlJob("bytedanceAdvertiserDailyReport")
-    public void execute() throws Exception {
+    public void execute() {
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
         XxlJobHelper.log("头条广告主日报获取任务执行开始");
         Date getDate = DateUtils.addDay(new Date(), -1);
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("定时获取头条数据异常:为获取到可用的token");
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
         }
-        CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> executorService.submit(() -> {
-            try {
-                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            } catch (Exception e) {
-                e.printStackTrace();
-            } finally {
-                countDownLatch.countDown();
-            }
-        }));
-        countDownLatch.await();
+        reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         XxlJobHelper.log("头条广告主日报获取任务执行结束");
     }
 

+ 21 - 13
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceAdvertiserHourlyReportLoadJob.java

@@ -25,23 +25,31 @@ public class BytedanceAdvertiserHourlyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(4);
 
     @XxlJob("bytedanceAdvertiserHourlyReport")
-    public void execute() throws Exception {
-        XxlJobHelper.log("头条时报数据获取开始");
+    public void execute(){
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        XxlJobHelper.log("头条广告主时报数据获取开始");
         Date getDate = new Date();
         String hour = DateUtils.getNowHour(getDate);
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        tokens.forEach(token -> executorService.submit(() -> {
-            if ("00".equals(hour)) {
-                Date finalGetDate = DateUtils.addDay(getDate, -1);
-                //获取广告主信息数据
-                reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-            }
-            reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-        }));
-        XxlJobHelper.log("头条时报数据获取结束");
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
+        }
+        if ("00".equals(hour)) {
+            Date finalGetDate = DateUtils.addDay(getDate, -1);
+            //获取广告主信息数据
+            reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        }
+        reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        XxlJobHelper.log("头条广告主({})时报数据获取结束",param);
     }
 }

+ 23 - 14
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceAdvertisingDataLoadJob.java

@@ -33,24 +33,33 @@ public class BytedanceAdvertisingDataLoadJob {
     private IByteDanceCreativeService creativeService;
 
     @XxlJob("bytedanceAdvertisingData")
-    public void execute() throws Exception {
+    public void execute() {
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
+        }
         Date getDate = new Date();
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         String dateString = dateFormat.format(getDate);
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        tokens.forEach(token -> executorService.submit(() -> {
-            try {
-                //1:获取当日广告组数据
-                campaignService.getAdvertiserCampaign(token, null, dateString);
-                //2:获取当日广告计划数据
-                advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
-                //3:获取当日创意数据
-                creativeService.getAdvertiserCreative(token, "", dateString);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }));
+        try {
+            //1:获取当日广告组数据
+            campaignService.getAdvertiserCampaign(token, null, dateString);
+            //2:获取当日广告计划数据
+            advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
+            //3:获取当日创意数据
+            creativeService.getAdvertiserCreative(token, "", dateString);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         XxlJobHelper.log("物料数据同步完成");
     }
 }

+ 16 - 17
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceCampaignDailyReportLoadJob.java

@@ -22,25 +22,24 @@ public class BytedanceCampaignDailyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("bytedanceCampaignDailyReport")
-    public void execute() throws Exception {
-        XxlJobHelper.log("头条广告组日报获取任务执行开始");
+    public void execute(){
         Date getDate = DateUtils.addDay(new Date(), -1);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> executorService.submit(() -> {
-            try {
-                reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            } catch (Exception e) {
-                e.printStackTrace();
-            } finally {
-                countDownLatch.countDown();
-            }
-        }));
-        countDownLatch.await();
-        XxlJobHelper.log("头条广告组日报获取任务执行结束");
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        XxlJobHelper.log("头条广告组日报获取任务执行开始(账户id:{})",param);
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
+        }
+        reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        XxlJobHelper.log("头条广告组日报获取任务执行结束(账户id:{})",param);
     }
 }

+ 19 - 15
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceCampaignHourlyReportLoadJob.java

@@ -21,26 +21,30 @@ public class BytedanceCampaignHourlyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(4);
 
     @XxlJob("bytedanceCampaignHourlyReport")
-    public void execute() throws Exception {
-        XxlJobHelper.log("头条广告组时报数据获取开始");
+    public void execute(){
         Date getDate = new Date();
         String hour = DateUtils.getNowHour(getDate);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("定时获取头条小时数据异常:未获取到可用的token");
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
         }
-        tokens.forEach(token -> executorService.submit(() -> {
-            if ("00".equals(hour)) {
-                Date finalGetDate = DateUtils.addDay(getDate, -1);
-                //获取广告主信息数据
-                reportService.getAdvertiserCampaignReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-            }
-            reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-        }));
+        XxlJobHelper.log("头条广告组时报获取任务执行开始(账户id:{})",param);
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
+        }
+        if ("00".equals(hour)) {
+            Date yesterday = DateUtils.addDay(getDate, -1);
+            //获取广告主信息数据
+            reportService.getAdvertiserCampaignReport(token, yesterday, yesterday, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        }
+        reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
         XxlJobHelper.log("头条广告组时报数据获取结束");
     }
 }

+ 15 - 8
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceCreativeDailyReportLoadJob.java

@@ -26,17 +26,24 @@ public class BytedanceCreativeDailyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("bytedanceCreativeDailyReport")
-    public void execute() throws Exception {
-        Date getDate = DateUtils.addDay(new Date(), -1);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("定时获取头条数据异常:为获取到可用的token");
+    public void execute(){
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        XxlJobHelper.log("头条广告组时报获取任务执行开始(账户id:{})",param);
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
         }
-        tokens.forEach(token -> executorService.submit(() -> reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY)));
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
     }
 
 

+ 21 - 16
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceCreativeHourlyReportLoadJob.java

@@ -25,26 +25,31 @@ public class BytedanceCreativeHourlyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(4);
 
     @XxlJob("bytedanceCreativeHourlyReport")
-    public void execute() throws Exception {
-        XxlJobHelper.log("头条时报数据获取开始");
+    public void execute(){
+        XxlJobHelper.log("头条创意时报数据获取开始");
         Date now = new Date();
         String hour = DateUtils.getNowHour(now);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("定时获取头条小时数据异常:未获取到可用的token");
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
         }
-        tokens.forEach(token -> executorService.submit(() -> {
-            if ("00".equals(hour)) {
-                Date finalGetDate = DateUtils.addDay(now, -1);
-                //获取广告创意信息数据
-                reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-            }
-            reportService.getAdvertiserCreativeReport(token, now, now, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-        }));
-        XxlJobHelper.log("头条时报数据获取结束");
+        XxlJobHelper.log("头条创意时报获取任务执行开始(账户id:{})",param);
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
+        }
+        if ("00".equals(hour)) {
+            Date finalGetDate = DateUtils.addDay(now, -1);
+            //获取广告创意信息数据
+            reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        }
+        reportService.getAdvertiserCreativeReport(token, now, now, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        XxlJobHelper.log("头条创意时报数据获取结束(账户id:{})",param);
     }
 }

+ 18 - 38
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceDailyMaterialReportJob.java

@@ -18,57 +18,37 @@ import java.util.concurrent.Executors;
 
 @Component
 public class BytedanceDailyMaterialReportJob {
-
-    static ExecutorService executorService = Executors.newFixedThreadPool(4);
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IBytedanceReportService bytedanceReportService;
-    @Autowired
-    private IByteDanceVideoReportDailyService videoReportDailyService;
-
 
     @XxlJob("bytedanceDailyMaterialReportJob")
-    public void execute() throws Exception {
-        Date getDate2 = DateUtils.addDay(new Date(), -2);
-        String date2 = DateUtils.formatDate(getDate2);
+    public void execute() {
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        XxlJobHelper.log("头条广告组时报获取任务执行开始(账户id:{})",param);
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
+        }
         Long start = System.currentTimeMillis();
         Date getDate = DateUtils.addDay(new Date(), -1);
         String date = DateUtils.formatDate(getDate);
-        XxlJobHelper.log("头条获取素材报表数据任务开始,任务时间:" + date2 + "~" + date);
-
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
-
-        tokens.forEach(token -> executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        //获取头条素材报表两天前的数据
-                        XxlJobHelper.log("账户"+token.getAccountId() + "素材报表数据任务开始,任务时间:" + date + "~" + date2);
-                        bytedanceReportService.bytedanceMaterialReport(token, date2, date2);
-                        bytedanceReportService.bytedanceMaterialReport(token, date, date);
-                        //获取头条素材报表数据
-                        bytedanceReportService.bytedanceVideoMaterialReport(token, date2, date2);
-                        bytedanceReportService.bytedanceVideoMaterialReport(token, date, date);
-                        XxlJobHelper.log("账户"+token.getAccountId() + "素材报表数据任务完成,任务时间:" + date + "~" + date2);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        countDownLatch.countDown();
-                    }
-                }
-            }));
-
+        XxlJobHelper.log("头条获取素材报表数据任务开始,任务时间:"+ date);
         try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
+            //获取头条素材报表两天前的数据
+            bytedanceReportService.bytedanceMaterialReport(token, date, date);
+        } catch (Exception e) {
             e.printStackTrace();
         }
         Long end = System.currentTimeMillis();
         XxlJobHelper.log("头条素材数据获取耗时:{}毫秒", end - start);
-
-        videoReportDailyService.videoInfoList(date, date);
-        videoReportDailyService.videoInfoList(date2, date2);
     }
 }

+ 1 - 11
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceDailyMaterialReportRetryJob.java

@@ -47,20 +47,10 @@ public class BytedanceDailyMaterialReportRetryJob {
                             start = DateUtils.addDay(startDate, i);
                             end = start;
                             //获取头条素材报表数据
-                            int code = bytedanceReportService.bytedanceMaterialReportRetry(type, token, start, end);
-                            XxlJobHelper.log("头条素材报表重试定时任务完成,当前accountId为:" + token.getAccountId() + "code:" + code);
-                            if (code == 200 || code == 1) {
-                                if (type == 1) {
-                                    XxlJobHelper.log("头条素材报表重试定时任务清洗数据开始,当前accountId为:" + token.getAccountId());
-                                    //重试成功清洗数据
-                                    byteDanceVideoReportDailyService.videoInfoListByAccountId(start, end, accountId);
-                                    XxlJobHelper.log("头条素材报表重试定时任务清洗数据完成,当前accountId为:" + token.getAccountId());
-                                }
-                            }
+                            bytedanceReportService.bytedanceMaterialReportRetry(type, token, start, end);
                         }
                     } catch (Exception e) {
                         e.printStackTrace();
-                    } finally {
                     }
                 }
             });

+ 18 - 32
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceDailyPlayableReportJob.java

@@ -24,42 +24,28 @@ public class BytedanceDailyPlayableReportJob {
     private IBytedanceInterfaceService bytedanceInterfaceService;
 
     @XxlJob("bytedanceDailyPlayableReportJob")
-    public void execute() throws Exception {
-        Date getDate2 = DateUtils.addDay(new Date(), -2);
-        String date2 = DateUtils.formatDate(getDate2);
+    public void execute() {
+        String param = XxlJobHelper.getJobParam();
+        if (param == null || param.trim().length() == 0) {
+            XxlJobHelper.log("param[" + param + "] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在", param);
+            XxlJobHelper.handleFail();
+            return;
+        }
 
         Date getDate = DateUtils.addDay(new Date(), -1);
         String date = DateUtils.formatDate(getDate);
-        XxlJobHelper.log("头条获取试玩报表数据任务开始,任务时间:" + date2 + "~" + date);
+        XxlJobHelper.log("头条获取试玩报表数据任务开始,任务时间:" + date);
 
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        if (null == tokens || tokens.size() <= 0) {
-            XxlJobHelper.log("头条获取试玩报表数据任务执行失败:未获取到可用的token");
+        try {
+            bytedanceInterfaceService.bytedancePlayableReport(token, date, date);
+        } catch (Exception e) {
+            e.printStackTrace();
         }
-
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        //获取头条素材报表两天前的数据
-                        XxlJobHelper.log("账户"+token.getAccountId() + "试玩报表数据任务开始,任务时间:" + date2 + "~" + date2);
-                        bytedanceInterfaceService.bytedancePlayableReport(token, date2, date2);
-                        XxlJobHelper.log("账户"+token.getAccountId() + "试玩报表数据任务完成,任务时间:" + date2 + "~" + date2);
-
-                        //获取头条素材报表数据
-                        XxlJobHelper.log("账户"+token.getAccountId() + "试玩报表数据任务开始,任务时间:" + date + "~" + date);
-                        bytedanceInterfaceService.bytedancePlayableReport(token, date, date);
-                        XxlJobHelper.log("账户"+token.getAccountId() + "试玩报表数据任务完成,任务时间:" + date + "~" + date);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                    }
-                }
-            });
-        });
     }
-
-
-
 }

+ 52 - 0
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceDistributeJob.java

@@ -0,0 +1,52 @@
+package com.xxl.job.executor.jobhandler;
+
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import com.xxl.job.executor.common.service.ICtopOauthTokenService;
+import com.xxl.job.executor.job.entity.JobDistributeInfo;
+import com.xxl.job.executor.job.service.IJobDistributeInfoService;
+import com.xxl.job.executor.utils.HttpUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Component
+public class BytedanceDistributeJob {
+    @Autowired
+    private IJobDistributeInfoService jobDistributeInfoService;
+    String URLPREFIX = "http://139.186.29.76:8090/xxl-job-admin/jobinfo/trigger?id=";
+    String EXECUTORPARAM = "&executorParam=";
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @XxlJob("bytedanceDistributeDailyJob")
+    public void bytedanceDistributeDailyJob(){
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if(null!=tokens&&!tokens.isEmpty()){
+            List<JobDistributeInfo>distributeInfos = jobDistributeInfoService.selectByParams("DAILY","BYTEDANCE");
+            if(null!=distributeInfos&&!distributeInfos.isEmpty()){
+                tokens.forEach(token->
+                    distributeInfos.forEach(distributeInfo->{
+                        String url = URLPREFIX+distributeInfo.getJobId()+EXECUTORPARAM+token.getAccountId();
+                        HttpUtils.httpGet(url,new HashMap<>(),new HashMap<>());
+                    }));
+            }
+        }
+    }
+
+    @XxlJob("bytedanceDistributeHourlyJob")
+    public void bytedanceDistributeHourlyJob(){
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if(null!=tokens&&!tokens.isEmpty()){
+            List<JobDistributeInfo>distributeInfos = jobDistributeInfoService.selectByParams("HOURLY","BYTEDANCE");
+            if(null!=distributeInfos&&!distributeInfos.isEmpty()){
+                tokens.forEach(token->
+                        distributeInfos.forEach(distributeInfo->{
+                            String url = URLPREFIX+distributeInfo.getJobId()+EXECUTORPARAM+token.getAccountId();
+                            HttpUtils.httpGet(url,new HashMap<>(),new HashMap<>());
+                        }));
+            }
+        }
+    }
+}

+ 14 - 6
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceFlowFundJob.java

@@ -22,14 +22,22 @@ public class BytedanceFlowFundJob {
     private IBytedanceFundDailyService bytedanceFundDailyService;
     static ExecutorService executorService = Executors.newFixedThreadPool(4);
     @XxlJob("bytedanceFlowFund")
-    public void execute() throws Exception {
+    public void execute(){
+        String param = XxlJobHelper.getJobParam();
+        if (param == null || param.trim().length() == 0) {
+            XxlJobHelper.log("param[" + param + "] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在", param);
+            XxlJobHelper.handleFail();
+            return;
+        }
         XxlJobHelper.log("头条账户流水数据获取开始");
         Date getDate = new Date();
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("头条账户流水数据异常:未获取到可用的token");
-        }
-        tokens.forEach(token -> executorService.submit(() -> bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(getDate), DateUtils.formatDate(getDate),1)));
+        bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(getDate), DateUtils.formatDate(getDate),1);
         XxlJobHelper.log("头条账户流水数据获取结束");
     }
 }

+ 13 - 24
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceMaterialsLoadJob.java

@@ -17,36 +17,25 @@ import java.util.concurrent.Executors;
 public class BytedanceMaterialsLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(4);
-    //线程计数器
-    static CountDownLatch countDownLatch = null;
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
 
     @XxlJob("bytedanceMaterialsLoadJob")
     public void execute() throws Exception{
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        //获取全量视频素材数据
-                        advertiserDataService.getMaterialList(token);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        countDownLatch.countDown();
-                    }
-                }
-            });
-        });
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
+        String param = XxlJobHelper.getJobParam();
+        if (param == null || param.trim().length() == 0) {
+            XxlJobHelper.log("param[" + param + "] invalid.");
+            XxlJobHelper.handleFail();
+            return;
         }
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在", param);
+            XxlJobHelper.handleFail();
+            return;
+        }
+        //获取全量视频素材数据
+        advertiserDataService.getMaterialList(token);
         XxlJobHelper.log("物料数据同步完成");
     }
 }

+ 34 - 0
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanDailyReportETLJob.java

@@ -0,0 +1,34 @@
+package com.xxl.job.executor.jobhandler;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.executor.common.entity.CtopOauthToken;
+import com.xxl.job.executor.common.entity.UserAllocation;
+import com.xxl.job.executor.common.service.IUserAllocationService;
+import com.xxl.job.executor.report.entity.BytedancePlanDailyReport;
+import com.xxl.job.executor.report.service.IBytedancePlanDailyReportService;
+import com.xxl.job.executor.utils.CtopAdConstant;
+import com.xxl.job.executor.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Component
+public class BytedancePlanDailyReportETLJob {
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
+    @XxlJob("bytedancePlanDailyReportETLJob")
+    public void execute() {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        planDailyReportService.cleanChannelCodeData(112, getDate);
+        planDailyReportService.cleanChannelCodeData(113, getDate);
+        planDailyReportService.cleanChannelCodeData(222, getDate);
+        planDailyReportService.cleanYzData(151);
+        planDailyReportService.cleanChannelCodeData(235, getDate);
+        planDailyReportService.cleanChannelCodeData(270, getDate);
+    }
+}

+ 16 - 69
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanDailyReportLoadJob.java

@@ -28,80 +28,27 @@ public class BytedancePlanDailyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    @Autowired
-    private IUserAllocationService userAllocationService;
-    @Autowired
-    private IBytedancePlanDailyReportService planDailyReportService;
-
 
     @XxlJob("bytedancePlanDailyReport")
-    public void execute() throws Exception {
+    public void execute() {
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        XxlJobHelper.log("头条广告组时报获取任务执行开始(账户id:{})",param);
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
+        }
         Date getDate = DateUtils.addDay(new Date(), -1);
         //次留用
         Date getDate2 = DateUtils.addDay(new Date(), -2);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("定时获取头条数据异常:为获取到可用的token");
-        }
-        tokens.forEach(token -> reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY));
-        formatZybData(215, getDate);
-        planDailyReportService.cleanChannelCodeData(112, getDate);
-        planDailyReportService.cleanChannelCodeData(113, getDate);
-        planDailyReportService.cleanChannelCodeData(222, getDate);
-        planDailyReportService.cleanYzData(151);
-        planDailyReportService.cleanChannelCodeData(235, getDate);
-        planDailyReportService.cleanChannelCodeData(270, getDate);
-
+        reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         //跑次留
-        tokens.forEach(token -> reportService.getAdvertiserPlanReport(token, getDate2, getDate2, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY));
-    }
-
-    private void formatZybData(Integer projectId, Date getDate) {
-        //清洗关于作业帮数据
-        //1:查询作业帮相关的用户数据
-        QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
-        wrapper.eq("project_id", projectId);
-        List<UserAllocation> allocations = userAllocationService.list(wrapper);
-        if (null != allocations && !allocations.isEmpty()) {
-            allocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(getDate) + " 00:00:00";
-                queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                        .eq("stat_datetime", dateString)
-                ;
-                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if (null != bytedancePlanDailyReports && !bytedancePlanDailyReports.isEmpty()) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setAdsense(tags[1]);
-                        report.setPlanCode(tags[2]);
-                        String materialName = tags[3];
-                        report.setMaterialName(materialName);
-                        if (materialName.contains("其他")) {
-                            report.setMaterialType("其他");
-                        } else if (materialName.contains("图片轮播")) {
-                            report.setMaterialType("图片轮播");
-                        } else if (materialName.contains("大字报")) {
-                            report.setMaterialType("大字报");
-                        } else if (materialName.contains("文字动画")) {
-                            report.setMaterialType("文字动画");
-                        } else if (materialName.contains("采访形式")) {
-                            report.setMaterialType("采访形式");
-                        } else if (materialName.contains("剧情")) {
-                            report.setMaterialType("剧情");
-                        } else if (materialName.contains("口播")) {
-                            report.setMaterialType("口播");
-                        } else {
-                            report.setMaterialType("其他");
-                        }
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
+        reportService.getAdvertiserPlanReport(token, getDate2, getDate2, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
     }
 }

+ 30 - 0
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanHourlyReportETLJob.java

@@ -0,0 +1,30 @@
+package com.xxl.job.executor.jobhandler;
+
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.executor.report.service.IBytedancePlanDailyReportService;
+import com.xxl.job.executor.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Component
+public class BytedancePlanHourlyReportETLJob {
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
+
+    @XxlJob("bytedancePlanHourlyReportETLJob")
+    public void execute() {
+        Date getDate = new Date();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
+        String hour = simpleDateFormat.format(getDate);
+        if ("00".equals(hour)) {
+            Date lastday = DateUtils.addDay(getDate, -1);
+            planDailyReportService.cleanYddHourlyChannelCode(419, lastday);
+        }
+        planDailyReportService.cleanYddHourlyChannelCode(419, getDate);
+        XxlJobHelper.log("头条时报数据获取结束");
+    }
+}

+ 16 - 34
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanHourlyReportLoadJob.java

@@ -28,49 +28,31 @@ public class BytedancePlanHourlyReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    @Autowired
-    private IBytedancePlanDailyReportService planDailyReportService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
-    //线程计数器
-    static CountDownLatch countDownLatch = null;
-
 
     @XxlJob("bytedancePlanHourlyReport")
     public void execute() {
-        XxlJobHelper.log("头条时报数据获取开始");
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            XxlJobHelper.log("param["+ param +"] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        XxlJobHelper.log("头条广告组时报获取任务执行开始(账户id:{})",param);
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在",param);
+            XxlJobHelper.handleFail();
+            return;
+        }
         Date getDate = new Date();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         String hour = simpleDateFormat.format(getDate);
-        //1:查询当日计划时报数据
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> executorService.submit(() -> {
-                try {
-                    if (null != hour && "00".equals(hour)) {
-                        Date finalGetDate = DateUtils.addDay(getDate, -1);
-                        reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                    }
-                    reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                } catch (Exception e) {
-                    XxlJobHelper.log(e.getMessage());
-                } finally {
-                    countDownLatch.countDown();
-                }
-        }));
 
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            XxlJobHelper.log(e.getMessage());
-        }
-        //清洗缘多多数据渠道号
         if ("00".equals(hour)) {
-            Date lastday = DateUtils.addDay(getDate, -1);
-            planDailyReportService.cleanYddHourlyChannelCode(113, lastday);
-            planDailyReportService.cleanYddHourlyChannelCode(419, lastday);
+            Date finalGetDate = DateUtils.addDay(getDate, -1);
+            reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
         }
-        planDailyReportService.cleanYddHourlyChannelCode(113, getDate);
-        planDailyReportService.cleanYddHourlyChannelCode(419, getDate);
+        reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
         XxlJobHelper.log("头条时报数据获取结束");
     }
 }

+ 14 - 14
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanLoadJob.java

@@ -19,22 +19,22 @@ public class BytedancePlanLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(4);
-    static CountDownLatch countDownLatch = null;
 
     @XxlJob("bytedancePlanLoadJob")
-    public void execute() throws Exception {
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> executorService.submit(() -> {
-            try {
-                advertiserDataService.getAdvertiserPlan(token, "", null, null);
-            }catch (Exception e){
-            }finally {
-                countDownLatch.countDown();
-            }
-        }));
-        countDownLatch.await();
+    public void execute(){
+        String param = XxlJobHelper.getJobParam();
+        if (param == null || param.trim().length() == 0) {
+            XxlJobHelper.log("param[" + param + "] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在", param);
+            XxlJobHelper.handleFail();
+            return;
+        }
+        advertiserDataService.getAdvertiserPlan(token, "", null, null);
         XxlJobHelper.log("头条全量计划数据获取完成");
     }
 }

+ 0 - 2
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedancePlanRealTimeLoadJob.java

@@ -34,6 +34,4 @@ public class BytedancePlanRealTimeLoadJob {
         tokens.forEach(token -> executorService.submit(() -> advertiserDataService.getAdvertiserPlan(token, "", nowDate, nowDate)));
         XxlJobHelper.log("头条当日计划数据获取完成");
     }
-
-
 }

+ 15 - 4
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/jobhandler/BytedanceSameDayCreativeLoadJob.java

@@ -1,5 +1,6 @@
 package com.xxl.job.executor.jobhandler;
 
+import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.executor.common.entity.CtopOauthToken;
 import com.xxl.job.executor.common.service.ICtopOauthTokenService;
@@ -18,13 +19,23 @@ import java.util.concurrent.Executors;
 public class BytedanceSameDayCreativeLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(6);
     @Autowired
     private IByteDanceCreativeService byteDanceCreativeService;
     @XxlJob("bytedanceSameDayCreative")
-    public void execute() throws Exception {
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+    public void execute(){
+        String param = XxlJobHelper.getJobParam();
+        if (param == null || param.trim().length() == 0) {
+            XxlJobHelper.log("param[" + param + "] invalid.");
+            XxlJobHelper.handleFail();
+            return;
+        }
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(param);
+        if (null == token) {
+            XxlJobHelper.log("获取头条token数据异常:账户{}token不存在", param);
+            XxlJobHelper.handleFail();
+            return;
+        }
         String getDateStr = DateUtils.formatDate(new Date());
-        tokens.forEach(token -> executorService.submit(() -> byteDanceCreativeService.getAdvertiserCreative(token, null,getDateStr)));
+        byteDanceCreativeService.getAdvertiserCreative(token, null,getDateStr);
     }
 }

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceAdvertisePlanMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.ByteDanceAdvertisePlanMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.ByteDanceAdvertisePlanMapper">
 
     <select id="selectWarningGroup" resultType="java.lang.String">
    SELECT

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceAdvertiserMapper.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.ByteDanceAdvertiserMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.ByteDanceAdvertiserMapper">
 
 </mapper>

+ 2 - 2
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceAudiencePackageMapper.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.ByteDanceAudiencePackageMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.ByteDanceAudiencePackageMapper">
 
-</mapper>
+</mapper>

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceCampaignMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.ByteDanceCampaignMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.ByteDanceCampaignMapper">
 
     <insert id="replaceBatch">
         replace into ctop_bytedance_campaign(

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceCreativeMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.ByteDanceCreativeMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.ByteDanceCreativeMapper">
     <insert id="replaceBatch">
         replace into ctop_bytedance_creative(
         id,

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceCreativeMaterialMapper.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.ByteDanceCreativeMaterialMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.ByteDanceCreativeMaterialMapper">
 
 </mapper>

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/ByteDanceVideoInfoMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.ByteDanceVideoInfoMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.ByteDanceVideoInfoMapper">
     <insert id="replaceBatch">
         replace into ctop_bytedance_video_info(
         id,

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/BytedanceEffectVideoInfoMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.BytedanceEffectVideoInfoMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.BytedanceEffectVideoInfoMapper">
 
     <update id="updateTotalCost">
         update

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/material/mapper/xml/BytedanceImageInfoMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.BytedanceImageInfoMapper">
+<mapper namespace="com.xxl.job.executor.material.mapper.BytedanceImageInfoMapper">
 
     <insert id="replaceBatch">
         replace into ctop_bytedance_image_info(

+ 38 - 38
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/report/mapper/xml/BytedanceCreativeDailyReportMapper.xml

@@ -4,25 +4,25 @@
     <select id="bytedanceCreativeDailyReport" parameterType="Map"
             resultType="com.xxl.job.executor.report.entity.BytedanceCreativeDailyReport">
     select
-        t2.creative_id as creativeId,  <!-- 素材id -->
-        t4.video_url as videoUrl,  <!-- 视频url -->
-        sum(t2.show_num) as showNum,  <!-- 展示量 -->
-        sum(t2.click) as click,  <!-- 点击量 -->
-        sum(t2.convert_num) as convertNum,  <!-- 转化量 -->
-        sum(t2.cost) as cost,  <!-- 总花费 -->
-        sum(t2.active) as active, <!-- 应用下载-激活 -->
-        sum(t2.download_finish) as downloadFinish,  <!-- 应用下载-安卓下载完成 -->
-        sum(t2.click_install) as clickInstall,  <!-- 应用下载-点击安装数 -->
-        sum(t2.in_app_pay) as inAppPay, <!-- 应用下载-付费 -->
-        sum(t2.total_play) as totalPlay, <!-- 视频-总播放 -->
-        sum(t2.valid_play) as validPlay, <!-- 视频-有效播放 -->
-        sum(t2.wifi_play) as wifiPlay, <!-- 视频-wifi播放 -->
-        sum(t2.play100_feed_break) as play100FeedBreak,  <!-- 视频-播放100%进度总数 -->
-        sum(t2.play75_feed_break) as play75FeedBreak,  <!-- 视频-播放75%进度总数 -->
-        sum(t2.comment) as comment,  <!-- 互动数据-评论数 -->
-        AVG(t2.next_day_open) as nextDayOpen,  <!-- 次留数 -->
-        AVG(t2.next_day_open_rate) as nextDayOpenRate,  <!-- 次留率 -->
-        AVG(t2.next_day_open_cost) as nextDayOpenCost  <!-- 次留成本 -->
+        t2.creative_id as creativeId,
+        t4.video_url as videoUrl,
+        sum(t2.show_num) as showNum,
+        sum(t2.click) as click,
+        sum(t2.convert_num) as convertNum,
+        sum(t2.cost) as cost,
+        sum(t2.active) as active,
+        sum(t2.download_finish) as downloadFinish,
+        sum(t2.click_install) as clickInstall,
+        sum(t2.in_app_pay) as inAppPay,
+        sum(t2.total_play) as totalPlay,
+        sum(t2.valid_play) as validPlay,
+        sum(t2.wifi_play) as wifiPlay,
+        sum(t2.play100_feed_break) as play100FeedBreak,
+        sum(t2.play75_feed_break) as play75FeedBreak,
+        sum(t2.comment) as comment,
+        AVG(t2.next_day_open) as nextDayOpen,
+        AVG(t2.next_day_open_rate) as nextDayOpenRate,
+        AVG(t2.next_day_open_cost) as nextDayOpenCost
         from
         ctop_user_allocation t1
         left join ctop_bytedance_report_creative_daily t2 on t1.account_id = t2.advertiser_id
@@ -49,25 +49,25 @@
     <select id="bytedanceCreativeAccountReport" parameterType="Map"
             resultType="com.xxl.job.executor.report.entity.BytedanceCreativeDailyReport">
         select
-        t2.creative_id as creativeId,  <!-- 素材id -->
-        t4.video_url as videoUrl,  <!-- 视频url -->
-        sum(t2.show_num) as showNum,  <!-- 展示量 -->
-        sum(t2.click) as click,  <!-- 点击量 -->
-        sum(t2.convert_num) as convertNum,  <!-- 转化量 -->
-        sum(t2.cost) as cost,  <!-- 总花费 -->
-        sum(t2.active) as active, <!-- 应用下载-激活 -->
-        sum(t2.download_finish) as downloadFinish,  <!-- 应用下载-安卓下载完成 -->
-        sum(t2.click_install) as clickInstall,  <!-- 应用下载-点击安装数 -->
-        sum(t2.in_app_pay) as inAppPay, <!-- 应用下载-付费 -->
-        sum(t2.total_play) as totalPlay, <!-- 视频-总播放 -->
-        sum(t2.valid_play) as validPlay, <!-- 视频-有效播放 -->
-        sum(t2.wifi_play) as wifiPlay, <!-- 视频-wifi播放 -->
-        sum(t2.play100_feed_break) as play100FeedBreak,  <!-- 视频-播放100%进度总数 -->
-        sum(t2.play75_feed_break) as play75FeedBreak,  <!-- 视频-播放75%进度总数 -->
-        sum(t2.comment) as comment,  <!-- 互动数据-评论数 -->
-        AVG(t2.next_day_open) as nextDayOpen,  <!-- 次留数 -->
-        AVG(t2.next_day_open_rate) as nextDayOpenRate,  <!-- 次留率 -->
-        AVG(t2.next_day_open_cost) as nextDayOpenCost  <!-- 次留成本 -->
+        t2.creative_id as creativeId,
+        t4.video_url as videoUrl,
+        sum(t2.show_num) as showNum,
+        sum(t2.click) as click,
+        sum(t2.convert_num) as convertNum,
+        sum(t2.cost) as cost,
+        sum(t2.active) as active,
+        sum(t2.download_finish) as downloadFinish,
+        sum(t2.click_install) as clickInstall,
+        sum(t2.in_app_pay) as inAppPay,
+        sum(t2.total_play) as totalPlay,
+        sum(t2.valid_play) as validPlay,
+        sum(t2.wifi_play) as wifiPlay,
+        sum(t2.play100_feed_break) as play100FeedBreak,
+        sum(t2.play75_feed_break) as play75FeedBreak,
+        sum(t2.comment) as comment,
+        AVG(t2.next_day_open) as nextDayOpen,
+        AVG(t2.next_day_open_rate) as nextDayOpenRate,
+        AVG(t2.next_day_open_cost) as nextDayOpenCost
         from
         ctop_user_allocation t1
         left join ctop_bytedance_report_creative_daily t2 on t1.account_id = t2.advertiser_id

+ 2 - 2
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.yml

@@ -97,14 +97,14 @@ xxl:
   job:
     accessToken:
     executor:
-      appname: module-job-bytedance-test
+      appname: datapull-job-bytedance
       port: 9998
       ip:
       logpath: /data/applogs/xxl-job/jobhandler
       logretentiondays: 30
       address:
     admin:
-      addresses: http://129.28.197.250:8090/xxl-job-admin
+      addresses: http://139.186.29.76:8090/xxl-job-admin/
 #      addresses: http://127.0.0.1:8090/xxl-job-admin
 #mybatis plus 设置
 mybatis-plus: