|
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
-import org.jeecg.modules.bytedance.advertise.dockapi.Marketing;
|
|
|
+import org.jeecg.modules.bytedance.advertise.dockapi.MarketingService;
|
|
|
import org.jeecg.modules.bytedance.advertise.entity.*;
|
|
|
import org.jeecg.modules.bytedance.advertise.enums.BytedanceCreativeMatTypeEnum;
|
|
|
import org.jeecg.modules.bytedance.advertise.mapper.AiBytedanceAdvertiserStrategyMapper;
|
|
@@ -63,6 +63,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
private IAiBytedanceAdDplinkInfoService adDplinkInfoService;
|
|
|
@Autowired
|
|
|
private IByteDanceVideoInfoService videoInfoService;
|
|
|
+ @Autowired
|
|
|
+ private MarketingService marketingService;
|
|
|
|
|
|
@Override
|
|
|
public Long createCreative(AiBytedanceAdvertiserStrategy strategy,Integer createType, Long videoCnt) {
|
|
@@ -111,7 +113,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
adDplinkInfo.setId(null);
|
|
|
adDplinkInfo.setDpLinkIndex(adDplinkInfo.getDpLinkIndex()+1);
|
|
|
}
|
|
|
- dpIndex = strategy.getDpLinkStartIndex();
|
|
|
+ dpIndex = adDplinkInfo.getDpLinkIndex();
|
|
|
if(dpIndex>strategy.getDpLinkEndIndex()){
|
|
|
log.info("此账户策略创建结束=>账户id:{};策略id:{}", token.getAccountId(),strategy.getId());
|
|
|
return 0L;
|
|
@@ -127,11 +129,11 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
adDplinkInfo.setAdId(adId);
|
|
|
adDplinkInfo.setAccountId(strategy.getAccountId());
|
|
|
adDplinkInfo.setStatus(1);
|
|
|
- adDplinkInfo.setStratrgyId(strategy.getId());
|
|
|
+ adDplinkInfo.setStrategyId(strategy.getId());
|
|
|
adDplinkInfoService.save(adDplinkInfo);
|
|
|
//3:创建创意
|
|
|
JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
|
|
|
- JSONObject creativeObject = Marketing.creativeCreate(token,adId,creativeParams);
|
|
|
+ JSONObject creativeObject = marketingService.creativeCreate(token,adId,creativeParams);
|
|
|
if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
|
|
|
String message = creativeObject.getString("message");
|
|
|
//创建创意失败
|
|
@@ -151,9 +153,13 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
params.put("ad_id",adId);
|
|
|
String inventoryType = strategy.getCreativeInventoryType();
|
|
|
if(null!=inventoryType&&!"".equals(inventoryType)){
|
|
|
- JSONArray inventoryTypeArray = JSON.parseArray(inventoryType);
|
|
|
- if(!Check.isNull(inventoryTypeArray)){
|
|
|
- params.put("inventory_type",inventoryTypeArray);
|
|
|
+ String[] inventoryTypeString = inventoryType.split(",");
|
|
|
+ if(inventoryTypeString.length>0){
|
|
|
+ JSONArray inventoryTypeArray = new JSONArray();
|
|
|
+ for(int i=0;i<inventoryTypeString.length;i++){
|
|
|
+ inventoryTypeArray.add(inventoryTypeString[i]);
|
|
|
+ }
|
|
|
+ params.put("inventory_type",inventoryTypeArray);
|
|
|
}
|
|
|
}
|
|
|
Integer smartInventory = strategy.getCreativeSmartInventory();
|
|
@@ -182,19 +188,20 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
JSONObject imageObject = new JSONObject();
|
|
|
//视频类型
|
|
|
if(videoInfo.getType() == 1){
|
|
|
- //横版视频
|
|
|
- imageObject.put("image_mode","CREATIVE_IMAGE_MODE_VIDEO");
|
|
|
- }
|
|
|
- if(videoInfo.getType() == 2){
|
|
|
//竖版视频
|
|
|
imageObject.put("image_mode","CREATIVE_IMAGE_MODE_VIDEO_VERTICAL");
|
|
|
}
|
|
|
+ if(videoInfo.getType() == 2){
|
|
|
+ //横版视频
|
|
|
+ imageObject.put("image_mode","CREATIVE_IMAGE_MODE_VIDEO");
|
|
|
+ }
|
|
|
imageObject.put("video_id",videoInfo.getVid());
|
|
|
//获取视频封面id
|
|
|
String imageId = getSuggestImageId(token,videoInfo.getVid());
|
|
|
if(!Check.isNull(imageId)){
|
|
|
imageObject.put("image_id",imageId);
|
|
|
}
|
|
|
+ imageArray.add(imageObject);
|
|
|
params.put("image_list",imageArray);
|
|
|
JSONArray titleArray = new JSONArray();
|
|
|
List<BytedanceVideoSlogenInfo>slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1);
|
|
@@ -205,7 +212,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
titleArray.add(titleObject);
|
|
|
});
|
|
|
}
|
|
|
- if(Check.isNull(titleArray)){
|
|
|
+ if(!Check.isNull(titleArray)){
|
|
|
params.put("title_list",titleArray);
|
|
|
}
|
|
|
//广告来源
|
|
@@ -277,13 +284,17 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
String productSellingPoints = strategy.getCreativeProductSellingPoints();
|
|
|
if(!Check.isNull(productSellingPoints)){
|
|
|
- JSONArray pointArray = JSON.parseArray(productSellingPoints);
|
|
|
- if(null!=pointArray&&pointArray.size()>0){
|
|
|
+ String[] pointString = productSellingPoints.split(",");
|
|
|
+ if(pointString.length>0){
|
|
|
+ JSONArray pointArray = new JSONArray();
|
|
|
+ for(int i=0;i<pointString.length;i++){
|
|
|
+ pointArray.add(pointString[i]);
|
|
|
+ }
|
|
|
promotionCard.put("product_selling_points",pointArray);
|
|
|
}
|
|
|
}
|
|
|
String productDescription = strategy.getCreativeProductDescription();
|
|
|
- if(Check.isNull(productDescription)){
|
|
|
+ if(!Check.isNull(productDescription)){
|
|
|
promotionCard.put("product_description",productDescription);
|
|
|
}
|
|
|
Boolean enableStorePack = strategy.getCreativeEnablePersonalAction();
|
|
@@ -369,8 +380,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
|
|
|
private Long createAdInfo(CtopOauthToken token, AiBytedanceAdvertiserStrategy strategy, JSONObject adParams) {
|
|
|
- Result result = Marketing.createAdvertiserPlan(token,adParams,strategy);
|
|
|
- if(result.getCode()!=200){
|
|
|
+ Result result = marketingService.createAdvertiserPlan(token,adParams,strategy);
|
|
|
+ if(result.getCode()!=0){
|
|
|
//TODO 计划创建异常 后续需要加日志
|
|
|
return null;
|
|
|
}
|
|
@@ -383,6 +394,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
params.put("advertiser_id",strategy.getAccountId());
|
|
|
params.put("campaign_id",campaignId);
|
|
|
params.put("name",adName);
|
|
|
+ //竞价策略 默认优先跑量
|
|
|
+ params.put("flow_control_mode","FLOW_CONTROL_MODE_FAST");
|
|
|
//投放范围
|
|
|
params.put("delivery_range",strategy.getAdDeliveryRange());
|
|
|
if(!Check.isNull(strategy.getAdUnionVideoType())){
|
|
@@ -449,81 +462,141 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
params.put("gender",strategy.getAdGender());
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdAge())){
|
|
|
- JSONArray age = JSON.parseArray(strategy.getAdAge());
|
|
|
- if(null!=age&&!age.isEmpty()){
|
|
|
- params.put("age",age);
|
|
|
+ String[] age = strategy.getAdAge().split(",");
|
|
|
+ if(age.length>0){
|
|
|
+ JSONArray ageArray = new JSONArray();
|
|
|
+ for(int i=0;i<age.length;i++){
|
|
|
+ if(null!=age[i]&&!age[i].equals("NONE")){
|
|
|
+ ageArray.add(age[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!ageArray.isEmpty()){
|
|
|
+ params.put("age",ageArray);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdRetargetingTagsInclude())){
|
|
|
- JSONArray retargetingTagsInclude = JSON.parseArray(strategy.getAdRetargetingTagsInclude());
|
|
|
- if(null!=retargetingTagsInclude&&!retargetingTagsInclude.isEmpty()){
|
|
|
- params.put("retargeting_tags_include",retargetingTagsInclude);
|
|
|
+ String[] retargetingTagsInclude = strategy.getAdRetargetingTagsInclude().split(",");
|
|
|
+ if(retargetingTagsInclude.length>0){
|
|
|
+ JSONArray retargetingTagsIncludeArray = new JSONArray();
|
|
|
+ for(int i=0;i<retargetingTagsInclude.length;i++){
|
|
|
+ if(null!=retargetingTagsInclude[i]&&!retargetingTagsInclude[i].equals("NONE")){
|
|
|
+ retargetingTagsIncludeArray.add(Long.parseLong(retargetingTagsInclude[i]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!retargetingTagsIncludeArray.isEmpty()){
|
|
|
+ params.put("retargeting_tags_include",retargetingTagsIncludeArray);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdRetargetingTagsExclude())){
|
|
|
- JSONArray getAdRetargetingTagsExclude = JSON.parseArray(strategy.getAdRetargetingTagsExclude());
|
|
|
- if(null!=getAdRetargetingTagsExclude&&!getAdRetargetingTagsExclude.isEmpty()){
|
|
|
- params.put("retargeting_tags_exclude",getAdRetargetingTagsExclude);
|
|
|
+ String[] getAdRetargetingTagsExclude = strategy.getAdRetargetingTagsExclude().split(",");
|
|
|
+ if(getAdRetargetingTagsExclude.length>0){
|
|
|
+ JSONArray getAdRetargetingTagsExcludeArray = new JSONArray();
|
|
|
+ for(int i=0;i<getAdRetargetingTagsExclude.length;i++){
|
|
|
+ if(null!=getAdRetargetingTagsExclude[i]&&!getAdRetargetingTagsExclude[i].equals("NONE")){
|
|
|
+ getAdRetargetingTagsExcludeArray.add(getAdRetargetingTagsExclude[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!getAdRetargetingTagsExcludeArray.isEmpty()){
|
|
|
+ params.put("retargeting_tags_exclude",getAdRetargetingTagsExcludeArray);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdInterestActionMode())){
|
|
|
params.put("interest_action_mode",strategy.getAdInterestActionMode());
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdActionScene())){
|
|
|
- JSONArray actionScene = JSON.parseArray(strategy.getAdActionScene());
|
|
|
- if(null!=actionScene&&!actionScene.isEmpty()){
|
|
|
- params.put("action_scene",actionScene);
|
|
|
+ String[] actionScene = strategy.getAdActionScene().split(",");
|
|
|
+ if(actionScene.length>0){
|
|
|
+ JSONArray actionSceneArray = new JSONArray();
|
|
|
+ for(int i=0;i<actionScene.length;i++){
|
|
|
+ actionSceneArray.add(actionScene[i]);
|
|
|
+ }
|
|
|
+ params.put("action_scene",actionSceneArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdActionDays())){
|
|
|
params.put("action_days",strategy.getAdActionDays());
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdActionCategories())){
|
|
|
- JSONArray actionCategories = JSON.parseArray(strategy.getAdActionCategories());
|
|
|
- if(null!=actionCategories&&!actionCategories.isEmpty()){
|
|
|
- params.put("action_categories",actionCategories);
|
|
|
+ String[] actionCategories = strategy.getAdActionCategories().split(",");
|
|
|
+ if(actionCategories.length>0){
|
|
|
+ JSONArray actionCategoriesArray = new JSONArray();
|
|
|
+ for(int i=0;i<actionCategories.length;i++){
|
|
|
+ actionCategoriesArray.add(actionCategories[i]);
|
|
|
+ }
|
|
|
+ params.put("action_categories",actionCategoriesArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdActionWords())){
|
|
|
- JSONArray actionWords = JSON.parseArray(strategy.getAdActionWords());
|
|
|
- if(null!=actionWords&&!actionWords.isEmpty()){
|
|
|
- params.put("action_words",actionWords);
|
|
|
+ String[] actionWords = strategy.getAdActionWords().split(",");
|
|
|
+ if(actionWords.length>0){
|
|
|
+ JSONArray actionWordsArray = new JSONArray();
|
|
|
+ for(int i=0;i<actionWords.length;i++){
|
|
|
+ actionWordsArray.add(actionWords[i]);
|
|
|
+ }
|
|
|
+ params.put("action_words",actionWordsArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdInterestCategories())){
|
|
|
- JSONArray interestCategories = JSON.parseArray(strategy.getAdInterestCategories());
|
|
|
- if(null!=interestCategories&&!interestCategories.isEmpty()){
|
|
|
- params.put("interest_categories",interestCategories);
|
|
|
+ String[] interestCategories = strategy.getAdInterestCategories().split(",");
|
|
|
+ if(interestCategories.length>0){
|
|
|
+ JSONArray interestCategoriesArray = new JSONArray();
|
|
|
+ for(int i=0;i<interestCategories.length;i++){
|
|
|
+ interestCategoriesArray.add(interestCategories[i]);
|
|
|
+ }
|
|
|
+ params.put("interest_categories",interestCategoriesArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdInterestWords())){
|
|
|
- JSONArray interestWords = JSON.parseArray(strategy.getAdInterestWords());
|
|
|
- if(null!=interestWords&&!interestWords.isEmpty()){
|
|
|
- params.put("interest_words",interestWords);
|
|
|
+ String[] interestWords = strategy.getAdInterestWords().split(",");
|
|
|
+ if(interestWords.length>0){
|
|
|
+ JSONArray interestWordsArray = new JSONArray();
|
|
|
+ for(int i=0;i<interestWords.length;i++){
|
|
|
+ interestWordsArray.add(interestWords[i]);
|
|
|
+ }
|
|
|
+ params.put("interest_words",interestWordsArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdAwemeFanBehaviors())){
|
|
|
- JSONArray awemeFanBehaviors = JSON.parseArray(strategy.getAdAwemeFanBehaviors());
|
|
|
- if(null!=awemeFanBehaviors&&!awemeFanBehaviors.isEmpty()){
|
|
|
- params.put("aweme_fan_behaviors",awemeFanBehaviors);
|
|
|
+ String[] awemeFanBehaviors = strategy.getAdAwemeFanBehaviors().split(",");
|
|
|
+ if(awemeFanBehaviors.length>0){
|
|
|
+ JSONArray awemeFanBehaviorsArray = new JSONArray();
|
|
|
+ for(int i=0;i<awemeFanBehaviors.length;i++){
|
|
|
+ awemeFanBehaviorsArray.add(awemeFanBehaviors[i]);
|
|
|
+ }
|
|
|
+ params.put("aweme_fan_behaviors",awemeFanBehaviorsArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdAwemeFanCategories())){
|
|
|
- JSONArray awemeFanCategories = JSON.parseArray(strategy.getAdAwemeFanCategories());
|
|
|
- if(null!=awemeFanCategories&&!awemeFanCategories.isEmpty()){
|
|
|
- params.put("aweme_fan_categories",awemeFanCategories);
|
|
|
+ String[] awemeFanCategories = strategy.getAdAwemeFanCategories().split(",");
|
|
|
+ if(awemeFanCategories.length>0){
|
|
|
+ JSONArray awemeFanCategoriesArray = new JSONArray();
|
|
|
+ for(int i=0;i<awemeFanCategories.length;i++){
|
|
|
+ awemeFanCategoriesArray.add(awemeFanCategories[i]);
|
|
|
+ }
|
|
|
+ params.put("aweme_fan_categories",awemeFanCategoriesArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdAwemeFanAccounts())){
|
|
|
- JSONArray awemeFanAccount = JSON.parseArray(strategy.getAdAwemeFanAccounts());
|
|
|
- if(null!=awemeFanAccount&&!awemeFanAccount.isEmpty()){
|
|
|
- params.put("aweme_fan_accounts",awemeFanAccount);
|
|
|
+ String[] awemeFanAccount = strategy.getAdAwemeFanAccounts().split(",");
|
|
|
+ if(awemeFanAccount.length>0){
|
|
|
+ JSONArray awemeFanAccountArray = new JSONArray();
|
|
|
+ for(int i=0;i<awemeFanAccount.length;i++){
|
|
|
+ awemeFanAccountArray.add(awemeFanAccount[i]);
|
|
|
+ }
|
|
|
+ params.put("aweme_fan_accounts",awemeFanAccountArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdAwemeFansNumbers())){
|
|
|
- JSONArray awemeFansNumbers = JSON.parseArray(strategy.getAdAwemeFansNumbers());
|
|
|
- if(null!=awemeFansNumbers&&!awemeFansNumbers.isEmpty()){
|
|
|
- params.put("aweme_fans_numbers",awemeFansNumbers);
|
|
|
+ String[] awemeFansNumbers = strategy.getAdAwemeFansNumbers().split(",");
|
|
|
+ if(awemeFansNumbers.length>0){
|
|
|
+ JSONArray awemeFansNumbersArray = new JSONArray();
|
|
|
+ for(int i=0;i<awemeFansNumbers.length;i++){
|
|
|
+ awemeFansNumbersArray.add(awemeFansNumbers[i]);
|
|
|
+ }
|
|
|
+ params.put("aweme_fans_numbers",awemeFansNumbersArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdFilterAwemeAbnormalActive())){
|
|
@@ -539,21 +612,33 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
params.put("superior_popularity_type",strategy.getAdSuperiorPopularityType());
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdFlowPackage())){
|
|
|
- JSONArray flowPackage = JSON.parseArray(strategy.getAdFlowPackage());
|
|
|
- if(null!=flowPackage&&!flowPackage.isEmpty()){
|
|
|
- params.put("flow_package",flowPackage);
|
|
|
+ String[] flowPackage = strategy.getAdFlowPackage().split(",");
|
|
|
+ if(flowPackage.length>0){
|
|
|
+ JSONArray flowPackageArray = new JSONArray();
|
|
|
+ for(int i=0;i<flowPackage.length;i++){
|
|
|
+ flowPackageArray.add(flowPackage[i]);
|
|
|
+ }
|
|
|
+ params.put("flow_package",flowPackageArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdExcludeFlowPackage())){
|
|
|
- JSONArray excludeFlowPackage = JSON.parseArray(strategy.getAdExcludeFlowPackage());
|
|
|
- if(null!=excludeFlowPackage&&!excludeFlowPackage.isEmpty()){
|
|
|
- params.put("exclude_flow_package",excludeFlowPackage);
|
|
|
+ String[] excludeFlowPackage = strategy.getAdExcludeFlowPackage().split(",");
|
|
|
+ if(excludeFlowPackage.length>0){
|
|
|
+ JSONArray excludeFlowPackageArray = new JSONArray();
|
|
|
+ for(int i=0;i<excludeFlowPackage.length;i++){
|
|
|
+ excludeFlowPackageArray.add(excludeFlowPackage[i]);
|
|
|
+ }
|
|
|
+ params.put("exclude_flow_package",excludeFlowPackageArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdPlatform())){
|
|
|
- JSONArray platform = JSON.parseArray(strategy.getAdPlatform());
|
|
|
- if(null!=platform&&!platform.isEmpty()){
|
|
|
- params.put("platform",platform);
|
|
|
+ String[] platform = strategy.getAdPlatform().split(",");
|
|
|
+ if(platform.length>0){
|
|
|
+ JSONArray platformArray = new JSONArray();
|
|
|
+ for(int i=0;i<platform.length;i++){
|
|
|
+ platformArray.add(platform[i]);
|
|
|
+ }
|
|
|
+ params.put("platform",platformArray);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -565,21 +650,41 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
params.put("ios_osv",strategy.getAdAdIosOsv());
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdAc())){
|
|
|
- JSONArray ac = JSON.parseArray(strategy.getAdAc());
|
|
|
- if(null!=ac&&!ac.isEmpty()){
|
|
|
- params.put("ac",ac);
|
|
|
+ String[] ac = strategy.getAdAc().split(",");
|
|
|
+ if(ac.length>0){
|
|
|
+ JSONArray acArray = new JSONArray();
|
|
|
+ for(int i=0;i<ac.length;i++){
|
|
|
+ if(null!=ac[i]&&!ac[i].equals("NONE")){
|
|
|
+ acArray.add(ac[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!acArray.isEmpty()){
|
|
|
+ params.put("ac",acArray);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdCarrier())){
|
|
|
- JSONArray carrier = JSON.parseArray(strategy.getAdCarrier());
|
|
|
- if(null!=carrier&&!carrier.isEmpty()){
|
|
|
- params.put("carrier",carrier);
|
|
|
+ String[] carrier = strategy.getAdCarrier().split(",");
|
|
|
+ if(carrier.length>0){
|
|
|
+ JSONArray carrierArray = new JSONArray();
|
|
|
+ for(int i=0;i<carrier.length;i++){
|
|
|
+ if(null!=carrier[i]&&!carrier[i].equals("NONE")) {
|
|
|
+ carrierArray.add(carrier[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!carrierArray.isEmpty()){
|
|
|
+ params.put("carrier",carrierArray);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdDeviceType())){
|
|
|
- JSONArray deviceType = JSON.parseArray(strategy.getAdDeviceType());
|
|
|
- if(null!=deviceType&&!deviceType.isEmpty()){
|
|
|
- params.put("device_type",deviceType);
|
|
|
+ String[] deviceType = strategy.getAdDeviceType().split(",");
|
|
|
+ if(deviceType.length>0){
|
|
|
+ JSONArray deviceTypeArray = new JSONArray();
|
|
|
+ for(int i=0;i<deviceType.length;i++){
|
|
|
+ deviceTypeArray.add(deviceType[i]);
|
|
|
+ }
|
|
|
+ params.put("device_type",deviceTypeArray);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -594,36 +699,56 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
|
|
|
if(!Check.isNull(strategy.getAdActivateType())){
|
|
|
- JSONArray activateType = JSON.parseArray(strategy.getAdActivateType());
|
|
|
- if(null!=activateType&&!activateType.isEmpty()){
|
|
|
- params.put("activate_type",activateType);
|
|
|
+ String[] activateType = strategy.getAdActivateType().split(",");
|
|
|
+ if(activateType.length>0){
|
|
|
+ JSONArray activateTypeArray = new JSONArray();
|
|
|
+ for(int i=0;i<activateType.length;i++){
|
|
|
+ activateTypeArray.add(activateType[i]);
|
|
|
+ }
|
|
|
+ params.put("activate_type",activateTypeArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdArticleCategory())){
|
|
|
- JSONArray articleCategory = JSON.parseArray(strategy.getAdArticleCategory());
|
|
|
- if(null!=articleCategory&&!articleCategory.isEmpty()){
|
|
|
- params.put("article_category",articleCategory);
|
|
|
+ String[] articleCategory = strategy.getAdArticleCategory().split(",");
|
|
|
+ if(articleCategory.length>0){
|
|
|
+ JSONArray articleCategoryArray = new JSONArray();
|
|
|
+ for(int i=0;i<articleCategory.length;i++){
|
|
|
+ articleCategoryArray.add(articleCategory[i]);
|
|
|
+ }
|
|
|
+ params.put("article_category",articleCategoryArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdDeviceBrand())){
|
|
|
- JSONArray deviceBrand = JSON.parseArray(strategy.getAdDeviceBrand());
|
|
|
- if(null!=deviceBrand&&!deviceBrand.isEmpty()){
|
|
|
- params.put("device_brand",deviceBrand);
|
|
|
+ String[] deviceBrand = strategy.getAdDeviceBrand().split(",");
|
|
|
+ if(deviceBrand.length>0){
|
|
|
+ JSONArray deviceBrandArray = new JSONArray();
|
|
|
+ for(int i=0;i<deviceBrand.length;i++){
|
|
|
+ deviceBrandArray.add(deviceBrand[i]);
|
|
|
+ }
|
|
|
+ params.put("device_brand",deviceBrandArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdLaunchPrice())){
|
|
|
- JSONArray launchPrice = JSON.parseArray(strategy.getAdLaunchPrice());
|
|
|
- if(null!=launchPrice&&!launchPrice.isEmpty()){
|
|
|
- params.put("launch_price",launchPrice);
|
|
|
+ String[] launchPrice = strategy.getAdLaunchPrice().split(",");
|
|
|
+ if(launchPrice.length>0){
|
|
|
+ JSONArray launchPriceArray = new JSONArray();
|
|
|
+ for(int i=0;i<launchPrice.length;i++){
|
|
|
+ launchPriceArray.add(launchPrice[i]);
|
|
|
+ }
|
|
|
+ params.put("launch_price",launchPriceArray);
|
|
|
}
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdAutoExtendEnabled())){
|
|
|
params.put("auto_extend_enabled",strategy.getAdAutoExtendEnabled());
|
|
|
}
|
|
|
if(!Check.isNull(strategy.getAdAutoExtendTargets())){
|
|
|
- JSONArray autoExtendTargets = JSON.parseArray(strategy.getAdAutoExtendTargets());
|
|
|
- if(null!=autoExtendTargets&&!autoExtendTargets.isEmpty()){
|
|
|
- params.put("auto_extend_targets",autoExtendTargets);
|
|
|
+ String[] autoExtendTargets = strategy.getAdAutoExtendTargets().split(",");
|
|
|
+ if(autoExtendTargets.length>0){
|
|
|
+ JSONArray autoExtendTargetsArray = new JSONArray();
|
|
|
+ for(int i=0;i<autoExtendTargets.length;i++){
|
|
|
+ autoExtendTargetsArray.add(autoExtendTargets[i]);
|
|
|
+ }
|
|
|
+ params.put("auto_extend_targets",autoExtendTargetsArray);
|
|
|
}
|
|
|
}
|
|
|
//预算与出价
|
|
@@ -685,18 +810,19 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
if(adName.contains("{{日期}}")){
|
|
|
String date = DateUtils.formatDate(new Date(),"yyyyMMdd");
|
|
|
- adName.replace("{{日期}}",date);
|
|
|
+ adName = adName.replace("{{日期}}",date);
|
|
|
}
|
|
|
if(adName.contains("{{dp链接标识}}")){
|
|
|
- adName.replace("{{dp链接标识}}",dplinkCode);
|
|
|
+ adName = adName.replace("{{dp链接标识}}",dplinkCode);
|
|
|
}
|
|
|
if(adName.contains("{{出价方式}}")){
|
|
|
String pricing = strategy.getAdPricing().replace("PRICING_","");
|
|
|
- adName.replace("{{出价方式}}",pricing);
|
|
|
+ adName = adName.replace("{{出价方式}}",pricing);
|
|
|
}
|
|
|
if(adName.contains("{{素材名称}}")){
|
|
|
- MaterialInfo info = materialInfoService.getParams(videoInfo.getSignature(),1);
|
|
|
- adName.replace("{{素材名称}}",info.getMaterialName());
|
|
|
+ MaterialInfo info = materialInfoService.getParams(videoInfo.getSignature(),null);
|
|
|
+ System.out.println(info.getMaterialName());
|
|
|
+ adName = adName.replace("{{素材名称}}",info.getMaterialName());
|
|
|
}
|
|
|
return adName;
|
|
|
}
|
|
@@ -725,8 +851,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
campaignParam.put("delivery_related_num",strategy.getCampaignDeliveryRelatedNum());
|
|
|
}
|
|
|
//创建组
|
|
|
- Result campaignData = Marketing.createCampaign(token, campaignParam);
|
|
|
- if(campaignData.getCode()!=200){
|
|
|
+ Result campaignData = marketingService.createCampaign(token, campaignParam);
|
|
|
+ if(campaignData.getCode()!=0){
|
|
|
//TODO 组创建异常 后续需要加日志
|
|
|
return null;
|
|
|
}
|
|
@@ -829,7 +955,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
return Result.error("token获取失败====>>>>accountId:"+token.getAccountId());
|
|
|
}
|
|
|
// api 获取行业列表
|
|
|
- Result listResult = Marketing.getToolIndustryList(token,type);
|
|
|
+ Result listResult = marketingService.getToolIndustryList(token,type);
|
|
|
List<Map<String,Object>> industryListMap = (List<Map<String,Object>>) listResult.getResult();
|
|
|
// list map 数据格式 转 list entity 数据格式
|
|
|
List<IndustryVo> industryList = Check.convertListMap2ListBean(industryListMap,IndustryVo.class);
|
|
@@ -896,7 +1022,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
return Result.error("token获取失败====>>>>accountId:"+token.getAccountId());
|
|
|
}
|
|
|
// 获取广告组
|
|
|
- Result industryList = Marketing.getCampaignGroupList(token,accountId,adGroupSearchVoList,pageNo,pageSize);
|
|
|
+ Result industryList = marketingService.getCampaignGroupList(token,accountId,null,pageNo,pageSize);
|
|
|
log.error("获取广告组=======>>>>>>>>>>>", industryList.getResult());
|
|
|
return Result.successMsg("获取广告组成功。", industryList.getResult());
|
|
|
}
|
|
@@ -922,7 +1048,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
return Result.error("token获取失败====>>>>accountId:"+accountId );
|
|
|
}
|
|
|
// 获取计划
|
|
|
- Result industryList = Marketing.getPlanList(token,adGroupSearchVoList,pageNo,pageSize);
|
|
|
+ Result industryList = marketingService.getPlanList(token,adGroupSearchVoList,pageNo,pageSize);
|
|
|
log.error("获取广告计划=======>>>>>>>>>>>{}", industryList.getResult());
|
|
|
return Result.successMsg("获取广告计划成功。", industryList.getResult());
|
|
|
}
|
|
@@ -943,7 +1069,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
return Result.error("token获取失败====>>>>accountId:"+token.getAccountId());
|
|
|
}
|
|
|
// 获取 创意详细信息
|
|
|
- Result industryList = Marketing.creativeRead(token,accountId,adId);
|
|
|
+ Result industryList = marketingService.creativeRead(token,accountId,adId);
|
|
|
log.error("获取创意详细信息=======>>>>>>>>>>>", industryList.getResult());
|
|
|
return Result.successMsg("获取创意详细信息成功。", industryList.getResult());
|
|
|
}
|
|
@@ -963,17 +1089,17 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
return Result.error("token获取失败====>>>>accountId:"+token.getAccountId());
|
|
|
}
|
|
|
// 1:修改广告组
|
|
|
- Result resultCampaign = Marketing.updateCampaign(token,
|
|
|
+ Result resultCampaign = marketingService.updateCampaign(token,
|
|
|
"广告组id",groupModifyTime,
|
|
|
strategy.getCampaignName(),strategy.getCampaignBudgetMode(),strategy.getCampaignLandingType());
|
|
|
//广告组id
|
|
|
Long campaignId = (Long) resultCampaign.getResult();
|
|
|
// 2:修改广告计划
|
|
|
- Result resultPlan = Marketing.updateAdvertiserPlan(token,"计划id",planModifyTime,strategy);
|
|
|
+ Result resultPlan = marketingService.updateAdvertiserPlan(token,"计划id",planModifyTime,strategy);
|
|
|
//计划id
|
|
|
Object planId = resultPlan.getResult();
|
|
|
//3:修改创意 TODO 拼接创意参数
|
|
|
- Result creativeInfo = Marketing.creativeUpdate(token, "计划id","创意时间戳",null);
|
|
|
+ Result creativeInfo = marketingService.creativeUpdate(token, "计划id","创意时间戳",null);
|
|
|
//数据修改
|
|
|
aiBytedanceAdvertiserStrategyMapper.updateById(strategy);
|
|
|
return Result.successMsg("修改成功", strategy);
|
|
@@ -994,7 +1120,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
log.info("token获取失败=>accountId:{}", token.getAccountId());
|
|
|
return Result.error("token获取失败====>>>>accountId:"+token.getAccountId());
|
|
|
}
|
|
|
- return Marketing.getToolConvertQuery(token,adConvertQueryVo);
|
|
|
+ return marketingService.getToolConvertQuery(token,adConvertQueryVo);
|
|
|
}
|
|
|
|
|
|
|