|
@@ -74,7 +74,7 @@ public class ReportServiceImpl implements IReportService {
|
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
@Autowired
|
|
|
private IBytedanceInterfaceService bytedanceInterfaceService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private UserAllocationMapper allocationMapper;
|
|
|
|
|
|
@Override
|
|
@@ -444,24 +444,36 @@ public class ReportServiceImpl implements IReportService {
|
|
|
|
|
|
@Override
|
|
|
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.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
- this.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
- }
|
|
|
-
|
|
|
try {
|
|
|
+ String beginDateStr = allocationMapper.getUserAllocation(token.getAccountId()).getAuthBeginTime();
|
|
|
+ beginDateStr = Check.isNull(beginDateStr) ? DateUtils.formatDate(DateUtils.addDay(new Date(),-180),"yyyy-MM-dd") : beginDateStr;
|
|
|
+ Date beginDate = DateUtils.parseDate(beginDateStr,DateUtils.WEB_FORMAT);
|
|
|
+ Date endDate2 = DateUtils.addDay(new Date(),-1);
|
|
|
+ while (!beginDate.after(endDate2)){
|
|
|
+ beginDate = DateUtils.addDay(beginDate,1);
|
|
|
+ // for (int i = 1; i < 180; i++) {
|
|
|
+ // Date getDate = DateUtils.addDay(new Date(),1);
|
|
|
+ this.getAdvertiserCreativeReport(token, beginDate, beginDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ this.getAdvertiserPlanReport(token, beginDate, beginDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ this.getAdvertiserReport(token, beginDate, beginDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ // }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
advertiserDataService.getMaterialList(token);
|
|
|
log.info("获取历史素材报表:accountId:{}", token.getAccountId());
|
|
|
- String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- String endDate = DateUtils.addDay(nowDate, -180);
|
|
|
+// 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));
|
|
|
+// Date end = simpleDateFormat.parse(nowDate);
|
|
|
+// Date start = simpleDateFormat.parse(endDate);
|
|
|
+// List<Date> dates = DateUtils.findDates(start, end);
|
|
|
+
|
|
|
+ beginDate = DateUtils.parseDate(beginDateStr,DateUtils.WEB_FORMAT);
|
|
|
+ while (!beginDate.after(endDate2)){
|
|
|
+ beginDate = DateUtils.addDay(beginDate,1);
|
|
|
+ String formatDate = simpleDateFormat.format(beginDate);
|
|
|
//试玩报表
|
|
|
bytedanceInterfaceService.bytedancePlayableReport(token,formatDate,formatDate);
|
|
|
//
|
|
@@ -472,8 +484,21 @@ public class ReportServiceImpl implements IReportService {
|
|
|
byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, token.getAccountId());
|
|
|
}
|
|
|
|
|
|
- //
|
|
|
}
|
|
|
+// for (int i = 0; i < dates.size(); i++) {
|
|
|
+// String formatDate = simpleDateFormat.format(dates.get(i));
|
|
|
+// //试玩报表
|
|
|
+// bytedanceInterfaceService.bytedancePlayableReport(token,formatDate,formatDate);
|
|
|
+// //
|
|
|
+// //素材报表
|
|
|
+// int code = bytedanceReportService.bytedanceMaterialReport(token, formatDate, formatDate);
|
|
|
+// //如果成功的话跑视频清洗数据方法,失败会进入重试库,重试成功后再清洗数据
|
|
|
+// if (code == 200 || code == 1) {
|
|
|
+// byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, token.getAccountId());
|
|
|
+// }
|
|
|
+//
|
|
|
+// //
|
|
|
+// }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|