Selaa lähdekoodia

Merge branch 'wyp/0214-videoAuditFilter' of Server/long-article-recommend into master

wangyunpeng 4 kuukautta sitten
vanhempi
commit
57b91b96df

+ 3 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/aigc/AigcBaseMapper.java

@@ -6,6 +6,7 @@ import com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO;
 import com.tzld.longarticle.recommend.server.model.dto.ProducePlanAuditCheckDTO;
 import com.tzld.longarticle.recommend.server.model.dto.aigc.BadCrawlerAccountDTO;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.*;
+import com.tzld.longarticle.recommend.server.model.vo.IdNameVO;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -60,4 +61,6 @@ public interface AigcBaseMapper {
     void setCrawlerContentDisuseByAccountName(List<String> accountNames);
 
     List<ProduceContentDTO> getProduceContentById(List<String> planExeIds);
+
+    List<IdNameVO<String>> articleVideoAuditPlanFilterValue(List<String> planIds, String searchKeyword);
 }

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

@@ -11,10 +11,11 @@ import java.util.List;
 public interface ArticleAuditMapper {
 
     int articleVideoAuditListCount(List<String> contentId, List<Integer> status,
-                                   List<String> title, List<String> auditAccount);
+                                   List<String> title, List<String> auditAccount, List<String> producePlanIds);
 
     List<ArticleVideoAuditListVO> articleVideoAuditList(List<String> contentId, List<Integer> status,
                                                         List<String> title, List<String> auditAccount,
+                                                        List<String> producePlanIds,
                                                         int offset, Integer pageSize, String poolLevelDesc);
 
     void updateCrawlerVideoIsIllegal(List<Integer> illegalVideoIds, Integer isIllegal);

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

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

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/videoAudit/ArticleVideoAuditListParam.java

@@ -10,6 +10,7 @@ public class ArticleVideoAuditListParam {
     private List<String> title;
     private List<Integer> status;
     private List<String> auditAccount;
+    private List<String> sourceProducePlan;
 
     private Integer pageNum = 1;
     private Integer pageSize = 50;

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

@@ -13,6 +13,8 @@ public interface LongArticleTitleAuditRepository extends JpaRepository<LongArtic
 
     List<LongArticleTitleAudit> getByStatus(Integer status);
 
+    List<LongArticleTitleAudit> getByProducePlanIdIsNull();
+
     long countByAuditTimestampBetween(Long start, Long end);
 
     long countByStatusAndAuditTimestampBetween(Integer status, Long start, Long end);

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

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.recommend;
 import com.alibaba.fastjson.JSONArray;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishContentStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVideoAuditStatusEnum;
+import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
 import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleAuditMapper;
 import com.tzld.longarticle.recommend.server.model.dto.PublishContentMiniprogramDTO;
@@ -29,6 +30,8 @@ import java.util.stream.Collectors;
 @Slf4j
 public class ArticleVideoAuditService {
 
+    @Autowired
+    private AigcBaseMapper aigcBaseMapper;
     @Autowired
     private ArticleAuditMapper articleAuditMapper;
     @Autowired
@@ -57,9 +60,10 @@ public class ArticleVideoAuditService {
     public Page<ArticleVideoAuditListVO> list(ArticleVideoAuditListParam param) {
         int offset = (param.getPageNum() - 1) * param.getPageSize();
         int count = articleAuditMapper.articleVideoAuditListCount(param.getContentId(), param.getStatus(),
-                param.getTitle(), param.getAuditAccount());
+                param.getTitle(), param.getAuditAccount(), param.getSourceProducePlan());
         List<ArticleVideoAuditListVO> list = articleAuditMapper.articleVideoAuditList(param.getContentId(),
-                param.getStatus(), param.getTitle(), param.getAuditAccount(), offset, param.getPageSize(), poolLevelDesc);
+                param.getStatus(), param.getTitle(), param.getAuditAccount(), param.getSourceProducePlan()
+                , offset, param.getPageSize(), poolLevelDesc);
         buildArticleVideoAuditListVO(list);
         Page<ArticleVideoAuditListVO> page = new Page<>(param.getPageNum(), param.getPageSize());
         page.setTotalSize(count);
@@ -207,8 +211,18 @@ public class ArticleVideoAuditService {
         articleAuditService.buildArticleAuditDelete(publishContentIds, "视频审核不通过删除");
     }
 
-    public List<String> getFilterValue(AuditFilterParam param) {
-        return articleAuditMapper.searchFilterValueByItemName(param.getItemName(), param.getSearchKeyword());
+    public List<Object> getFilterValue(AuditFilterParam param) {
+        String itemName = param.getItemName();
+        if ("contentId".equals(itemName) || "title".equals(itemName) || "auditAccount".equals(itemName)) {
+            return articleAuditMapper.searchFilterValueByItemName(itemName, param.getSearchKeyword())
+                    .stream().collect(Collectors.toList());
+        } else if ("sourceProducePlan".equals(itemName)) {
+            List<String> planIds = articleAuditMapper.searchFilterValueByItemName(itemName, null);
+            return aigcBaseMapper.articleVideoAuditPlanFilterValue(planIds, param.getSearchKeyword())
+                    .stream().collect(Collectors.toList());
+        } else {
+            return new ArrayList<>();
+        }
     }
 
     @XxlJob("rematchVideoAudit")
@@ -264,6 +278,18 @@ public class ArticleVideoAuditService {
             audit.setAuditAccount(auditUser.get(per));
             titleAuditRepository.save(audit);
         }
+        // 内容生成计划id处理
+        List<LongArticleTitleAudit> list = titleAuditRepository.getByProducePlanIdIsNull();
+        List<String> ids = list.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
+        List<ProducePlanExeRecord> exeRecordList = producePlanExeRecordRepository.findByPlanExeIdIn(ids);
+        Map<String, String> map = exeRecordList.stream().collect(Collectors.toMap(ProducePlanExeRecord::getPlanExeId, ProducePlanExeRecord::getPlanId));
+        for (LongArticleTitleAudit titleAudit : list) {
+            String planId = map.get(titleAudit.getContentId());
+            if (StringUtils.hasText(planId)) {
+                titleAudit.setProducePlanId(planId);
+                titleAuditRepository.save(titleAudit);
+            }
+        }
         return ReturnT.SUCCESS;
     }
 }

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/recommend/ArticleVideoAuditController.java

@@ -37,7 +37,7 @@ public class ArticleVideoAuditController {
     }
 
     @PostMapping("/getFilterValue")
-    public CommonResponse<List<String>> getFilterValue(@RequestBody AuditFilterParam param) {
+    public CommonResponse<List<Object>> getFilterValue(@RequestBody AuditFilterParam param) {
         return CommonResponse.success(service.getFilterValue(param));
     }
 

+ 14 - 0
long-article-recommend-service/src/main/resources/mapper/aigc/AigcBaseMapper.xml

@@ -268,4 +268,18 @@
         </foreach>
     </select>
 
+    <select id="articleVideoAuditPlanFilterValue"
+            resultType="com.tzld.longarticle.recommend.server.model.vo.IdNameVO">
+        select id, name
+        from produce_plan
+        where id in
+        <foreach collection="planIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        <if test="searchKeyword != null and searchKeyword !=''">
+            and name like concat('%', #{searchKeyword}, '%')
+        </if>
+        limit 100
+    </select>
+
 </mapper>

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

@@ -31,6 +31,12 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="producePlanIds!= null and producePlanIds.size() > 0">
+                and lata.produce_plan_id in
+                <foreach collection="producePlanIds" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 
@@ -65,6 +71,12 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="producePlanIds!= null and producePlanIds.size() > 0">
+                and lata.produce_plan_id in
+                <foreach collection="producePlanIds" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         <choose>
             <when test="poolLevelDesc != null and poolLevelDesc != ''">
@@ -122,6 +134,10 @@
                 order by long_articles_title_audit.create_timestamp desc
                 limit 100
             </when>
+            <when test="itemName == 'sourceProducePlan'">
+                select distinct produce_plan_id
+                from long_articles_title_audit
+            </when>
         </choose>
     </select>