ソースを参照

视频内容池简介获取

wangyunpeng 1 ヶ月 前
コミット
ba58e3ae73
13 ファイル変更205 行追加8 行削除
  1. 30 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/longArticle/PublishSingleVideoSourceStatusEnum.java
  2. 34 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/IllegalArticles.java
  3. 3 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/PublishSingleVideoSource.java
  4. 81 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/VideoContentUnderstanding.java
  5. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/ArticleVideoPoolSourceVO.java
  6. 10 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/IllegalArticlesRepository.java
  7. 13 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/VideoContentUnderstandingRepository.java
  8. 12 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/ArticleVideoPoolService.java
  9. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticlePromotionService.java
  10. 11 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/VideoPoolAuditService.java
  11. 1 0
      long-article-recommend-service/src/main/resources/mapper/longArticle/ArticleCategoryMapper.xml
  12. 2 2
      long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml
  13. 5 5
      long-article-recommend-service/src/main/resources/mapper/longArticle/VideoPoolAuditMapper.xml

+ 30 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/longArticle/PublishSingleVideoSourceStatusEnum.java

@@ -0,0 +1,30 @@
+package com.tzld.longarticle.recommend.server.common.enums.longArticle;
+
+import lombok.Getter;
+
+@Getter
+public enum PublishSingleVideoSourceStatusEnum {
+
+    DEFAULT(0, "初始"),
+    PROCESSING(1, "处理中"),
+    SUCCESS(2, "处理完成"),
+    FAIL(3, "处理失败"),
+    ;
+
+    private final int code;
+    private final String msg;
+
+    PublishSingleVideoSourceStatusEnum(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public static PublishSingleVideoSourceStatusEnum getByCode(int code) {
+        for (PublishSingleVideoSourceStatusEnum statusEnum : PublishSingleVideoSourceStatusEnum.values()) {
+            if (statusEnum.getCode() == code) {
+                return statusEnum;
+            }
+        }
+        return null;
+    }
+}

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

@@ -0,0 +1,34 @@
+package com.tzld.longarticle.recommend.server.model.entity.longArticle;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@Table(name = "illegal_articles")
+public class IllegalArticles {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private Long id;
+    @Column(name = "gh_id")
+    private String ghId;
+    @Column(name = "account_name")
+    private String accountName;
+    @Column(name = "title")
+    private String title;
+    @Column(name = "wx_sn")
+    private String wxSn;
+    @Column(name = "publish_date")
+    private Date publishDate;
+    @Column(name = "illegal_reason")
+    private String illegalReason;
+    @Column(name = "root_source_id_list")
+    private String rootSourceIdList;
+}

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

@@ -65,6 +65,9 @@ public class PublishSingleVideoSource {
     @Column(name = "bad_status")
     private Integer badStatus;
 
+    @Column(name = "status")
+    private Integer status;
+
     @Column(name = "publish_timestamp")
     private Long publishTimestamp;
 

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

@@ -0,0 +1,81 @@
+package com.tzld.longarticle.recommend.server.model.entity.longArticle;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@Table(name = "video_content_understanding")
+public class VideoContentUnderstanding {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    @Column(name = "pq_audit_vid")
+    private Long pqAuditVid;
+
+    @Column(name = "content_trace_id")
+    private String contentTraceId;
+
+    @Column(name = "flow_pool_level")
+    private Integer flowPoolLevel;
+
+    @Column(name = "video_ori_title")
+    private String videoOriTitle;
+
+    @Column(name = "video_oss_path")
+    private String videoOssPath;
+
+    @Column(name = "upload_status")
+    private Integer uploadStatus;
+
+    @Column(name = "upload_status_ts")
+    private Date uploadStatusTs;
+
+    @Column(name = "file_name")
+    private String fileName;
+
+    @Column(name = "file_state")
+    private String fileState;
+
+    @Column(name = "file_expire_time")
+    private Date fileExpireTime;
+
+    @Column(name = "understanding_status")
+    private Integer understandingStatus;
+
+    @Column(name = "understanding_status_ts")
+    private Date understandingStatusTs;
+
+    @Column(name = "video_text")
+    private String videoText;
+
+    @Column(name = "summary_status")
+    private Integer summaryStatus;
+
+    @Column(name = "summary_status_ts")
+    private Date summaryStatusTs;
+
+    @Column(name = "summary_text")
+    private String summaryText;
+
+    @Column(name = "rewrite_status")
+    private Integer rewriteStatus;
+
+    @Column(name = "rewrite_status_ts")
+    private Date rewriteStatusTs;
+
+    @Column(name = "article_text")
+    private String articleText;
+
+    @Column(name = "create_time")
+    private Date createTime;
+
+}

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

@@ -13,6 +13,7 @@ public class ArticleVideoPoolSourceVO {
     private String sourceId;
     private String title;
     private String coverUrl;
+    private String synopsis;
 
     public static List<ArticleVideoPoolSourceVO> convertFromPublishSingleVideoSource(List<PublishSingleVideoSource> list) {
         return list.stream().map(publishSingleVideoSource -> {

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

@@ -0,0 +1,10 @@
+package com.tzld.longarticle.recommend.server.repository.longArticle;
+
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.IllegalArticles;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface IllegalArticlesRepository extends JpaRepository<IllegalArticles, Long> {
+
+}

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

@@ -0,0 +1,13 @@
+package com.tzld.longarticle.recommend.server.repository.longArticle;
+
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoContentUnderstanding;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface VideoContentUnderstandingRepository extends JpaRepository<VideoContentUnderstanding, Long> {
+
+    List<VideoContentUnderstanding> getByContentTraceIdInAndSummaryStatus(List<String> contentTraceIdList, Integer summaryStatus);
+}

+ 12 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/ArticleVideoPoolService.java

@@ -1,11 +1,14 @@
 package com.tzld.longarticle.recommend.server.service;
 
+import com.tzld.longarticle.recommend.server.common.enums.longArticle.PublishSingleVideoSourceStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.VideoTitleReWriteEnum;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoContentUnderstanding;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoTitleReWrite;
 import com.tzld.longarticle.recommend.server.model.param.ArticleVideoPoolSourceParam;
 import com.tzld.longarticle.recommend.server.model.vo.ArticleVideoPoolSourceVO;
+import com.tzld.longarticle.recommend.server.repository.longArticle.VideoContentUnderstandingRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.VideoTitleReWriteRepository;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +25,8 @@ public class ArticleVideoPoolService {
     private LongArticleBaseMapper longArticleBaseMapper;
     @Autowired
     private VideoTitleReWriteRepository videoTitleReWriteRepository;
+    @Autowired
+    private VideoContentUnderstandingRepository synopsisRepository;
 
     public List<ArticleVideoPoolSourceVO> getSource(ArticleVideoPoolSourceParam param) {
         List<PublishSingleVideoSource> list = longArticleBaseMapper.getPublishSingleVideoSource(param);
@@ -31,16 +36,23 @@ public class ArticleVideoPoolService {
     private List<ArticleVideoPoolSourceVO> buildArticleVideoPoolSourceVOList(List<PublishSingleVideoSource> list) {
         List<ArticleVideoPoolSourceVO> result = ArticleVideoPoolSourceVO.convertFromPublishSingleVideoSource(list);
         List<String> contentTraceIdList = result.stream().map(ArticleVideoPoolSourceVO::getSourceId).collect(Collectors.toList());
+        // 获取改写后标题
         List<VideoTitleReWrite> videoTitleReWriteList = videoTitleReWriteRepository.getByContentTraceIdInAndStatus(
                 contentTraceIdList, VideoTitleReWriteEnum.AVAILABLE.getCode());
         Map<String, List<VideoTitleReWrite>> videoTitleReWriteMap = videoTitleReWriteList.stream()
                 .sorted((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime()))
                 .collect(Collectors.groupingBy(VideoTitleReWrite::getContentTraceId));
+        // 获取简介
+        List<VideoContentUnderstanding> synopsisList = synopsisRepository.getByContentTraceIdInAndSummaryStatus(contentTraceIdList,
+                PublishSingleVideoSourceStatusEnum.SUCCESS.getCode());
+        Map<String, String> synopsisMap = synopsisList.stream()
+                .collect(Collectors.toMap(VideoContentUnderstanding::getContentTraceId, VideoContentUnderstanding::getSummaryText));
         for (ArticleVideoPoolSourceVO vo : result) {
             List<VideoTitleReWrite> reWriteList = videoTitleReWriteMap.get(vo.getSourceId());
             if (CollectionUtils.isNotEmpty(reWriteList)) {
                 vo.setTitle(reWriteList.get(reWriteList.size() - 1).getNewTitle());
             }
+            vo.setSynopsis(synopsisMap.get(vo.getSourceId()));
         }
         return result;
     }

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

@@ -6,6 +6,7 @@ import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.CrawlerModeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.ProducePlanInputSourceTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum;
+import com.tzld.longarticle.recommend.server.common.enums.longArticle.PublishSingleVideoSourceStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticlePoolPromotionSourceStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotIdEnum;
@@ -447,6 +448,7 @@ public class ArticlePromotionService {
             upLevel.setUpLevelSource(singleVideoSource.getContentTraceId());
             upLevel.setContentTraceId("video" + UUID.randomUUID().toString().replace("-", ""));
             upLevel.setFlowPoolLevel(poolLevel);
+            upLevel.setStatus(PublishSingleVideoSourceStatusEnum.DEFAULT.getCode());
             upLevel = publishSingleVideoSourceRepository.save(upLevel);
 
             List<VideoTitleReWrite> videoTitleReWrites = videoTitleReWriteRepository.getByContentTraceId(singleVideoSource.getContentTraceId());

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

@@ -5,16 +5,19 @@ import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 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.common.enums.longArticle.ArticleVideoBadStatusEnum;
+import com.tzld.longarticle.recommend.server.common.enums.longArticle.PublishSingleVideoSourceStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.VideoTitleReWriteEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
 import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.VideoPoolAuditMapper;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoContentUnderstanding;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoTitleReWrite;
 import com.tzld.longarticle.recommend.server.model.param.videoAudit.*;
 import com.tzld.longarticle.recommend.server.model.vo.VideoPoolAuditDataVO;
 import com.tzld.longarticle.recommend.server.model.vo.VideoPoolAuditListVO;
 import com.tzld.longarticle.recommend.server.repository.longArticle.PublishSingleVideoSourceRepository;
+import com.tzld.longarticle.recommend.server.repository.longArticle.VideoContentUnderstandingRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.VideoTitleReWriteRepository;
 import com.tzld.longarticle.recommend.server.util.DateUtils;
 import com.tzld.longarticle.recommend.server.util.RedisUtil;
@@ -47,6 +50,8 @@ public class VideoPoolAuditService {
     private RedisUtil redisUtil;
     @Autowired
     private VideoTitleReWriteRepository videoTitleReWriteRepository;
+    @Autowired
+    private VideoContentUnderstandingRepository synopsisRepository;
 
     @Autowired
     private RedisTemplate<String, String> redisTemplate;
@@ -90,12 +95,17 @@ public class VideoPoolAuditService {
         Map<String, List<VideoTitleReWrite>> videoTitleReWriteMap = videoTitleReWriteList.stream()
                 .sorted((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime()))
                 .collect(Collectors.groupingBy(VideoTitleReWrite::getContentTraceId));
+        // 获取简介
+        List<VideoContentUnderstanding> synopsisList = synopsisRepository.getByContentTraceIdInAndSummaryStatus(contentTraceIdList,
+                PublishSingleVideoSourceStatusEnum.SUCCESS.getCode());
+        Map<String, String> synopsisMap = synopsisList.stream()
+                .collect(Collectors.toMap(VideoContentUnderstanding::getContentTraceId, VideoContentUnderstanding::getSummaryText));
         for (PublishSingleVideoSource item : list) {
             VideoPoolAuditListVO vo = new VideoPoolAuditListVO();
             vo.setContentId(item.getContentTraceId());
             vo.setTitle(item.getArticleTitle());
             vo.setStatus(item.getVideoPoolAuditStatus());
-//            vo.setSynopsis(item.getSummaryText());
+            vo.setSynopsis(synopsisMap.get(item.getContentTraceId()));
             vo.setFlowPoolLevel(ContentPoolEnum.from(item.getFlowPoolLevel()).getDescription());
             vo.setCrawlerTimestamp(item.getCrawlerTimestamp() * 1000);
             vo.setAuditAccount(item.getVideoPoolAuditAccount());

+ 1 - 0
long-article-recommend-service/src/main/resources/mapper/longArticle/ArticleCategoryMapper.xml

@@ -56,6 +56,7 @@
         from publish_single_video_source
         where bad_status = 0
           and audit_status = 1
+          and status = 2
           and content_trace_id not in (select produce_content_id
                                        from article_category where version = #{version})
     </select>

+ 2 - 2
long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml

@@ -234,7 +234,7 @@
             resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
         select content_trace_id, article_title, cover_url, flow_pool_level
         from publish_single_video_source
-        where bad_status = 0 and audit_status = 1
+        where bad_status = 0 and audit_status = 1 and status = 2
         <if test="flowPoolLevel!= null ">
             and flow_pool_level = #{flowPoolLevel}
         </if>
@@ -331,7 +331,7 @@
                          and read_rate > 1
                          and view_count > 10000
                          and position in (1, 2)
-                         and title not in (select title from article_unsafe_title)
+                         and title not in (select title from article_unsafe_title where status = 1)
                          and first_level is not null
                          and strategy is not null
                        GROUP BY title) top on dss.title = top.title and dss.read_rate = top.read_rate

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

@@ -5,7 +5,7 @@
     <select id="articleVideoAuditListCount" resultType="java.lang.Integer">
         select count(content_trace_id)
         from publish_single_video_source
-        where bad_status in (0, 5) and audit_status = 1
+        where bad_status in (0, 5) and audit_status = 1 and status = 2
         <if test="status!= null and status.size() > 0">
             and video_pool_audit_status in
             <foreach collection="status" item="item" separator="," open="(" close=")">
@@ -60,7 +60,7 @@
             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
+        where bad_status in (0, 5) and audit_status = 1 and status = 2
         <if test="status!= null and status.size() > 0">
             and `video_pool_audit_status` in
             <foreach collection="status" item="item" separator="," open="(" close=")">
@@ -127,7 +127,7 @@
             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
+        where bad_status in (0, 5) and audit_status = 1 and status = 2
         <if test="status!= null and status.size() > 0">
             and `video_pool_audit_status` in
             <foreach collection="status" item="item" separator="," open="(" close=")">
@@ -207,7 +207,7 @@
             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
+        where bad_status in (0, 5) and audit_status = 1 and status = 2
         <if test="status!= null and status.size() > 0">
             and `video_pool_audit_status` in
             <foreach collection="status" item="item" separator="," open="(" close=")">
@@ -259,7 +259,7 @@
     <select id="articleVideoWaitingAuditCount" resultType="java.lang.Integer">
         select count(1)
         from publish_single_video_source
-        where bad_status = 0 and audit_status = 1 and video_pool_audit_status = 0
+        where bad_status = 0 and audit_status = 1 and status = 2 and video_pool_audit_status = 0
     </select>
 
 </mapper>