|
@@ -952,12 +952,12 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
* @param endDate
|
|
|
* @return
|
|
|
*/
|
|
|
- //@Override
|
|
|
+ @Override
|
|
|
public int bytedanceVideoMaterialReport(CtopOauthToken token, String startDate, String endDate) {
|
|
|
Long accountId = token.getAccountId();
|
|
|
log.info("头条素材报表当前accountId为:" + accountId);
|
|
|
Integer page = 1;
|
|
|
- Integer pageSize = 100;
|
|
|
+ Integer pageSize = 1000;
|
|
|
int code = bytedanceVideoMaterialReportByPage(page, pageSize, token, accountId, startDate, endDate);
|
|
|
if (code != 200 && code != 1) {
|
|
|
BytedanceReportMaterialRetry retry = new BytedanceReportMaterialRetry();
|
|
@@ -974,11 +974,11 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
}
|
|
|
|
|
|
private int bytedanceVideoMaterialReportByPage(Integer page, Integer pageSize, CtopOauthToken token, Long accountId, String startDate, String endDate) {
|
|
|
- //log.info("当前页数:"+ page);
|
|
|
+ log.info("当前页数:"+ page);
|
|
|
String access_token = token.getAccessToken();
|
|
|
|
|
|
// 请求地址
|
|
|
- String open_api_domain = "https";
|
|
|
+ String open_api_domain = "https://ad.oceanengine.com";
|
|
|
String path = "/open_api/2/report/video/get/";
|
|
|
|
|
|
// 请求参数
|
|
@@ -1017,38 +1017,25 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
JSONArray jsonArrayay = jsonData.getJSONArray("list");
|
|
|
if (jsonArrayay.size() == 0) {
|
|
|
log.info("accountId:" + accountId + ";没有数据。总页数为:" + totalPage + "当前页数为:" + currentPage);
|
|
|
- //returnCode = 1;
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
List<BytedanceReportVideoMaterialDaily> bytedanceReportVideoMaterialDailyList = new ArrayList<>();
|
|
|
for (int i = 0; i < jsonArrayay.size(); i++) {
|
|
|
- //BytedanceReportMaterialDaily daily = new BytedanceReportMaterialDaily();
|
|
|
- //daily.setAccountId(accountId);
|
|
|
JSONObject detailJson = jsonArrayay.getJSONObject(i);
|
|
|
if (!Check.isNull(detailJson)) {
|
|
|
BytedanceReportVideoMaterialDaily daily = new BytedanceReportVideoMaterialDaily(detailJson, accountId);
|
|
|
-
|
|
|
bytedanceReportVideoMaterialDailyList.add(daily);
|
|
|
}
|
|
|
}
|
|
|
- //Long insertStartTime = System.currentTimeMillis();
|
|
|
-
|
|
|
-
|
|
|
- bytedanceReportMaterialDailyMapper.replaceIntoBatch(bytedanceReportVideoMaterialDailyList);
|
|
|
-
|
|
|
-
|
|
|
- //Long insertEndTime = System.currentTimeMillis();
|
|
|
- //log.info("头条获取素材报表插入数据结束,执行耗时:{}秒", (insertEndTime - insertStartTime) / 1000);
|
|
|
+ bytedanceReportMaterialDailyMapper.replaceIntoVideoMaterialBatch(bytedanceReportVideoMaterialDailyList);
|
|
|
if (currentPage >= totalPage) {
|
|
|
- //log.info("accountId:" + accountId + "数据同步完成,开始时间:" + startDate + ",结束时间:"+ endDate);
|
|
|
return 1;
|
|
|
} else {
|
|
|
int pageCode = bytedanceVideoMaterialReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);
|
|
|
return pageCode;
|
|
|
}
|
|
|
} else {
|
|
|
- //returnCode = -1;
|
|
|
log.error("服务器返回为空,json:" + JSONObject.toJSONString(data));
|
|
|
return -1;
|
|
|
}
|