Selaa lähdekoodia

Merge branch 'wyp/1230-videoCoverAudit' of Server/long-article-recommend into master

wangyunpeng 5 kuukautta sitten
vanhempi
commit
6387b357fb

+ 2 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/LongArticleBaseMapper.java

@@ -67,8 +67,9 @@ public interface LongArticleBaseMapper {
 
     List<String> getExistsOssPath(Integer type);
 
+    List<Long> getExistsVideoId(Integer type, Long todayStart);
+
     void updateVideoPoolContentBad(String contentTraceId);
 
     void batchInsertArticleReMatchRecord(List<ArticleReMatchRecord> list);
-
 }

+ 10 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleAuditService.java

@@ -114,6 +114,8 @@ public class ArticleAuditService {
         Map<String, LongArticlesMatchVideo> longarticlesMatchVideoMap = longArticlesMatchVideoList.stream()
                 .collect(Collectors.toMap(LongArticlesMatchVideo::getTraceId, Function.identity()));
         List<String> existsOssPath = longArticleBaseMapper.getExistsOssPath(VideoAuditTypeEnum.PQ.getType());
+        Long todayStart = DateUtils.getTodayStart();
+        List<Long> existsVideoId = longArticleBaseMapper.getExistsVideoId(VideoAuditTypeEnum.PQ.getType(), todayStart);
         for (String traceId : traceIds) {
             try {
                 LongArticlesMatchVideo longArticlesMatchVideo = longarticlesMatchVideoMap.get(traceId);
@@ -127,6 +129,9 @@ public class ArticleAuditService {
                         }
                         existsOssPath.add(ossPath);
                     }
+                    if (existsVideoId.contains(response.getVideoID())) {
+                        continue;
+                    }
                     LongArticleVideoAudit videoAudit = new LongArticleVideoAudit();
                     videoAudit.setVideoId(response.getVideoID());
                     videoAudit.setTraceId(traceId);
@@ -174,6 +179,8 @@ public class ArticleAuditService {
         Map<String, LongArticlesMatchVideo> longarticlesMatchVideoMap = longArticlesMatchVideoList.stream()
                 .collect(Collectors.toMap(LongArticlesMatchVideo::getTraceId, Function.identity()));
         List<String> existsOssPath = longArticleBaseMapper.getExistsOssPath(VideoAuditTypeEnum.COVER.getType());
+        Long todayStart = DateUtils.getTodayStart();
+        List<Long> existsVideoId = longArticleBaseMapper.getExistsVideoId(VideoAuditTypeEnum.COVER.getType(), todayStart);
         for (String traceId : traceIds) {
             try {
                 Long now = System.currentTimeMillis();
@@ -188,6 +195,9 @@ public class ArticleAuditService {
                         }
                         existsOssPath.add(ossPath);
                     }
+                    if (existsVideoId.contains(response.getVideoID())) {
+                        continue;
+                    }
                     LongArticleVideoAudit videoAudit = new LongArticleVideoAudit();
                     videoAudit.setVideoId(response.getVideoID());
                     videoAudit.setTraceId(traceId);

+ 4 - 0
long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml

@@ -249,6 +249,10 @@
         select distinct oss_path from long_articles_video_audit where type = #{type}
     </select>
 
+    <select id="getExistsVideoId" resultType="java.lang.Long">
+        select video_id from long_articles_video_audit where type = #{type} and create_timestamp > #{todayStart}
+    </select>
+
     <update id="updateVideoPoolContentBad">
         update publish_single_video_source set bad_status = 1 where content_trace_id = #{contentTraceId};
     </update>