Browse Source

Merge remote-tracking branch 'origin/master'

zhaoxian 3 năm trước cách đây
mục cha
commit
b4fe5fbf53

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

@@ -163,11 +163,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                                 return 0L;
                             }
                             // 获取视频封面数据
-                            List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
+                          /*  List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
                             if ((null == cutFrameList || cutFrameList.isEmpty())) {
                                 log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
                                 continue;
-                            }
+                            }*/
                             //开始创建组+创意
                             String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appInfo.getAppId(), null);
                             JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId(), null);
@@ -197,7 +197,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                             videoCnt--;
                             JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, null);
-                            createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, appInfo.getAppVersion());
+                            createCreativeByImage(strategy.getImageCnt(), token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, appInfo.getAppVersion());
                             if (videoCnt <= 0) {
                                 return videoCnt;
                             }
@@ -212,11 +212,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 }
                 for (KuaiShouVideoGet videoItem : allVideos) {
                     // 获取视频封面数据
-                    List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
+               /*     List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
                     if ((null == cutFrameList || cutFrameList.isEmpty())) {
                         log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
                         continue;
-                    }
+                    }*/
                     for (int i = 0; i < appIdArray.size(); i++) {
 
                         Boolean unitOverrun = getUnitOverrun(accountId);
@@ -278,7 +278,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                         videoCnt--;
                         JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, null);
-                        createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
+                        createCreativeByImage(strategy.getImageCnt(), token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
                         if (videoCnt <= 0) {
                             return videoCnt;
                         }
@@ -362,11 +362,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         return 0L;
                     }
                     // 每个组,搭配5个创意
-                    List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
+              /*      List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
                     if ((null == cutFrameList || cutFrameList.isEmpty())) {
                         log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
                         continue;
-                    }
+                    }*/
+
                     //获取组级渠道号
                     if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
                         try {
@@ -419,7 +420,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         channelService.callBackUpdateChannelRel(level, usedchannel.getChannelCode(), accountId, newCampaignId, unitId);
                     }
                     JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, usedchannel);//TODO 添加素材
-                    createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
+                    createCreativeByImage(strategy.getImageCnt(), token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
                     if (videoCnt <= 0) {
                         return 0L;
                     }
@@ -1664,15 +1665,15 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
 
 
-    private void createCreativeByImage(List<MaterialCutFrame> cutFrameList, CtopOauthToken token, JSONObject creativeParams,
+    private void createCreativeByImage(Integer imageCount, CtopOauthToken token, JSONObject creativeParams,
                                        Long campaignId, Long unitId, KuaiShouVideoGet videoItem,
                                        int imageNumber, AiKuaishouAdvertiserStrategy strategy, String uuid, String appVersion) throws InterruptedException {
-        if ((null != cutFrameList && !cutFrameList.isEmpty())) {
-            for (int i = 0; i < cutFrameList.size(); i++) {
-                String imageCode = cutFrameList.get(i).getSignature();
-                String imageUrl = cutFrameList.get(i).getUrl();
+
+            for (int i = 0; i < imageCount; i++) {
+               /*  String imageCode = cutFrameList.get(i).getSignature();
+               String imageUrl = cutFrameList.get(i).getUrl();
                 String imageToken = getImageToken(imageUrl, imageCode, token.getAccountId(), token.getAccessToken());
-                creativeParams.put("image_token", imageToken);
+                creativeParams.put("image_token", imageToken);*/
                 createCreative(token, creativeParams, campaignId, unitId, i + 1, videoItem, strategy, uuid, appVersion);
                 Thread.sleep(200L);
                 imageNumber--;
@@ -1680,7 +1681,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     break;
                 }
             }
-        }
+
     }
 
     private String getImageToken(String imageUrl, String imageCode, Long accountId, String token) {