Explorar o código

广告文案数量-默认使用10

yangzian %!s(int64=3) %!d(string=hai) anos
pai
achega
93211ed612

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

@@ -377,12 +377,15 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         JSONObject creObj = new JSONObject();
         JSONObject creObj = new JSONObject();
 
 
         JSONArray titleArray = new JSONArray();
         JSONArray titleArray = new JSONArray();
+
+        //文案数量 默认10
+        int copyNum = strategy.getCopywritingNumber() == 0 ? 10 : strategy.getCopywritingNumber();
         //根据账户 和 文案数量 查询 指定文案
         //根据账户 和 文案数量 查询 指定文案
-        List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1,strategy.getCopywritingNumber());
+        List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1,copyNum);
         //使用指定文案
         //使用指定文案
         if(!Check.isNull(slogenInfos)){
         if(!Check.isNull(slogenInfos)){
             for (BytedanceVideoSlogenInfo slogenInfo:slogenInfos) {
             for (BytedanceVideoSlogenInfo slogenInfo:slogenInfos) {
-                if(titleArray.size() >= strategy.getCopywritingNumber()){    //接口中是要求一个视频最多10个标题
+                if(titleArray.size() >= copyNum){    //接口中是要求一个视频最多10个标题
                     break;
                     break;
                 }
                 }
                 JSONObject titleObject = new JSONObject();
                 JSONObject titleObject = new JSONObject();
@@ -408,7 +411,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
             List<ByteDanceGeneralCopywriter> byteDanceGeneralCopywriter = byteDanceGeneralCopywriterMapper.getRandThree(strategy.getAccountId());
             List<ByteDanceGeneralCopywriter> byteDanceGeneralCopywriter = byteDanceGeneralCopywriterMapper.getRandThree(strategy.getAccountId());
             if(!Check.isNull(byteDanceGeneralCopywriter)){
             if(!Check.isNull(byteDanceGeneralCopywriter)){
                 for(int i = 0; i < byteDanceGeneralCopywriter.size(); i++){
                 for(int i = 0; i < byteDanceGeneralCopywriter.size(); i++){
-                    if(titleArray.size() >= strategy.getCopywritingNumber()){
+                    if(titleArray.size() >= copyNum){
                         break;
                         break;
                     }
                     }
                     JSONObject titleObject = new JSONObject();
                     JSONObject titleObject = new JSONObject();
@@ -434,7 +437,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
             }
             }
             // 图片 使用通用文案 最多10条
             // 图片 使用通用文案 最多10条
         }else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
         }else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
-            List<ByteDanceGeneralCopywriter> byteDanceGeneralCopywriterList = byteDanceGeneralCopywriterMapper.getRandTen(strategy.getAccountId(),strategy.getCopywritingNumber());
+            List<ByteDanceGeneralCopywriter> byteDanceGeneralCopywriterList = byteDanceGeneralCopywriterMapper.getRandTen(strategy.getAccountId(),copyNum);
             if(!Check.isNull(byteDanceGeneralCopywriterList)){
             if(!Check.isNull(byteDanceGeneralCopywriterList)){
                 for (ByteDanceGeneralCopywriter byteDanceGeneralCopywriter : byteDanceGeneralCopywriterList){
                 for (ByteDanceGeneralCopywriter byteDanceGeneralCopywriter : byteDanceGeneralCopywriterList){
                     JSONObject titleObject = new JSONObject();
                     JSONObject titleObject = new JSONObject();