|
@@ -35,20 +35,13 @@ import java.util.TreeMap;
|
|
@Service
|
|
@Service
|
|
public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserDataService {
|
|
public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserDataService {
|
|
private static final Logger logger = LoggerFactory.getLogger(ByteDanceAdvertiserDataServiceImpl.class);
|
|
private static final Logger logger = LoggerFactory.getLogger(ByteDanceAdvertiserDataServiceImpl.class);
|
|
- @Autowired
|
|
|
|
- private CTopOauthTokenMapper cTopOauthTokenMapper;
|
|
|
|
-
|
|
|
|
- private CTopOauthToken getOAuthTokenByAccountId(String accountId) {
|
|
|
|
- QueryWrapper<CTopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
|
|
- queryWrapper.eq("advertiser_id", accountId).orderByDesc("create_time");
|
|
|
|
- CTopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
|
|
|
|
- return cTopOauthToken;
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICTopOauthTokenService tokenService;
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> getAdvertiserInfo(String accountId) {
|
|
public Map<String, Object> getAdvertiserInfo(String accountId) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
- CTopOauthToken cTopOauthToken = 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<>();
|
|
@@ -62,13 +55,15 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
|
|
|
if (null == code || !code.equals(0)) {
|
|
if (null == code || !code.equals(0)) {
|
|
logger.info("获取广告主信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
logger.info("获取广告主信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
|
|
|
|
+ resultMap.put("success", false);
|
|
resultMap.put("code", -1);
|
|
resultMap.put("code", -1);
|
|
resultMap.put("message", "获取广告主信息接口异常");
|
|
resultMap.put("message", "获取广告主信息接口异常");
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
JSONArray data = jsonObject.getJSONArray("data");
|
|
JSONArray data = jsonObject.getJSONArray("data");
|
|
if (null == data || data.size() <= 0) {
|
|
if (null == data || data.size() <= 0) {
|
|
- resultMap.put("code", 0);
|
|
|
|
|
|
+ resultMap.put("success", false);
|
|
|
|
+ resultMap.put("code", -1);
|
|
resultMap.put("message", "广告主信息不存在");
|
|
resultMap.put("message", "广告主信息不存在");
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
@@ -80,13 +75,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
advertiserMapper.insert(advertiser);
|
|
advertiserMapper.insert(advertiser);
|
|
resultMap.put("data", advertiser);
|
|
resultMap.put("data", advertiser);
|
|
}
|
|
}
|
|
|
|
+ resultMap.put("success", true);
|
|
resultMap.put("code", 0);
|
|
resultMap.put("code", 0);
|
|
resultMap.put("message", "获取广告主信息成功");
|
|
resultMap.put("message", "获取广告主信息成功");
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
|
|
private void getAdvertiserPlanByPageNumber(String accountId, Integer pageNumber, String ids) {
|
|
private void getAdvertiserPlanByPageNumber(String accountId, Integer pageNumber, String ids) {
|
|
- CTopOauthToken cTopOauthToken = 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_ad_get");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_get");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -155,7 +151,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> getAdvertiserBudget(String accountId) {
|
|
public Map<String, Object> getAdvertiserBudget(String accountId) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
- CTopOauthToken cTopOauthToken = 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_campaign_get");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -205,7 +201,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> getAdvertiserCreativeMaterial(String accountId, String creativeIds) {
|
|
public Map<String, Object> getAdvertiserCreativeMaterial(String accountId, String creativeIds) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
- CTopOauthToken cTopOauthToken = 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_creative_material_get");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_material_get");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -254,7 +250,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
ids.add(Long.parseLong(getIds[i]));
|
|
ids.add(Long.parseLong(getIds[i]));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- CTopOauthToken cTopOauthToken = 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_campaign_update_status");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update_status");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -301,7 +297,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> advertiserCampaignUpdate(String accountId, Long campaignId, String budgetMode, Integer budget, String campaignName) {
|
|
public Map<String, Object> advertiserCampaignUpdate(String accountId, Long campaignId, String budgetMode, Integer budget, String campaignName) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
- CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
|
|
|
|
|
|
+ CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
|
|
ByteDanceCampaign campaign = campaignMapper.selectById(campaignId);
|
|
ByteDanceCampaign campaign = campaignMapper.selectById(campaignId);
|
|
//2: 根据token以及用户id获取用户信息数据
|
|
//2: 根据token以及用户id获取用户信息数据
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update");
|
|
@@ -367,7 +363,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
ids.add(Long.parseLong(getIds[i]));
|
|
ids.add(Long.parseLong(getIds[i]));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- CTopOauthToken cTopOauthToken = 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_ad_update_status");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_status");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -422,7 +418,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
data.add(object);
|
|
data.add(object);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- CTopOauthToken cTopOauthToken = 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_ad_update_bid");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_bid");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -476,7 +472,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
data.add(object);
|
|
data.add(object);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- CTopOauthToken cTopOauthToken = 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_ad_update_budget");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_budget");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -522,7 +518,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
ids.add(Long.parseLong(getCreativeIds[i]));
|
|
ids.add(Long.parseLong(getCreativeIds[i]));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- CTopOauthToken cTopOauthToken = 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_creative_update_status");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_update_status");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -568,7 +564,7 @@ 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<>();
|
|
- CTopOauthToken token = getOAuthTokenByAccountId(accountId);
|
|
|
|
|
|
+ CTopOauthToken token = tokenService.getOAuthTokenByAccountId(accountId);
|
|
|
|
|
|
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");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -620,13 +616,10 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
private ByteDanceCustomAudienceMapper audienceMapper;
|
|
private ByteDanceCustomAudienceMapper audienceMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private ICTopOauthTokenService tokenService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
private ByteDanceCreativeMaterialMapper creativeMaterialMapper;
|
|
private ByteDanceCreativeMaterialMapper creativeMaterialMapper;
|
|
|
|
|
|
private void getAdvertiserCreativeByPageNumber(String accountId, Integer pageNumber, String ids) {
|
|
private void getAdvertiserCreativeByPageNumber(String accountId, Integer pageNumber, String ids) {
|
|
- CTopOauthToken cTopOauthToken = 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_creative_get");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_get");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -676,7 +669,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
private ByteDanceAdvertiserBudgetMapper advertiserBudgetMapper;
|
|
private ByteDanceAdvertiserBudgetMapper advertiserBudgetMapper;
|
|
|
|
|
|
private void getAdvertiserCampaignByPageNumber(String accountId, Integer pageNumber, String ids) {
|
|
private void getAdvertiserCampaignByPageNumber(String accountId, Integer pageNumber, String ids) {
|
|
- CTopOauthToken cTopOauthToken = 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_campaign_get");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get");
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|