Selaa lähdekoodia

修改上新视频获取逻辑bug

syh 4 vuotta sitten
vanhempi
commit
c86afa5525

+ 25 - 19
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -50,14 +50,15 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     @Autowired
     private IAiKuaiShouAppInfoService appInfoService;
 
+
     String getReplaceStringByCreateType(AiKuaishouAdvertiserStrategy strategy, Integer createType) {
-        String replaceString;
+        String replaceString = "素材上新";
         if (createType == 2) {
-            replaceString = "历史高质量";
+            replaceString = "高质量素材";
         } else if (createType == 3) {
             replaceString = "素材上新";
-        } else {
-            replaceString = "素材上新";
+        } else if(createType == 4){
+            replaceString = "历史素材";
         }
         if (strategy.getUnitType() == 7) {
             replaceString = "程序化" + replaceString;
@@ -127,6 +128,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     //1:查询素材
                     List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType);
                     if (null == allVideos || allVideos.isEmpty()) {
+                        log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime,replaceString);
                         return;
                     }
                     Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN");
@@ -168,7 +170,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             //单一应用
             List<KuaiShouVideoGet> newVideos = getVideosByParams(strategy, startTime, endTime, null, 100);
             if (null == newVideos || newVideos.isEmpty()) {
-                log.info("账户:{},{} 到 {} 这段时间没有上新素材", accountId, startTime, endTime);
+                log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime,replaceString);
                 return;
             }
             Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY");
@@ -425,21 +427,25 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
 
     private List<KuaiShouVideoGet> getNewVideoListByParams(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo) {
-        List<KuaiShouVideoGet> generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), null, null);
-        //2:查询特定素材
-        List<KuaiShouVideoGet> customVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), appInfo.getAppVersion(), null);
-        if (Check.isNull(generalVideos) && Check.isNull(customVideos)) {
+        if(null == appInfo){
+            return videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), null, null);
+        }else{
+            List<KuaiShouVideoGet> generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), null, null);
+            //2:查询特定素材
+            List<KuaiShouVideoGet> customVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), appInfo.getAppVersion(), null);
+            if (Check.isNull(generalVideos) && Check.isNull(customVideos)) {
             log.info("账户:{},appId({}){}到{}这段时间没有上新素材", strategy.getAccountId(), appInfo.getAppId(), startTime, endTime);
-            return new ArrayList<>();
-        }
-        //合并
-        if (null == generalVideos||generalVideos.isEmpty()) {
-            return customVideos;
-        } else if (null == customVideos||customVideos.isEmpty()) {
-            return generalVideos;
-        } else {
-            generalVideos.addAll(customVideos);
-            return generalVideos;
+                return new ArrayList<>();
+            }
+            //合并
+            if (null == generalVideos||generalVideos.isEmpty()) {
+                return customVideos;
+            } else if (null == customVideos||customVideos.isEmpty()) {
+                return generalVideos;
+            } else {
+                generalVideos.addAll(customVideos);
+                return generalVideos;
+            }
         }
     }