|
@@ -63,28 +63,21 @@ public class AdUnitReportServiceImpl implements IAdUnitReportService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public void getAdUnitReport(Long advertiserId, String accessToken, String startDate, String endDate, int page) {
|
|
public void getAdUnitReport(Long advertiserId, String accessToken, String startDate, String endDate, int page) {
|
|
- log.info("accountId:=={}=====获取广告组数据信息====page--{}===》》》》", advertiserId, page);
|
|
|
|
- Integer page_size = 500;
|
|
|
|
-
|
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
|
- headers.put("Access-Token", accessToken);
|
|
|
|
- Map<String, Object> param = new HashMap<>();
|
|
|
|
|
|
+ JSONObject param = new JSONObject();
|
|
param.put("advertiser_id", advertiserId);
|
|
param.put("advertiser_id", advertiserId);
|
|
-
|
|
|
|
- if (!Check.isNull(startDate)) {
|
|
|
|
|
|
+ param.put("page_size", 500);
|
|
|
|
+ param.put("page", page);
|
|
|
|
+ if (startDate != null && endDate != null) {
|
|
param.put("start_date", startDate);
|
|
param.put("start_date", startDate);
|
|
- }
|
|
|
|
- if (!Check.isNull(endDate)) {
|
|
|
|
param.put("end_date", endDate);
|
|
param.put("end_date", endDate);
|
|
}
|
|
}
|
|
- param.put("page_size", page_size);
|
|
|
|
- param.put("page", page);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- String result = HttpUtils.httpPostRequest(postUrl + KuaishouConstant.AD_UNIT_LIST, param, headers);
|
|
|
|
- // System.err.println(result);
|
|
|
|
|
|
+ Map<String, String> headers = new HashMap<>();
|
|
|
|
+ headers.put("Access-Token", accessToken);
|
|
|
|
+ headers.put("Content-Type", "application/json");
|
|
|
|
|
|
|
|
+ String result = HttpUtils.kuaiShouhttpPostRequest("https://ad.e.kuaishou.com/rest/openapi/v1/ad_unit/list", param.toJSONString(), headers);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
|
+
|
|
if (Check.isNull(resultJson)) {
|
|
if (Check.isNull(resultJson)) {
|
|
log.info("accountId:=={}=====广告组数据信息====暂无====》》》》", advertiserId);
|
|
log.info("accountId:=={}=====广告组数据信息====暂无====》》》》", advertiserId);
|
|
return;
|
|
return;
|
|
@@ -112,12 +105,12 @@ public class AdUnitReportServiceImpl implements IAdUnitReportService {
|
|
|
|
|
|
if (!Check.isNull(ksAdUnitList)) {
|
|
if (!Check.isNull(ksAdUnitList)) {
|
|
adUnitReportMapper.replaceBatchKsAdUnit(ksAdUnitList);
|
|
adUnitReportMapper.replaceBatchKsAdUnit(ksAdUnitList);
|
|
- log.info("组数据添加成功,accountId:{},条数:{}",advertiserId,ksAdUnitList.size());
|
|
|
|
|
|
+ log.info("组数据添加成功,accountId:{},条数:{}", advertiserId, ksAdUnitList.size());
|
|
}
|
|
}
|
|
|
|
|
|
//是否有下一页
|
|
//是否有下一页
|
|
Boolean toGet = true;
|
|
Boolean toGet = true;
|
|
- if (details.size() < page_size) {
|
|
|
|
|
|
+ if (details.size() < page) {
|
|
toGet = false;
|
|
toGet = false;
|
|
}
|
|
}
|
|
if (toGet) {
|
|
if (toGet) {
|
|
@@ -457,7 +450,7 @@ public class AdUnitReportServiceImpl implements IAdUnitReportService {
|
|
* @param page
|
|
* @param page
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public void getKuaishouDailyFlows(Long advertiserId, String accessToken, int page) {
|
|
|
|
|
|
+ public void getKuaishouDailyFlows(Long advertiserId, String accessToken, String startDate, String endDate, int page) {
|
|
log.info("获取账户流水========,账户id:{},page--{}", advertiserId, page);
|
|
log.info("获取账户流水========,账户id:{},page--{}", advertiserId, page);
|
|
Integer page_size = 500;
|
|
Integer page_size = 500;
|
|
String url = postUrl + KuaishouConstant.FUND_DAILY_FLOWS;
|
|
String url = postUrl + KuaishouConstant.FUND_DAILY_FLOWS;
|
|
@@ -467,6 +460,8 @@ public class AdUnitReportServiceImpl implements IAdUnitReportService {
|
|
param.put("advertiser_id", advertiserId);
|
|
param.put("advertiser_id", advertiserId);
|
|
param.put("page_size", page_size);
|
|
param.put("page_size", page_size);
|
|
param.put("page", page);
|
|
param.put("page", page);
|
|
|
|
+ param.put("start_date", startDate);
|
|
|
|
+ param.put("end_date", endDate);
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
Integer code = resultJson.getInteger("code");
|
|
Integer code = resultJson.getInteger("code");
|
|
@@ -495,7 +490,7 @@ public class AdUnitReportServiceImpl implements IAdUnitReportService {
|
|
toGet = false;
|
|
toGet = false;
|
|
}
|
|
}
|
|
if (toGet) {
|
|
if (toGet) {
|
|
- getKuaishouDailyFlows(advertiserId, accessToken, page + 1);
|
|
|
|
|
|
+ getKuaishouDailyFlows(advertiserId, accessToken, startDate, endDate, page + 1);
|
|
} else {
|
|
} else {
|
|
log.info("账户流水========获取完成:accountId:{}", advertiserId);
|
|
log.info("账户流水========获取完成:accountId:{}", advertiserId);
|
|
}
|
|
}
|