Explorar o código

视频内容池审核未通过内容过滤

wangyunpeng hai 4 meses
pai
achega
497e833001

+ 17 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/recall/RecallService.java

@@ -222,13 +222,29 @@ public class RecallService implements ApplicationContextAware {
         if (CollectionUtils.isEmpty(content)) {
             return;
         }
-        List<String> sourceIds = content.stream().map(Content::getSourceId).collect(Collectors.toList());
+        // 长文内容池审核过滤
+        List<String> sourceIds = content.stream()
+                .filter(o -> !Objects.equals(o.getSourceType(), PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal()))
+                .map(Content::getSourceId).collect(Collectors.toList());
         List<LongArticleTitleAudit> titleAuditList = titleAuditRepository.getByContentIdIn(sourceIds);
         Map<String, Integer> titleAuditMap = titleAuditList.stream()
                 .collect(Collectors.toMap(LongArticleTitleAudit::getContentId, LongArticleTitleAudit::getStatus));
         content.removeIf(o -> !Objects.equals(o.getSourceType(), PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal())
                 && (Objects.isNull(titleAuditMap.get(o.getSourceId()))
                 || titleAuditMap.get(o.getSourceId()) != ArticleVideoAuditStatusEnum.PASS.getCode()));
+        if (CollectionUtils.isEmpty(content)) {
+            return;
+        }
+        // 视频内容池审核过滤
+        List<String> videoPoolSourceIds = content.stream()
+                .filter(o -> Objects.equals(o.getSourceType(), PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal()))
+                .map(Content::getSourceId).collect(Collectors.toList());
+        List<PublishSingleVideoSource> videoSourceList = publishSingleVideoSourceRepository.getByContentTraceIdIn(videoPoolSourceIds);
+        Map<String, Integer> videoAuditMap = videoSourceList.stream()
+                .collect(Collectors.toMap(PublishSingleVideoSource::getContentTraceId, PublishSingleVideoSource::getVideoPoolAuditStatus));
+        content.removeIf(o -> Objects.equals(o.getSourceType(), PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal())
+                && (Objects.isNull(videoAuditMap.get(o.getSourceId()))
+                || videoAuditMap.get(o.getSourceId()) != ArticleVideoAuditStatusEnum.PASS.getCode()));
     }
 
     private void filterNotMatchContent(List<Content> content) {