yumeng 5 年 前
コミット
3666746254

+ 16 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyCreativeReportLoadJob.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;
 
 /**
  * 获取创意分天报表
@@ -26,6 +28,8 @@ public class KuaishouDailyCreativeReportLoadJob implements Job {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
+    static ExecutorService executorService = null;
+
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         Thread thread = new Thread() {
@@ -35,6 +39,7 @@ public class KuaishouDailyCreativeReportLoadJob implements Job {
                 kuaishouInterfaceService.deleteHourlyReport(deleteDate);
                 Date getDate = DateUtils.addDay(new Date(), -1);
                 //1:查询当日数据
+                executorService = Executors.newFixedThreadPool(3);
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取头条数据异常:为获取到可用的token");
@@ -43,11 +48,18 @@ public class KuaishouDailyCreativeReportLoadJob implements Job {
 
                 log.info("快手物料数据同步完成");
 
-                tokens.forEach(token -> {
 
-                    // 获取广告创意信息数据
-                    kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, getDate, getDate);
-                });
+                for (CtopOauthToken token : tokens) {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            log.info("获取创意分天报表开始,accountId:{}", token.getAccountId());
+                            kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, getDate, getDate);
+                        }
+                    });
+
+
+                }
             }
         };
         thread.start();

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

@@ -794,12 +794,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         Integer code = resultJson.getInteger("code");
         String message = resultJson.getString("message");
         if (null == code || code != 0) {
-            log.error("获取快手广告创意报表异常:{},accountId:{}", message, token.getAccountId());
+            log.error("获取快手广告创意分天报表异常:{},accountId:{}", message, token.getAccountId());
             return;
         }
         JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
         if (null == details || details.size() <= 0) {
-            log.info("快手广告创意报表信息为空=》accountId:{}", token.getAccountId());
+            log.info("快手广告创意分天报表信息为空=》accountId:{}", token.getAccountId());
             return;
         }
         for (int i = 0; i < details.size(); i++) {