| 
					
				 | 
			
			
				@@ -4,17 +4,20 @@ import cn.hutool.core.collection.CollectionUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.google.common.collect.Lists; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.StatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishContentStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.aigc.PushTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.cgi.PQVideoAuditResultEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.cgi.PQVideoSensitiveLevelEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleDeleteStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleMatchContentStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotIdEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.cgi.PQVideoAuditResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.dto.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.entity.longArticle.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.param.ArticleDangerFindDeleteParam; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -24,6 +27,7 @@ import com.tzld.longarticle.recommend.server.remote.WxArticleDeleteService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.remote.pq.PQVideoAuditResultService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.remote.pq.PQVideoAuditStartProcessService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.repository.aigc.PublishAccountRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.repository.aigc.PublishContentRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.repository.longArticle.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.util.DateUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -74,6 +78,10 @@ public class ArticleAuditService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private PQVideoAuditResultService pqVideoAuditResultService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private LongArticleBaseMapper longArticleBaseMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private PublishContentRepository publishContentRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private LongArticlesTextRepository longArticlesTextRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @XxlJob("articleVideoAudit") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -201,18 +209,74 @@ public class ArticleAuditService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private void saveDeleteRecord(String ossPath) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void saveDeleteRecord(String ossPath) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<LongArticleCrawlerVideo> crawlerVideoList = longArticleCrawlerVideoRepository.getByVideoOssPath(ossPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> traceIds = crawlerVideoList.stream().map(LongArticleCrawlerVideo::getTraceId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<PublishContentMiniprogramDTO> publishContentList = aigcBaseMapper.getPublishContentByTraceIdIn(traceIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> publishContentIds = publishContentList.stream().map(PublishContentMiniprogramDTO::getPublishContentId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isEmpty(crawlerVideoList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (LongArticleCrawlerVideo longArticleCrawlerVideo : crawlerVideoList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            longArticleCrawlerVideo.setIsIllegal(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            longArticleCrawlerVideoRepository.save(longArticleCrawlerVideo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> contentIds = crawlerVideoList.stream().map(LongArticleCrawlerVideo::getContentId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<LongArticlesMatchVideo> matchVideoList = longArticlesMatchVideoRepository.getByContentIdIn(contentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, LongArticlesMatchVideo> matchVideoMap = matchVideoList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               .collect(Collectors.toMap(LongArticlesMatchVideo::getTraceId, Function.identity())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> traceIds = matchVideoList.stream().map(LongArticlesMatchVideo::getTraceId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<PublishContentMiniprogramDTO> publishContentMiniprogramList = aigcBaseMapper.getPublishContentByTraceIdIn(traceIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> publishContentIds = publishContentMiniprogramList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .map(PublishContentMiniprogramDTO::getPublishContentId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, String> PublishTraceIdMap = publishContentMiniprogramList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               .collect(Collectors.toMap(PublishContentMiniprogramDTO::getPublishContentId, PublishContentMiniprogramDTO::getTraceId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 过滤状态非已发布内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<PublishContent> publishContentList = publishContentRepository.getByIdIn(publishContentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> publishedIds = publishContentList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .filter(o -> Objects.equals(o.getStatus(), PublishContentStatusEnum.published.getVal())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .map(PublishContent::getId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        publishContentIds = publishContentIds.stream().filter(publishedIds::contains).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> deleteTraceIds = publishContentIds.stream().map(PublishTraceIdMap::get).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 重新匹配小程序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> reMatchTraceIds = traceIds.stream().filter(o -> !deleteTraceIds.contains(o)).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        buildReMatchRecord(reMatchTraceIds, ossPath, matchVideoMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 文章删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         buildArticleAuditDelete(publishContentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void buildReMatchRecord(List<String> reMatchTraceIds, String ossPath, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    Map<String, LongArticlesMatchVideo> matchVideoMap) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isEmpty(reMatchTraceIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long now = System.currentTimeMillis() / 1000; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ArticleReMatchRecord> reMatchRecordList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (String traceId : reMatchTraceIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LongArticlesMatchVideo matchVideo = matchVideoMap.get(traceId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (Objects.isNull(matchVideo) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    || ArticleMatchContentStatusEnum.ETL_COMPLETE_STATUS.getCode().equals(matchVideo.getContentStatus()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    || ArticleMatchContentStatusEnum.MISMATCH_STATUS.getCode().equals(matchVideo.getContentStatus()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    || ArticleMatchContentStatusEnum.EXIT_STATUS.getCode().equals(matchVideo.getContentStatus()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    || ArticleMatchContentStatusEnum.FAIL_STATUS.getCode().equals(matchVideo.getContentStatus())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ArticleReMatchRecord record = new ArticleReMatchRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            record.setTraceId(traceId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            record.setContentId(matchVideo.getContentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            record.setOssPath(ossPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            record.setStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.hasText(matchVideo.getResponse())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                record.setOldResponse(matchVideo.getResponse()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            record.setCreateTimestamp(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            reMatchRecordList.add(record); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        longArticleBaseMapper.batchInsertArticleReMatchRecord(reMatchRecordList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void buildArticleAuditDelete(List<String> publishContentIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isEmpty(publishContentIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 过滤已删除数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<LongArticleAuditDelete> existList = longArticleAuditDeleteRepository.getByPublishContentIdIn(publishContentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<String> existContentIds = existList.stream().map(LongArticleAuditDelete::getPublishContentId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         publishContentIds = publishContentIds.stream().filter(id -> !existContentIds.contains(id)).collect(Collectors.toList()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -244,7 +308,7 @@ public class ArticleAuditService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .collect(Collectors.groupingBy(PublishGzhPushContentRelDTO::getPushId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<PublishAccountTypeDTO> accountTypeList = aigcBaseMapper.getAccountTypeList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, PublishAccountTypeDTO> accountTypeMap = accountTypeList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               .collect(Collectors.toMap(PublishAccountTypeDTO::getGhId, Function.identity())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.toMap(PublishAccountTypeDTO::getGhId, Function.identity())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 删除文章 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (String publishContentId : publishContentIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String pushId = publishPushIdMap.get(publishContentId); 
			 |