Explorar el Código

自动创建时,无指定文案,使用三个通用文案

huangxuechao hace 4 años
padre
commit
7556cfb119

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

@@ -375,19 +375,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         JSONArray titleArray = new JSONArray();
         List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1);
         if(!Check.isNull(slogenInfos)){
-//            slogenInfos.forEach(slogenInfo->{
-////                JSONObject titleObject = new JSONObject();
-////                titleObject.put("title",slogenInfo.getSlogan());
-////                String creativeWordsIds = slogenInfo.getCreativeWordIds();
-////                if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
-////                    JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
-////                    if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
-////                        titleObject.put("creative_word_ids",creativeWordsArray);
-////                    }
-////                }
-////                titleArray.add(titleObject);
-////            });
-
             for (BytedanceVideoSlogenInfo slogenInfo:slogenInfos) {
                 if(titleArray.size() >= 10){    //接口中是要求一个视频最多10个标题
                     break;
@@ -403,27 +390,27 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 }
                 titleArray.add(titleObject);
             }
-            for(int i = 0; i < 3; i++){
-                if(titleArray.size() >= 10){
-                    break;
-                }
-                ByteDanceGeneralCopywriter byteDanceGeneralCopywriter = byteDanceGeneralCopywriterMapper.getRandOne(strategy.getAccountId());
-                if(!Check.isNull(byteDanceGeneralCopywriter)){
-                    JSONObject titleObject = new JSONObject();
-                    titleObject.put("title",byteDanceGeneralCopywriter.getTextCopywriter());
-                    String creativeWordsIds = byteDanceGeneralCopywriter.getCreativeWordIds();
-                    if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
-                        JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
-                        if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
-                            titleObject.put("creative_word_ids",creativeWordsArray);
-                        }
+        }
+        for(int i = 0; i < 3; i++){
+            if(titleArray.size() >= 10){
+                break;
+            }
+            ByteDanceGeneralCopywriter byteDanceGeneralCopywriter = byteDanceGeneralCopywriterMapper.getRandOne(strategy.getAccountId());
+            if(!Check.isNull(byteDanceGeneralCopywriter)){
+                JSONObject titleObject = new JSONObject();
+                titleObject.put("title",byteDanceGeneralCopywriter.getTextCopywriter());
+                String creativeWordsIds = byteDanceGeneralCopywriter.getCreativeWordIds();
+                if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
+                    JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
+                    if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
+                        titleObject.put("creative_word_ids",creativeWordsArray);
                     }
-                    titleArray.add(titleObject);
                 }
-
+                titleArray.add(titleObject);
             }
 
         }
+
         if(!Check.isNull(titleArray)){
             params.put("title_list",titleArray);
         }