|
@@ -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();
|
|
|
+ }
|
|
|
+}
|