Browse Source

获取广告组信息 从前一天改成获取前两天数据

zxa 3 years ago
parent
commit
dbad12cefa

+ 11 - 2
job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/UnitReportJob.java

@@ -23,6 +23,7 @@ public class UnitReportJob {
     private IOauthTokenService tokenService;
     private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(3);
     private static ExecutorService adSceneDailyExecutorService = Executors.newFixedThreadPool(3);
+    private static ExecutorService adSceneDailyExecutorService2 = Executors.newFixedThreadPool(3);
     private static ExecutorService placementTypeDailyExecutorService = Executors.newFixedThreadPool(3);
     private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(3);
     @Autowired
@@ -67,10 +68,18 @@ public class UnitReportJob {
     public void unitAdSceneTypeDailyReport() throws Exception {
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
         String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
         List<JSONObject> tokens = tokenService.getByProjectId(458L);    //淘特项目
         tokens.forEach(t -> adSceneDailyExecutorService.submit(() -> {
-            unitReportDailyService.getUnitAdSceneReportDaily(t.getLong("accountId"), t.getString("accessToken"), startDate, endDate, 1);
+            unitReportDailyService.getUnitAdSceneReportDaily(t.getLong("accountId"), t.getString("accessToken"), startDate, startDate, 1);
+        }));
+        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
+        tokens.forEach(t -> adSceneDailyExecutorService2.submit(() -> {
+            try {
+                Thread.sleep(500L);
+                unitReportDailyService.getUnitAdSceneReportDaily(t.getLong("accountId"), t.getString("accessToken"), endDate, endDate, 1);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
         }));
     }