|
|
@@ -269,7 +269,7 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
/**
|
|
|
* 获取团长任务ID列表
|
|
|
*/
|
|
|
- public void getContractorMissionList(String accessToken, Long advertiserId, Long contractorId, int page) {
|
|
|
+ public void getContractorMissionList(String accessToken, Long advertiserId, Long contractorId, int offset) {
|
|
|
String url = KuaishouLinkConstants.KS_PREFIX + KuaishouLinkConstants.AD_SOCIAL_CONTRACTOR_MISSION_LIST;
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("Content-Type", "application/json");
|
|
|
@@ -279,7 +279,7 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
param.put("contractor_user_id", contractorId);
|
|
|
param.put("advertiser_id", advertiserId);
|
|
|
param.put("limit", pageSize);
|
|
|
- param.put("offset", page);
|
|
|
+ param.put("offset", offset);
|
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
if (Check.isNull(result)) {
|
|
|
log.error("获取快手团长任务ID列表接口异常:{},accountId:{} {}", "返回结果为空", advertiserId, contractorId);
|
|
|
@@ -294,7 +294,6 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
}
|
|
|
JSONObject data = resultJson.getJSONObject("data");
|
|
|
int totalCount = data.getIntValue("total_count");
|
|
|
- int totalPage = (int) Math.ceil(totalCount * 1.0 / pageSize);
|
|
|
JSONArray details = data.getJSONArray("details");
|
|
|
List<KuaiShouAdSocialContractorMission> addList = new ArrayList<>();
|
|
|
if (!Check.isNull(details)) {
|
|
|
@@ -309,10 +308,10 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
if (!Check.isNull(addList)) {
|
|
|
kuaiShouAdSocialMapper.insertContractorMissionList(addList);
|
|
|
}
|
|
|
- if (page < totalPage) {
|
|
|
- getContractorMissionList(accessToken, advertiserId, contractorId, page + 1);
|
|
|
+ if (offset + pageSize < totalCount) {
|
|
|
+ getContractorMissionList(accessToken, advertiserId, contractorId, offset + pageSize);
|
|
|
} else {
|
|
|
- log.info("【{}】录入快手团长任务ID列表完成 {} page: {}", advertiserId, contractorId, page);
|
|
|
+ log.info("【{}】录入快手团长任务ID列表完成 {} totalCount: {}", advertiserId, contractorId, totalCount);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -353,7 +352,7 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
/**
|
|
|
* 获取团长订单投后数据
|
|
|
*/
|
|
|
- public void getContractorMissionOrder(String accessToken, Long advertiserId, Long contractorId, Long missionId, int page) {
|
|
|
+ public void getContractorMissionOrder(String accessToken, Long advertiserId, Long contractorId, Long missionId, int offset) {
|
|
|
String url = KuaishouLinkConstants.KS_PREFIX + KuaishouLinkConstants.AD_SOCIAL_CONTRACTOR_MISSION_DATA;
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("Content-Type", "application/json");
|
|
|
@@ -364,7 +363,7 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
param.put("advertiser_id", advertiserId);
|
|
|
param.put("mission_id", missionId);
|
|
|
param.put("limit", pageSize);
|
|
|
- param.put("offset", page);
|
|
|
+ param.put("offset", offset);
|
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
if (Check.isNull(result)) {
|
|
|
log.error("获取快手团长订单投后数据列表接口异常:{},accountId:{} {} {}", "返回结果为空", advertiserId, contractorId, missionId);
|
|
|
@@ -379,7 +378,6 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
}
|
|
|
JSONObject data = resultJson.getJSONObject("data");
|
|
|
int totalCount = data.getIntValue("total_count");
|
|
|
- int totalPage = (int) Math.ceil(totalCount * 1.0 / pageSize);
|
|
|
JSONArray details = data.getJSONArray("details");
|
|
|
List<KuaiShouAdSocialContractorMissionOrder> addList = new ArrayList<>();
|
|
|
if (!Check.isNull(details)) {
|
|
|
@@ -395,10 +393,10 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
if (!Check.isNull(addList)) {
|
|
|
kuaiShouAdSocialMapper.insertContractorMissionOrder(addList);
|
|
|
}
|
|
|
- if (page < totalPage) {
|
|
|
- getContractorMissionOrder(accessToken, advertiserId, contractorId, missionId, page + 1);
|
|
|
+ if (offset + pageSize < totalCount) {
|
|
|
+ getContractorMissionOrder(accessToken, advertiserId, contractorId, missionId, offset + pageSize);
|
|
|
} else {
|
|
|
- log.info("【{}】获取快手团长订单投后数据列表完成 {} {} page: {}", advertiserId, contractorId, missionId, page);
|
|
|
+ log.info("【{}】获取快手团长订单投后数据列表完成 {} {} totalCount: {}", advertiserId, contractorId, missionId, totalCount);
|
|
|
}
|
|
|
}
|
|
|
}
|