Procházet zdrojové kódy

修改代码格式

syh před 5 roky
rodič
revize
bf76c40ebb

+ 12 - 14
xxl-job-executor/src/main/java/com/xxl/job/executor/handler/bytedance/BytedancePlanHourlyReportLoadJob.java

@@ -5,11 +5,10 @@ import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanDailyReportService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.text.SimpleDateFormat;
@@ -24,7 +23,7 @@ import java.util.concurrent.Executors;
  * 头条计划时报数据任务
  */
 @Slf4j
-public class BytedancePlanHourlyReportLoadJob implements Job {
+public class BytedancePlanHourlyReportLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
@@ -36,9 +35,9 @@ public class BytedancePlanHourlyReportLoadJob implements Job {
     static CountDownLatch countDownLatch = null;
 
 
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        log.info("头条时报数据获取开始");
+    @XxlJob("bytedancePlanHourlyReport")
+    public void execute(String param) {
+        XxlJobLogger.log("头条时报数据获取开始");
         Date getDate = new Date();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         String hour = simpleDateFormat.format(getDate);
@@ -46,8 +45,7 @@ public class BytedancePlanHourlyReportLoadJob implements Job {
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
         executorService = Executors.newFixedThreadPool(5);
         countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> {
-            executorService.submit(() -> {
+        tokens.forEach(token -> executorService.submit(() -> {
                 try {
                     if (null != hour && "00".equals(hour)) {
                         Date finalGetDate = DateUtils.addDay(getDate, -1);
@@ -55,16 +53,16 @@ public class BytedancePlanHourlyReportLoadJob implements Job {
                     }
                     reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    XxlJobLogger.log(e.getMessage());
                 } finally {
                     countDownLatch.countDown();
                 }
-            });
-        });
+        }));
+
         try {
             countDownLatch.await();
         } catch (InterruptedException e) {
-            e.printStackTrace();
+            XxlJobLogger.log(e.getMessage());
         }
         //清洗缘多多数据渠道号
         if (null != hour && "00".equals(hour)) {
@@ -73,7 +71,7 @@ public class BytedancePlanHourlyReportLoadJob implements Job {
         }
         planDailyReportService.cleanYddHourlyChannelCode(113, getDate);
 
-        log.info("头条计划时报数据获取完成");
+        XxlJobLogger.log("头条时报数据获取结束");
         executorService.shutdown();
     }
 }

+ 1 - 1
xxl-job-executor/src/main/java/com/xxl/job/executor/handler/kuaishou/KuaishouDailyReportTaskJob.java

@@ -28,7 +28,7 @@ public class KuaishouDailyReportTaskJob {
         Long start = System.currentTimeMillis();
         Date getDate = DateUtils.addDay(new Date(), -1);
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             log.info("快手获取日报数据任务执行失败:未获取到可用的token");
             return ReturnT.FAIL;
         }

+ 1 - 1
xxl-job-executor/src/main/java/com/xxl/job/executor/handler/kuaishou/KuaishouGroupJob.java

@@ -23,7 +23,7 @@ public class KuaishouGroupJob {
 
     static ExecutorService executorService = null;
 
-    @XxlJob("KuaishouGroup")
+    @XxlJob("kuaishouGroup")
     public ReturnT<String> execute(String param) throws Exception {
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         executorService = Executors.newFixedThreadPool(3);

+ 1 - 2
xxl-job-executor/src/main/java/com/xxl/job/executor/handler/kuaishou/KuaishouHourlyAccountWarningLoadJob.java

@@ -17,9 +17,8 @@ import java.util.concurrent.Executors;
 import static org.jeecg.common.util.DateUtils.getAnotherDay;
 
 /**
- * 获取广告主分时报表
  *
- * @author syh
+ * @author 于蒙
  */
 @Slf4j
 @Component

+ 1 - 1
xxl-job-executor/src/main/java/com/xxl/job/executor/handler/kuaishou/KuaishouHourlyCreativeReportLoadJob.java

@@ -31,7 +31,7 @@ public class KuaishouHourlyCreativeReportLoadJob {
 
     static ExecutorService executorService = null;
 
-    @XxlJob("KuaishouHourlyCreativeReport")
+    @XxlJob("kuaishouHourlyCreativeReport")
     public ReturnT<String> execute(String param) throws Exception {
         Date getDate = new Date();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");