Browse Source

视频审核分发 消费修改

wangyunpeng 4 months ago
parent
commit
5794eb32df

+ 7 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/ArticleAuditMapper.java

@@ -28,6 +28,12 @@ public interface ArticleAuditMapper {
                                                   List<String> producePlanIds, String poolLevel,
                                                   List<String> excludeContentIds);
 
+    List<ArticleVideoAuditListVO> articleVideoWatingAuditList(List<Integer> status,
+                                                              List<String> flowPoolLevels,
+                                                              List<String> excludeContentIds,
+                                                              Integer size);
+
+
     void updateCrawlerVideoIsIllegal(List<Integer> illegalVideoIds, Integer isIllegal);
 
     List<String> searchFilterValueByItemName(String itemName, String searchKeyword);
@@ -37,4 +43,5 @@ public interface ArticleAuditMapper {
     void updateVideoTitle(VideoTitleUpdateParam param, Long updateTime);
 
     void updateTitleAuditFlowPoolLevel();
+
 }

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

@@ -22,8 +22,13 @@ public interface VideoPoolAuditMapper {
                                                          int offset, Integer pageSize, String poolLevelDesc);
 
     PublishSingleVideoSource articleVideoAuditNext(List<String> contentId, List<Integer> status,
-                                                         List<String> title, List<String> auditAccount,
-                                                         Integer flowPoolLevel, List<String> excludeContentIds);
+                                                   List<String> title, List<String> auditAccount,
+                                                   Integer flowPoolLevel, List<String> excludeContentIds);
+
+    List<PublishSingleVideoSource> articleVideoWatingAuditList(List<Integer> status,
+                                                               List<Integer> flowPoolLevels,
+                                                               List<String> excludeContentIds,
+                                                               Integer size);
 
     List<String> searchFilterValueByItemName(String itemName, String searchKeyword);
 

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

@@ -122,10 +122,6 @@ public class ArticleVideoAuditService {
     }
 
     public Page<ArticleVideoAuditListVO> next(ArticleVideoAuditListParam param) {
-        if (Objects.nonNull(param.getSourceProducePlan())) {
-            param.setPageSize(1);
-            return list(param);
-        }
         Page<ArticleVideoAuditListVO> result = new Page<>();
 
         String lockKey = "article-pool-audit-lock";
@@ -442,18 +438,21 @@ public class ArticleVideoAuditService {
                 break;
             }
         }
+        List<String> excludeContentIds = new ArrayList<>();
         List<String> nextList = redisTemplate.opsForList().range(nextListRedisKey, 0, -1);
         Map<String, List<LongArticleTitleAudit>> nextListPoolCountMap = new HashMap<>();
         if (CollectionUtils.isNotEmpty(nextList)) {
             List<String> nextListIds = nextList.stream().map(item -> JSONObject.parseObject(item).getString("id")).collect(Collectors.toList());
             List<LongArticleTitleAudit> auditQueueList = titleAuditRepository.getByContentIdIn(new ArrayList<>(nextListIds));
             nextListPoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
+            excludeContentIds.addAll(nextListIds);
         }
         Set<String> auditQueueIds = redisTemplate.opsForZSet().rangeByScore(auditQueueRedisKey, 0, 100);
         Map<String, List<LongArticleTitleAudit>> auditQueuePoolCountMap = new HashMap<>();
         if (CollectionUtils.isNotEmpty(auditQueueIds)) {
             List<LongArticleTitleAudit> auditQueueList = titleAuditRepository.getByContentIdIn(new ArrayList<>(auditQueueIds));
             auditQueuePoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
+            excludeContentIds.addAll(auditQueueIds);
         }
         // 每日配置发送量不足添加
         for (Map.Entry<String, Integer> entry : dailyAuditPoolCount.entrySet()) {
@@ -465,13 +464,13 @@ public class ArticleVideoAuditService {
                 List<LongArticleTitleAudit> nextListPool = nextListPoolCountMap.getOrDefault(poolEnum.getContentPool(), new ArrayList<>());
                 int needCount = entry.getValue() - (totalCount + auditQueueList.size() + nextListPool.size());
                 if (needCount > 0) {
-                    List<ArticleVideoAuditListVO> addList = articleAuditMapper.articleVideoAuditList(null,
-                            Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, null,
-                            null, Arrays.asList(poolEnum.getContentPool()), null,
-                            0, needCount, poolLevelDesc);
+                    List<ArticleVideoAuditListVO> addList = articleAuditMapper.articleVideoWatingAuditList(
+                            Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()),
+                            Arrays.asList(poolEnum.getContentPool()), excludeContentIds, needCount);
                     if (CollectionUtils.isNotEmpty(addList)) {
                         for (ArticleVideoAuditListVO item : addList) {
                             redisTemplate.opsForZSet().add(auditQueueRedisKey, item.getContentId(), poolEnum.getWeight());
+                            excludeContentIds.add(item.getContentId());
                         }
                     }
                 }
@@ -480,9 +479,8 @@ public class ArticleVideoAuditService {
         // 待发布内容不足添加
         Long auditQueueSize = redisTemplate.opsForZSet().size(auditQueueRedisKey);
         if (Objects.isNull(auditQueueSize) || auditQueueSize < 20) {
-            List<ArticleVideoAuditListVO> list = articleAuditMapper.articleVideoAuditList(null,
-                    Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, null, null
-                    , null, null, 0, 40, poolLevelDesc);
+            List<ArticleVideoAuditListVO> list = articleAuditMapper.articleVideoWatingAuditList(
+                    Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, excludeContentIds, 40);
             if (CollectionUtils.isNotEmpty(list)) {
                 for (ArticleVideoAuditListVO item : list) {
                     ContentPoolEnum poolEnum = ContentPoolEnum.from(item.getFlowPoolLevel());

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

@@ -96,10 +96,6 @@ public class VideoPoolAuditService {
     }
 
     public Page<VideoPoolAuditListVO> next(VideoPoolAuditListParam param) {
-        if (Objects.nonNull(param.getFlowPoolLevel())) {
-            param.setPageSize(1);
-            return list(param);
-        }
         Page<VideoPoolAuditListVO> result = new Page<>();
         String lockKey = "video-pool-audit-lock";
         String requestId = UUID.randomUUID().toString();
@@ -276,18 +272,21 @@ public class VideoPoolAuditService {
                 break;
             }
         }
+        List<String> excludeContentIds = new ArrayList<>();
         List<String> nextList = redisTemplate.opsForList().range(nextListRedisKey, 0, -1);
         Map<String, List<PublishSingleVideoSource>> nextListPoolCountMap = new HashMap<>();
         if (CollectionUtils.isNotEmpty(nextList)) {
             List<String> nextListIds = nextList.stream().map(item -> JSONObject.parseObject(item).getString("id")).collect(Collectors.toList());
             List<PublishSingleVideoSource> auditQueueList = videoSourceRepository.getByContentTraceIdIn(new ArrayList<>(nextListIds));
             nextListPoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
+            excludeContentIds.addAll(nextListIds);
         }
         Set<String> auditQueueIds = redisTemplate.opsForZSet().rangeByScore(auditQueueRedisKey, 0, 100);
         Map<String, List<PublishSingleVideoSource>> auditQueuePoolCountMap = new HashMap<>();
         if (CollectionUtils.isNotEmpty(auditQueueIds)) {
             List<PublishSingleVideoSource> auditQueueList = videoSourceRepository.getByContentTraceIdIn(new ArrayList<>(auditQueueIds));
             auditQueuePoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
+            excludeContentIds.addAll(auditQueueIds);
         }
         // 每日配置发送量不足添加
         for (Map.Entry<String, Integer> entry : dailyAuditPoolCount.entrySet()) {
@@ -299,12 +298,13 @@ public class VideoPoolAuditService {
                 List<PublishSingleVideoSource> nextListPool = nextListPoolCountMap.getOrDefault(poolEnum.getContentPool(), new ArrayList<>());
                 int needCount = entry.getValue() - (totalCount + auditQueueList.size() + nextListPool.size());
                 if (needCount > 0) {
-                    List<PublishSingleVideoSource> addList = videoPoolAuditMapper.articleVideoAuditList(null,
-                            Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, null,
-                            Arrays.asList(poolEnum.getValue()), null, 0, needCount, poolLevelDesc);
+                    List<PublishSingleVideoSource> addList = videoPoolAuditMapper.articleVideoWatingAuditList(
+                            Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()),
+                            Arrays.asList(poolEnum.getValue()), excludeContentIds, needCount);
                     if (CollectionUtils.isNotEmpty(addList)) {
                         for (PublishSingleVideoSource item : addList) {
                             redisTemplate.opsForZSet().add(auditQueueRedisKey, item.getContentTraceId(), poolEnum.getWeight());
+                            excludeContentIds.add(item.getContentTraceId());
                         }
                     }
                 }
@@ -313,9 +313,8 @@ public class VideoPoolAuditService {
         // 待发布内容不足添加
         Long auditQueueSize = redisTemplate.opsForZSet().size(auditQueueRedisKey);
         if (Objects.isNull(auditQueueSize) || auditQueueSize < 20) {
-            List<PublishSingleVideoSource> list = videoPoolAuditMapper.articleVideoAuditList(null,
-                    Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, null, null
-                    , null, 0, 40, poolLevelDesc);
+            List<PublishSingleVideoSource> list = videoPoolAuditMapper.articleVideoWatingAuditList(
+                    Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, excludeContentIds, 40);
             if (CollectionUtils.isNotEmpty(list)) {
                 for (PublishSingleVideoSource item : list) {
                     ContentPoolEnum poolEnum = ContentPoolEnum.from(item.getFlowPoolLevel());

+ 30 - 0
long-article-recommend-service/src/main/resources/mapper/longArticle/ArticleAuditMapper.xml

@@ -243,6 +243,36 @@
         limit 1
     </select>
 
+    <select id="articleVideoWatingAuditList"
+            resultType="com.tzld.longarticle.recommend.server.model.vo.ArticleVideoAuditListVO">
+        select lata.content_id, lata.status, lat.article_title as title, lat.kimi_title,
+        lata.audit_account, lata.audit_timestamp, lata.flow_pool_level
+        from long_articles_title_audit lata
+        left join long_articles_text lat on lata.content_id = lat.content_id
+        <where>
+            <if test="status!= null and status.size() > 0">
+                and lata.status in
+                <foreach collection="status" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="flowPoolLevels!= null and flowPoolLevels.size() > 0">
+                and lata.flow_pool_level in
+                <foreach collection="flowPoolLevels" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="excludeContentIds!= null and excludeContentIds.size() > 0">
+                and lata.content_id not in
+                <foreach collection="excludeContentIds" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        order by lata.content_id desc
+        limit #{size}
+    </select>
+
     <update id="updateArticleTitle">
         update long_articles_text
         set old_article_title = article_title,

+ 30 - 3
long-article-recommend-service/src/main/resources/mapper/longArticle/VideoPoolAuditMapper.xml

@@ -111,13 +111,13 @@
         </if>
         <choose>
             <when test="poolLevelDesc != null and poolLevelDesc != ''">
-                order by flow_pool_level ${poolLevelDesc}, content_trace_id desc
+                order by flow_pool_level ${poolLevelDesc}, crawler_timestamp desc
             </when>
             <when test="auditTimestamp != null and auditTimestamp.orderType != null and auditTimestamp.orderType != ''">
                 order by video_pool_audit_timestamp ${auditTimestamp.orderType}
             </when>
             <otherwise>
-                order by content_trace_id desc
+                order by crawler_timestamp desc
             </otherwise>
         </choose>
         limit #{offset}, #{pageSize}
@@ -161,7 +161,7 @@
         <if test="flowPoolLevel != null">
             and flow_pool_level = #{flowPoolLevel}
         </if>
-        order by content_trace_id desc
+        order by crawler_timestamp desc
         limit 1
     </select>
 
@@ -203,6 +203,33 @@
         </choose>
     </select>
 
+    <select id="articleVideoWatingAuditList"
+            resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
+        select *
+        from publish_single_video_source
+        where bad_status in (0, 5) and audit_status = 1
+        <if test="status!= null and status.size() > 0">
+            and `video_pool_audit_status` in
+            <foreach collection="status" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="flowPoolLevels!= null and flowPoolLevels.size() > 0">
+            and flow_pool_level in
+            <foreach collection="flowPoolLevels" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="excludeContentIds!= null and excludeContentIds.size() > 0">
+            and content_trace_id not in
+            <foreach collection="excludeContentIds" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        order by crawler_timestamp desc
+        limit #{size}
+    </select>
+
     <update id="updateArticleTitle">
         update publish_single_video_source
         set old_article_title = article_title,