Quellcode durchsuchen

有效视频接口增加项目筛选

hcst_sunzhen vor 5 Jahren
Ursprung
Commit
08ca91d2ad

+ 22 - 22
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -260,31 +260,31 @@ public class ReportServiceImpl implements IReportService {
     public void loadBytedanceHistoryData(CtopOauthToken token) {
         for (int i = 1; i < 180; i++) {
             Date getDate = DateUtils.addDay(new Date(), -i);
-            //this.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            this.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
             this.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            //this.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            this.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         }
 
-        //try {
-        //    advertiserDataService.getMaterialList(token);
-        //    log.info("获取历史素材报表:accountId:{}", token.getAccountId());
-        //    String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        //    String endDate = DateUtils.addDay(nowDate, -180);
-        //    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        //    Date end = simpleDateFormat.parse(nowDate);
-        //    Date start = simpleDateFormat.parse(endDate);
-        //    List<Date> dates = DateUtils.findDates(start, end);
-        //    for (int i = 0; i < dates.size(); i++) {
-        //        String formatDate = simpleDateFormat.format(dates.get(i));
-        //        int code = bytedanceReportService.bytedanceMaterialReport(token, formatDate, formatDate);
-        //        //如果成功的话跑视频清洗数据方法,失败会进入重试库,重试成功后再清洗数据
-        //        if (code == 200 || code == 1) {
-        //            byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, token.getAccountId());
-        //        }
-        //    }
-        //} catch (Exception e) {
-        //    e.printStackTrace();
-        //}
+        try {
+            advertiserDataService.getMaterialList(token);
+            log.info("获取历史素材报表:accountId:{}", token.getAccountId());
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            String endDate = DateUtils.addDay(nowDate, -180);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date end = simpleDateFormat.parse(nowDate);
+            Date start = simpleDateFormat.parse(endDate);
+            List<Date> dates = DateUtils.findDates(start, end);
+            for (int i = 0; i < dates.size(); i++) {
+                String formatDate = simpleDateFormat.format(dates.get(i));
+                int code = bytedanceReportService.bytedanceMaterialReport(token, formatDate, formatDate);
+                //如果成功的话跑视频清洗数据方法,失败会进入重试库,重试成功后再清洗数据
+                if (code == 200 || code == 1) {
+                    byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, token.getAccountId());
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
     private ByteDanceAdvertiserReportDTO getReportDTO(CtopOauthToken token, Date startDate, Date endDate, String bytedanceReportTypePl) {