|
@@ -46,6 +46,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
params.put("advertiser_id", accountId);
|
|
params.put("advertiser_id", accountId);
|
|
String result = HttpUtils.httpGetRequest(url, headers, params);
|
|
String result = HttpUtils.httpGetRequest(url, headers, params);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
+ System.err.println(jsonObject);
|
|
if (Check.isNull(jsonObject)) {
|
|
if (Check.isNull(jsonObject)) {
|
|
throw new Exception("返回结果为空");
|
|
throw new Exception("返回结果为空");
|
|
}
|
|
}
|
|
@@ -82,9 +83,9 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Map<String, Object> getAdvertiserInfo(String accountId,String token) {
|
|
|
|
|
|
+ public Map<String, Object> getAdvertiserInfo(String accountId, String token) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
- // CtopOauthToken cTopOauthToken = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
|
|
|
+ // CtopOauthToken cTopOauthToken = tokenService.getOauthTokenByAccountId(accountId);
|
|
//2: 根据token以及用户id获取用户信息数据
|
|
//2: 根据token以及用户id获取用户信息数据
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_advertiser_info");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_advertiser_info");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -97,7 +98,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
int code = jsonObject.getInteger("code");
|
|
int code = jsonObject.getInteger("code");
|
|
|
|
|
|
- if (code!=0) {
|
|
|
|
|
|
+ if (code != 0) {
|
|
log.info("获取广告主信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
log.info("获取广告主信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
resultMap.put("success", false);
|
|
resultMap.put("success", false);
|
|
resultMap.put("code", -1);
|
|
resultMap.put("code", -1);
|
|
@@ -122,6 +123,40 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public JSONArray advertiserList(String token) {
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
+ // CtopOauthToken cTopOauthToken = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
|
+ //2: 根据token以及用户id获取用户信息数据
|
|
|
|
+ String url = "https://ad.oceanengine.com/open_api/oauth2/advertiser/get/";
|
|
|
|
+ Map<String, String> headers = new HashMap<>();
|
|
|
|
+ headers.put("Content-Type", "application/json");
|
|
|
|
+ TreeMap<String, Object> params = new TreeMap<>();
|
|
|
|
+ params.put("access_token", token);
|
|
|
|
+ String appId = PropertiesUtils.getValue("bytedance_config", "bytedance_appid");
|
|
|
|
+ String secret = PropertiesUtils.getValue("bytedance_config", "bytedance_secret");
|
|
|
|
+ params.put("secret", secret);
|
|
|
|
+ params.put("app_id", appId);
|
|
|
|
+ String result = HttpUtils.httpGetRequest(url, headers, params);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
+ log.info("返回信息:{}", jsonObject);
|
|
|
|
+ Integer code = jsonObject.getInteger("code");
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ JSONObject dataJson = jsonObject.getJSONObject("data");
|
|
|
|
+ if (!Check.isNull(dataJson)) {
|
|
|
|
+ JSONArray listArr = dataJson.getJSONArray("list");
|
|
|
|
+ if (!Check.isNull(listArr)) {
|
|
|
|
+ return listArr;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return new JSONArray();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
public void getAd(CtopOauthToken token, int pageNum, String ids, String date, String updateDate) {
|
|
public void getAd(CtopOauthToken token, int pageNum, String ids, String date, String updateDate) {
|
|
JSONArray getIds = null;
|
|
JSONArray getIds = null;
|
|
if (null != ids && !"".equals(ids)) {
|
|
if (null != ids && !"".equals(ids)) {
|
|
@@ -260,7 +295,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
private void getCreativeByPage(CtopOauthToken token, String date, int pageNum) {
|
|
private void getCreativeByPage(CtopOauthToken token, String date, int pageNum) {
|
|
JSONObject resultObject = getCreative(token, date, pageNum);
|
|
JSONObject resultObject = getCreative(token, date, pageNum);
|
|
Integer code = resultObject.getInteger("code");
|
|
Integer code = resultObject.getInteger("code");
|
|
@@ -324,7 +358,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
String result = HttpUtils.httpPostRequest(url, params, headers);
|
|
String result = HttpUtils.httpPostRequest(url, params, headers);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
int code = jsonObject.getInteger("code");
|
|
int code = jsonObject.getInteger("code");
|
|
- if (code!=0) {
|
|
|
|
|
|
+ if (code != 0) {
|
|
log.error("广告计划更新状态接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
|
|
log.error("广告计划更新状态接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
|
|
resultMap.put("code", -1);
|
|
resultMap.put("code", -1);
|
|
resultMap.put("message", "广告计划更新状态接口异常");
|
|
resultMap.put("message", "广告计划更新状态接口异常");
|
|
@@ -375,7 +409,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
String result = HttpUtils.httpPostRequest(url, params, headers);
|
|
String result = HttpUtils.httpPostRequest(url, params, headers);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
int code = jsonObject.getInteger("code");
|
|
int code = jsonObject.getInteger("code");
|
|
- if (code!=0) {
|
|
|
|
|
|
+ if (code != 0) {
|
|
log.info("修改计划出价接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
|
|
log.info("修改计划出价接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
|
|
resultMap.put("code", -1);
|
|
resultMap.put("code", -1);
|
|
resultMap.put("message", "修改计划出价接口异常");
|
|
resultMap.put("message", "修改计划出价接口异常");
|
|
@@ -457,13 +491,13 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> advertiserCustomAudienceSelect(String accountId) {
|
|
public Map<String, Object> advertiserCustomAudienceSelect(String accountId) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
- if(null == accountId||accountId.trim().equals("")){
|
|
|
|
- ResultMapUtils.setResultMap(resultMap,StatusCode.COMMON_PARAM_ERROR);
|
|
|
|
|
|
+ if (null == accountId || accountId.trim().equals("")) {
|
|
|
|
+ ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_PARAM_ERROR);
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
- if(null==token){
|
|
|
|
- ResultMapUtils.setResultMap(resultMap,StatusCode.COMMON_PARAM_ERROR);
|
|
|
|
|
|
+ if (null == token) {
|
|
|
|
+ ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_PARAM_ERROR);
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_dmp_custom_audience_select");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_dmp_custom_audience_select");
|
|
@@ -581,6 +615,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IBytedanceImageInfoService imageInfoService;
|
|
private IBytedanceImageInfoService imageInfoService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void getImageByPage(CtopOauthToken token, String imageIds, int page) {
|
|
public void getImageByPage(CtopOauthToken token, String imageIds, int page) {
|
|
// 请求地址
|
|
// 请求地址
|
|
@@ -602,7 +637,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
}
|
|
}
|
|
|
|
|
|
JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
|
|
JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
|
|
- if(null==resultObject){
|
|
|
|
|
|
+ if (null == resultObject) {
|
|
log.error("获取图片素材库接口异常==》accountId:{}", token.getAccountId());
|
|
log.error("获取图片素材库接口异常==》accountId:{}", token.getAccountId());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -646,7 +681,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
}
|
|
}
|
|
|
|
|
|
JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
|
|
JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
|
|
- if(null==resultObject){
|
|
|
|
|
|
+ if (null == resultObject) {
|
|
log.error("获取视频素材库接口异常==》accountId:{}", token.getAccountId());
|
|
log.error("获取视频素材库接口异常==》accountId:{}", token.getAccountId());
|
|
return;
|
|
return;
|
|
}
|
|
}
|