Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

syh 5 gadi atpakaļ
vecāks
revīzija
9304be40a2

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

@@ -1,14 +1,9 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
-import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
 import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UserAllocation;
 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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -18,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;
 
 /**
  * @author syh
@@ -29,8 +26,8 @@ public class BytedanceDailyReportLoadJob implements Job {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IReportService reportService;
-    @Autowired
-    private IUserAllocationService userAllocationService;
+    static ExecutorService executorService = null;
+
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@@ -41,18 +38,24 @@ public class BytedanceDailyReportLoadJob implements Job {
             log.info("定时获取头条数据异常:为获取到可用的token");
             return;
         }
+        executorService = Executors.newFixedThreadPool(5);
         tokens.forEach(token -> {
-            //1: 获取广告主信息数据
-            reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    //1: 获取广告主信息数据
+                    reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
 //            2:获取广告组信息数据
 //            reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            //3:获取广告计划信息数据
+                    //3:获取广告计划信息数据
 //            reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            //4: 获取广告创意信息数据
+                    //4: 获取广告创意信息数据
 //            reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+
+                }
+            });
         });
     }
 
-    @Autowired
-    private IBytedancePlanDailyReportService planDailyReportService;
+
 }