|
@@ -219,7 +219,6 @@ public class ReportServiceImpl implements IReportService {
|
|
|
}
|
|
|
|
|
|
private void getPlanReportByPage(CtopOauthToken token, ByteDanceAdvertiserReportDTO conditions, int page) {
|
|
|
- log.info("获取头条计划报表,accountId:{}", token.getAccountId());
|
|
|
conditions.setPage(page);
|
|
|
var config = new SerializeConfig();
|
|
|
config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
|
|
@@ -228,12 +227,12 @@ public class ReportServiceImpl implements IReportService {
|
|
|
var code = getObject.getInteger("code");
|
|
|
var message = getObject.getString("message");
|
|
|
if (null == code || code != 0) {
|
|
|
- log.error("广告计划报表数据获取异常:{}", message);
|
|
|
+ log.error("广告计划报表数据获取异常=》account:{};message:{}", token.getAccountId(), message);
|
|
|
return;
|
|
|
}
|
|
|
var dataArray = getObject.getJSONObject("data").getJSONArray("list");
|
|
|
if (null == dataArray || dataArray.size() <= 0) {
|
|
|
- log.info("广告计划报表获取完成=》accountId:{}", token.getAccountId());
|
|
|
+// log.info("广告计划报表获取完成=》accountId:{}", token.getAccountId());
|
|
|
return;
|
|
|
}
|
|
|
List<BytedancePlanHourlyReport> hourlyReports = new ArrayList<>();
|
|
@@ -327,16 +326,26 @@ public class ReportServiceImpl implements IReportService {
|
|
|
log.info("广告创意报表信息为空=》accountId:{}", token.getAccountId());
|
|
|
return;
|
|
|
}
|
|
|
+ List<BytedanceCreativeHourlyReport> hourlyReports = new ArrayList<>();
|
|
|
+ List<BytedanceCreativeDailyReport> dailyReports = new ArrayList<>();
|
|
|
for (var i = 0; i < dataArray.size(); i++) {
|
|
|
var data = dataArray.getJSONObject(i);
|
|
|
if (null != conditions.getTimeGranularity() && CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY.equals(conditions.getTimeGranularity())) {
|
|
|
var hourlyReport = new BytedanceCreativeHourlyReport(data, token.getAccountId());
|
|
|
- creativeHourlyReportService.saveOrUpdate(hourlyReport);
|
|
|
+// creativeHourlyReportService.saveOrUpdate(hourlyReport);
|
|
|
+ hourlyReports.add(hourlyReport);
|
|
|
} else {
|
|
|
var dailyReport = new BytedanceCreativeDailyReport(data, token.getAccountId());
|
|
|
- creativeDailyReportService.saveOrUpdate(dailyReport);
|
|
|
+// creativeDailyReportService.saveOrUpdate(dailyReport);
|
|
|
+ dailyReports.add(dailyReport);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (null != conditions.getTimeGranularity() && CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY.equals(conditions.getTimeGranularity())) {
|
|
|
+ creativeHourlyReportService.replaceBatch(hourlyReports);
|
|
|
+ } else {
|
|
|
+ creativeDailyReportService.replaceBatch(dailyReports);
|
|
|
+ }
|
|
|
getCreativeReportByPage(token, conditions, page + 1);
|
|
|
}
|
|
|
|