Browse Source

修改自动创建计划有异常不跳过为有问题的继续向下执行下一个户

huangxuechao 4 years ago
parent
commit
b7c64e7008

+ 30 - 26
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -1401,32 +1401,36 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
     private IByteDanceAdvertisePlanService planService;
     @Override
     public void customCreativeSupplement(AiBytedanceAdvertiserStrategy strategy, Integer hour,String openUrl) {
-        Long customUnitCnt = strategy.getCampaignAdCnt()*strategy.getCampaignCnt();
-        Long unitNum = customUnitCnt * hour / 19;
-        log.info("{}当前时间内需要创建计划总数:{}", strategy.getAccountId(), unitNum);
-        //查询当前账户创建自定义类型计划数量
-        int unitCreateCnt = planService.queryToDayBuiltCount(strategy.getAccountId());
-        log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
-        long remindCnt = unitNum - unitCreateCnt;
-        if (remindCnt >= 1) {
-            log.info("{}计划创建不足,剩余需要创建个数{},使用上新素材创建", strategy.getAccountId(), remindCnt);
-            //优先创建历史遗漏素材
-            remindCnt = this.createCreative(strategy, 1, remindCnt,openUrl);
-        }
-        if (remindCnt >= 1) {
-            log.info("{}计划创建不足,剩余需要创建个数{},使用历史遗漏素材创建", strategy.getAccountId(), remindCnt);
-            //优先创建历史遗漏素材
-            remindCnt = this.createCreative(strategy, 3, remindCnt,openUrl);
-        }
-        if (remindCnt >= 1) {
-            log.info("{}计划创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
-            //高质量素材
-            remindCnt = this.createCreative(strategy, 2, remindCnt,openUrl);
-        }
-        if (remindCnt >= 1) {
-            //历史打捞素材
-            log.info("{}计划创建不足,剩余需要创建个数{},使用历史打捞素材创建", strategy.getAccountId(), remindCnt);
-            this.createCreative(strategy, 4, remindCnt,openUrl);
+        try{
+            Long customUnitCnt = strategy.getCampaignAdCnt()*strategy.getCampaignCnt();
+            Long unitNum = customUnitCnt * hour / 19;
+            log.info("{}当前时间内需要创建计划总数:{}", strategy.getAccountId(), unitNum);
+            //查询当前账户创建自定义类型计划数量
+            int unitCreateCnt = planService.queryToDayBuiltCount(strategy.getAccountId());
+            log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
+            long remindCnt = unitNum - unitCreateCnt;
+            if (remindCnt >= 1) {
+                log.info("{}计划创建不足,剩余需要创建个数{},使用上新素材创建", strategy.getAccountId(), remindCnt);
+                //优先创建历史遗漏素材
+                remindCnt = this.createCreative(strategy, 1, remindCnt,openUrl);
+            }
+            if (remindCnt >= 1) {
+                log.info("{}计划创建不足,剩余需要创建个数{},使用历史遗漏素材创建", strategy.getAccountId(), remindCnt);
+                //优先创建历史遗漏素材
+                remindCnt = this.createCreative(strategy, 3, remindCnt,openUrl);
+            }
+            if (remindCnt >= 1) {
+                log.info("{}计划创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
+                //高质量素材
+                remindCnt = this.createCreative(strategy, 2, remindCnt,openUrl);
+            }
+            if (remindCnt >= 1) {
+                //历史打捞素材
+                log.info("{}计划创建不足,剩余需要创建个数{},使用历史打捞素材创建", strategy.getAccountId(), remindCnt);
+                this.createCreative(strategy, 4, remindCnt,openUrl);
+            }
+        }catch (Exception e){
+            log.info(e.getMessage());
         }
     }