Browse Source

项目自动化调试,添加定时任务

zhaoxian 3 năm trước cách đây
mục cha
commit
7a8629637f

+ 107 - 10
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiProjectCreativeJob.java

@@ -7,10 +7,12 @@ import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouProjectStrategyService;
 import com.alibaba.fastjson.JSONObject;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import java.text.ParseException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,32 +32,127 @@ public class KuaishouAiProjectCreativeJob {
     private IKuaishouProjectStrategyService kuaishouProjectStrategyService;
 
     /**
-     * 项目自动化
+     * 项目自定义上新
      */
-    @XxlJob("kuaishouAiProjectCreativeJob")
-    public void execute() {
-        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy();
+    @XxlJob("projectCustomCreativeOnNew")
+    public void projectCustomCreativeOnNew() {
+        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy(4, "1");
         if (null == strategies || strategies.isEmpty()) {
             return;
         }
-        String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectAutomaticCreates";
+        String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectCreative";
         for (KuaishouProjectStrategy strategy : strategies) {
             Map<String, Object> requestMap = new HashMap<>();
             requestMap.put("id", strategy.getId());
-            //  operationType 1检查反馈,2创建时信息
-            requestMap.put("operationType", 2);
             String result = HttpUtils2.httpGet(url, requestMap, null);
             JSONObject jsonObject = JSONObject.parseObject(result);
             if (!Check.isNull(jsonObject)) {
                 Integer code = jsonObject.getInteger("code");
                 if (code == 200) {
-                    log.info("项目自动化创建执行中,projectId:{}", strategy.getProjectId());
+                    log.info("快手自动上新异步执行中,accountId:{}", strategy.getProjectId());
                 } else {
-                    log.error("项目自动化创建执行失败,projectId:{}", strategy.getProjectId());
+                    log.error("快手自动上新异执行失败,accountId:{}", strategy.getProjectId());
                 }
             } else {
-                log.error("项目自动化创建返回结果为空,projectId:{}", strategy.getProjectId());
+                log.error("快手自动上新返回结果为空,accountId:{}", strategy.getProjectId());
             }
         }
     }
+
+    /**
+     * 项目自定义补充
+     */
+    @XxlJob("projectCustomCreativeSupplement")
+    public void projectCustomCreativeSupplement() {
+        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy(4, null);
+        if (null == strategies || strategies.isEmpty()) {
+            return;
+        }
+        try {
+            String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectCreativeSupplement";
+            int hour = DateUtils.getNowHour();
+            for (KuaishouProjectStrategy strategy : strategies) {
+                Map<String, Object> requestMap = new HashMap<>();
+                requestMap.put("id", strategy.getId());
+                requestMap.put("hour", hour);
+                String result = HttpUtils2.httpGet(url, requestMap, null);
+                JSONObject jsonObject = JSONObject.parseObject(result);
+                if (!Check.isNull(jsonObject)) {
+                    Integer code = jsonObject.getInteger("code");
+                    if (code == 0) {
+                        log.info("快手创意补充异步执行中,accountId:{}", strategy.getAccountId());
+                    } else {
+                        log.error("快手创意补充异步执行失败,accountId:{}", strategy.getAccountId());
+                    }
+                } else {
+                    log.error("快手创意补充返回结果为空,accountId:{}", strategy.getAccountId());
+                }
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 项目程序化上新创意
+     */
+    @XxlJob("projectProgramCreativeAuto")
+    public void kuaishouProgramCreativeAuto() {
+        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy(7, "1");
+        if (null == strategies || strategies.isEmpty()) {
+            return;
+        }
+        String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectProgramAutomaticCreates";
+        for (KuaishouProjectStrategy strategy : strategies) {
+            long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("id", strategy.getId());
+            requestMap.put("videoCnt", videoCnt);
+            String result = HttpUtils2.httpGet(url, requestMap, null);
+            JSONObject jsonObject = JSONObject.parseObject(result);
+            if (!Check.isNull(jsonObject)) {
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    log.info("快手上新程序化创意补充异步执行中,accountId:{}", strategy.getAccountId());
+                } else {
+                    log.error("快手上新程序化异步执行失败,accountId:{}", strategy.getAccountId());
+                }
+            } else {
+                log.error("快手上新程序化充返回结果为空,accountId:{}", strategy.getAccountId());
+            }
+        }
+
+
+    }
+
+    /**
+     * 项目程序化高质量创意
+     */
+    @XxlJob("projectProgramCreativeTop")
+    public void kuaishouProgramCreativeTop() {
+        List<KuaishouProjectStrategy> strategies = kuaishouProjectStrategyService.getAllEffectStrategy(7, "2");
+        if (null == strategies || strategies.isEmpty()) {
+            return;
+        }
+        String url = jobUrl + "/jeecg-boot/ai/projectCreate/projectProgramCreativeTop";
+        for (KuaishouProjectStrategy strategy : strategies) {
+            long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("id", strategy.getId());
+            requestMap.put("videoCnt", videoCnt);
+            String result = HttpUtils2.httpGet(url, requestMap, null);
+            JSONObject jsonObject = JSONObject.parseObject(result);
+            if (!Check.isNull(jsonObject)) {
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    log.info("快手历史高质量程序化创意补充异步执行中,accountId:{}", strategy.getAccountId());
+                } else {
+                    log.error("快手历史高质量程序化异步执行失败,accountId:{}", strategy.getAccountId());
+                }
+            } else {
+                log.error("快手历史高质量程序化充返回结果为空,accountId:{}", strategy.getAccountId());
+            }
+        }
+
+    }
 }

+ 124 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouProjectCreateCreativeController.java

@@ -35,7 +35,7 @@ public class AiKuaishouProjectCreateCreativeController {
     static ExecutorService kuaishouCustomCreativeSupplementExecutorService = Executors.newFixedThreadPool(3);
 
     /**
-     * 项目自动创建
+     * 检查匹配
      *
      * @param id
      * @return
@@ -44,7 +44,6 @@ public class AiKuaishouProjectCreateCreativeController {
     public JSONObject projectAutomaticCreates(String id, Integer operationType) {
         JSONObject returnJson = new JSONObject();
         try {
-
             if (Check.isNull(id) || Check.isNull(operationType)) {
                 throw new Exception("参数为空");
             }
@@ -66,7 +65,47 @@ public class AiKuaishouProjectCreateCreativeController {
                 }
             }));
             returnJson.put("code", 0);
-            returnJson.put("message", "异步创建中");
+            returnJson.put("message", "自定义上新异步创建中");
+        } catch (Exception e) {
+            log.error("项目自动创建异常", e.fillInStackTrace());
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+
+    /**
+     * 项目自定义上新
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/projectCreative")
+    public JSONObject projectCreative(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("参数为空");
+            }
+            KuaishouProjectStrategy strategy = kuaishouProjectStrategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Long projectId = strategy.getProjectId();
+            List<Long> list = userAllocationService.queryAutomaticAccounts(projectId);
+            if (Check.isNull(list)) {
+                throw new Exception("项目:" + projectId + "中未配置自动投放账户!");
+            }
+            list.forEach(accountId -> executorService.submit(() -> {
+                Boolean unitOverrun = projectCreateCreativeService.getUnitOverrun(projectId.toString().concat(accountId.toString()));
+                if (!unitOverrun) {
+                    strategy.setAccountId(accountId);
+                    projectCreateCreativeService.projectAutomaticCreates(strategy);
+                }
+            }));
+            returnJson.put("code", 0);
+            returnJson.put("message", "自定义上新异步创建中");
         } catch (Exception e) {
             log.error("项目自动创建异常", e.fillInStackTrace());
             returnJson.put("code", -1);
@@ -76,14 +115,14 @@ public class AiKuaishouProjectCreateCreativeController {
     }
 
     /**
-     * 自定义创意补充
+     * 项目维度自定义创意补充
      *
      * @param id
      * @param hour
      * @return
      */
-    @GetMapping(value = "/kuaishouCustomCreativeSupplement")
-    public JSONObject kuaishouCustomCreativeSupplement(String id, Integer hour) {
+    @GetMapping(value = "/projectCreativeSupplement")
+    public JSONObject projectCreativeSupplement(String id, Integer hour) {
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(id)) {
@@ -110,13 +149,91 @@ public class AiKuaishouProjectCreateCreativeController {
                 }
             }));
             returnJson.put("code", 0);
-            returnJson.put("message", "异步创建中");
+            returnJson.put("message", "自定义补充异步创建中...");
         } catch (Exception e) {
             returnJson.put("code", -1);
             returnJson.put("message", e.getMessage());
         }
         return returnJson;
+    }
+
 
+    /**
+     * 项目程序化上新
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/projectProgramAutomaticCreates")
+    public JSONObject projectProgramAutomaticCreates(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("参数为空");
+            }
+            KuaishouProjectStrategy strategy = kuaishouProjectStrategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Long projectId = strategy.getProjectId();
+            List<Long> list = userAllocationService.queryAutomaticAccounts(projectId);
+            if (Check.isNull(list)) {
+                throw new Exception("项目:" + projectId + "中未配置自动投放账户!");
+            }
+            list.forEach(accountId -> executorService.submit(() -> {
+                Boolean unitOverrun = projectCreateCreativeService.getUnitOverrun(projectId.toString().concat(accountId.toString()));
+                if (!unitOverrun) {
+                    strategy.setAccountId(accountId);
+                    projectCreateCreativeService.projectProgramAutomaticCreates(strategy, 1);
+                }
+            }));
+            returnJson.put("code", 0);
+            returnJson.put("message", "程序化上新异步创建中");
+        } catch (Exception e) {
+            log.error("项目自动创建异常", e.fillInStackTrace());
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
     }
 
+    /**
+     * 项目程序化高质量创意
+     *
+     * @param id
+     * @param hour
+     * @return
+     */
+    @GetMapping(value = "/projectProgramCreativeTop")
+    public JSONObject projectProgramCreativeSupplement(String id, Integer hour) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("参数为空");
+            }
+            KuaishouProjectStrategy strategy = kuaishouProjectStrategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Long projectId = strategy.getProjectId();
+            List<Long> list = userAllocationService.queryAutomaticAccounts(projectId);
+            if (Check.isNull(list)) {
+                throw new Exception("项目:" + projectId + "中未配置自动投放账户!");
+            }
+            list.forEach(accountId -> executorService.submit(() -> {
+                Boolean unitOverrun = projectCreateCreativeService.getUnitOverrun(projectId.toString().concat(accountId.toString()));
+                if (!unitOverrun) {
+                    strategy.setAccountId(accountId);
+                    projectCreateCreativeService.projectProgramAutomaticCreates(strategy, 2);
+                }
+            }));
+            returnJson.put("code", 0);
+            returnJson.put("message", "程序化高质量异步创建中");
+        } catch (Exception e) {
+            log.error("项目自动创建异常", e.fillInStackTrace());
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouProjectCreativeMatTypeEnum.java

@@ -9,7 +9,7 @@ public enum KuaishouProjectCreativeMatTypeEnum {
      * type字段 第一位创意创建方式,第二位素材获取方式
      * 快手创意素材获取类型
      */
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_NEW("41","自定义上新",-1*60*24L,-5L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_NEW("41","自定义上新",-20L,-10L),
     KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HIGH_quality("42","自定义高质量",-28*60*24L,-1*60*24L),
     KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_MISSING("43","自定义上新",-60*60*24L,-1*60*24L),
     KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HISTORY("44","自定义历史",-60*60*24L,-1*60*24L),

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouProjectStrategyMapper.java

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.ai.mapper;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -25,5 +26,5 @@ public interface KuaishouProjectStrategyMapper extends BaseMapper<KuaishouProjec
 
     Integer checkProjectisOpen(Long projectId);
 
-    List<KuaishouProjectStrategy> getAllEffectStrategy();
+    List<KuaishouProjectStrategy> getAllEffectStrategy(@Param("unitType")int unitType, @Param("sourceMaterial")String sourceMaterial);
 }

+ 8 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouProjectStrategyMapper.xml

@@ -164,7 +164,14 @@
     </select>
 
     <select id="getAllEffectStrategy" resultType="cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy">
-        SELECT id,project_id FROM ctop_ai_kuaishou_project_strategy WHERE data_status = 1
+        SELECT id, project_id from ctop_ai_kuaishou_project_strategy
+        WHERE data_status = 1
+        <if test="unitType != null ">
+          AND (unit_type = #{unitType} OR unit_type = 0)
+        </if>
+        <if test="sourceMaterial != null ">
+          AND LOCATE(#{sourceMaterial},source_material)
+        </if>
     </select>
 
 

+ 3 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouProjectCreateCreativeService.java

@@ -9,9 +9,11 @@ public interface IAiKuaishouProjectCreateCreativeService {
 
     void customCreativeSupplement(KuaishouProjectStrategy strategy, Integer hour) throws ParseException;
 
-    void projectAutomaticCreates(KuaishouProjectStrategy strategy,Integer operationType);
+    void projectAutomaticCreates(KuaishouProjectStrategy strategy);
 
+    void projectAutomaticCreates(KuaishouProjectStrategy strategy,Integer operationType);
     // 组创建是否超限
     Boolean getUnitOverrun(String keyx);
 
+    void projectProgramAutomaticCreates(KuaishouProjectStrategy strategy,Integer type);
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouProjectStrategyService.java

@@ -24,5 +24,5 @@ public interface IKuaishouProjectStrategyService extends IService<KuaishouProjec
 
     boolean checkProjectisOpen(Long projectId);
 
-    List<KuaishouProjectStrategy> getAllEffectStrategy();
+    List<KuaishouProjectStrategy> getAllEffectStrategy(int unitType,String sourceMaterial);
 }

+ 82 - 28
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouProjectCreateCreativeServiceImpl.java

@@ -123,35 +123,83 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
     private IKuaiShouGroupService groupService;
     static ExecutorService executorService = Executors.newFixedThreadPool(2);
 
+    /**
+     * 检查匹配
+     */
+    @Override
+    public void projectAutomaticCreates(KuaishouProjectStrategy strategy, Integer operationType) {
+        try {
+            Integer customUnitCnt = strategy.getCustomUnitCnt();
+            if (Check.isNull(customUnitCnt)) {
+                Integer imageCnt = strategy.getImageCnt();
+                if (imageCnt <= 5) {
+                    customUnitCnt = 600;
+                } else {
+                    customUnitCnt = 2000 / imageCnt;
+                }
+            }
+            //程序化组数 最大60
+            Integer programUnitCnt = strategy.getProgramUnitCnt();
+            if (Check.isNull(programUnitCnt)) {
+                Integer imageCnt = strategy.getImageCnt();
+                if (imageCnt <= 5) {
+                    programUnitCnt = 60;
+                } else {
+                    programUnitCnt = 300 / imageCnt;
+                }
+            }
+            //素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞
+            List<Integer> sourceMaterial = JSONObject.parseObject(strategy.getSourceMaterial(), List.class);
+            //创意制作方式,0-不限,4-自定义,7-程序化创意
+            for (Integer createType : sourceMaterial) {
+                if (strategy.getUnitType() == 4) {
+                    this.autoCreateCreative(strategy, createType, customUnitCnt, 1);
+                } else if (strategy.getUnitType() == 7) {
+                    this.autoCreateProgramCreative(strategy, createType, programUnitCnt, 1);
+                } else {
+                    this.autoCreateCreative(strategy, createType, customUnitCnt, 1);
+                    this.autoCreateProgramCreative(strategy, createType, programUnitCnt, 1);
+                }
+            }
+        } catch (Exception e) {
+            log.error("项目自动化创建异常", e);
+        }
+    }
+
+    /**
+     * 自定义补充
+     */
     @Override
     public void customCreativeSupplement(KuaishouProjectStrategy strategy, Integer hour) throws ParseException {
         Integer customUnitCnt = strategy.getCustomUnitCnt();
         if (Check.isNull(customUnitCnt)) {
             Integer imageCnt = strategy.getImageCnt();
-            if (imageCnt <= 1) {
+            if (imageCnt <= 5) {
                 customUnitCnt = 600;
             } else {
                 customUnitCnt = 2000 / imageCnt;
             }
         }
-
         int unitNum = customUnitCnt * hour / 20;
         log.info("{}当前时间内需要创建组总数:{}", strategy.getAccountId(), unitNum);
         //查询当前账户创建自定义类型组数量
         int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
         log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
         int remindCnt = unitNum - unitCreateCnt;
-        if (remindCnt >= 1) {
+        int concat = strategy.getSourceMaterial().contains("3") ? 3 : 0;
+        if (concat != 0 && remindCnt >= 1) {
             log.info("{}组创建不足,剩余需要创建个数{},使用历史遗漏素材创建", strategy.getAccountId(), remindCnt);
             //优先创建历史遗漏素材
             remindCnt = this.autoCreateCreative(strategy, 3, remindCnt, 2);
         }
-        if (remindCnt >= 1) {
+        concat = strategy.getSourceMaterial().contains("2") ? 2 : 0;
+        if (concat != 0 && remindCnt >= 1) {
             log.info("{}组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
             //高质量素材
             remindCnt = this.autoCreateCreative(strategy, 2, remindCnt, 2);
         }
-        if (remindCnt >= 1) {
+        concat = strategy.getSourceMaterial().contains("4") ? 4 : 0;
+        if (concat != 0 && remindCnt >= 1) {
             //历史打捞素材
             log.info("{}组创建不足,剩余需要创建个数{},使用历史打捞素材创建", strategy.getAccountId(), remindCnt);
             this.autoCreateCreative(strategy, 4, remindCnt, 2);
@@ -159,51 +207,56 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
     }
 
     /**
-     * 项目自动创建
-     *
-     * @return void
+     * 自定义上新
      */
     @Override
-    public void projectAutomaticCreates(KuaishouProjectStrategy strategy, Integer operationType) {
+    public void projectAutomaticCreates(KuaishouProjectStrategy strategy) {
         try {
-            //自定义组数,最多540
             Integer customUnitCnt = strategy.getCustomUnitCnt();
             if (Check.isNull(customUnitCnt)) {
                 Integer imageCnt = strategy.getImageCnt();
-                if (imageCnt <= 1) {
+                if (imageCnt <= 5) {
                     customUnitCnt = 600;
                 } else {
                     customUnitCnt = 2000 / imageCnt;
                 }
             }
-            //程序化组数 最大60
-            Integer programUnitCnt = strategy.getProgramUnitCnt();
+            log.info("{}可创建组总数:{}", strategy.getAccountId(), customUnitCnt);
+            //查询当前账户创建自定义类型组数量
+            int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
+            log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
+            int remindCnt = customUnitCnt - unitCreateCnt;
+            if (remindCnt >= 1) {
+                this.autoCreateCreative(strategy, 1, remindCnt, 2);
+            }
+        } catch (Exception e) {
+            log.error("项目自动创建自定义上新异常", e);
+        }
+    }
+
+    /**
+     * 程序化上新
+     */
+    @Override
+    public void projectProgramAutomaticCreates(KuaishouProjectStrategy strategy,Integer type) {
+        try {
+            Integer programUnitCnt = strategy.getCustomUnitCnt();
             if (Check.isNull(programUnitCnt)) {
                 Integer imageCnt = strategy.getImageCnt();
-                if (imageCnt <= 1) {
+                if (imageCnt <= 5) {
                     programUnitCnt = 60;
                 } else {
                     programUnitCnt = 300 / imageCnt;
                 }
             }
-            //素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞
-            List<Integer> sourceMaterial = JSONObject.parseObject(strategy.getSourceMaterial(), List.class);
-            //创意制作方式,0-不限,4-自定义,7-程序化创意
-            for (Integer createType : sourceMaterial) {
-                if (strategy.getUnitType() == 4) {
-                    this.autoCreateCreative(strategy, createType, customUnitCnt, operationType);
-                } else if (strategy.getUnitType() == 7) {
-                    this.autoCreateProgramCreative(strategy, createType, programUnitCnt, operationType);
-                } else {
-                    this.autoCreateCreative(strategy, createType, customUnitCnt, operationType);
-                    this.autoCreateProgramCreative(strategy, createType, programUnitCnt, operationType);
-                }
-            }
+            log.info("{}可创建组总数:{}", strategy.getAccountId(), programUnitCnt);
+            this.autoCreateCreative(strategy, type, programUnitCnt, 2);
         } catch (Exception e) {
-            log.error("项目自动创建异常", e);
+            log.error("项目自动创建自定义上新异常", e);
         }
     }
 
+
     /**
      * 创建自定义创意
      *
@@ -1462,6 +1515,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
 
     }
 
+
     /**
      * 记录账户维度操作数据
      *

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouProjectStrategyServiceImpl.java

@@ -71,7 +71,7 @@ public class KuaishouProjectStrategyServiceImpl extends ServiceImpl<KuaishouProj
     }
 
     @Override
-    public List<KuaishouProjectStrategy> getAllEffectStrategy() {
-        return kuaishouProjectStrategyMapper.getAllEffectStrategy();
+    public List<KuaishouProjectStrategy> getAllEffectStrategy(int unitType,String sourceMaterial) {
+        return kuaishouProjectStrategyMapper.getAllEffectStrategy(unitType,sourceMaterial);
     }
 }