فهرست منبع

自动投放修改2.1

zhaoxian 3 سال پیش
والد
کامیت
efba14125a

+ 32 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoDoController.java

@@ -28,7 +28,37 @@ public class AiKuaishouAccountAutoDoController {
     static ExecutorService programService = Executors.newFixedThreadPool(8);
 
     /**
-     * 创建自定义广告创意
+     * 创建自定义上新广告创意 、频率 20分钟/次
+     */
+    @GetMapping(value = "/createCustomUpNewCreative")
+    public JSONObject createCustomUpNewCreative(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            AiKuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("****** 广告组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日广告组创建已超限");
+            }
+            customService.submit(() -> autoDoService.createCustomUpNewCreative(strategy));
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+
+    /**
+     * 创建自定义非上新广告创意 、频率 60分钟/次
      */
     @GetMapping(value = "/createCustomCreative")
     public JSONObject createCustomCreative(String id) {
@@ -58,7 +88,7 @@ public class AiKuaishouAccountAutoDoController {
     }
 
     /**
-     * 创建程序化广告创意
+     * 创建程序化广告创意 频率 60分钟/次
      */
     @GetMapping(value = "/createProgramCreative")
     public JSONObject createProgramCreative(String id) {

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

@@ -116,6 +116,9 @@ public class AiKuaishouAccountAutoStrategyController {
                 if (null != allocation) {
                     record.setAuthName(allocation.getAuthName());
                 }
+                //TODO
+                record.setCustomCreatedUnitCnt(0);
+                record.setProgramCreatedUnitCnt(0);
             });
         }
         pageInfo.setList(list);
@@ -205,7 +208,7 @@ public class AiKuaishouAccountAutoStrategyController {
      * @return
      */
     @ApiOperation(value = "自动投放重构-账户策略表-编辑", notes = "自动投放重构-账户策略表-编辑")
-    @PutMapping(value = "/edit")
+    @PostMapping(value = "/edit")
     public Result<AiKuaishouAccountAutoStrategy> edit(@RequestBody AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategy) {
         Result<AiKuaishouAccountAutoStrategy> result = new Result<AiKuaishouAccountAutoStrategy>();
         AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategyEntity = aiKuaishouAccountAutoStrategyService.getById(aiKuaishouAccountAutoStrategy.getId());
@@ -213,7 +216,7 @@ public class AiKuaishouAccountAutoStrategyController {
             result.error500("未找到对应实体");
         } else {
             Integer singleAppId = aiKuaishouAccountAutoStrategy.getSingleAppid();
-            if (aiKuaishouAccountAutoStrategy.getCampaignType() == 2 || aiKuaishouAccountAutoStrategy.getCampaignType() == 7) {
+            if (aiKuaishouAccountAutoStrategyEntity.getCampaignType() == 2 || aiKuaishouAccountAutoStrategyEntity.getCampaignType() == 7) {
                 if (null != singleAppId && singleAppId == 1) {
                     Long appId = Long.valueOf(JSONArray.parseArray(aiKuaishouAccountAutoStrategy.getAppIdArray()).getString(0));
                     aiKuaishouAccountAutoStrategy.setAppId(appId);

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

@@ -491,4 +491,10 @@ public class AiKuaishouAccountAutoStrategy {
 
     @TableField(exist = false)
     private String authName;
+
+    @TableField(exist = false)
+    private int customCreatedUnitCnt;
+
+    @TableField(exist = false)
+    private int programCreatedUnitCnt;
 }

+ 3 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoVideoMapper.java

@@ -19,11 +19,11 @@ public interface AiKuaishouAccountAutoVideoMapper extends BaseMapper<AiKuaishouA
 
     List<AiKuaishouAccountAutoVideo> getUpNewVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("statDate") String statDate, @Param("createType") String createType);
 
-    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("createType") String createType);
+    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("createType") String createType, @Param("statDate") String statDate);
 
-    List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt);
+    List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("statDate") String statDate);
 
-    List<AiKuaishouAccountAutoVideo> getZeroVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt);
+    List<AiKuaishouAccountAutoVideo> getZeroVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt, @Param("statDate") String date);
 
     Integer getAutoVideoUsed(@Param("accountId") Long accountId, @Param("signature") String signature, @Param("videoType") Integer videoType, @Param("createType") String createType);
 

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

@@ -32,10 +32,10 @@
     <select id="getUpNewVideos" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo">
         SELECT * FROM ctop_ai_kuaishou_account_auto_video
         WHERE account_id = #{accountId}
-        <if test="createType ==custom">
+        <if test="createType == 'custom' ">
             AND custom_status = 1
         </if>
-        <if test="createType ==program">
+        <if test="createType == 'program'">
             AND program_status = 1
         </if>
         <if test="channelType!=null">
@@ -76,7 +76,7 @@
         channel_type,
         material_type
         from ctop_material_top_cost
-        where t1.account_id = #{accountId}
+        where account_id = #{accountId}
         and md5 not in
         (
         SELECT signature FROM ctop_ai_kuaishou_account_auto_video_used
@@ -96,7 +96,7 @@
             and material_name like concat(#{keyword},'%')
         </if>
         group by signature
-        ORDER BY t2.7day_cost DESC
+        ORDER BY 7day_cost DESC
         LIMIT #{videoCnt}
     </select>
 
@@ -108,8 +108,8 @@
         material_name as 'photoName',
         channel_type,
         material_type
-        from ctop_material_top_cost
-        where t1.account_id = #{accountId}
+        from ctop_history_material_catch
+        where account_id = #{accountId}
         and md5 not in
         (
         SELECT signature FROM ctop_ai_kuaishou_account_auto_video_used
@@ -127,7 +127,7 @@
             and material_name like concat(#{keyword},'%')
         </if>
         group by signature
-        ORDER BY t2.sum_cost DESC
+        ORDER BY sum_cost DESC
         LIMIT #{videoCnt}
     </select>
 

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

@@ -6,7 +6,10 @@ import java.text.ParseException;
 
 public interface IAiKuaishouAccountAutoDoService {
 
-    //创建自定义广告创意
+    //创建自定义上新广告创意
+    void createCustomUpNewCreative(AiKuaishouAccountAutoStrategy strategy);
+
+    //创建自定义非上新广告创意
     void createCustomCreative(AiKuaishouAccountAutoStrategy strategy);
 
     //创建程序化广告创意

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

@@ -113,20 +113,74 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
     @Autowired
     private IKuaiShouCampaignService campaignService;
 
+    @Override
+    public void createCustomUpNewCreative(AiKuaishouAccountAutoStrategy strategy) {
+        Long accountId = strategy.getAccountId();
+        //==========账户{}执行自定义上新自动创建==========start==========
+        String date = DateUtils.formatDate(new Date());
+        //当前需要创建广告组数量
+        int unitNum = strategy.getCustomPlanCnt() * strategy.getCustomUnitCnt();
+        //获取自定义已创建广告组数量
+        Integer customUnitCnt = (Integer) redisUtil.get(date + "_auto_custom_cnt_" + accountId);
+        if (Check.isNull(customUnitCnt)) {
+            if (unitNum > 600) {
+                unitNum = 600;
+            }
+        } else {
+            unitNum = unitNum - customUnitCnt;
+        }
+        if (unitNum == 0) {
+            return;
+        }
+        log.info("----- (自定义上新)账户:{},已建组数:{};剩余待建组数:{}", strategy.getAccountId(), customUnitCnt, unitNum);
+        Integer hours = 0;
+        try {
+            //当前剩余小时数 (2~21)
+            hours = 22 - DateUtils.getHour(DateUtils.formatDateTime());
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        JSONObject cnt = getCnt(strategy.getSourceMaterial(), unitNum, hours);
+        Integer upNewCnt = cnt.getInteger("upNewCnt");
+        if (upNewCnt == 0) {
+            return;
+        } else if (upNewCnt >= 3) {
+            //上新每小时执行3次
+            upNewCnt = upNewCnt / 3;
+        } else {
+            upNewCnt = 1;
+        }
+        if (upNewCnt > 0) {
+            // 1上新
+            log.info("----- (自定义上新)账户:{},本次可建组数:{}", strategy.getAccountId(), upNewCnt);
+            unitNum = this.autoCreateCreative(strategy, 1, upNewCnt);
+        }
+
+    }
+
     /**
-     * 创建自定义广告创意
+     * 创建自定义高质量、打捞、遗漏广告创意
      */
     @Override
     public void createCustomCreative(AiKuaishouAccountAutoStrategy strategy) {
         Long accountId = strategy.getAccountId();
-        log.info("==========账户{}执行自定义自动创建==========start==========");
-//        String date = DateUtils.formatDate(new Date());
-//        Integer customUnitCnt = (Integer) redisUtil.get(accountId + date + "_custom_count");
-        //获取自定义待创建数量
-        Integer customUnitCnt = strategy.getCustomUnitCnt();
-        //查询当前账户创建自定义类型组数量
-        int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId(), 4);
-        log.info("--------- 账户{}截止目前创建自定义组总数:{}", strategy.getAccountId(), unitCreateCnt);
+        //==========账户{}执行自定义(高质量、打捞、遗漏)自动创建==========start==========
+        String date = DateUtils.formatDate(new Date());
+        //当前需要创建广告组数量
+        int unitNum = strategy.getCustomPlanCnt() * strategy.getCustomUnitCnt();
+        //获取自定义已创建广告组数量
+        Integer customUnitCnt = (Integer) redisUtil.get(date + "_auto_custom_cnt_" + accountId);
+        if (Check.isNull(customUnitCnt)) {
+            if (unitNum > 600) {
+                unitNum = 600;
+            }
+        } else {
+            unitNum = unitNum - customUnitCnt;
+        }
+        if (unitNum == 0) {
+            return;
+        }
+        log.info("----- (自定义)账户:{},已建组数:{};剩余待建组数:{}", strategy.getAccountId(), customUnitCnt, unitNum);
         Integer hours = 0;
         try {
             //当前剩余小时数 (2~21)
@@ -134,30 +188,35 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
         } catch (ParseException e) {
             e.printStackTrace();
         }
-        //计算当前需要创建广告组数量
-        int unitNum = customUnitCnt - unitCreateCnt;
+
+        //高质量待建数
+        int highCnt = 0;
+        //遗漏
+        int omitCnt = 0;
+        //打捞
+        int salvageCnt = 0;
+        //1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞
+        String material = strategy.getSourceMaterial();
         if (hours > 0) {
-            unitNum = unitNum / hours;
-        }
-        log.info("--------- 账户{}当前小时需要创建自定义组数:{},剩余可创建总数:{}", strategy.getAccountId(), unitNum, customUnitCnt - unitCreateCnt);
-        if (unitNum >= 1) {
-            //1上新
-            unitNum = this.autoCreateCreative(strategy, 1, unitNum);
+            JSONObject cnt = getCnt(material, unitNum, hours);
+            highCnt = cnt.getInteger("highCnt");
+            omitCnt = cnt.getInteger("omitCnt");
+            salvageCnt = cnt.getInteger("salvageCnt");
         }
-        if (unitNum >= 1 && "3".contains(strategy.getSourceMaterial())) {
-            log.info("{}自定义组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), unitNum);
+        if (omitCnt > 0 && material.contains("3")) {
             //3历史遗漏
-            unitNum = this.autoCreateCreative(strategy, 3, unitNum);
+            log.info("----- (自定义历史遗漏)账户:{},本次可建组数:{}", strategy.getAccountId(), omitCnt);
+            unitNum = this.autoCreateCreative(strategy, 3, omitCnt);
         }
-        if (unitNum >= 1 && "2".contains(strategy.getSourceMaterial())) {
-            log.info("{}自定义组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), unitNum);
+        if (highCnt > 0 && material.contains("2")) {
             //2高质量素材
-            unitNum = this.autoCreateCreative(strategy, 2, unitNum);
+            log.info("----- (自定义高质量)账户:{},本次可建组数:{}", strategy.getAccountId(), highCnt);
+            unitNum = this.autoCreateCreative(strategy, 2, highCnt);
         }
-        if (unitNum >= 1 && "4".contains(strategy.getSourceMaterial())) {
+        if (salvageCnt > 0 && material.contains("4")) {
             //4历史打捞素材
-            log.info("{}自定义组创建不足,剩余需要创建个数{},使用历史打捞素材创建", strategy.getAccountId(), unitNum);
-            this.autoCreateCreative(strategy, 4, unitNum);
+            log.info("----- (自定义历史打捞)账户:{},本次可建组数:{}", strategy.getAccountId(), salvageCnt);
+            this.autoCreateCreative(strategy, 4, salvageCnt);
         }
     }
 
@@ -459,12 +518,23 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
     @Override
     public void createProgramCreative(AiKuaishouAccountAutoStrategy strategy) {
         Long accountId = strategy.getAccountId();
-        log.info("==========账户{}执行程序化自动创建==========start==========");
-        //获取程序化待创建数量
-        Integer customUnitCnt = strategy.getCustomUnitCnt();
-        //查询当前账户创建程序化类型组数量
-        int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId(), 7);
-        log.info("--------- 账户{}截止目前创建程序化组总数:{}", strategy.getAccountId(), unitCreateCnt);
+        //==========账户{}执行自定义(高质量、打捞、遗漏)自动创建==========start==========
+        String date = DateUtils.formatDate(new Date());
+        //当前需要创建广告组数量
+        int unitNum = strategy.getProgramPlanCnt() * strategy.getProgramUnitCnt();
+        //获取自定义已创建广告组数量
+        Integer programUnitCnt = (Integer) redisUtil.get(date + "_auto_program_cnt_" + accountId);
+        if (Check.isNull(programUnitCnt)) {
+            if (unitNum > 300) {
+                unitNum = 300;
+            }
+        } else {
+            unitNum = unitNum - programUnitCnt;
+        }
+        if (unitNum == 0) {
+            return;
+        }
+        log.info("----- (程序化)账户:{},已建组数:{};剩余待建组数:{}", strategy.getAccountId(), programUnitCnt, unitNum);
         Integer hours = 0;
         try {
             //当前剩余小时数 (2~21)
@@ -472,20 +542,29 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
         } catch (ParseException e) {
             e.printStackTrace();
         }
-        //计算当前需要创建广告组数量
-        int unitNum = customUnitCnt - unitCreateCnt;
-        if (hours > 0) {
-            unitNum = unitNum / hours;
+        int highCnt = 0;
+        int upNewCnt = unitNum;
+        String matchType = strategy.getSourceMaterial();
+        //包含高质量,则按照 上新:高质量 = 75%:25% 分配
+        if (matchType.contains("2")) {
+            highCnt = (int) (unitNum * 0.25);
+            upNewCnt = (int) (unitNum * 0.75);
+        }
+        if (hours > upNewCnt) {
+            upNewCnt = 1;
+        } else {
+            highCnt = highCnt / hours;
+            upNewCnt = upNewCnt / hours;
         }
-        log.info("--------- 账户{}当前小时需要创建程序化组数:{},剩余可创建总数:{}", strategy.getAccountId(), unitNum, customUnitCnt - unitCreateCnt);
-        if (unitNum >= 1) {
+        if (upNewCnt > 0) {
             //1上新
-            unitNum = this.autoCreateProgramCreative(strategy, 1, unitNum);
+            log.info("----- (程序化上新)账户:{},本次可建组数:{}", strategy.getAccountId(), upNewCnt);
+            unitNum = this.autoCreateProgramCreative(strategy, 1, upNewCnt);
         }
-        if (unitNum >= 1 && "2".contains(strategy.getSourceMaterial())) {
-            log.info("{}程序化组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), unitNum);
+        if (highCnt > 0 && matchType.contains("2")) {
+            log.info("----- (程序化高质量)账户:{},本次可建组数:{}", strategy.getAccountId(), highCnt);
             //2高质量素材
-            unitNum = this.autoCreateProgramCreative(strategy, 2, unitNum);
+            unitNum = this.autoCreateProgramCreative(strategy, 2, highCnt);
         }
     }
 
@@ -1704,7 +1783,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
 
             if (!Check.isNull(scenceIdString) && !Check.isNull(JSONArray.parseArray(scenceIdString))) {
                 JSONArray scenceArray = JSONArray.parseArray(scenceIdString);
-                sceneId = scenceArray.getInteger(   0);
+                sceneId = scenceArray.getInteger(0);
                 unitParams.put("scene_id", scenceArray);
             }
             Integer campaignType = strategy.getCampaignType();
@@ -2335,4 +2414,100 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
         }
     }
 
+
+    /**
+     * 获取创建比例
+     */
+    private JSONObject getCnt(String material, int unitNum, int hours) {
+        JSONObject object = new JSONObject();
+        int upNewCnt = unitNum;
+        //高质量待建数
+        int highCnt = 0;
+        //遗漏
+        int omitCnt = 0;
+        //打捞
+        int salvageCnt = 0;
+
+        //如果当前待建数低于循环次数(hours),则待建数 = 1
+        if (unitNum < hours) {
+            unitNum = 1;
+        }
+        /*素材优先级以及百分比:1上新、2高质量、3遗漏、4打捞
+         *全选的情况:上新(70%):高质量(20%):遗漏(5%):打捞(5%)
+         *部分选择:上新:高质量=75%:25%;上新:遗漏/+打捞=85%:15%
+         *上新:高质量:遗漏/打捞=70%:20%:10% */
+        if (material.contains("2")) {
+            if (material.contains("3") && material.contains("4")) {
+                /*----------全选的情况:上新(70%):高质量(20%):遗漏(5%):打捞(5%)----------*/
+                //上新
+                upNewCnt = getRealCnt(unitNum, hours, 0.7);
+                //高质量
+                highCnt = getRealCnt(unitNum, hours, 0.2);
+                //遗漏
+                omitCnt = getRealCnt(unitNum, hours, 0.05);
+                //打捞
+                salvageCnt = getRealCnt(unitNum, hours, 0.05);
+            } else if (material.contains("3") || material.contains("4")) {
+                /*----------上新:高质量:遗漏/打捞=70%:20%:10% ----------*/
+                //上新
+                upNewCnt = getRealCnt(unitNum, hours, 0.7);
+                //高质量
+                highCnt = getRealCnt(unitNum, hours, 0.2);
+                //遗漏
+                omitCnt = getRealCnt(unitNum, hours, 0.1);
+                //打捞
+                salvageCnt = getRealCnt(unitNum, hours, 0.1);
+            } else {
+                /*----------部分选择:上新:高质量=75%:25%;----------*/
+                //上新
+                upNewCnt = getRealCnt(unitNum, hours, 0.75);
+                //高质量
+                highCnt = getRealCnt(unitNum, hours, 0.25);
+            }
+        } else {
+            if (material.contains("3") && material.contains("4")) {
+                /*---------- 上新:遗漏:打捞=80%:10%:10%----------*/
+                //上新
+                upNewCnt = getRealCnt(unitNum, hours, 0.8);
+                //遗漏
+                omitCnt = getRealCnt(unitNum, hours, 0.1);
+                //打捞
+                salvageCnt = getRealCnt(unitNum, hours, 0.1);
+
+            } else if (material.contains("3") || material.contains("4")) {
+                /*---------- 上新:遗漏/+打捞=85%:15%----------*/
+                //上新
+                upNewCnt = getRealCnt(unitNum, hours, 0.85);
+                //遗漏
+                omitCnt = getRealCnt(unitNum, hours, 0.15);
+                //打捞
+                salvageCnt = getRealCnt(unitNum, hours, 0.15);
+            } else {
+                /*---------- 100%上新----------*/
+                //上新
+                upNewCnt = getRealCnt(unitNum, hours, 1);
+            }
+        }
+        object.put("upNewCnt", upNewCnt);
+        object.put("highCnt", highCnt);
+        object.put("omitCnt", omitCnt);
+        object.put("salvageCnt", salvageCnt);
+        System.out.println("upNewCnt:" + upNewCnt + ",highCnt:" + highCnt + "omitCnt:" + omitCnt + ",salvageCnt:" + salvageCnt);
+        return object;
+    }
+
+    private int getRealCnt(int unitNum, int hours, double i) {
+        //上新总的待建数
+        int upNewCnt = (int) (unitNum * i);
+        if (upNewCnt > hours) {
+            //总待建数大于循环次数
+            upNewCnt = upNewCnt / hours;
+        } else if (upNewCnt != 0) {
+            //总待建数大于1时,本次执行创建一个高质量
+            upNewCnt = 1;
+        } else {
+            upNewCnt = 0;
+        }
+        return upNewCnt;
+    }
 }

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

@@ -49,17 +49,17 @@ public class AiKuaishouAccountAutoVideoServiceImpl extends ServiceImpl<AiKuaisho
 
     @Override
     public List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType) {
-        return autoVideoMapper.getHistoryTopVideos(accountId, channelType, keyword, videoCnt, createType);
+        return autoVideoMapper.getHistoryTopVideos(accountId, channelType, keyword, videoCnt, createType,statDate);
     }
 
     @Override
     public List<AiKuaishouAccountAutoVideo> getMissVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate) {
-        return autoVideoMapper.getZeroVideoByParams(accountId, channelType, keyword, videoCnt);
+        return autoVideoMapper.getZeroVideoByParams(accountId, channelType, keyword, videoCnt,statDate);
     }
 
     @Override
     public List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate) {
-        return autoVideoMapper.getHistoryCatchVideos(accountId, channelType, keyword, videoCnt);
+        return autoVideoMapper.getHistoryCatchVideos(accountId, channelType, keyword, videoCnt,statDate);
     }
 
 

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

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.channel.mapper.KuaishouChannelCreateStrategyMapper">
 
     <select id="queryAllIdByAccountId" resultType="java.lang.Long">
-        SELECT *
+        SELECT id
         FROM (SELECT id
               FROM ctop_kuaishou_channel_create_strategy
               WHERE account_id = #{accountId}

+ 3 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelMapper.xml

@@ -198,7 +198,7 @@
         WHERE t1.strategy_id IN
         <foreach collection="strategys" item="item" separator=","
                  open="(" close=")">
-            #{item.id}
+            #{item}
         </foreach>
             AND t1.state = 1
             AND t1.channel_state = 1
@@ -206,21 +206,20 @@
             AND is_cycle = 1
           </if>
             AND app_id in (
-                SELECT app_id FROM ctop_kuaishou_channel_app_info where app_name = #{appName}
+                SELECT DISTINCT app_id FROM ctop_kuaishou_channel_app_info where app_name = #{appName}  and app_id is not null
             )
             AND t1.usage_times = #{usageTimes}
             and t1.usage_level = #{usageLevel}
             ORDER BY t1.create_time,t1.channel_number
     </select>
 
-
     <select id="queryUsedLevel" resultType="java.lang.Integer">
         SELECT usage_times
         FROM `ctop_kuaishou_channel`
         where strategy_id in
         <foreach collection="strategys" item="item" separator=","
                  open="(" close=")">
-            #{item.id}
+            #{item}
         </foreach>
         AND state = 1
         group by usage_times