Browse Source

兼容原有功能,添加行为兴趣定向参数

zhaoxian 4 năm trước cách đây
mục cha
commit
a757e3c296

+ 14 - 179
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouDirectionalPackageServiceImpl.java

@@ -15,6 +15,7 @@ import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalTemplateRelSe
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouTemplateMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouTemplateService;
 import com.alibaba.fastjson.JSONArray;
@@ -63,6 +64,8 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
     @Autowired
     private KuaiShouGroupMapper groupMapper;
 
+    @Autowired
+    private IKuaiShouGroupTemplateService groupTemplateService;
     static ExecutorService executorService = null;
 
     @Override
@@ -141,192 +144,23 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
                 throw new Exception("未获取到组信息");
             }
             CtopOauthToken token = oauthTokenService.getTokenByAccountId(kuaiShouGroup.getAccountId());
-            String sceneId = kuaiShouGroup.getSceneId();
-            if (Check.isNull(sceneId)) {
+            String sceneIdStr = kuaiShouGroup.getSceneId();
+            if (Check.isNull(sceneIdStr)) {
                 throw new Exception("未获取资源位置");
             }
-            Integer scene = (Integer) JSONArray.parseArray(sceneId).get(0);
+            Integer sceneId = (Integer) JSONArray.parseArray(sceneIdStr).get(0);
             JSONObject unitJson = new JSONObject();
-            unitJson.put("advertiser_id", token.getAccountId());
+            unitJson.put("advertiser_id", kuaiShouGroup.getAccountId());
             unitJson.put("unit_id", unitId);
-            // 广告组名称
-            unitJson.put("unit_name", kuaiShouGroup.getUnitName());
-            // 资源位置
-            unitJson.put("scene_id", JSONArray.parseArray(sceneId));
-            //投放开始时间
-            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            boolean beginTimeBoolean = DateUtils.compare(kuaiShouGroup.getBeginTime(), nowDate);
-            if (beginTimeBoolean) {
-                unitJson.put("begin_time", nowDate);
+            if (sceneId != 5) {
+                unitJson.put("template_id", unit.getLong("template_id"));
             } else {
-                unitJson.put("begin_time", kuaiShouGroup.getBeginTime());
-            }
-            // 创意展现方式
-            unitJson.put("show_mode", kuaiShouGroup.getShowMode());
-            //投放方式
-            unitJson.put("speed", kuaiShouGroup.getSpeed());
-
-            // -----------------修改组非必填参数-----------
-            // 出价
-            if (!Check.isNull(kuaiShouGroup.getBid())) {
-                unitJson.put("bid", kuaiShouGroup.getBid());
-            }
-            // 深度转化出价
-            if (!Check.isNull(kuaiShouGroup.getCpaBid())) {
-                unitJson.put("cpa_bid", kuaiShouGroup.getCpaBid());
-            }
-            // 深度转化目标出价
-            if (!Check.isNull(kuaiShouGroup.getDeepConversionBid())) {
-                unitJson.put("deep_conversion_bid", kuaiShouGroup.getDeepConversionBid());
-            }
-            // 投放结束时间
-            if (!Check.isNull(kuaiShouGroup.getEndTime())) {
-                unitJson.put("end_time", kuaiShouGroup.getEndTime());
-            }
-            // 投放时间段
-            if (!Check.isNull(kuaiShouGroup.getScheduleTime())) {
-                unitJson.put("schedule_time", kuaiShouGroup.getScheduleTime());
-            }
-            // 广告组单日预算
-            if (!Check.isNull(kuaiShouGroup.getDayBudget())) {
-                unitJson.put("day_budget", kuaiShouGroup.getDayBudget());
-            }
-            // url类型
-            if (!Check.isNull(kuaiShouGroup.getUrlType())) {
-                unitJson.put("url_type", kuaiShouGroup.getUrlType());
-            }
-            // url
-            if (!Check.isNull(kuaiShouGroup.getUrl())) {
-                unitJson.put("url", kuaiShouGroup.getUrl());
-            }
-            // appId
-            if (!Check.isNull(kuaiShouGroup.getAppId())) {
-                unitJson.put("app_id", kuaiShouGroup.getAppId());
-            }
-            // 优先从系统应用商店下载
-            if (!Check.isNull(kuaiShouGroup.getUseAppMarket())) {
-                unitJson.put("use_app_market", kuaiShouGroup.getUseAppMarket());
-            }
-            // 应用商店列表
-            if (!Check.isNull(kuaiShouGroup.getAppStore())) {
-                unitJson.put("app_store", JSONArray.parseArray(kuaiShouGroup.getAppStore()));
-            }
-            // 转化目标
-            if (!Check.isNull(kuaiShouGroup.getConvertId())) {
-                unitJson.put("convert_id", kuaiShouGroup.getConvertId());
-            }
-            // -----------------用户定向-----------
-            JSONObject targetJson = new JSONObject();
-
-            // 地域
-            if (!Check.isNull(requestJson.getJSONArray("region"))) {
-                targetJson.put("region", requestJson.getJSONArray("region"));
-            }
-
-            // 自定义年龄段
-
-            if (!Check.isNull(requestJson.getInteger("min")) && !Check.isNull(requestJson.getInteger("max"))) {
-                JSONObject ageJson = new JSONObject();
-                ageJson.put("min", requestJson.getInteger("min"));
-                ageJson.put("max", requestJson.getInteger("max"));
-                targetJson.put("age", ageJson);
-            }
-            // 固定年龄段
-            if (!Check.isNull(requestJson.getJSONArray("agesRange"))) {
-                targetJson.put("ages_range", requestJson.getJSONArray("agesRange"));
-            }
-            // 性别
-            if (!Check.isNull(requestJson.getInteger("gender"))) {
-                targetJson.put("gender", requestJson.getInteger("gender"));
-            }
-            //操作系统
-            if (!Check.isNull(requestJson.getInteger("platformOs"))) {
-                targetJson.put("platform_os", requestJson.getInteger("platformOs"));
-            }
-            //Android版本
-            if (!Check.isNull(requestJson.getInteger("androidOsv"))) {
-                targetJson.put("android_osv", requestJson.getInteger("androidOsv"));
-            }
-            // iOS版本
-            if (!Check.isNull(requestJson.getInteger("iosOsv"))) {
-                targetJson.put("ios_osv", requestJson.getInteger("iosOsv"));
-            }
-            //网络环境
-            if (!Check.isNull(requestJson.getInteger("network"))) {
-                targetJson.put("network", requestJson.getInteger("network"));
-            }
-            // 设备品牌
-            if (!Check.isNull(requestJson.getJSONArray("deviceBrand"))) {
-                targetJson.put("device_brand", requestJson.getJSONArray("deviceBrand"));
-            }
-            // 设备价格
-            if (!Check.isNull(requestJson.getJSONArray("devicePrice"))) {
-                targetJson.put("device_price", requestJson.getJSONArray("devicePrice"));
-            }
-
-            if (!Check.isNull(requestJson.getJSONArray("appInterest"))) {
-                targetJson.put("app_interest", requestJson.getJSONArray("appInterest"));
-            }
-            // APP行为-按APP名称
-            if (!Check.isNull(requestJson.getJSONArray("appIds"))) {
-                targetJson.put("app_ids", requestJson.getJSONArray("appIds"));
-            }
-            // 人群包
-            if (!Check.isNull(requestJson.getJSONArray("population"))) {
-                targetJson.put("population", requestJson.getJSONArray("population"));
-            }
-            // 人群包排除
-            if (!Check.isNull(requestJson.getJSONArray("excludePopulation"))) {
-                targetJson.put("exclude_population", requestJson.getJSONArray("excludePopulation"));
-            }
-            if (!Check.isNull(requestJson.getJSONArray("thirdPlatformCode"))) {
-                targetJson.put("third_platform_code", requestJson.getJSONArray("thirdPlatformCode"));
-            }
-
-            if (scene != 5) {
-                if (!Check.isNull(requestJson.getInteger("filterConvertedLevel"))) {
-                    targetJson.put("filter_converted_level", requestJson.getInteger("filterConvertedLevel"));
-                }
-                //商业兴趣类型
-                if (!Check.isNull(requestJson.getInteger("businessInterestType"))) {
-                    targetJson.put("business_interest_type", requestJson.getInteger("businessInterestType"));
-                }
-                // 商业兴趣
-                if (!Check.isNull(requestJson.getJSONArray("businessInterest"))) {
-                    targetJson.put("business_interest", requestJson.getJSONArray("businessInterest"));
-                }
-                //网红粉丝
-                if (!Check.isNull(requestJson.getJSONArray("fansStar"))) {
-                    targetJson.put("fans_star", requestJson.getJSONArray("fansStar"));
-                }
-                //兴趣视频用户
-                if (!Check.isNull(requestJson.getJSONArray("interestVideo"))) {
-                    targetJson.put("interest_video", requestJson.getJSONArray("interestVideo"));
-                }
-            }
-            if (scene != 5) {
-                JSONObject intelliExtendJson = new JSONObject();
-                // 开启智能扩量
-                if (!Check.isNull(requestJson.getInteger("isOpen"))) {
-                    intelliExtendJson.put("is_open", requestJson.getInteger("isOpen"));
-                }
-                //不可突破年龄
-                if (!Check.isNull(requestJson.getInteger("noAgeBreak"))) {
-                    intelliExtendJson.put("no_age_break", requestJson.getInteger("noAgeBreak"));
-                }
-                //不可突破性别
-                if (!Check.isNull(requestJson.getInteger("noGenderBreak"))) {
-                    intelliExtendJson.put("no_gender_break", requestJson.getInteger("noGenderBreak"));
-                }
-                // 不可突破地域
-                if (!Check.isNull(requestJson.getInteger("noAreaBreak"))) {
-                    intelliExtendJson.put("no_area_break", requestJson.getInteger("noAreaBreak"));
-                }
-                if (!Check.isNull(intelliExtendJson)) {
-                    targetJson.put("intelli_extend", intelliExtendJson);
+                JSONObject unionJson = groupTemplateService.getUnionJson(unit.getLong("template_id"));
+                if (Check.isNullMap(unionJson)) {
+                    throw new Exception("根据定向模板未获取到相关信息");
                 }
+                unitJson.put("target", unionJson);
             }
-            unitJson.put("target", targetJson);
             JSONObject jsonObject = updateService.updateUnit(token.getAccessToken(), unitJson);
         } catch (Exception e) {
             log.error("修改广告组定向异常", e);
@@ -639,6 +473,7 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
             if (!Check.isNull(targetJson)) {
                 param.put("target", targetJson);
             }
+            //-------------兴趣行为定向
             JSONObject behaviorInterest = new JSONObject();
             JSONObject behavior = new JSONObject();
             JSONObject interest = new JSONObject();

+ 36 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTarget.java

@@ -188,6 +188,42 @@ public class KuaiShouGroupTarget {
     @ApiModelProperty(value = "不可突破地域 0:可突破/无需控制,1:不可突破")
     private Integer noAreaBreak;
     /**
+     * 行为定向关键词
+     */
+    @Excel(name = "行为定向关键词", width = 15)
+    @ApiModelProperty(value = "行为定向关键词")
+    private String keyword;
+    /**
+     * 行为定向 类目词
+     */
+    @Excel(name = "行为定向 类目词", width = 15)
+    @ApiModelProperty(value = "行为定向 类目词")
+    private String label;
+    /**
+     * 兴趣定向类目词
+     */
+    @Excel(name = "兴趣定向类目词", width = 15)
+    @ApiModelProperty(value = "兴趣定向类目词")
+    private String interestLabel;
+    /**
+     * 在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天
+     */
+    @Excel(name = "在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天", width = 15)
+    @ApiModelProperty(value = "在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天")
+    private Integer timeType;
+    /**
+     * 行为强度	0:不限 1:高强度
+     */
+    @Excel(name = "行为强度	0:不限 1:高强度", width = 15)
+    @ApiModelProperty(value = "行为强度	0:不限 1:高强度")
+    private Integer strengthType;
+    /**
+     * 行为场景	1:社区 2:APP 4:推广
+     */
+    @Excel(name = "行为场景	1:社区 2:APP 4:推广", width = 15)
+    @ApiModelProperty(value = "行为场景	1:社区 2:APP 4:推广")
+    private String sceneType;
+    /**
      * 创建时间
      */
     @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")

+ 36 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouTemplateTarget.java

@@ -198,6 +198,42 @@ public class KuaishouTemplateTarget {
     @ApiModelProperty(value = "不可突破地域 默认为0(可突破/无需控制),定向region数据不为空时,可设为1(不可突破)")
     private Integer noAreaBreak;
     /**
+     * 行为定向关键词
+     */
+    @Excel(name = "行为定向关键词", width = 15)
+    @ApiModelProperty(value = "行为定向关键词")
+    private String keyword;
+    /**
+     * 行为定向 类目词
+     */
+    @Excel(name = "行为定向 类目词", width = 15)
+    @ApiModelProperty(value = "行为定向 类目词")
+    private String label;
+    /**
+     * 兴趣定向类目词
+     */
+    @Excel(name = "兴趣定向类目词", width = 15)
+    @ApiModelProperty(value = "兴趣定向类目词")
+    private String interestLabel;
+    /**
+     * 在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天
+     */
+    @Excel(name = "在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天", width = 15)
+    @ApiModelProperty(value = "在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天")
+    private Integer timeType;
+    /**
+     * 行为强度	0:不限 1:高强度
+     */
+    @Excel(name = "行为强度	0:不限 1:高强度", width = 15)
+    @ApiModelProperty(value = "行为强度	0:不限 1:高强度")
+    private Integer strengthType;
+    /**
+     * 行为场景	1:社区 2:APP 4:推广
+     */
+    @Excel(name = "行为场景	1:社区 2:APP 4:推广", width = 15)
+    @ApiModelProperty(value = "行为场景	1:社区 2:APP 4:推广")
+    private String sceneType;
+    /**
      * 定向模板创建时间
      */
     @Excel(name = "定向模板创建时间", width = 15)

+ 139 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -6,9 +6,21 @@ import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.*;
-import cn.com.ctop.kuaishou.modules.batch.mapper.*;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.mapper.BatchMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCreativeMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -356,6 +368,37 @@ public class BatchServiceImpl implements IBatchService {
             if (!Check.isNull(intelliExtendJson)) {
                 targetJson.put("intelli_extend", intelliExtendJson);
             }
+            //-------------兴趣行为定向
+            JSONObject behaviorInterest = new JSONObject();
+            JSONObject behavior = new JSONObject();
+            JSONObject interest = new JSONObject();
+            if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
+                behavior.put("keyword", requestJson.getJSONArray("keyword"));
+            }
+            if (!Check.isNull(requestJson.getJSONArray("label"))) {
+                behavior.put("label", requestJson.getJSONArray("label"));
+            }
+            if (!Check.isNull(requestJson.getInteger("strengthType"))) {
+                behavior.put("strength_type", requestJson.getInteger("strengthType"));
+            }
+            if (!Check.isNull(requestJson.getInteger("timeType"))) {
+                behavior.put("time_type", requestJson.getInteger("timeType"));
+            }
+            if (!Check.isNull(requestJson.getJSONArray("sceneType"))) {
+                behavior.put("scene_type", requestJson.getJSONArray("sceneType"));
+            }
+            if (!Check.isNull(requestJson.getJSONArray("interestLabel"))) {
+                interest.put("label", requestJson.getJSONArray("interestLabel"));
+            }
+            if (!Check.isNull(behavior)) {
+                behaviorInterest.put("behavior", behavior);
+            }
+            if (!Check.isNull(interest)) {
+                behaviorInterest.put("interest", interest);
+            }
+            if (!Check.isNull(behaviorInterest)) {
+                targetJson.put("behavior_interest", behaviorInterest);
+            }
         }
 
         unitJson.put("target", targetJson);
@@ -662,6 +705,37 @@ public class BatchServiceImpl implements IBatchService {
                 if (!Check.isNull(intelliExtendJson)) {
                     targetJson.put("intelli_extend", intelliExtendJson);
                 }
+                //-------------兴趣行为定向
+                JSONObject behaviorInterest = new JSONObject();
+                JSONObject behavior = new JSONObject();
+                JSONObject interest = new JSONObject();
+                if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
+                    behavior.put("keyword", requestJson.getJSONArray("keyword"));
+                }
+                if (!Check.isNull(requestJson.getJSONArray("label"))) {
+                    behavior.put("label", requestJson.getJSONArray("label"));
+                }
+                if (!Check.isNull(requestJson.getInteger("strengthType"))) {
+                    behavior.put("strength_type", requestJson.getInteger("strengthType"));
+                }
+                if (!Check.isNull(requestJson.getInteger("timeType"))) {
+                    behavior.put("time_type", requestJson.getInteger("timeType"));
+                }
+                if (!Check.isNull(requestJson.getJSONArray("sceneType"))) {
+                    behavior.put("scene_type", requestJson.getJSONArray("sceneType"));
+                }
+                if (!Check.isNull(requestJson.getJSONArray("interestLabel"))) {
+                    interest.put("label", requestJson.getJSONArray("interestLabel"));
+                }
+                if (!Check.isNull(behavior)) {
+                    behaviorInterest.put("behavior", behavior);
+                }
+                if (!Check.isNull(interest)) {
+                    behaviorInterest.put("interest", interest);
+                }
+                if (!Check.isNull(behaviorInterest)) {
+                    targetJson.put("behavior_interest", behaviorInterest);
+                }
             }
             unitJson.put("target", targetJson);
             JSONObject groupJson = requestJson.getJSONObject("groupArr");
@@ -955,8 +1029,38 @@ public class BatchServiceImpl implements IBatchService {
                         if (!Check.isNull(intelliExtendJson)) {
                             targetJson.put("intelli_extend", intelliExtendJson);
                         }
+                        //-------------兴趣行为定向
+                        JSONObject behaviorInterest = new JSONObject();
+                        JSONObject behavior = new JSONObject();
+                        JSONObject interest = new JSONObject();
+                        if (!Check.isNull(groupTarget.getKeyword())) {
+                            behavior.put("keyword", JSONArray.parseArray(groupTarget.getKeyword()));
+                        }
+                        if (!Check.isNull(groupTarget.getLabel())) {
+                            behavior.put("label", JSONArray.parseArray(groupTarget.getLabel()));
+                        }
+                        if (!Check.isNull(groupTarget.getStrengthType())) {
+                            behavior.put("strength_type", groupTarget.getStrengthType());
+                        }
+                        if (!Check.isNull(groupTarget.getTimeType())) {
+                            behavior.put("time_type", groupTarget.getTimeType());
+                        }
+                        if (!Check.isNull(groupTarget.getSceneType())) {
+                            behavior.put("scene_type", JSONArray.parseArray(groupTarget.getSceneType()));
+                        }
+                        if (!Check.isNull(groupTarget.getInterestLabel())) {
+                            interest.put("label", JSONArray.parseArray(groupTarget.getInterestLabel()));
+                        }
+                        if (!Check.isNull(behavior)) {
+                            behaviorInterest.put("behavior", behavior);
+                        }
+                        if (!Check.isNull(interest)) {
+                            behaviorInterest.put("interest", interest);
+                        }
+                        if (!Check.isNull(behaviorInterest)) {
+                            targetJson.put("behavior_interest", behaviorInterest);
+                        }
                     }
-
                     unitJson.put("target", targetJson);
                 }
                 // 出价
@@ -1832,10 +1936,38 @@ public class BatchServiceImpl implements IBatchService {
                     targetJson.put("intelli_extend", intelliExtendJson);
                 }
             }
-
-
+            //-------------兴趣行为定向
+            JSONObject behaviorInterest = new JSONObject();
+            JSONObject behavior = new JSONObject();
+            JSONObject interest = new JSONObject();
+            if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
+                behavior.put("keyword", requestJson.getJSONArray("keyword"));
+            }
+            if (!Check.isNull(requestJson.getJSONArray("label"))) {
+                behavior.put("label", requestJson.getJSONArray("label"));
+            }
+            if (!Check.isNull(requestJson.getInteger("strengthType"))) {
+                behavior.put("strength_type", requestJson.getInteger("strengthType"));
+            }
+            if (!Check.isNull(requestJson.getInteger("timeType"))) {
+                behavior.put("time_type", requestJson.getInteger("timeType"));
+            }
+            if (!Check.isNull(requestJson.getJSONArray("sceneType"))) {
+                behavior.put("scene_type", requestJson.getJSONArray("sceneType"));
+            }
+            if (!Check.isNull(requestJson.getJSONArray("interestLabel"))) {
+                interest.put("label", requestJson.getJSONArray("interestLabel"));
+            }
+            if (!Check.isNull(behavior)) {
+                behaviorInterest.put("behavior", behavior);
+            }
+            if (!Check.isNull(interest)) {
+                behaviorInterest.put("interest", interest);
+            }
+            if (!Check.isNull(behaviorInterest)) {
+                targetJson.put("behavior_interest", behaviorInterest);
+            }
             unitJson.put("target", targetJson);
-
             returnJson = updateService.updateUnit(token.getAccessToken(), unitJson);
         } catch (Exception e) {
             e.printStackTrace();

+ 36 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -7,7 +7,11 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplateTarget;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTemplateMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouTemplateTargetService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -490,6 +494,37 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         if (!Check.isNull(templateTarget.getPaidAudience())) {
             target.put("paid_audience", JSONArray.parseArray(templateTarget.getPaidAudience()));
         }
+        //-------------兴趣行为定向
+        JSONObject behaviorInterest = new JSONObject();
+        JSONObject behavior = new JSONObject();
+        JSONObject interest = new JSONObject();
+        if (!Check.isNull(templateTarget.getKeyword())) {
+            behavior.put("keyword", JSONArray.parseArray(templateTarget.getKeyword()));
+        }
+        if (!Check.isNull(templateTarget.getLabel())) {
+            behavior.put("label", JSONArray.parseArray(templateTarget.getLabel()));
+        }
+        if (!Check.isNull(templateTarget.getStrengthType())) {
+            behavior.put("strength_type", templateTarget.getStrengthType());
+        }
+        if (!Check.isNull(templateTarget.getTimeType())) {
+            behavior.put("time_type", templateTarget.getTimeType());
+        }
+        if (!Check.isNull(templateTarget.getSceneType())) {
+            behavior.put("scene_type", JSONArray.parseArray(templateTarget.getSceneType()));
+        }
+        if (!Check.isNull(templateTarget.getInterestLabel())) {
+            interest.put("label", JSONArray.parseArray(templateTarget.getInterestLabel()));
+        }
+        if (!Check.isNull(behavior)) {
+            behaviorInterest.put("behavior", behavior);
+        }
+        if (!Check.isNull(interest)) {
+            behaviorInterest.put("interest", interest);
+        }
+        if (!Check.isNull(behaviorInterest)) {
+            target.put("behavior_interest", behaviorInterest);
+        }
         returnJson.put("target", target);
         returnJson.put("code", 0);
         return returnJson;

+ 38 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouCampaignCopyDataServiceImpl.java

@@ -8,7 +8,13 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouCampaignCopyData;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouCampaignCopyDataMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouCampaignCopyDataService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -370,6 +376,37 @@ public class KuaishouCampaignCopyDataServiceImpl extends ServiceImpl<KuaishouCam
                             targetJson.put("intelli_extend", intelliExtendJson);
                         }
                     }
+                    //-------------兴趣行为定向
+                    JSONObject behaviorInterest = new JSONObject();
+                    JSONObject behavior = new JSONObject();
+                    JSONObject interest = new JSONObject();
+                    if (!Check.isNull(target.getJSONArray("keyword"))) {
+                        behavior.put("keyword", target.getJSONArray("keyword"));
+                    }
+                    if (!Check.isNull(target.getJSONArray("label"))) {
+                        behavior.put("label", target.getJSONArray("label"));
+                    }
+                    if (!Check.isNull(target.getInteger("strengthType"))) {
+                        behavior.put("strength_type", target.getInteger("strengthType"));
+                    }
+                    if (!Check.isNull(target.getInteger("timeType"))) {
+                        behavior.put("time_type", target.getInteger("timeType"));
+                    }
+                    if (!Check.isNull(target.getJSONArray("sceneType"))) {
+                        behavior.put("scene_type", target.getJSONArray("sceneType"));
+                    }
+                    if (!Check.isNull(target.getJSONArray("interestLabel"))) {
+                        interest.put("label", target.getJSONArray("interestLabel"));
+                    }
+                    if (!Check.isNull(behavior)) {
+                        behaviorInterest.put("behavior", behavior);
+                    }
+                    if (!Check.isNull(interest)) {
+                        behaviorInterest.put("interest", interest);
+                    }
+                    if (!Check.isNull(behaviorInterest)) {
+                        targetJson.put("behavior_interest", behaviorInterest);
+                    }
                     unitJson.put("target", targetJson);
                 }
                 // 出价

+ 37 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouStrategyServiceImpl.java

@@ -7,7 +7,11 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouStrategy;
 import cn.com.ctop.kuaishou.modules.batch.entity.kuaishoustrategycampaignRel;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouStrategyMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouStrategyService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -464,6 +468,38 @@ public class KuaishouStrategyServiceImpl extends ServiceImpl<KuaishouStrategyMap
         if (!Check.isNull(groupJson.getJSONArray("thirdPlatformCode"))) {
             targetJson.put("third_platform_code", groupJson.getJSONArray("thirdPlatformCode"));
         }
+
+        //-------------兴趣行为定向
+        JSONObject behaviorInterest = new JSONObject();
+        JSONObject behavior = new JSONObject();
+        JSONObject interest = new JSONObject();
+        if (!Check.isNull(groupJson.getJSONArray("keyword"))) {
+            behavior.put("keyword", groupJson.getJSONArray("keyword"));
+        }
+        if (!Check.isNull(groupJson.getJSONArray("label"))) {
+            behavior.put("label", groupJson.getJSONArray("label"));
+        }
+        if (!Check.isNull(groupJson.getInteger("strengthType"))) {
+            behavior.put("strength_type", groupJson.getInteger("strengthType"));
+        }
+        if (!Check.isNull(groupJson.getInteger("timeType"))) {
+            behavior.put("time_type", groupJson.getInteger("timeType"));
+        }
+        if (!Check.isNull(groupJson.getJSONArray("sceneType"))) {
+            behavior.put("scene_type", groupJson.getJSONArray("sceneType"));
+        }
+        if (!Check.isNull(groupJson.getJSONArray("interestLabel"))) {
+            interest.put("label", groupJson.getJSONArray("interestLabel"));
+        }
+        if (!Check.isNull(behavior)) {
+            behaviorInterest.put("behavior", behavior);
+        }
+        if (!Check.isNull(interest)) {
+            behaviorInterest.put("interest", interest);
+        }
+        if (!Check.isNull(behaviorInterest)) {
+            targetJson.put("behavior_interest", behaviorInterest);
+        }
         unitJson.put("target", targetJson);
         return kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson, 1);
     }