فهرست منبع

top内容重发 去除unsafe内容

wangyunpeng 2 هفته پیش
والد
کامیت
824ca72f29

+ 14 - 7
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticlePromotionService.java

@@ -32,10 +32,7 @@ import com.tzld.longarticle.recommend.server.remote.aigc.AIGCProducePlanDetailSe
 import com.tzld.longarticle.recommend.server.remote.aigc.AIGCProducePlanSaveService;
 import com.tzld.longarticle.recommend.server.repository.aigc.PublishAccountRepository;
 import com.tzld.longarticle.recommend.server.repository.crawler.PublishSortLogRepository;
-import com.tzld.longarticle.recommend.server.repository.longArticle.ArticlePoolPromotionSourceRepository;
-import com.tzld.longarticle.recommend.server.repository.longArticle.DatastatSortStrategyRepository;
-import com.tzld.longarticle.recommend.server.repository.longArticle.PublishSingleVideoSourceRepository;
-import com.tzld.longarticle.recommend.server.repository.longArticle.VideoTitleReWriteRepository;
+import com.tzld.longarticle.recommend.server.repository.longArticle.*;
 import com.tzld.longarticle.recommend.server.util.DateUtils;
 import com.tzld.longarticle.recommend.server.util.Md5Util;
 import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil;
@@ -89,6 +86,9 @@ public class ArticlePromotionService {
     AigcBaseMapper aigcBaseMapper;
     @Autowired
     VideoTitleReWriteRepository videoTitleReWriteRepository;
+    @Autowired
+    ArticleUnsafeTitleRepository articleUnsafeTitleRepository;
+
     @ApolloJsonValue("${articlePromotionProduceConfig:{}}")
     private Map<String, Map<String, Map<String, String>>> produceConfig;
     @Value("${topProducePlanId:}")
@@ -505,7 +505,7 @@ public class ArticlePromotionService {
     }
 
     private void articleAddDependPlan(String produceId, ProducePlanDetailVO detail, String inputSourceValue,
-                                      String inputSourceLabel, Integer inputSourceType) {
+                                      String inputSourceLabel, Integer inputSourceType, List<ArticleUnsafeTitle> unsafeTitleList) {
         try {
             // 获取生产计划的详细信息
             if (detail == null) {
@@ -520,8 +520,14 @@ public class ArticlePromotionService {
             // 获取依赖计划 ID 列表
             List<ProducePlanInputSourceParam> inputSources = detail.getInputSourceGroups().get(0).getInputSources();
             List<String> dependValues = new ArrayList<>();
-            for (ProducePlanInputSourceParam inputSource : inputSources) {
+            Iterator<ProducePlanInputSourceParam> iterator = inputSources.iterator();
+            while (iterator.hasNext()) {
+                ProducePlanInputSourceParam inputSource = iterator.next();
                 dependValues.add(inputSource.getInputSourceValue());
+                // 违规文章移除
+                if (unsafeTitleList.stream().anyMatch(unsafeTitle -> inputSource.getInputSourceLabel().contains(unsafeTitle.getTitle()))) {
+                    iterator.remove();
+                }
             }
             // 如果计划 ID 已存在,直接返回
             if (dependValues.contains(inputSourceValue)) {
@@ -650,6 +656,7 @@ public class ArticlePromotionService {
         Map<String, Long> crawlerContentMap = crawlerContentList.stream().collect(Collectors.toMap(
                 CrawlerContent::getChannelContentId, CrawlerContent::getId));
         ProducePlanDetailVO detail = aigcProducePlanDetailService.articleGetProducePlanDetail(topProducePlanId);
+        List<ArticleUnsafeTitle> unsafeTitleList = articleUnsafeTitleRepository.getByStatus(1);
         int retryTimes = 5;
         while (Objects.isNull(detail) && retryTimes > 0) {
             detail = aigcProducePlanDetailService.articleGetProducePlanDetail(topProducePlanId);
@@ -675,7 +682,7 @@ public class ArticlePromotionService {
                 continue;
             }
             articleAddDependPlan(topProducePlanId, detail, String.valueOf(crawlerContentId), inputSourceLabel,
-                    ProducePlanInputSourceTypeEnum.contentID.getVal());
+                    ProducePlanInputSourceTypeEnum.contentID.getVal(), unsafeTitleList);
         }
         return ReturnT.SUCCESS;
     }