Pārlūkot izejas kodu

视频内容池文章晋级

wangyunpeng 6 mēneši atpakaļ
vecāks
revīzija
97c3c7f575

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

@@ -68,6 +68,9 @@ public class PublishSingleVideoSource {
     @Column(name = "up_level_timestamp")
     private Long upLevelTimestamp;
 
+    @Column(name = "up_level_source")
+    private String upLevelSource;
+
     @Column(name = "exit_timestamp")
     private Long exitTimestamp;
 

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

@@ -11,4 +11,6 @@ public interface PublishSingleVideoSourceRepository extends JpaRepository<Publis
     List<PublishSingleVideoSource> getByContentTraceIdIn(List<String> contentTraceIds);
 
     PublishSingleVideoSource getByContentTraceId(String sourceId);
+
+    PublishSingleVideoSource getByUpLevelSource(String sourceId);
 }

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

@@ -411,7 +411,11 @@ public class ArticlePromotionService {
                 continue;
             }
             PublishSingleVideoSource singleVideoSource = publishSingleVideoSourceRepository.getByContentTraceId(sourceId);
-            if (singleVideoSource == null) {
+            if (Objects.isNull(singleVideoSource)) {
+                continue;
+            }
+            PublishSingleVideoSource exists = publishSingleVideoSourceRepository.getByUpLevelSource(sourceId);
+            if (Objects.nonNull(exists)) {
                 continue;
             }
             PublishSingleVideoSource upLevel = new PublishSingleVideoSource();
@@ -420,6 +424,7 @@ public class ArticlePromotionService {
             singleVideoSource.setUpLevelTimestamp(System.currentTimeMillis() / 1000);
             publishSingleVideoSourceRepository.save(singleVideoSource);
             upLevel.setId(null);
+            upLevel.setUpLevelSource(singleVideoSource.getContentTraceId());
             upLevel.setContentTraceId("video" + UUID.randomUUID().toString().replace("-", ""));
             upLevel.setFlowPoolLevel(poolLevel);
             publishSingleVideoSourceRepository.save(upLevel);