Prechádzať zdrojové kódy

视频审核增加内容池

wangyunpeng 5 mesiacov pred
rodič
commit
d409916844

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

@@ -24,4 +24,6 @@ public interface ArticleAuditMapper {
     void updateArticleTitle(ArticleTitleUpdateParam param, Long updateTime);
 
     void updateVideoTitle(VideoTitleUpdateParam param, Long updateTime);
+
+    void updateTitleAuditFlowPoolLevel();
 }

+ 3 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/LongArticleTitleAudit.java

@@ -23,6 +23,9 @@ public class LongArticleTitleAudit {
     @Column(name = "status")
     private Integer status;
 
+    @Column(name = "flow_pool_level")
+    private String flowPoolLevel;
+
     @Column(name = "create_timestamp")
     private Long createTimestamp;
 

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/ArticleVideoAuditListVO.java

@@ -10,6 +10,7 @@ public class ArticleVideoAuditListVO {
     private String contentId;
     private String title;
     private String kimiTitle;
+    private String flowPoolLevel;
     private Integer videoCount;
     private Integer waitingAuditVideoCount;
     private Integer status;

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

@@ -20,4 +20,6 @@ public interface LongArticleTitleAuditRepository extends JpaRepository<LongArtic
     List<LongArticleTitleAudit> getByContentIdIn(List<String> sourceIds);
 
     List<LongArticleTitleAudit> getByAuditTimestampBetween(Long start, Long end);
+
+    List<LongArticleTitleAudit> getByFlowPoolLevelIsNull();
 }

+ 12 - 1
long-article-recommend-service/src/main/resources/mapper/longArticle/ArticleAuditMapper.xml

@@ -38,7 +38,8 @@
             resultType="com.tzld.longarticle.recommend.server.model.vo.ArticleVideoAuditListVO">
         select long_articles_title_audit.content_id, long_articles_title_audit.status,
         long_articles_text.article_title as title, long_articles_text.kimi_title,
-        long_articles_title_audit.audit_account, long_articles_title_audit.audit_timestamp
+        long_articles_title_audit.audit_account, long_articles_title_audit.audit_timestamp,
+        long_articles_title_audit.flow_pool_level
         from long_articles_title_audit
         left join long_articles_text on long_articles_title_audit.content_id = long_articles_text.content_id
         <where>
@@ -137,4 +138,14 @@
         where content_id = #{param.contentId}
     </update>
 
+    <update id="updateTitleAuditFlowPoolLevel">
+        update long_articles_title_audit lat
+        join ( SELECT DISTINCT lamv.content_id, lamv.flow_pool_level
+               FROM long_articles_match_videos lamv
+                        JOIN long_articles_title_audit lata ON lamv.content_id = lata.content_id
+               where lamv.flow_pool_level is not null) lamv ON lat.content_id = lamv.content_id
+        set lat.flow_pool_level = lamv.flow_pool_level
+        where lat.flow_pool_level is null
+    </update>
+
 </mapper>

+ 54 - 0
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/ArticleVideoAuditTest.java

@@ -0,0 +1,54 @@
+package com.tzld.longarticle.recommend.server;
+
+import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleAuditMapper;
+import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlan;
+import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticleTitleAudit;
+import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanExeRecordRepository;
+import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanRepository;
+import com.tzld.longarticle.recommend.server.repository.longArticle.LongArticleTitleAuditRepository;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@SpringBootTest(classes = Application.class)
+@Slf4j
+public class ArticleVideoAuditTest {
+
+    @Resource
+    private ArticleAuditMapper articleAuditMapper;
+    @Resource
+    private LongArticleTitleAuditRepository titleAuditRepository;
+    @Resource
+    private ProducePlanExeRecordRepository exeRecordRepository;
+    @Resource
+    private ProducePlanRepository producePlanRepository;
+
+    @Test
+    public void updateTitleAuditFlowPoolLevel() {
+        List<LongArticleTitleAudit> list = titleAuditRepository.getByFlowPoolLevelIsNull();
+        List<String> contentIds = list.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
+        List<ProducePlanExeRecord> contentList = exeRecordRepository.findByPlanExeIdIn(contentIds);
+        Map<String, String> contentPlanMap = contentList.stream().collect(Collectors.toMap(ProducePlanExeRecord::getPlanExeId, ProducePlanExeRecord::getPlanId));
+        List<String> planIds = contentList.stream().map(ProducePlanExeRecord::getPlanId).collect(Collectors.toList());
+        List<ProducePlan> planList = producePlanRepository.findByIdIn(planIds);
+        Map<String, String> planMap = planList.stream().collect(Collectors.toMap(ProducePlan::getId, ProducePlan::getPlanTag));
+        for (LongArticleTitleAudit titleAudit : list) {
+            String contentId = titleAudit.getContentId();
+            String planId = contentPlanMap.get(contentId);
+            String tag = planMap.get(planId);
+            if (!StringUtils.hasText(tag)) {
+                continue;
+            }
+            titleAudit.setFlowPoolLevel(tag);
+            titleAuditRepository.save(titleAudit);
+        }
+        articleAuditMapper.updateTitleAuditFlowPoolLevel();
+    }
+}