Преглед на файлове

修改头条时报任务0点执行前一天数据获取bug

songyinghao преди 5 години
родител
ревизия
e03eda4d22

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

@@ -35,9 +35,6 @@ public class BytedanceAdvertiserHourlyReportLoadJob implements Job {
         Date getDate = new Date();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         String hour = simpleDateFormat.format(getDate);
-        if (null != hour && "00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
         if (null == tokens || tokens.size() <= 0) {
@@ -45,13 +42,16 @@ public class BytedanceAdvertiserHourlyReportLoadJob implements Job {
             return;
         }
         executorService = Executors.newFixedThreadPool(4);
-        Date finalGetDate = getDate;
         tokens.forEach(token -> {
             executorService.submit(new Runnable() {
                 @Override
                 public void run() {
-                    //获取广告主信息数据
-                    reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+                    if (null != hour && "00".equals(hour)) {
+                        Date  finalGetDate = DateUtils.addDay(getDate, -1);
+                        //获取广告主信息数据
+                        reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+                    }
+                    reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
                 }
 
             });

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

@@ -35,9 +35,6 @@ public class BytedanceCreativeHourlyReportLoadJob implements Job {
         Date getDate = new Date();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         String hour = simpleDateFormat.format(getDate);
-        if (null != hour && "00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
         if (null == tokens || tokens.size() <= 0) {
@@ -45,13 +42,16 @@ public class BytedanceCreativeHourlyReportLoadJob implements Job {
             return;
         }
         executorService = Executors.newFixedThreadPool(4);
-        Date finalGetDate = getDate;
         tokens.forEach(token -> {
             executorService.submit(new Runnable() {
                 @Override
                 public void run() {
-                    //获取广告创意信息数据
-                    reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+                    if (null != hour && "00".equals(hour)) {
+                        Date  finalGetDate = DateUtils.addDay(getDate, -1);
+                        //获取广告创意信息数据
+                        reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+                    }
+                    reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
                 }
 
             });

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

@@ -37,12 +37,8 @@ public class BytedancePlanHourlyReportLoadJob implements Job {
         Date getDate = new Date();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
         String hour = simpleDateFormat.format(getDate);
-        if (null != hour && "00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
         //1:查询当日计划时报数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        Date finalGetDate = getDate;
         executorService = Executors.newFixedThreadPool(5);
         countDownLatch = new CountDownLatch(tokens.size());
         tokens.forEach(token -> {
@@ -50,7 +46,11 @@ public class BytedancePlanHourlyReportLoadJob implements Job {
                 @Override
                 public void run() {
                     try {
-                        reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+                        if (null != hour && "00".equals(hour)) {
+                            Date  finalGetDate = DateUtils.addDay(getDate, -1);
+                            reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+                        }
+                        reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
                     } catch (Exception e) {
                         e.printStackTrace();
                     } finally {