浏览代码

修改定时任务

yumeng 5 年之前
父节点
当前提交
d11bba2f21

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

@@ -40,10 +40,8 @@ public class KuaishouCreativeLoadJob implements Job {
                 //增加接口的开始和结束日期
                 Date startDate = DateUtils.addDay(new Date(), -1);
                 Date endDate = new Date();
-
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-
                 executorService = Executors.newFixedThreadPool(5);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {

+ 12 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyAccountReportLoadJob.java

@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.Date;
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * 快手广告主分天数据
@@ -25,6 +27,7 @@ public class KuaishouDailyAccountReportLoadJob implements Job {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    static ExecutorService executorService = null;
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@@ -37,16 +40,19 @@ public class KuaishouDailyAccountReportLoadJob implements Job {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取头条数据异常:为获取到可用的token");
+                    log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
 
-                log.info("快手物料数据同步完成");
-
+                executorService = Executors.newFixedThreadPool(3);
                 tokens.forEach(token -> {
-                    //1: 获取广告主信息数据
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
-
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            //1: 获取广告主信息数据
+                            kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
+                        }
+                    });
                 });
             }
         };

+ 13 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyCampaignReportLoadJob.java

@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.Date;
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * 广告计划分天报表
@@ -25,6 +27,7 @@ public class KuaishouDailyCampaignReportLoadJob implements Job {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    static ExecutorService executorService = null;
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@@ -37,17 +40,19 @@ public class KuaishouDailyCampaignReportLoadJob implements Job {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取头条数据异常:为获取到可用的token");
+                    log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
-
-                log.info("快手物料数据同步完成");
-
+                executorService = Executors.newFixedThreadPool(3);
                 tokens.forEach(token -> {
-
-                    //获取广告计划信息数据
-                    kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate);
-
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            //获取广告计划信息数据
+                            kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate);
+
+                        }
+                    });
                 });
             }
         };

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

@@ -42,13 +42,10 @@ public class KuaishouDailyCreativeReportLoadJob implements Job {
                 executorService = Executors.newFixedThreadPool(4);
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取头条数据异常:为获取到可用的token");
+                    log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
-
-                log.info("快手物料数据同步完成");
-
-
+                log.info("开始分天创意报表拉去完成");
                 for (CtopOauthToken token : tokens) {
                     executorService.submit(new Runnable() {
                         @Override

+ 13 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyGroupReportLoadJob.java

@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.Date;
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * 获取广告组分天报表
@@ -25,6 +27,7 @@ public class KuaishouDailyGroupReportLoadJob implements Job {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    static ExecutorService executorService = null;
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@@ -37,17 +40,20 @@ public class KuaishouDailyGroupReportLoadJob implements Job {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取头条数据异常:为获取到可用的token");
+                    log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
 
-                log.info("快手物料数据同步完成");
-
+                log.info("快手广告租报表同步完成");
+                executorService = Executors.newFixedThreadPool(3);
                 tokens.forEach(token -> {
-
-                    //获取广告组信息数据
-                    kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getDate, getDate);
-
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            //获取广告组信息数据
+                            kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getDate, getDate);
+                        }
+                    });
                 });
             }
 

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

@@ -48,7 +48,7 @@ public class KuaishouHourlyAccountReportLoadJob implements Job {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取头条数据异常:为获取到可用的token");
+                    log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
                 executorService = Executors.newFixedThreadPool(7);

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

@@ -37,7 +37,7 @@ public class KuaishouHourlyAccountWarningLoadJob implements Job {
                 try {
                     List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                     if (null == tokens || tokens.size() <= 0) {
-                        log.info("定时获取头条数据异常:未获取到可用的token");
+                        log.info("定时获取快手数据异常:未获取到可用的token");
                         return;
                     }
                     String statDate = DateUtils.getDate("yyyy-MM-dd");

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

@@ -49,7 +49,7 @@ public class KuaishouHourlyCampaignReportLoadJob implements Job {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取头条数据异常:为获取到可用的token");
+                    log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
                 executorService = Executors.newFixedThreadPool(5);

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

@@ -48,7 +48,7 @@ public class KuaishouHourlyCreativeReportLoadJob implements Job {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取头条数据异常:为获取到可用的token");
+                    log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
                 executorService = Executors.newFixedThreadPool(3);

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

@@ -48,7 +48,7 @@ public class KuaishouHourlyGroupReportLoadJob implements Job {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取头条数据异常:为获取到可用的token");
+                    log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
                 executorService = Executors.newFixedThreadPool(5);

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

@@ -33,10 +33,8 @@ public class KuaishouMaterialsLoadJob implements Job {
                 //增加接口的开始和结束日期
                 Date startDate = DateUtils.addDay(new Date(), -1);
                 Date endDate = new Date();
-
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-
                 executorService = Executors.newFixedThreadPool(5);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {