|
@@ -4,12 +4,11 @@ import cn.com.ctop.common.utils.HttpUtils;
|
|
|
import cn.com.ctop.common.utils.PropertiesUtils;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.modules.ctop.entity.*;
|
|
|
import org.jeecg.modules.ctop.mapper.*;
|
|
|
import org.jeecg.modules.ctop.service.IByteDanceAdvertiserDataService;
|
|
|
import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -21,12 +20,28 @@ import java.util.TreeMap;
|
|
|
/**
|
|
|
* @author 宋英豪
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserDataService {
|
|
|
- private static final Logger logger = LoggerFactory.getLogger(ByteDanceAdvertiserDataServiceImpl.class);
|
|
|
-
|
|
|
@Autowired
|
|
|
private ICTopOauthTokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private ByteDanceAdvertisePlanMapper advertisePlanMapper;
|
|
|
+ @Autowired
|
|
|
+ private ByteDanceCampaignTemplateMapper campaignTemplateMapper;
|
|
|
+ @Autowired
|
|
|
+ private ByteDanceCustomAudienceMapper audienceMapper;
|
|
|
+ @Autowired
|
|
|
+ private ByteDanceCreativeMaterialMapper creativeMaterialMapper;
|
|
|
+ @Autowired
|
|
|
+ private ByteDanceCreativeMapper creativeMapper;
|
|
|
+ @Autowired
|
|
|
+ private ByteDanceAdvertiserBudgetMapper advertiserBudgetMapper;
|
|
|
+ @Autowired
|
|
|
+ private ByteDanceCampaignMapper campaignMapper;
|
|
|
+ @Autowired
|
|
|
+ private ByteDanceAdvertiserMapper advertiserMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> getAdvertiserInfo(String accountId) {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
@@ -44,7 +59,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("获取广告主信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("获取广告主信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("success", false);
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "获取广告主信息接口异常");
|
|
@@ -99,12 +114,12 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.error("获取广告计划信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.error("获取广告计划信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
return;
|
|
|
}
|
|
|
JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
|
|
|
if (null == data || data.size() <= 0) {
|
|
|
- logger.error("获取广告计划信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.error("获取广告计划信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
return;
|
|
|
}
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
@@ -117,9 +132,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
getAdvertiserPlanByPageNumber(accountId, pageNumber + 1, ids);
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private ByteDanceAdvertisePlanMapper advertisePlanMapper;
|
|
|
-
|
|
|
@Override
|
|
|
public Map<String, Object> getAdvertiserPlan(String accountId, String ids) {
|
|
|
getAdvertiserPlanByPageNumber(accountId, 1, ids);
|
|
@@ -155,14 +167,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("获取广告预算信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("获取广告预算信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "获取广告预算信息接口异常");
|
|
|
return resultMap;
|
|
|
}
|
|
|
JSONArray data = jsonObject.getJSONArray("data");
|
|
|
if (null == data || data.size() <= 0) {
|
|
|
- logger.info("广告主预算信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("广告主预算信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", 0);
|
|
|
resultMap.put("message", "获取广告主预算信息完成");
|
|
|
return resultMap;
|
|
@@ -206,14 +218,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("获取广告主创意素材信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("获取广告主创意素材信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "获取广告主创意素材信息接口异常");
|
|
|
return resultMap;
|
|
|
}
|
|
|
JSONArray data = jsonObject.getJSONArray("data");
|
|
|
if (null == data || data.size() <= 0) {
|
|
|
- logger.info("广告主创意素材信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("广告主创意素材信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", 0);
|
|
|
resultMap.put("message", "获取广告主预算信息完成");
|
|
|
return resultMap;
|
|
@@ -256,14 +268,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("广告组更新状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("广告组更新状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "广告组更新状态接口异常");
|
|
|
return resultMap;
|
|
|
}
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
if (null == data) {
|
|
|
- logger.info("广告组更新状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("广告组更新状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "广告组更新状态异常");
|
|
|
return resultMap;
|
|
@@ -314,14 +326,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("广告组更新接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("广告组更新接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "广告组更新接口异常");
|
|
|
return resultMap;
|
|
|
}
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
if (null == data) {
|
|
|
- logger.info("广告组更新异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("广告组更新异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "广告组更新异常");
|
|
|
return resultMap;
|
|
@@ -369,14 +381,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.error("广告计划更新状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.error("广告计划更新状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "广告计划更新状态接口异常");
|
|
|
return resultMap;
|
|
|
}
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
if (null == data) {
|
|
|
- logger.info("广告计划更新状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("广告计划更新状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "广告计划更新状态异常");
|
|
|
return resultMap;
|
|
@@ -423,14 +435,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("修改计划出价接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("修改计划出价接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "修改计划出价接口异常");
|
|
|
return resultMap;
|
|
|
}
|
|
|
JSONObject getData = jsonObject.getJSONObject("data");
|
|
|
if (null == getData) {
|
|
|
- logger.info("修改计划出价异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("修改计划出价异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "修改计划出价异常");
|
|
|
return resultMap;
|
|
@@ -476,14 +488,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("修改计划预算接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("修改计划预算接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "修改计划预算接口异常");
|
|
|
return resultMap;
|
|
|
}
|
|
|
JSONObject getData = jsonObject.getJSONObject("data");
|
|
|
if (null == getData) {
|
|
|
- logger.info("修改计划预算异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("修改计划预算异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "修改计划预算异常");
|
|
|
return resultMap;
|
|
@@ -524,14 +536,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("修改创意状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("修改创意状态接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "修改创意状态接口异常");
|
|
|
return resultMap;
|
|
|
}
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
if (null == data) {
|
|
|
- logger.info("修改创意状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("修改创意状态异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "修改创意状态异常");
|
|
|
return resultMap;
|
|
@@ -571,7 +583,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("获取人群包信息接口异常==》accountId:{},message:{}", token.getAdvertiserId(), jsonObject.getString("message"));
|
|
|
+ log.info("获取人群包信息接口异常==》accountId:{},message:{}", token.getAdvertiserId(), jsonObject.getString("message"));
|
|
|
resultMap.put("success", false);
|
|
|
resultMap.put("message", "获取人群包信息接口异常");
|
|
|
resultMap.put("code", -1);
|
|
@@ -579,7 +591,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
}
|
|
|
JSONArray data = jsonObject.getJSONObject("data").getJSONArray("custom_audience_list");
|
|
|
if (null == data || data.size() <= 0) {
|
|
|
- logger.info("人群包信息不存在==》accountId:{},message:{}", token.getAdvertiserId(), jsonObject.getString("message"));
|
|
|
+ log.info("人群包信息不存在==》accountId:{},message:{}", token.getAdvertiserId(), jsonObject.getString("message"));
|
|
|
resultMap.put("success", false);
|
|
|
resultMap.put("message", "人群包信息不存在");
|
|
|
resultMap.put("code", -1);
|
|
@@ -598,16 +610,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private ByteDanceCampaignTemplateMapper campaignTemplateMapper;
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ByteDanceCustomAudienceMapper audienceMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ByteDanceCreativeMaterialMapper creativeMaterialMapper;
|
|
|
-
|
|
|
private void getAdvertiserCreativeByPageNumber(String accountId, Integer pageNumber, String ids) {
|
|
|
CTopOauthToken cTopOauthToken = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
//2: 根据token以及用户id获取用户信息数据
|
|
@@ -635,12 +637,12 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.info("获取广告主广告创意信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("获取广告主广告创意信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
return;
|
|
|
}
|
|
|
JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
|
|
|
if (null == data || data.size() <= 0) {
|
|
|
- logger.info("广告主广告创意信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.info("广告主广告创意信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
return;
|
|
|
}
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
@@ -653,11 +655,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
getAdvertiserCreativeByPageNumber(accountId, pageNumber + 1, ids);
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private ByteDanceCreativeMapper creativeMapper;
|
|
|
- @Autowired
|
|
|
- private ByteDanceAdvertiserBudgetMapper advertiserBudgetMapper;
|
|
|
-
|
|
|
private void getAdvertiserCampaignByPageNumber(String accountId, Integer pageNumber, String ids) {
|
|
|
CTopOauthToken cTopOauthToken = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
//2: 根据token以及用户id获取用户信息数据
|
|
@@ -685,12 +682,12 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
|
- logger.error("获取广告组信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.error("获取广告组信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
return;
|
|
|
}
|
|
|
JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
|
|
|
if (null == data || data.size() <= 0) {
|
|
|
- logger.error("获取广告组信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
+ log.error("获取广告组信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
return;
|
|
|
}
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
@@ -702,10 +699,4 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
}
|
|
|
getAdvertiserCampaignByPageNumber(accountId, pageNumber + 1, ids);
|
|
|
}
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ByteDanceCampaignMapper campaignMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ByteDanceAdvertiserMapper advertiserMapper;
|
|
|
}
|