Bladeren bron

Merge branch 'wyp/0416-highPriorityProducePlan' of Server/long-article-recommend into master

wangyunpeng 1 week geleden
bovenliggende
commit
01a299d43c

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

@@ -28,10 +28,11 @@ 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);
+    List<ArticleVideoAuditListVO> articleVideoWaitingAuditList(List<Integer> status,
+                                                               List<String> flowPoolLevels,
+                                                               List<String> excludeContentIds,
+                                                               List<String> producePlanIds,
+                                                               Integer size);
 
 
     void updateCrawlerVideoIsIllegal(List<Integer> illegalVideoIds, Integer isIllegal);

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

@@ -72,6 +72,9 @@ public class ArticleVideoAuditService {
     @ApolloJsonValue("${daily.article.audit.pool.count.config:{}}")
     private Map<String, Integer> dailyAuditPoolCount;
 
+    @ApolloJsonValue("${highPriorityProducePlan:[]}")
+    private List<String> highPriorityProducePlan;
+
     public Page<ArticleVideoAuditListVO> list(ArticleVideoAuditListParam param) {
         int offset = (param.getPageNum() - 1) * param.getPageSize();
         int count = articleAuditMapper.articleVideoAuditListCount(param.getContentId(), param.getStatus(),
@@ -475,6 +478,18 @@ public class ArticleVideoAuditService {
                 auditQueuePoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
                 excludeContentIds.addAll(auditQueueIds);
             }
+            // 高优先级计划内容添加
+            if (CollectionUtils.isNotEmpty(highPriorityProducePlan)) {
+                List<ArticleVideoAuditListVO> addList = articleAuditMapper.articleVideoWaitingAuditList(
+                        Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()),
+                        null, excludeContentIds, highPriorityProducePlan, 100);
+                if (CollectionUtils.isNotEmpty(addList)) {
+                    for (ArticleVideoAuditListVO item : addList) {
+                        redisTemplate.opsForZSet().add(auditQueueRedisKey, item.getContentId(), 101);
+                        excludeContentIds.add(item.getContentId());
+                    }
+                }
+            }
             // 每日配置发送量不足添加
             for (Map.Entry<String, Integer> entry : dailyAuditPoolCount.entrySet()) {
                 ContentPoolEnum poolEnum = ContentPoolEnum.from(entry.getKey());
@@ -485,9 +500,9 @@ public class ArticleVideoAuditService {
                     List<LongArticleTitleAudit> inAuditListPool = inAuditListPoolCountMap.getOrDefault(poolEnum.getContentPool(), new ArrayList<>());
                     int needCount = entry.getValue() - (totalCount + auditQueueList.size() + inAuditListPool.size());
                     if (needCount > 0) {
-                        List<ArticleVideoAuditListVO> addList = articleAuditMapper.articleVideoWatingAuditList(
+                        List<ArticleVideoAuditListVO> addList = articleAuditMapper.articleVideoWaitingAuditList(
                                 Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()),
-                                Arrays.asList(poolEnum.getContentPool()), excludeContentIds, needCount);
+                                Arrays.asList(poolEnum.getContentPool()), excludeContentIds, null, needCount);
                         if (CollectionUtils.isNotEmpty(addList)) {
                             for (ArticleVideoAuditListVO item : addList) {
                                 redisTemplate.opsForZSet().add(auditQueueRedisKey, item.getContentId(), poolEnum.getWeight());
@@ -500,8 +515,9 @@ public class ArticleVideoAuditService {
             // 待发布内容不足添加
             Long auditQueueSize = redisTemplate.opsForZSet().size(auditQueueRedisKey);
             if (Objects.isNull(auditQueueSize) || auditQueueSize < 20) {
-                List<ArticleVideoAuditListVO> list = articleAuditMapper.articleVideoWatingAuditList(
-                        Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, excludeContentIds, 40);
+                List<ArticleVideoAuditListVO> list = articleAuditMapper.articleVideoWaitingAuditList(
+                        Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null,
+                        excludeContentIds, null, 40);
                 if (CollectionUtils.isNotEmpty(list)) {
                     for (ArticleVideoAuditListVO item : list) {
                         ContentPoolEnum poolEnum = ContentPoolEnum.from(item.getFlowPoolLevel());

+ 13 - 9
long-article-recommend-service/src/main/resources/mapper/longArticle/ArticleAuditMapper.xml

@@ -243,33 +243,37 @@
         limit 1
     </select>
 
-    <select id="articleVideoWatingAuditList"
+    <select id="articleVideoWaitingAuditList"
             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
+        select content_id, status, audit_account, audit_timestamp, flow_pool_level
+        from long_articles_title_audit
         <where>
             <if test="status!= null and status.size() > 0">
-                and lata.status in
+                and 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
+                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 lata.content_id not in
+                and content_id not in
                 <foreach collection="excludeContentIds" item="item" separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
+            <if test="producePlanIds!= null and producePlanIds.size() > 0">
+                and produce_plan_id in
+                <foreach collection="producePlanIds" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
-        order by lata.content_id desc
+        order by content_id desc
         limit #{size}
     </select>