|
|
@@ -13,6 +13,7 @@ import cn.com.ctop.job.kuaishou.utils.doris.sink.DorisMultiTableStreamLoadManage
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -268,8 +269,8 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
return kuaiShouAdSocialMapper.queryAdSocialContractorToken();
|
|
|
}
|
|
|
|
|
|
- public List<JSONObject> getAdSocialMissionToken() {
|
|
|
- return kuaiShouAdSocialMapper.queryAdSocialMissionToken();
|
|
|
+ public List<JSONObject> getAdSocialMissionToken(Long missionId,Long contractorUserId) {
|
|
|
+ return kuaiShouAdSocialMapper.queryAdSocialMissionToken( missionId, contractorUserId);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -326,7 +327,7 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
/**
|
|
|
* 获取团长任务详情
|
|
|
*/
|
|
|
- public void getContractorMissionInfo(String accessToken, Long advertiserId, Long contractorId, Long missionId) {
|
|
|
+ public void getContractorMissionInfo(String accessToken, Long advertiserId, Long contractorId, Long missionId, int retry) {
|
|
|
String url = KuaishouLinkConstants.KS_PREFIX + KuaishouLinkConstants.AD_SOCIAL_CONTRACTOR_MISSION_INFO;
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("Content-Type", "application/json");
|
|
|
@@ -345,7 +346,15 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
Integer code = resultJson.getInteger("code");
|
|
|
String message = resultJson.getString("message");
|
|
|
if (null == code || code != 0) {
|
|
|
- log.error("获取快手团长任务详情接口异常:{},accountId:{} {} {}", message, advertiserId, contractorId, missionId);
|
|
|
+ if (retry <= 3) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(800);
|
|
|
+ } catch (InterruptedException ignored) {
|
|
|
+ }
|
|
|
+ getContractorMissionInfo(accessToken, advertiserId, contractorId, missionId, retry+1);
|
|
|
+ }else {
|
|
|
+ log.error("获取快手团长任务详情接口异常:{},accountId:{} {} {}", message, advertiserId, contractorId, missionId);
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
JSONObject data = resultJson.getJSONObject("data");
|
|
|
@@ -363,7 +372,8 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
/**
|
|
|
* 获取团长订单投后数据
|
|
|
*/
|
|
|
- public void getContractorMissionOrder(String accessToken, Long advertiserId, Long contractorId, Long missionId, Long filterStartTime, int offset) {
|
|
|
+ public void getContractorMissionOrder(String accessToken, Long advertiserId, Long contractorId, Long missionId, Long filterStartTime, int offset, int retry) {
|
|
|
+ //log.info("获取快手团长订单投后数据 {}-{}-{}-{}-{}", advertiserId, contractorId, missionId,offset,filterStartTime);
|
|
|
String url = KuaishouLinkConstants.KS_PREFIX + KuaishouLinkConstants.AD_SOCIAL_CONTRACTOR_MISSION_DATA;
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("Content-Type", "application/json");
|
|
|
@@ -386,7 +396,15 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
Integer code = resultJson.getInteger("code");
|
|
|
String message = resultJson.getString("message");
|
|
|
if (null == code || code != 0) {
|
|
|
- log.error("获取快手团长订单投后数据列表接口异常:{},accountId:{} {} {}", message, advertiserId, contractorId, missionId);
|
|
|
+ if (retry <= 3) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(800);
|
|
|
+ } catch (InterruptedException ignored) {
|
|
|
+ }
|
|
|
+ getContractorMissionOrder(accessToken, advertiserId, contractorId, missionId, filterStartTime, offset, retry + 1);
|
|
|
+ }else{
|
|
|
+ log.error("获取快手团长订单投后数据列表接口异常:{},accountId:{} {} {}", message, advertiserId, contractorId, missionId);
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
JSONObject data = resultJson.getJSONObject("data");
|
|
|
@@ -409,10 +427,10 @@ public class KuaiShouAdSocialServiceImpl implements IKuaiShouAdSocialService {
|
|
|
//kuaiShouAdSocialMapper.insertContractorMissionOrder(addList);
|
|
|
dorisLoadManager.add("media_api", "kuaishou_ad_social_transaction_contractor_mission_order", addList);
|
|
|
}
|
|
|
- if (offset + pageSize < totalCount && offset + pageSize <= 10000) {
|
|
|
- getContractorMissionOrder(accessToken, advertiserId, contractorId, missionId, filterStartTime, offset + pageSize);
|
|
|
- } else if (offset + pageSize < totalCount && offset + pageSize > 10000) {
|
|
|
- getContractorMissionOrder(accessToken, advertiserId, contractorId, missionId, nextFilterStartTime, 0);
|
|
|
+ if (offset + pageSize < totalCount && offset + pageSize <= 10000 - pageSize) {
|
|
|
+ getContractorMissionOrder(accessToken, advertiserId, contractorId, missionId, filterStartTime, offset + pageSize , 0);
|
|
|
+ } else if (offset + pageSize < totalCount && offset + pageSize > 10000 - pageSize) {
|
|
|
+ getContractorMissionOrder(accessToken, advertiserId, contractorId, missionId, nextFilterStartTime, 0, 0);
|
|
|
} else {
|
|
|
log.info("【{}】获取快手团长订单投后数据列表完成 {} {} totalCount: {}", advertiserId, contractorId, missionId, totalCount);
|
|
|
}
|