소스 검색

Merge branch 'wyp/1205-articleVideoPool' of Server/long-article-recommend into master

wangyunpeng 7 달 전
부모
커밋
a25dc29d4f

+ 8 - 6
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/LongArticleBaseMapper.java

@@ -1,11 +1,11 @@
 package com.tzld.longarticle.recommend.server.mapper.longArticle;
 
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesRootSourceId;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.ArticleCategory;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatScore;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.ArticlePoolPromotionSource;
-import com.tzld.longarticle.recommend.server.model.dto.*;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy;
+import com.tzld.longarticle.recommend.server.model.dto.GetOffVideos;
+import com.tzld.longarticle.recommend.server.model.dto.LongArticlesCrawlerVideos;
+import com.tzld.longarticle.recommend.server.model.dto.LongArticlesMatchVideos;
+import com.tzld.longarticle.recommend.server.model.dto.LongArticlesText;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.*;
+import com.tzld.longarticle.recommend.server.model.param.ArticleVideoPoolSourceParam;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -61,4 +61,6 @@ public interface LongArticleBaseMapper {
     void updateLongArticleMatchVideosResponse(LongArticlesMatchVideos longArticlesMatchVideos);
 
     int countNeedMatchVideos(Long id);
+
+    List<PublishSingleVideoSource> getPublishSingleVideoSource(ArticleVideoPoolSourceParam param);
 }

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

@@ -0,0 +1,79 @@
+package com.tzld.longarticle.recommend.server.model.entity.longArticle;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.*;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@Table(name = "publish_single_video_source")
+public class PublishSingleVideoSource {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    @Column(name = "content_trace_id")
+    private String contentTraceId;
+
+    @Column(name = "article_title")
+    private String articleTitle;
+
+    @Column(name = "out_account_id")
+    private String outAccountId;
+
+    @Column(name = "out_account_name")
+    private String outAccountName;
+
+    @Column(name = "read_cnt")
+    private Integer readCount;
+
+    @Column(name = "like_cnt")
+    private Integer likeCount;
+
+    @Column(name = "article_index")
+    private Byte articleIndex;
+
+    @Column(name = "article_publish_type")
+    private String articlePublishType;
+
+    @Column(name = "article_url")
+    private String articleUrl;
+
+    @Column(name = "cover_url")
+    private String coverUrl;
+
+    @Column(name = "video_oss_path")
+    private String videoOssPath;
+
+    @Column(name = "flow_pool_level")
+    private Integer flowPoolLevel;
+
+    @Column(name = "bad_status")
+    private Byte badStatus;
+
+    @Column(name = "publish_timestamp")
+    private Long publishTimestamp;
+
+    @Column(name = "crawler_timestamp")
+    private Long crawlerTimestamp;
+
+    @Column(name = "url_unique_md5")
+    private String urlUniqueMd5;
+
+    @Column(name = "up_level_timestamp")
+    private Long upLevelTimestamp;
+
+    @Column(name = "exit_timestamp")
+    private Long exitTimestamp;
+
+    @Column(name = "source_account")
+    private Integer sourceAccount;
+
+    @Column(name = "audit_status")
+    private Integer auditStatus;
+}

+ 8 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/ArticleVideoPoolSourceParam.java

@@ -0,0 +1,8 @@
+package com.tzld.longarticle.recommend.server.model.param;
+
+import lombok.Data;
+
+@Data
+public class ArticleVideoPoolSourceParam {
+    private Integer flowPoolLevel;
+}

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

@@ -0,0 +1,26 @@
+package com.tzld.longarticle.recommend.server.model.vo;
+
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource;
+import lombok.Data;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Data
+public class ArticleVideoPoolSourceVO {
+    private Integer poolId;
+    private Integer flowPoolLevel;
+    private String sourceId;
+    private String title;
+
+    public static List<ArticleVideoPoolSourceVO> convertFromPublishSingleVideoSource(List<PublishSingleVideoSource> list) {
+        return list.stream().map(publishSingleVideoSource -> {
+            ArticleVideoPoolSourceVO articleVideoPoolSourceVO = new ArticleVideoPoolSourceVO();
+            articleVideoPoolSourceVO.setPoolId(publishSingleVideoSource.getFlowPoolLevel());
+            articleVideoPoolSourceVO.setFlowPoolLevel(publishSingleVideoSource.getFlowPoolLevel());
+            articleVideoPoolSourceVO.setSourceId(publishSingleVideoSource.getContentTraceId());
+            articleVideoPoolSourceVO.setTitle(publishSingleVideoSource.getArticleTitle());
+            return articleVideoPoolSourceVO;
+        }).collect(Collectors.toList());
+    }
+}

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

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

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

@@ -0,0 +1,22 @@
+package com.tzld.longarticle.recommend.server.service;
+
+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.param.ArticleVideoPoolSourceParam;
+import com.tzld.longarticle.recommend.server.model.vo.ArticleVideoPoolSourceVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ArticleVideoPoolService {
+
+    @Autowired
+    private LongArticleBaseMapper longArticleBaseMapper;
+
+    public List<ArticleVideoPoolSourceVO> getSource(ArticleVideoPoolSourceParam param) {
+        List<PublishSingleVideoSource> list = longArticleBaseMapper.getPublishSingleVideoSource(param);
+        return ArticleVideoPoolSourceVO.convertFromPublishSingleVideoSource(list);
+    }
+}

+ 28 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/recommend/ArticleVideoPoolController.java

@@ -0,0 +1,28 @@
+package com.tzld.longarticle.recommend.server.web.recommend;
+
+import com.tzld.longarticle.recommend.server.common.response.CommonResponse;
+import com.tzld.longarticle.recommend.server.model.param.ArticleVideoPoolSourceParam;
+import com.tzld.longarticle.recommend.server.model.vo.ArticleVideoPoolSourceVO;
+import com.tzld.longarticle.recommend.server.service.ArticleVideoPoolService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/videoPool")
+@Slf4j
+public class ArticleVideoPoolController {
+
+    @Autowired
+    private ArticleVideoPoolService service;
+    @PostMapping("/getSource")
+    public CommonResponse<List<ArticleVideoPoolSourceVO>> getSource(@RequestBody ArticleVideoPoolSourceParam param) {
+        return CommonResponse.success(service.getSource(param));
+    }
+
+}

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

@@ -1,4 +1,4 @@
-package com.tzld.longarticle.recommend.server.web;
+package com.tzld.longarticle.recommend.server.web.recommend;
 
 import com.tzld.longarticle.recommend.server.service.DataFlushService;
 import lombok.extern.slf4j.Slf4j;

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

@@ -229,4 +229,14 @@
         </foreach>
     </insert>
 
+    <select id="getPublishSingleVideoSource"
+            resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
+        select content_trace_id, article_title, flow_pool_level
+        from publish_single_video_source
+        where bad_status = 0 and audit_status = 1
+        <if test="flowPoolLevel!= null ">
+            and flow_pool_level = #{flowPoolLevel}
+        </if>
+    </select>
+
 </mapper>