Selaa lähdekoodia

Merge remote-tracking branch 'origin/test' into test

huangxuechao 4 vuotta sitten
vanhempi
commit
8f517ae7b3

+ 4 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/MarketingService.java

@@ -75,4 +75,8 @@ public interface MarketingService {
     Result createAudiencePackage(CtopOauthToken token);
 
     Result getSite(CtopOauthToken token);
+
+
+    Result getCreativeComponent(CtopOauthToken token);
+
 }

+ 26 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/MarketingServiceImpl.java

@@ -1230,5 +1230,31 @@ public class MarketingServiceImpl implements MarketingService{
 
     }
 
+    @Override
+    public Result getCreativeComponent(CtopOauthToken token) {
+
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", token.getAccountId());
+        params.put("page", 1);
+        params.put("page_size", 40);
+        params.put("filtering", null);
+        params = Check.jsonRemoveEmpty(params);
+
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                urlPath+ PropertiesUtils.getValue("bytedance_config", "bytedance_v2_assets_get"),params);
+        Integer code = jsonObject.getInteger("code");
+        String message = jsonObject.getString("message");
+        if (null == code || !code.equals(0)) {
+            log.info("查询组件列表接口异常==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error(message);
+        }
+        JSONObject dataList = jsonObject.getJSONObject("data");
+        if (null == dataList || dataList.isEmpty()) {
+            log.info("查询组件列表不存在==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error("查询组件列表不存在");
+        }
+        return Result.successMsg("查询组件列表成功",dataList.getJSONArray("list"));
+    }
+
 
 }

+ 21 - 3
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/entity/AiBytedanceAdvertiserStrategy.java

@@ -51,6 +51,9 @@ public class AiBytedanceAdvertiserStrategy{
 	private Long campaignAdCnt;
 	/**广告类型*/
 	private String advertisingType;
+
+	/**广告类型  FEED-信息流 SEARCH-搜索广告*/
+	private String campaignType;
 	/**账户预算类型*/
 	private String accountBudgetMode;
 	/**账户预算*/
@@ -63,6 +66,7 @@ public class AiBytedanceAdvertiserStrategy{
 	private String campaignLandingType;
 	/**广告组商品类型*/
 	private String campaignDeliveryRelatedNum;
+
 	/**计划名称*/
 	private String adName;
 	/**投放范围(投放范围)*/
@@ -192,7 +196,7 @@ public class AiBytedanceAdvertiserStrategy{
 	/**预算类型*/
 	private String adBudgetMode;
 	/**计划预算*/
-	private Integer adBudget;
+	private BigDecimal adBudget;
 	/**投放时间类型*/
 	private String adScheduleType;
 	/**投放开始时间 */
@@ -236,7 +240,7 @@ public class AiBytedanceAdvertiserStrategy{
 	@TableField(exist = false)
 	private String[] creativeInventoryTypes;
 	/**优选广告位*/
-	private Integer creativeSmartInventory;
+	private String creativeSmartInventory;
 	/**场景广告位*/
 	private String creativeSceneInventory;
 	/**创意方式*/
@@ -251,7 +255,7 @@ public class AiBytedanceAdvertiserStrategy{
 	private String creativeImageMode;
 	/**广告来源*/
 	private String creativeSource;
-	/**品牌主页*/
+	/**品牌主页 使用抖音号*/
 	private String creativeIesCoreUserId;
 	/**作品页隐藏广告内容*/
 	private Integer creativeIsFeedAndFavSee;
@@ -332,4 +336,18 @@ public class AiBytedanceAdvertiserStrategy{
 
 
 
+
+	/**
+	 * 营销目的
+	 */
+	private String marketingPurpose;
+	/**
+	 * 广告位大类
+	 */
+	private String inventoryCatalog;
+	/**
+	 * 组件id
+	 */
+	private String componentId;
+
 }

+ 228 - 190
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -158,6 +158,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
                 log.info("账户id:{};创意创建参数:{}",strategy.getAccountId(),creativeParams);
                 JSONObject creativeObject =  marketingService.creativeCreate(token,adId,creativeParams);
+                log.info("创建创意=====》》》》》》{}",creativeObject);
                 if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
                     List<Long> adIds = new ArrayList<>();
                     adIds.add(adId);
@@ -272,69 +273,105 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         }
         return videoCnt;
     }
+
+    // 创建创意  拼接创意参数
     private JSONObject getCreativeParams(AiBytedanceAdvertiserStrategy strategy, Long adId,ByteDanceVideoInfo videoInfo,CtopOauthToken token) {
         JSONObject params = new JSONObject();
         params.put("advertiser_id", strategy.getAccountId());
         params.put("ad_id", adId);
-        String inventoryType = strategy.getCreativeInventoryType();
-        if ("CREATIVE_IMAGE_MODE_UNION_SPLASH".equalsIgnoreCase(strategy.getCreativeImageMode())) {
-            params.put("inventory_type", new String[]{"INVENTORY_UNION_SPLASH_SLOT"});
-        } else {
-        if (null != inventoryType && !"".equals(inventoryType)) {
-            String[] inventoryTypeString = inventoryType.split(",");
-            if (inventoryTypeString.length > 0) {
-                params.put("inventory_type", inventoryTypeString);
-            }
-        }
-    }
 
-        Integer smartInventory = strategy.getCreativeSmartInventory();
-        if(null!=smartInventory&&smartInventory!=0){
-            params.put("smart_inventory",smartInventory);
+        /*基础创意*/
+        JSONObject ad_data = new JSONObject();
+        //行业类别
+        String thirdIndustryId = strategy.getCreativeThirdIndustryId();
+        if(!Check.isNull(thirdIndustryId)){
+            ad_data.put("third_industry_id",thirdIndustryId);
         }
 
-        String sceneInventory = strategy.getCreativeSceneInventory();
-        if(!Check.isNull(sceneInventory)){
-            params.put("scene_inventory",sceneInventory);
+        //关键词 添加随机关键词逻辑
+        String adKeywords = strategy.getCreativeAdKeywords();
+        if(!Check.isNull(adKeywords)){
+            String [] keywords = adKeywords.split(",");
+            if(keywords.length>0){
+                if(keywords.length<=20){
+                    ad_data.put("ad_keywords",keywords);
+                }else {
+                    List<String>keywordList = Arrays.asList(keywords);
+                    Collections.shuffle(keywordList);
+                    List<String> getKeyWords = keywordList.subList(0,20);
+                    ad_data.put("ad_keywords",getKeyWords);
+                }
+            }
+        }
+        //广告来源
+        String source = strategy.getCreativeSource();
+        if(!Check.isNull(source)){
+            ad_data.put("source",source);
+        }
+        //推广抖音号
+        String iesCoreUserId = strategy.getCreativeIesCoreUserId();
+        if(!Check.isNull(iesCoreUserId)){
+            ad_data.put("ies_core_user_id",iesCoreUserId);
+        }
+        //主页作品列表隐藏广告内容
+        Integer isFeedAndFavSee = strategy.getCreativeIsFeedAndFavSee();
+        if(null!=isFeedAndFavSee&&isFeedAndFavSee!=0){
+            ad_data.put("is_feed_and_fav_see",isFeedAndFavSee);
+        }
+        //是否开启自动生成素材
+        Integer creativeAutoGenerateSwitch = strategy.getCreativeAutoGenerateSwitch();
+        if(null!=creativeAutoGenerateSwitch&&creativeAutoGenerateSwitch!=1){
+            ad_data.put("creative_auto_generate_switch",creativeAutoGenerateSwitch);
         }
-        //程序化创意 非dpa
-        params.put("creative_material_mode","STATIC_ASSEMBLE");
         //是否自动生成视频素材
         Integer isPresentedVideo = strategy.getCreativeIsPresentedVideo();
         if(null!=isPresentedVideo&&isPresentedVideo!=0){
-            params.put("is_presented_video",isPresentedVideo);
+            ad_data.put("is_presented_video",isPresentedVideo);
         }
         //是否开启衍生计划
         Integer generateDerivedAd = strategy.getCreativeGenerateDerivedAd();
         if(null!=generateDerivedAd&&generateDerivedAd!=0){
-            params.put("generate_derived_ad",generateDerivedAd);
+            ad_data.put("generate_derived_ad",generateDerivedAd);
+        }
+        //搭配试玩素材url
+        String playableUrl = strategy.getCreativePlayableUrl();
+        if(!Check.isNull(playableUrl)){
+            ad_data.put("playable_url",playableUrl);
+        }
+        //应用名
+        String appName = strategy.getCreativeAppName();
+        if(!Check.isNull(appName)){
+            ad_data.put("app_name",appName);
+        }
+        //Android应用下载详情页
+        String webUrl = strategy.getCreativeWebUrl();
+        if(!Check.isNull(webUrl)){
+            ad_data.put("web_url",webUrl);
+        }
+        //落地页链接
+        if(!Check.isNull(strategy.getAdExternalUrl())){
+            ad_data.put("external_url",strategy.getAdExternalUrl());
         }
-        //视频素材
-        JSONArray imageArray = new JSONArray();
-        JSONObject imageObject = new JSONObject();
 
-        if ("video".equalsIgnoreCase(videoInfo.getMaterialType())){
-            //视频类型
-            //1-竖版视频 2-横版视频
-//            String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_VIDEO_VERTICAL" : "CREATIVE_IMAGE_MODE_VIDEO";
-            String imageMode = strategy.getCreativeImageMode();
-            imageObject.put("image_mode",imageMode);
-            imageObject.put("video_id",videoInfo.getVid());
-            //获取视频封面id
-            String imageId = getSuggestImageId(token,videoInfo.getVid());
-            if(!Check.isNull(imageId)){
-                imageObject.put("image_id",imageId);
-            }
-        }else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
-            //1-大图横图; 2-大图竖图
-//            String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_LARGE" : "CREATIVE_IMAGE_MODE_LARGE_VERTICAL";
-            String imageMode = strategy.getCreativeImageMode();
-            imageObject.put("image_mode",imageMode);
-            imageObject.put("image_ids",new String[]{videoInfo.getId()});
+        //是否关闭评论,0为开启,1为关闭,默认值:0
+        Integer isCommentDisable = strategy.getCreativeIsCommentDisable();
+        if(!Check.isNull(isCommentDisable)&&isCommentDisable!=0){
+            ad_data.put("is_comment_disable",isCommentDisable);
+        }
+        //允许客户端下载视频功能
+        Integer adDownloadStatus = strategy.getCreativeDownloadStatus();
+        if(!Check.isNull(adDownloadStatus)&&adDownloadStatus!=0){
+            ad_data.put("ad_download_status",adDownloadStatus);
+        }
+        //创意展现方式
+        String creativeDisplayMode = strategy.getCreativeDisplayMode();
+        if(!Check.isNull(creativeDisplayMode)){
+            ad_data.put("creative_display_mode",creativeDisplayMode);
         }
+        params.put("ad_data",ad_data);
+
+        JSONObject creObj = new JSONObject();
 
-        imageArray.add(imageObject);
-        params.put("image_list",imageArray);
         JSONArray titleArray = new JSONArray();
         List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1);
         //使用指定文案
@@ -346,11 +383,16 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 JSONObject titleObject = new JSONObject();
                 titleObject.put("title",slogenInfo.getSlogan());
                 String creativeWordsIds = slogenInfo.getCreativeWordIds();
+                JSONArray wordsArr = new JSONArray();
                 if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
                     JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
-                    if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
-                        titleObject.put("creative_word_ids",creativeWordsArray);
-                    }
+                        for (Object creative : creativeWordsArray) {
+                            JSONObject creativeObject = new JSONObject();
+                            creativeObject.put("word_id",creative);
+                            wordsArr.add(creativeObject);
+                        }
+                        titleObject.put("word_list",wordsArr);
+
                 }
                 titleArray.add(titleObject);
             }
@@ -366,15 +408,24 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                     }
                     JSONObject titleObject = new JSONObject();
                     titleObject.put("title",byteDanceGeneralCopywriter.get(i).getTextCopywriter());
+
                     String creativeWordsIds = byteDanceGeneralCopywriter.get(i).getCreativeWordIds();
-                    if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
+
+                    JSONArray wordsArr = new JSONArray();
+
+                    if(null != creativeWordsIds && !creativeWordsIds.trim().equals("")){
                         JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
-                        if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
-                            titleObject.put("creative_word_ids",creativeWordsArray);
-                        }
+                            for (Object creative : creativeWordsArray) {
+                                JSONObject creativeObject = new JSONObject();
+                                creativeObject.put("word_id",creative);
+                                wordsArr.add(creativeObject);
+                            }
+                            titleObject.put("word_list",wordsArr);
+
                     }
                     titleArray.add(titleObject);
                 }
+
             }
             // 图片 使用通用文案 最多10条
         }else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
@@ -386,155 +437,90 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                     String creativeWordsIds = byteDanceGeneralCopywriter.getCreativeWordIds();
                     if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
                         JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
+                        JSONArray wordsArr = new JSONArray();
                         if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
-                            titleObject.put("creative_word_ids",creativeWordsArray);
+                            for (Object creative : creativeWordsArray) {
+                                JSONObject creativeObject = new JSONObject();
+                                creativeObject.put("word_id",creative);
+                                wordsArr.add(creativeObject);
+                            }
+                            titleObject.put("word_list",wordsArr);
                         }
                     }
                     titleArray.add(titleObject);
                 }
+
             }
         }
 
         if(!Check.isNull(titleArray)){
-            params.put("title_list",titleArray);
-        }
-        //广告来源
-        String source = strategy.getCreativeSource();
-        if(!Check.isNull(source)){
-            params.put("source",source);
-        }
-        //推广抖音号
-        String iesCoreUserId = strategy.getCreativeIesCoreUserId();
-        if(!Check.isNull(iesCoreUserId)){
-            params.put("ies_core_user_id",iesCoreUserId);
-        }
-        //主页作品列表隐藏广告内容
-        Integer isFeedAndFavSee = strategy.getCreativeIsFeedAndFavSee();
-        if(null!=isFeedAndFavSee&&isFeedAndFavSee!=0){
-            params.put("is_feed_and_fav_see",isFeedAndFavSee);
-        }
-        //是否开启自动生成素材
-        Integer creativeAutoGenerateSwitch = strategy.getCreativeAutoGenerateSwitch();
-        if(null!=creativeAutoGenerateSwitch&&creativeAutoGenerateSwitch!=1){
-            params.put("creative_auto_generate_switch",creativeAutoGenerateSwitch);
-        }
-        String appName = strategy.getCreativeAppName();
-        if(!Check.isNull(appName)){
-            params.put("app_name",appName);
+            creObj.put("title_materials",titleArray);
+        }
+        JSONArray imageMaterials = new JSONArray();
+        JSONObject object = new JSONObject();
+        //类型
+
+        if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
+            //图片素材
+            object.put("image_mode",strategy.getCreativeImageMode());
+            String[] imageIds = new String[]{videoInfo.getId()};
+            JSONArray image_info = new JSONArray();
+            for (String imgId : imageIds) {
+                JSONObject imageObject = new JSONObject();
+                imageObject.put("image_id",imgId);
+                image_info.add(imageObject);
+            }
+            object.put("image_info",image_info);
+            imageMaterials.add(object);
+            creObj.put("image_materials",imageMaterials);
         }
 
-        String subTitle = strategy.getCreativeSubTitle();
-        if(!Check.isNull(subTitle)){
-            params.put("sub_title",subTitle);
-        }
+        if ("video".equalsIgnoreCase(videoInfo.getMaterialType())){
+            //视频
+            object.put("image_mode",strategy.getCreativeImageMode());
+            JSONObject videoObj = new JSONObject();
+            videoObj.put("video_id",videoInfo.getVid());
+            //视频封面
+            JSONObject imgObj = new JSONObject();
+            //获取视频封面id
+            String imageId = getSuggestImageId(token,videoInfo.getVid());
+            if(!Check.isNull(imageId)){
+                imgObj.put("image_id",imageId);
+            }
+            object.put("image_info",imgObj);
+            object.put("video_info",videoObj);
 
-        String webUrl = strategy.getCreativeWebUrl();
-        if(!Check.isNull(webUrl)){
-            params.put("web_url",webUrl);
-        }
+            imageMaterials.add(object);
 
-        String actionText = strategy.getCreativeActionText();
-        if(!Check.isNull(actionText)){
-            params.put("action_text",actionText);
+            creObj.put("video_materials",imageMaterials);
         }
 
-        //搭配试玩素材url
-        String playableUrl = strategy.getCreativePlayableUrl();
-        if(!Check.isNull(playableUrl)){
-            params.put("playable_url",playableUrl);
-        }
+        //副标题
+        String subTitle = strategy.getCreativeSubTitle();
+        if(!Check.isNull(subTitle)){
+            JSONObject titleObj = new JSONObject();
+            titleObj.put("sub_title",subTitle);
+            creObj.put("sub_title_material",titleObj);
+        }
+        //组件id
+       JSONArray component = new JSONArray();
+       String componentIdStr = strategy.getComponentId();
+       if (!Check.isNull(componentIdStr)){
+           String[] componentId = componentIdStr.split(",");
+           for (String strId : componentId) {
+               JSONObject obj = new JSONObject();
+               obj.put("component_id",new Long(strId));
+               component.add(obj);
+           }
+           creObj.put("component_materials",component);
+       }
 
-        Integer isCommentDisable = strategy.getCreativeIsCommentDisable();
-        if(!Check.isNull(isCommentDisable)&&isCommentDisable!=0){
-            params.put("is_comment_disable",isCommentDisable);
-        }
-        String creativeDisplayMode = strategy.getCreativeDisplayMode();
-        if(!Check.isNull(creativeDisplayMode)){
-            params.put("creative_display_mode",creativeDisplayMode);
-        }
-//        允许客户端下载视频功能
-//        Integer adDownloadStatus = strategy.getCreativeAdDownloadStatus();
-//        if(!Check.isNull(adDownloadStatus)&&adDownloadStatus!=0){
-//            params.put("ad_download_status",adDownloadStatus);
-//        }
-        //商品推广卡片
-        String imageCode = strategy.getCreativeProductImageCode();
-        if(!Check.isNull(imageCode)){
-            //1:根据imageCode获取图片id
-            JSONObject promotionCard = new JSONObject();
-            String iconImageId = getBytedanceImageIdByCode(imageCode,token);
-            if(!Check.isNull(iconImageId)){
-                promotionCard.put("product_image_id",iconImageId);
-            }
-            String productSellingPoints = strategy.getCreativeProductSellingPoints();
-            if(!Check.isNull(productSellingPoints)){
-                String[] pointString = productSellingPoints.split(",");
-                if(pointString.length>0){
-                    promotionCard.put("product_selling_points",pointString);
-                }
-            }
-            String productDescription = strategy.getCreativeProductDescription();
-            if(!Check.isNull(productDescription)){
-                promotionCard.put("product_description",productDescription);
-            }
-            Boolean enableStorePack = strategy.getCreativeEnablePersonalAction();
-            if(null!=enableStorePack){
-                promotionCard.put("enable_store_pack",enableStorePack);
-            }
-            String callToAction = strategy.getCreativeCallToAction();
-            if(!Check.isNull(callToAction)){
-                promotionCard.put("call_to_action",callToAction);
-            }
-            Boolean enablePersonalAction = strategy.getCreativeEnablePersonalAction();
-            if(null!=enablePersonalAction){
-                promotionCard.put("enable_personal_action",enablePersonalAction);
-            }
-            params.put("promotion_card",promotionCard);
-        }
-        //行业类别
-        String thirdIndustryId = strategy.getCreativeThirdIndustryId();
-        if(!Check.isNull(thirdIndustryId)){
-            params.put("third_industry_id",thirdIndustryId);
-        }
-        //关键词 添加随机关键词逻辑
-        String adKeywords = strategy.getCreativeAdKeywords();
-        if(!Check.isNull(adKeywords)){
-            String [] keywords = adKeywords.split(",");
-            if(keywords.length>0){
-                if(keywords.length<=20){
-                    params.put("ad_keywords",keywords);
-                }else {
-                    List<String>keywordList = Arrays.asList(keywords);
-                    Collections.shuffle(keywordList);
-                    List<String> getKeyWords = keywordList.subList(0,20);
-                    params.put("ad_keywords",getKeyWords);
-                }
-            }
-        }
-        String trackUrl = strategy.getCreativeTrackUrl();
-        if(!Check.isNull(trackUrl)){
-            params.put("track_url",trackUrl);
-        }
-        String actionTrackUrl = strategy.getCreativeActionTrackUrl();
-        if(!Check.isNull(actionTrackUrl)){
-            params.put("action_track_url",actionTrackUrl);
-        }
-        String videoPlayEffectiveTrackUrl = strategy.getCreativeVideoPlayEffectiveTrackUrl();
-        if(!Check.isNull(videoPlayEffectiveTrackUrl)){
-            params.put("video_play_effective_track_url",videoPlayEffectiveTrackUrl);
-        }
-//        String videoPlayDoneTrackUrl = strategy.getCreativeVideoPlayDoneTrackUrl();
-//        if(!Check.isNull(videoPlayDoneTrackUrl)){
-//            params.put("video_play_done_track_url",videoPlayDoneTrackUrl);
-//        }
-        String videoPlayTrackUrl = strategy.getCreativeVideoPlayTrackUrl();
-        if(!Check.isNull(videoPlayTrackUrl)){
-            params.put("video_play_track_url",videoPlayTrackUrl);
-        }
+        params.put("creative",creObj);
         return params;
 
     }
 
+
     private String getBytedanceImageIdByCode(String imageCode, CtopOauthToken token) {
         //1:根据code获取图片信息
         BytedanceImageInfo bytedanceImageInfo = bytedanceImageInfoService.getByParams(imageCode);
@@ -586,18 +572,63 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         params.put("name",adName);
         //竞价策略 默认优先跑量
         params.put("flow_control_mode","FLOW_CONTROL_MODE_FAST");
+
+        // 搜索快投
+        if(!"UNION".equals(strategy.getAdDeliveryRange())){
+            params.put("feed_delivery_search","DISABLED");
+        }
+
         //投放范围
-        if(null!=strategy.getAdDeliveryRange()&&!"".equals(strategy.getAdDeliveryRange().trim())){
+        if(null!=strategy.getAdDeliveryRange() && !"".equals(strategy.getAdDeliveryRange().trim())){
             params.put("delivery_range",strategy.getAdDeliveryRange());
-            if(!"UNION".equals(strategy.getAdDeliveryRange())){
+            //搜索快投
+           /*if(!"UNION".equals(strategy.getAdDeliveryRange())){
                 params.put("feed_delivery_search","DISABLED");
+            }*/
+        }
+
+        //点击监测链接
+        String actionTrackUrl = strategy.getCreativeActionTrackUrl();
+        if(!Check.isNull(actionTrackUrl)){
+            params.put("action_track_url",new String[]{actionTrackUrl});
+        }
+
+
+        //广告位大类
+         if (!Check.isNull(strategy.getInventoryCatalog())){
+            params.put("inventory_catalog",strategy.getInventoryCatalog());
+        }else{
+             params.put("inventory_catalog","MANUAL");
+         }
+
+        //广告投放位置
+        String inventoryType = strategy.getCreativeInventoryType();
+        if ("CREATIVE_IMAGE_MODE_UNION_SPLASH".equalsIgnoreCase(strategy.getCreativeImageMode())) {
+            params.put("inventory_type", new String[]{"INVENTORY_UNION_SPLASH_SLOT"});
+        } else {
+            if (null != inventoryType && !"".equals(inventoryType)) {
+                String[] inventoryTypeString = inventoryType.split(",");
+                if (inventoryTypeString.length > 0) {
+                    params.put("inventory_type", inventoryTypeString);
+                }
             }
         }
+        //优选广告位
+        if (!Check.isNull(strategy.getCreativeSmartInventory())){
+            params.put("smart_inventory",strategy.getCreativeSmartInventory());
+        }else{
+            params.put("smart_inventory","NORMAL");
+        }
+
+        // 投放形式
         if(!Check.isNull(strategy.getAdUnionVideoType())){
             params.put("union_video_type",strategy.getAdUnionVideoType());
         }
-        //投放目标
+
+        //下载方式
         params.put("download_type",strategy.getAdDownloadType());
+
+
         if(!Check.isNull(strategy.getAdDownloadUrl())){
             params.put("download_url",strategy.getAdDownloadUrl());
         }
@@ -609,9 +640,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if(!Check.isNull(strategy.getAdQuickAppUrl())){
             params.put("quick_app_url",strategy.getAdQuickAppUrl());
         }
-        if(!Check.isNull(strategy.getAdExternalUrl())){
-            params.put("external_url",strategy.getAdExternalUrl());
-        }
+
         if(!Check.isNull(strategy.getAdAppType())){
             params.put("app_type",strategy.getAdAppType());
         }
@@ -1050,8 +1079,14 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if(null != strategy.getCampaignDeliveryRelatedNum()&&!"".equals(strategy.getCampaignDeliveryRelatedNum().trim())){
             campaignParam.put("delivery_related_num",strategy.getCampaignDeliveryRelatedNum());
         }
+        //营销目的 --行动转化
+        //营销目的,允许值CONVERSION行动转化、INTENTION用户意向、ACKNOWLEDGE品牌认知
+        campaignParam.put("marketing_purpose",strategy.getMarketingPurpose());
+        //广告类型 允许值FEED信息流、SEARCH搜索广告
+        campaignParam.put("campaign_type",strategy.getCampaignType());
         //创建组
         Result campaignData = marketingService.createCampaign(token, campaignParam);
+        log.info("===创建组==={}",campaignData);
         if(campaignData.getCode()!=0){
             AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
                     strategy.getAccountId(),
@@ -1223,12 +1258,12 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
             // 出价不为空 则 固定出价
             if (!Check.isNull(updAdStaOrCpaOrBudget.getAdCpaBid())){
                 // 出价 > 计划预算
-                a = updAdStaOrCpaOrBudget.getAdCpaBid().compareTo(new BigDecimal(strategyVo.getAdBudget()));
+                a = updAdStaOrCpaOrBudget.getAdCpaBid().compareTo(strategyVo.getAdBudget());
             //出价为空 则 随机出价 或者 阶梯出价
             // 最高出价 不能大于 计划预算
             }else {
                 // 最高出价 > 计划预算
-                a = updAdStaOrCpaOrBudget.getAdMaxBid().compareTo(new BigDecimal(strategyVo.getAdBudget()));
+                a = updAdStaOrCpaOrBudget.getAdMaxBid().compareTo(strategyVo.getAdBudget());
             }
             if (a == 1){
                 return Result.errorMsg("最高出价不能大于计划预算。");
@@ -1506,11 +1541,11 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         aiBytedanceAdvertiserStrategy.setStatus(0);
 
         //添加素材信息
-        MaterialImageInfo imageInfo = new MaterialImageInfo();
+       /* MaterialImageInfo imageInfo = new MaterialImageInfo();
         imageInfo.setUrl(aiBytedanceAdvertiserStrategy.getImageUrl());
         imageInfo.setUserId(aiBytedanceAdvertiserStrategy.getUserId());
         materialImageInfoService.initImageCode(imageInfo);
-
+*/
 
 
         aiBytedanceAdvertiserStrategyMapper.insert(aiBytedanceAdvertiserStrategy);
@@ -1788,4 +1823,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
     }
 
 
+
+
+
 }

+ 8 - 1
jeecg-boot-bytedance/src/main/resources/bytedance_config.properties

@@ -63,7 +63,8 @@ bytedance_v2_creative_material_get=/2/creative/material/read/
 #\u521B\u610F\u8BE6\u7EC6\u4FE1\u606F
 bytedance_v2_creative_read=/2/creative/read_v2/
 #\u521B\u5EFA\u5E7F\u544A\u521B\u610F
-bytedance_v2_creative_create_v2=/2/creative/create_v2/
+#bytedance_v2_creative_create_v2=/2/creative/create_v2/
+bytedance_v2_creative_create_v2=/2/creative/procedural_creative/create/
 #\u83B7\u53D6\u521B\u610F\u5217\u8868
 bytedance_v2_creative_get=/2/creative/get/
 #\u4FEE\u6539\u521B\u610F\u4FE1\u606F
@@ -96,3 +97,9 @@ bytedance_v2_campaign_report_get=/2/report/campaign/get/
 bytedance_v2_ad_report_get=/2/report/ad/get/
 bytedance_v2_ad_creative_get=/2/report/creative/get/
 
+
+
+
+
+#\u67E5\u8BE2\u7EC4\u4EF6\u5217\u8868
+bytedance_v2_assets_get=/2/assets/creative_component/get/

+ 75 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/AiBytedanceAdvertiserStrategyController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.bytedance.advertise.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -30,10 +31,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -513,6 +511,79 @@ public class AiBytedanceAdvertiserStrategyController {
 
 
 
+	@ApiOperation(value="获取组件列表", notes="获取组件列表")
+	@GetMapping(value = "/getCreativeComponent")
+	public Result getCreativeComponent(@RequestParam("accountId") String accountId) {
+		try {
+			CtopOauthToken token = tokenService.getTokenByAccountId(new Long(accountId));
+			return marketingService.getCreativeComponent(token);
+		}catch (Exception e){
+			log.error("获取组件列表异常",e);
+			return Result.error("请求失败,请联系开发人员!");
+		}
+	}
+
+
+
+	@ApiOperation(value="创建组件", notes="创建组件")
+	@PostMapping(value = "/creativeComponent")
+	public Result creativeComponent(@RequestParam("accountId") String accountId) {
+		try {
+
+			CtopOauthToken token = tokenService.getTokenByAccountId(new Long(accountId));
+
+			JSONObject params = new JSONObject();
+			params.put("advertiser_id", token.getAccountId());
+
+
+			JSONObject info = new JSONObject();
+
+			info.put("component_type","VOTE_MAGNET");
+			info.put("component_name","测试组件名称");
+
+			JSONObject date = new JSONObject();
+			date.put("title","测试主标题");
+			date.put("sub_title","测试副标题测试副标题测试副标题测试副标题测试副标题");
+			date.put("vote_card_web_url","测试组件名称");
+			date.put("click_text","测试显示文案");
+
+			Map map1= new HashMap();
+			map1.put("button_text", "测试按钮1");
+			Map map2 = new HashMap();
+			map2.put("button_text", "测试按钮2");
+			List list = new ArrayList();
+			list.add(map1);
+			list.add(map2);
+			date.put("button_list",list);
+
+			info.put("component_data",date);
+			params.put("component_info", info);
+
+			params = Check.jsonRemoveEmpty(params);
+
+			JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+					"https://ad.oceanengine.com/open_api/2/assets/creative_component/create/" ,params);
+			Integer code = jsonObject.getInteger("code");
+			String message = jsonObject.getString("message");
+			if (null == code || !code.equals(0)) {
+				log.info("创建组件失败异常==》accountId:{},message:{}", token.getAccountId(), message);
+				return Result.error(message);
+			}
+			JSONObject dataList = jsonObject.getJSONObject("data");
+			if (null == dataList || dataList.isEmpty()) {
+				log.info("创建组件失败==》accountId:{},message:{}", token.getAccountId(), message);
+				return Result.error("创建组件失败");
+			}
+		}catch (Exception e){
+			log.error("创建组件异常",e);
+			return Result.error("请求失败,请联系开发人员!");
+		}
+		return null;
+	}
+
+
+
+
 
 
 

+ 10 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/BytedanceReportController.java

@@ -169,8 +169,8 @@ public class BytedanceReportController {
 									@RequestParam("adId") String adId,
 									@RequestParam(value = "cpaBid",required = false) BigDecimal cpaBid,
 									@RequestParam(value = "adScheduleTime",required = false) String adScheduleTime,
-									//@RequestParam(value = "budgetMode",required = false) String budgetMode,
-									@RequestParam(value = "budget",required = false) Integer budget,
+									@RequestParam(value = "budgetMode",required = false) String budgetMode,
+									@RequestParam(value = "budget",required = false) BigDecimal budget,
 								 	@RequestParam(value = "downloadUrl",required = false) String downloadUrl) {
 		try {
 			CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
@@ -203,6 +203,14 @@ public class BytedanceReportController {
 				if (!resultUpd.isSuccess()){
 					return Result.errorMsg(resultUpd.getMessage());
 				}
+				ByteDanceAdvertisePlan byteDanceAdvertisePlan = new ByteDanceAdvertisePlan();
+				byteDanceAdvertisePlan.setId(Long.valueOf(adId));
+				byteDanceAdvertisePlan.setCpaBid(cpaBid);
+				byteDanceAdvertisePlan.setScheduleTime(adScheduleTime);
+				byteDanceAdvertisePlan.setBudgetMode(budgetMode);
+				byteDanceAdvertisePlan.setBudget(Check.isNull(budget) ? null : budget);
+				//更新 表 bid || 定向包id || 状态
+				byteDanceAdvertisePlanService.updatePlanOrPackage(byteDanceAdvertisePlan);
 			}
 
 			return Result.successMsg("修改出价成功。",null);

+ 1 - 0
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -153,6 +153,7 @@ spring:
          min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
        shutdown-timeout: 100ms
      password: hcst@2020
+     #password: ''
      port: 6379
 #mybatis plus 设置
 mybatis-plus: