|
@@ -145,10 +145,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
param.put("end_date", DateUtils.formatDate(endDate));
|
|
|
param.put("advertiser_id", token.getAccountId());
|
|
|
param.put("temporal_granularity", "HOURLY");
|
|
|
- param.put("page_size", 500);
|
|
|
+ param.put("page_size", 2000);
|
|
|
param.put("page", page);
|
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
+ System.err.println(resultJson);
|
|
|
Integer code = resultJson.getInteger("code");
|
|
|
String message = resultJson.getString("message");
|
|
|
if (null == code || code != 0) {
|
|
@@ -159,19 +160,21 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
if (null == details || details.size() <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
+ List<KuaishouReportHourlyAccount> addList = new ArrayList<>();
|
|
|
for (int i = 0; i < details.size(); i++) {
|
|
|
JSONObject detailJson = details.getJSONObject(i);
|
|
|
var show = detailJson.getLong("show");
|
|
|
detailJson.put("photo_show", show);
|
|
|
var like = detailJson.getLong("like");
|
|
|
detailJson.put("photo_like", like);
|
|
|
- var kuaishouReportHourlyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyAccount.class);
|
|
|
+ KuaishouReportHourlyAccount kuaishouReportHourlyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyAccount.class);
|
|
|
kuaishouReportHourlyAccount.setAccountId(token.getAccountId());
|
|
|
kuaishouReportHourlyAccount.setId("" + token.getAccountId() + kuaishouReportHourlyAccount.getStatDate() + kuaishouReportHourlyAccount.getStatHour());
|
|
|
- kuaishouReportHourlyAccount.setCreateTime(new Date());
|
|
|
- kuaishouReportHourlyAccount.setUpdateTime(new Date());
|
|
|
- hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
|
|
|
+ // hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
|
|
|
+ addList.add(kuaishouReportHourlyAccount);
|
|
|
}
|
|
|
+ hourlyAccountService.replaceBatch(addList);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -290,7 +293,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
param.put("end_date", DateUtils.formatDate(endDate));
|
|
|
}
|
|
|
if (!Check.isNull(reportDims)) {
|
|
|
- param.put("report_dims", reportDims);
|
|
|
+ JSONArray array = new JSONArray();
|
|
|
+ array.add(reportDims);
|
|
|
+ param.put("report_dims", array);
|
|
|
}
|
|
|
|
|
|
param.put("advertiser_id", token.getAccountId());
|
|
@@ -311,7 +316,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- List<>
|
|
|
+ List<KuaishouReportDailyAccount> addList = new ArrayList<>();
|
|
|
for (int i = 0; i < details.size(); i++) {
|
|
|
JSONObject detailJson = details.getJSONObject(i);
|
|
|
if (!Check.isNull(detailJson)) {
|
|
@@ -321,13 +326,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
detailJson.put("photo_show", detailJson.getString("show"));
|
|
|
KuaishouReportDailyAccount KuaishouReportDailyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportDailyAccount.class);
|
|
|
KuaishouReportDailyAccount.setAccountId(token.getAccountId());
|
|
|
- // dailyAccountMapper.insertSelective(KuaishouReportDailyAccount);
|
|
|
+ // dailyAccountMapper.insertSelective(KuaishouReportDailyAccount);
|
|
|
+ addList.add(KuaishouReportDailyAccount);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ dailyAccountMapper.replaceBatch(addList);
|
|
|
getAccountDailyReportByPage(token, startDate, endDate, page + 1, reportDims);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public void getAdvertiserCampaignReportDaily(CtopOauthToken token, Date startDate, Date endDate) {
|
|
|
getCampaignDailyReportByPage(token, startDate, endDate, 1);
|
|
@@ -906,7 +913,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
Date getStartDate = DateUtils.addDay(endDate, -i);
|
|
|
//1: 获取广告主信息数据
|
|
|
getAdvertiserReportHourly(token, getStartDate, getStartDate);
|
|
|
- getAdvertiserReportDaily(token, getStartDate, getStartDate);
|
|
|
+ getAdvertiserReportDaily(token, getStartDate, getStartDate, "adScene");
|
|
|
//2:获取广告计划信息数据
|
|
|
// getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
|
|
|
//3:获取广告组信息数据
|