瀏覽代碼

自动投放修改_兴趣行为定向

zhaoxian 3 年之前
父節點
當前提交
d29c5c67a4

+ 6 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoStrategyController.java

@@ -149,16 +149,18 @@ public class AiKuaishouAccountAutoStrategyController {
         }
         if (type == 1) {
             AiKuaishouAdvertiserStrategy getEntity = aiKuaishouAdvertiserStrategyService.getByAccountId(accountId);
-            if (null != getEntity) {
-                return Result.error("该账户旧版自动投放配置信息已存在,请关闭后再创建");
+            if (null != getEntity && getEntity.getStatus() == 1) {
+                return Result.error("该账户旧版自动投放策略已启动,请关闭后再创建");
             }
+
         } else {
             QueryWrapper<AiKuaishouAccountAutoStrategy> queryWrapper = new QueryWrapper();
             queryWrapper.eq("account_id", accountId).last("limit 1");
             AiKuaishouAccountAutoStrategy one = aiKuaishouAccountAutoStrategyService.getOne(queryWrapper);
-            if (null != one) {
-                return Result.error("该账户重构版自动投放配置信息已存在,请关闭后再创建");
+            if (null != one && one.getStatus() == 1) {
+                return Result.error("该账户重构版自动投放策略已启动,请关闭后再创建");
             }
+
         }
         return Result.ok("success");
     }

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

@@ -2058,13 +2058,17 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             //自定义年龄段
             if (!Check.isNull(templateTarget.getMax()) && !Check.isNull(templateTarget.getMin())) {
                 JSONObject ageJson = new JSONObject();
-                if (!Check.isNull(templateTarget.getMax())) {
-                    ageJson.put("max", templateTarget.getMax());
+                Integer max = templateTarget.getMax();
+                Integer min = templateTarget.getMin();
+                if (!Check.isNull(max) && max != -1) {
+                    ageJson.put("max", max);
                 }
-                if (!Check.isNull(templateTarget.getMin())) {
-                    ageJson.put("min", templateTarget.getMin());
+                if (!Check.isNull(min) && min != -1) {
+                    ageJson.put("min", min);
+                }
+                if (!ageJson.isEmpty()) {
+                    target.put("age", ageJson);
                 }
-                target.put("age", ageJson);
             }
             // 固定年龄段
             JSONArray agesRange = JSONArray.parseArray(templateTarget.getAgesRange());
@@ -2178,31 +2182,27 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             JSONObject behaviorInterest = new JSONObject();
             JSONObject behavior = new JSONObject();
             JSONObject interest = new JSONObject();
-            if (!Check.isNull(templateTarget.getKeyword())) {
+
+            String keyword = templateTarget.getKeyword();
+            if (!Check.isNull(keyword) && !keyword.isEmpty()) {
                 behavior.put("keyword", JSONArray.parseArray(templateTarget.getKeyword()));
             }
-            if (!Check.isNull(templateTarget.getLabel())) {
+            String label = templateTarget.getLabel();
+            if (!Check.isNull(label) && !label.isEmpty()) {
                 behavior.put("label", JSONArray.parseArray(templateTarget.getLabel()));
             }
-            if (!Check.isNull(templateTarget.getStrengthType())) {
-                behavior.put("strength_type", templateTarget.getStrengthType());
+            String interestLabel = templateTarget.getInterestLabel();
+            if (!Check.isNull(interestLabel) && !interestLabel.isEmpty()) {
+                interest.put("label", JSONArray.parseArray(interestLabel));
             }
-            if (!Check.isNull(templateTarget.getTimeType())) {
+            String sceneType = templateTarget.getSceneType();
+            if (!Check.isNull(templateTarget.getTimeType()) && !Check.isNull(sceneType) && !sceneType.isEmpty() && !Check.isNull(templateTarget.getInterestLabel())) {
                 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) && !behavior.isEmpty()) {
+                behavior.put("scene_type", JSONArray.parseArray(sceneType));
+                behavior.put("strength_type", templateTarget.getStrengthType());
                 behaviorInterest.put("behavior", behavior);
-            }
-            if (!Check.isNull(interest) && !interest.isEmpty()) {
+                interest.put("scene_type", JSONArray.parseArray(sceneType));
                 behaviorInterest.put("interest", interest);
-            }
-            if (!Check.isNull(behaviorInterest) && !behaviorInterest.isEmpty()) {
                 target.put("behavior_interest", behaviorInterest);
             }
             return target;