Преглед на файлове

自动投放修改——通配符命名,添加行为意向

zhaoxian преди 3 години
родител
ревизия
b69255e0af

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoStrategy.java

@@ -274,6 +274,11 @@ public class AiKuaishouAccountAutoStrategy {
     @Excel(name = "封面广告语标题", width = 15)
     @ApiModelProperty(value = "封面广告语标题")
     private String stickerTitle;
+
+    /**
+     * 行为意向-系统优选,0关闭,1开启
+     */
+    private Integer intentionTarget;
     /**
      * 贴纸样式类型
      */

+ 41 - 36
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoDoServiceImpl.java

@@ -1806,7 +1806,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             //判断是否扔可创建计划
             if (planCnt > datas.size()) {
                 return createCampaign(strategy, token, videoType, uuid, channel);
-            }else{
+            } else {
                 log.info("当日创建量已达标");
             }
         } else {
@@ -1833,7 +1833,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             //添加创建记录
             AiKuaishouCampaignLevelOperationRecord record = new AiKuaishouCampaignLevelOperationRecord(strategy, null, code, message, campaignName, uuid);
             if (code != 0) {
-                if (strategy.getCampaignName().contains("{{序号}}")) {
+                if (strategy.getCampaignName().contains("-{{序号}}-")) {
                     String redisKey = token.getAccountId() + "_planCnt";
                     Integer redisValue = (Integer) redisUtil.get(redisKey);
                     redisUtil.set(redisKey, redisValue - 1);
@@ -2014,6 +2014,11 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             if (!Check.isNull(strategy.getAutoTarget())) {
                 unitParams.put("auto_target", strategy.getAutoTarget());
             }
+            //行为意向-系统优选
+            if (!Check.isNull(strategy.getIntentionTarget()) && strategy.getIntentionTarget() != 0) {
+                unitParams.put("intention_target", true);
+            }
+
             //是否开启自动生成视频
             if (!Check.isNull(strategy.getAutoCreatePhoto())) {
                 unitParams.put("auto_create_photo", strategy.getAutoCreatePhoto());
@@ -2405,76 +2410,76 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
      */
     private String getName(String wildcard, AiKuaishouAccountAutoStrategy strategy, Integer videoType,
                            String materialName, String type, Long campaignId, Long appId, Long targetId, KuaishouChannel channel) {
-        if (wildcard.contains("{{渠道号}}") || wildcard.contains("{{渠道号名称}}")) {
+        if (wildcard.contains("-{{渠道号}}-") || wildcard.contains("-{{渠道号名称}}-")) {
             if (Check.isNull(channel)) {
-                wildcard = wildcard.replace("{{渠道号}}", "");
-                wildcard = wildcard.replace("{{渠道号名称}}", "");
+                wildcard = wildcard.replace("-{{渠道号}}-", "");
+                wildcard = wildcard.replace("-{{渠道号名称}}-", "");
             } else {
-                wildcard = wildcard.replace("{{渠道号}}", channel.getChannelCode());
-                wildcard = wildcard.replace("{{渠道号名称}}", channel.getChannelName());
+                wildcard = wildcard.replace("-{{渠道号}}-", channel.getChannelCode());
+                wildcard = wildcard.replace("-{{渠道号名称}}-", channel.getChannelName());
             }
         }
 
-        if (wildcard.contains("{{定向包名}}")) {
+        if (wildcard.contains("-{{定向包名}}-")) {
             AiKuaishouAccountAutoTarget templateTarget = autoTargetService.getById(targetId);
             if (!Check.isNull(templateTarget)) {
-                wildcard = wildcard.replace("{{定向包名}}", templateTarget.getTargetName());
+                wildcard = wildcard.replace("-{{定向包名}}-", templateTarget.getTargetName());
             } else {
-                wildcard = wildcard.replace("{{定向包名}}", "");
+                wildcard = wildcard.replace("-{{定向包名}}-", "");
             }
         }
 
-        if (wildcard.contains("{{应用名称}}") || wildcard.contains("{{应用标记}}") || wildcard.contains("{{应用包名}}")) {
+        if (wildcard.contains("-{{应用名称}}-") || wildcard.contains("-{{应用标记}}-") || wildcard.contains("-{{应用包名}}-")) {
             KuaiShouAppList getAppInfo = appListService.getAppInfo(strategy.getAccountId(), appId);
             if (!Check.isNull(getAppInfo)) {
-                wildcard = wildcard.replace("{{应用名称}}", getAppInfo.getAppName());
-                wildcard = wildcard.replace("{{应用标记}}", getAppInfo.getAppVersion());
-                wildcard = wildcard.replace("{{应用包名}}", getAppInfo.getPackageName());
+                wildcard = wildcard.replace("-{{应用名称}}-", getAppInfo.getAppName());
+                wildcard = wildcard.replace("-{{应用标记}}-", getAppInfo.getAppVersion());
+                wildcard = wildcard.replace("-{{应用包名}}-", getAppInfo.getPackageName());
             } else {
-                wildcard = wildcard.replace("{{应用名称}}", "");
-                wildcard = wildcard.replace("{{应用标记}}", "");
-                wildcard = wildcard.replace("{{应用包名}}", "");
+                wildcard = wildcard.replace("-{{应用名称}}-", "");
+                wildcard = wildcard.replace("-{{应用标记}}-", "");
+                wildcard = wildcard.replace("-{{应用包名}}-", "");
             }
         }
 
-        if (wildcard.contains("{{创意制作方式}}")) {
+        if (wildcard.contains("-{{创意制作方式}}-")) {
             if (strategy.getUnitType() == 4) {
-                wildcard = wildcard.replace("{{创意制作方式}}", "自定义");
+                wildcard = wildcard.replace("-{{创意制作方式}}-", "自定义");
             } else if (strategy.getUnitType() == 7) {
-                wildcard = wildcard.replace("{{创意制作方式}}", "程序化");
+                wildcard = wildcard.replace("-{{创意制作方式}}-", "程序化");
             }
         }
 
-        if (wildcard.contains("{{广告位置}}")) {
+        if (wildcard.contains("-{{广告位置}}-")) {
             String adsence = getAdSenceByParams(strategy.getSceneId());
-            wildcard = wildcard.replace("{{广告位置}}", adsence);
+            wildcard = wildcard.replace("-{{广告位置}}-", adsence);
         }
 
-        if (wildcard.contains("{{素材名称}}")) {
+        if (wildcard.contains("-{{素材名称}}-")) {
             if (Check.isNull(materialName)) {
-                wildcard = wildcard.replace("{{素材名称}}", "");
+                wildcard = wildcard.replace("-{{素材名称}}-", "");
             } else {
-                wildcard = wildcard.replace("{{素材名称}}", materialName);
+                wildcard = wildcard.replace("-{{素材名称}}-", materialName);
             }
         }
-        if (!wildcard.contains("{{自定义}}")) {
-            wildcard = wildcard + "-{{自定义}}";
+        if (!wildcard.contains("-{{自定义}}-")) {
+            wildcard = wildcard + "-{{自定义}}-";
         }
         String nowDate = DateUtils.formatDate(new Date(), "yy-MMdd");
         if ("plan".equals(type)) {
             //创意制作方式
             if (strategy.getUnitType() == 4) {
-                wildcard = wildcard.replace("{{自定义}}", "自定义");
+                wildcard = wildcard.replace("-{{自定义}}-", "自定义");
             } else {
-                wildcard = wildcard.replace("{{自定义}}", "程序化");
+                wildcard = wildcard.replace("-{{自定义}}-", "程序化");
             }
-            if (wildcard.contains("{{日期}}")) {
-                wildcard = wildcard.replace("{{日期}}", nowDate);
+            if (wildcard.contains("-{{日期}}-")) {
+                wildcard = wildcard.replace("-{{日期}}-", nowDate);
             } else {
                 wildcard = wildcard + "-" + nowDate;
             }
-            if (!wildcard.contains("{{序号}}")) {
-                wildcard = wildcard + "{{序号}}";
+            if (!wildcard.contains("-{{序号}}-")) {
+                wildcard = wildcard + "-{{序号}}-";
             }
             Integer count = 0;
             String redisKey = strategy.getAccountId() + "_planCnt";
@@ -2486,11 +2491,11 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
                 count = redisValue + 1;
                 redisUtil.set(redisKey, count);
             }
-            wildcard = wildcard.replace("{{序号}}", count + "");
+            wildcard = wildcard.replace("-{{序号}}-", count + "");
         } else if ("unit".equals(type)) {
             String targetName = KuaishouAutoTypeEnum.getNameByType(strategy.getUnitType().toString() + videoType.toString());
-            wildcard = wildcard.replace("{{自定义}}", targetName);
-            wildcard = wildcard.replace("{{日期}}", nowDate);
+            wildcard = wildcard.replace("-{{自定义}}-", targetName);
+            wildcard = wildcard.replace("-{{日期}}-", nowDate);
         }
         //组序号,必填
         if (!Check.isNull(campaignId)) {