|
@@ -0,0 +1,59 @@
|
|
|
+package com.tzld.longarticle.recommend.server.service.recommend.filter.strategy;
|
|
|
+
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum;
|
|
|
+import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
|
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource;
|
|
|
+import com.tzld.longarticle.recommend.server.repository.longArticle.PublishSingleVideoSourceRepository;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recommend.filter.FilterParam;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recommend.filter.FilterResult;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recommend.filter.FilterStrategy;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class VideoPoolBadAuditStrategy implements FilterStrategy {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PublishSingleVideoSourceRepository publishSingleVideoSourceRepository;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public FilterResult filter(FilterParam param) {
|
|
|
+ FilterResult filterResult = new FilterResult();
|
|
|
+ List<String> result = new ArrayList<>(param.getContents().size());
|
|
|
+ List<Content> filterContents = new ArrayList<>();
|
|
|
+ List<String> videoPoolContentSourceIds = param.getContents().stream().map(Content::getSourceId).collect(Collectors.toList());
|
|
|
+ List<PublishSingleVideoSource> videoPoolList = publishSingleVideoSourceRepository.getByContentTraceIdIn(videoPoolContentSourceIds);
|
|
|
+ Map<String, PublishSingleVideoSource> videoPoolMap = videoPoolList.stream().collect(Collectors.toMap(PublishSingleVideoSource::getContentTraceId, o -> o));
|
|
|
+ for (Content content : param.getContents()) {
|
|
|
+ if (!PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal().equals(content.getSourceType())) {
|
|
|
+ result.add(content.getId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ PublishSingleVideoSource videoPool = videoPoolMap.get(content.getSourceId());
|
|
|
+ if (Objects.isNull(videoPool)) {
|
|
|
+ content.setFilterReason("视频内容池不存在");
|
|
|
+ filterContents.add(content);
|
|
|
+ } else if (videoPool.getBadStatus() != 0) {
|
|
|
+ content.setFilterReason("视频内容池已退场");
|
|
|
+ filterContents.add(content);
|
|
|
+ } else if (videoPool.getAuditStatus() != 1) {
|
|
|
+ content.setFilterReason("视频内容池审核不通过");
|
|
|
+ filterContents.add(content);
|
|
|
+ } else {
|
|
|
+ result.add(content.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ filterResult.setContentIds(result);
|
|
|
+ filterResult.setFilterContent(filterContents);
|
|
|
+ return filterResult;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|