Ver código fonte

添加程序化校验

zhaoxian 3 anos atrás
pai
commit
86cbf89a5e

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

@@ -140,7 +140,7 @@ public class AiKuaishouCreateCreativeController {
                 throw new Exception("视频数量不能为空");
             }
             kuaishouProgramCreativeAutoService.submit(() -> {
-                createCreativeService.autoCreateProgramCreative(strategy, 1, videoCnt);
+                createCreativeService.ProgramCreative(strategy, 1, videoCnt);
 
             });
             returnJson.put("code", 0);
@@ -181,7 +181,7 @@ public class AiKuaishouCreateCreativeController {
             }
             if (strategy.getHistoryTop() == 0) {
                 kuaishouProgramTopCreativeAutoService.submit(() -> {
-                    createCreativeService.autoCreateProgramCreative(strategy, 2, videoCnt);
+                    createCreativeService.ProgramCreative(strategy, 2, videoCnt);
                 });
             } else {
                 log.info("历史高质量暂停搭建,accountId:{}", strategy.getAccountId());

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

@@ -13,6 +13,7 @@ public interface IAiKuaishouCreateCreativeService {
 
     void customCreativeLimit(AiKuaishouAdvertiserStrategy strategy);
 
+    void ProgramCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt);
     // 组创建是否超限
     Boolean getUnitOverrun(Long accountId);
 }

+ 20 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -875,6 +875,26 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     @Autowired
     private IKuaiShouUpdateService updateService;
 
+
+    @Override
+    public void ProgramCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt) {
+        Long programUnitCnt = strategy.getProgramUnitCnt();
+        if (Check.isNull(programUnitCnt)) {
+            return;
+        }
+        String date = DateUtils.formatDate(new Date());
+        //查询当前账户创建自定义类型组数量
+        Integer unitCreateCnt = queryUnitCnt(strategy.getAccountId() + date + "_old_program_cnt");
+        Long unitNum = 0L;
+        if (!Check.isNull(unitCreateCnt)) {
+            unitNum = programUnitCnt - unitCreateCnt;
+        }
+        log.info("{}截止目前创建程序化组总数:{}", strategy.getAccountId(), unitCreateCnt);
+        if (unitNum >= 1) {
+            this.autoCreateProgramCreative(strategy, createType, videoCnt);
+        }
+    }
+
     private void createProgramCreative(CtopOauthToken token, JSONObject creativeParams, AiKuaishouAdvertiserStrategy strategy) {
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");