浏览代码

Merge branch 'wyp/0123-videoAuditRoot' of Server/long-article-recommend into master

wangyunpeng 3 月之前
父节点
当前提交
85091ef53f

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/aigc/ProducePlanExeRecordRepository.java

@@ -10,4 +10,6 @@ import java.util.List;
 public interface ProducePlanExeRecordRepository extends JpaRepository<ProducePlanExeRecord, String> {
 
     List<ProducePlanExeRecord> findByPlanExeIdIn(List<String> planExeIds);
+
+    ProducePlanExeRecord getByPlanExeId(String contentId);
 }

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/LongArticleCrawlerVideoRepository.java

@@ -25,4 +25,6 @@ public interface LongArticleCrawlerVideoRepository extends JpaRepository<LongArt
     List<LongArticleCrawlerVideo> getByAuditTimestampBetween(Long start, Long end);
 
     long countByStatusAndAuditTimestampBetween(Integer status, Long start, Long end);
+
+    List<LongArticleCrawlerVideo> getByContentId(String rootProduceContentId);
 }

+ 35 - 5
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleVideoAuditService.java

@@ -6,12 +6,11 @@ import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVid
 import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleAuditMapper;
 import com.tzld.longarticle.recommend.server.model.dto.PublishContentMiniprogramDTO;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.ArticleReMatchRecord;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticleCrawlerVideo;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticleTitleAudit;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesMatchVideo;
+import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.*;
 import com.tzld.longarticle.recommend.server.model.param.videoAudit.*;
 import com.tzld.longarticle.recommend.server.model.vo.ArticleVideoAuditListVO;
+import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanExeRecordRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.*;
 import com.tzld.longarticle.recommend.server.util.page.Page;
 import com.xxl.job.core.biz.model.ReturnT;
@@ -23,7 +22,10 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @Service
@@ -44,6 +46,10 @@ public class ArticleVideoAuditService {
     private LongArticlesMatchVideoRepository articlesMatchVideoRepository;
     @Autowired
     private ArticleAuditService articleAuditService;
+    @Autowired
+    private ProducePlanExeRecordRepository producePlanExeRecordRepository;
+    @Autowired
+    private ArticlePoolPromotionSourceRepository articlePoolPromotionSourceRepository;
 
     @Value("${cdnUrl:https://rescdn.piaoquantv.com/}")
     private String cdnUrl;
@@ -149,12 +155,36 @@ public class ArticleVideoAuditService {
             video.setIsIllegal(1);
             // 审核不通过
             auditVideoReject(video);
+            updateRootContentVideo(param.getContentId(), video);
         } else {
             video.setIsIllegal(0);
         }
         crawlerVideoRepository.save(video);
     }
 
+    private void updateRootContentVideo(String contentId, LongArticleCrawlerVideo video) {
+        ProducePlanExeRecord content = producePlanExeRecordRepository.getByPlanExeId(contentId);
+        if (Objects.isNull(content)) {
+            return;
+        }
+        ArticlePoolPromotionSource source = articlePoolPromotionSourceRepository.getByChannelContentId(content.getChannelContentId());
+        if (Objects.isNull(source)) {
+            return;
+        }
+        String rootProduceContentId = source.getRootProduceContentId();
+        List<LongArticleCrawlerVideo> crawlerVideoList = crawlerVideoRepository.getByContentId(rootProduceContentId);
+        if (CollectionUtils.isEmpty(crawlerVideoList)) {
+            return;
+        }
+        for (LongArticleCrawlerVideo crawlerVideo : crawlerVideoList) {
+            if (!crawlerVideo.getVideoTitle().equals(video.getVideoTitle())) {
+                continue;
+            }
+            crawlerVideo.setIsIllegal(video.getIsIllegal());
+            crawlerVideoRepository.save(crawlerVideo);
+        }
+    }
+
     private void auditVideoReject(LongArticleCrawlerVideo video) {
         // 已发布文章删除
         List<LongArticlesMatchVideo> matchVideos = articlesMatchVideoRepository.getByContentId(video.getContentId());