ソースを参照

自动投放修改2.1

zhaoxian 3 年 前
コミット
f6de7b5686

+ 3 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java

@@ -69,7 +69,9 @@ public enum StatusCode {
     KUAISHOU_CRAWLER_APP_TASK_END("爬虫任务运行结束", 1, true),
     KUAISHOU_CRAWLER_APP_JOB_StART("任务开始执行开始", 0, true),
     KUAISHOU_CRAWLER_APP_JOB_END("任务运行结束", 1, true),
-    MODEL_VIDEO_NOT_EXIST("模板视频不存在或者已经被删除", 0, false);
+    MODEL_VIDEO_NOT_EXIST("模板视频不存在或者已经被删除", 0, false),
+
+    KUAISHOU_AUTO_STRATEGY_UPDATE("修改失败,该账户旧版自动投放策略已运行", 500, false);
     private String desc;
     private int code;
     private boolean flag;

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

@@ -33,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -151,14 +150,14 @@ public class AiKuaishouAccountAutoStrategyController {
         if (type == 1) {
             AiKuaishouAdvertiserStrategy getEntity = aiKuaishouAdvertiserStrategyService.getByAccountId(accountId);
             if (null != getEntity) {
-                return Result.error("该账户旧版自动投放配置信息已存在,请删除后再创建");
+                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("该账户重构版自动投放配置信息已存在,请删除后再创建");
+                return Result.error("该账户重构版自动投放配置信息已存在,请关闭后再创建");
             }
         }
         return Result.ok("success");
@@ -244,6 +243,32 @@ public class AiKuaishouAccountAutoStrategyController {
         return result;
     }
 
+
+    /**
+     * 修改状态
+     *
+     * @return
+     */
+    @PostMapping(value = "/updateState")
+    public Result<AiKuaishouAccountAutoStrategy> updateState(@RequestBody AiKuaishouAccountAutoStrategy strategy) {
+        Result<AiKuaishouAccountAutoStrategy> result = new Result<AiKuaishouAccountAutoStrategy>();
+        AiKuaishouAccountAutoStrategy entity = aiKuaishouAccountAutoStrategyService.getById(strategy.getId());
+        if (entity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            AiKuaishouAdvertiserStrategy getEntity = aiKuaishouAdvertiserStrategyService.getByAccountId(entity.getAccountId());
+            if (null != getEntity && getEntity.getStatus() == strategy.getStatus() && strategy.getStatus() == 1) {
+                result.error500("修改失败,该账户旧版自动投放策略已运行");
+            }
+            boolean ok = aiKuaishouAccountAutoStrategyService.updateById(strategy);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
     /**
      * 通过id删除
      *

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

@@ -375,7 +375,7 @@ public class AiKuaishouAccountAutoStrategy {
      */
     @Excel(name = "深度转化出价", width = 15)
     @ApiModelProperty(value = "深度转化出价")
-    private BigDecimal deepConversionBid;
+    private String deepConversionBid;
     /**
      * 是否创建程序化创意
      */

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoTargetMapper.xml

@@ -8,7 +8,7 @@
         FROM ctop_ai_kuaishou_account_auto_target
         where account_id = #{accountId}
         <if test="targetName != null">
-            and target_name = #{targetName}
+            and target_name LIKE CONCAT(CONCAT('%', #{targetName}), '%')
         </if>
         order by create_time desc
     </select>

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

@@ -62,7 +62,7 @@ public class AiKuaishouAccountAutoTargetServiceImpl extends ServiceImpl<AiKuaish
         wrapper.eq("target_name", requestJson.getString("targetName")).last("limit 1");
         AiKuaishouAccountAutoTarget one = this.getOne(wrapper);
         if (!Check.isNull(one) && one.getId() - requestJson.getLong("id") != 0) {
-            return Result.ok("账户下定向包名重复");
+            return Result.error("账户下定向包名重复");
         }
         AiKuaishouAccountAutoTarget target = JSONObject.toJavaObject(requestJson, AiKuaishouAccountAutoTarget.class);
         if (!Check.isNull(requestJson.getJSONArray("keyword"))) {

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AiKuaishouAdvertiserStrategyController.java

@@ -6,12 +6,16 @@ import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoStrategyService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaiShouAppMultipleBidsService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
@@ -55,6 +59,9 @@ public class AiKuaishouAdvertiserStrategyController {
     @Autowired
     private IKuaiShouAppMultipleBidsService kuaiShouAppMultipleBidsService;
 
+    @Autowired
+    private IAiKuaishouAccountAutoStrategyService aiKuaishouAccountAutoStrategyService;
+
     /**
      * 分页列表查询
      *
@@ -188,6 +195,13 @@ public class AiKuaishouAdvertiserStrategyController {
         if (status != 0) {
             status = 1;
         }
+        QueryWrapper<AiKuaishouAccountAutoStrategy> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("project_id", aiKuaishouAdvertiserStrategyEntity.getAccountId());
+        AiKuaishouAccountAutoStrategy one = aiKuaishouAccountAutoStrategyService.getOne(queryWrapper);
+        if(null!=one&&one.getStatus() == status &&status ==1){
+            ResultMapUtils.setResultMap(result, StatusCode.KUAISHOU_AUTO_STRATEGY_UPDATE);
+            return result;
+        }
         aiKuaishouAdvertiserStrategyEntity.setStatus(status);
         aiKuaishouAdvertiserStrategyService.updateById(aiKuaishouAdvertiserStrategyEntity);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);