ソースを参照

Merge branch 'wyp/0225-videoPoolDetailExport' of Server/long-article-recommend into master

wangyunpeng 4 ヶ月 前
コミット
4a65a1f2cd

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

@@ -0,0 +1,30 @@
+package com.tzld.longarticle.recommend.server.common.enums.longArticle;
+
+import lombok.Getter;
+
+import java.util.Objects;
+
+@Getter
+public enum VideoPoolPlatformEnum {
+
+    GZH("gzh", "公众号"),
+    HkSP("hksp", "好看视频"),
+    ;
+
+    private final String platform;
+    private final String description;
+
+    VideoPoolPlatformEnum(String platform, String description) {
+        this.platform = platform;
+        this.description = description;
+    }
+
+    public static VideoPoolPlatformEnum from(String platform) {
+        for (VideoPoolPlatformEnum platformEnum : VideoPoolPlatformEnum.values()) {
+            if (Objects.equals(platformEnum.getPlatform(), platform)) {
+                return platformEnum;
+            }
+        }
+        return null;
+    }
+}

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

@@ -115,4 +115,7 @@ public class PublishSingleVideoSource {
 
     @Column(name = "video_pool_audit_timestamp")
     private Long videoPoolAuditTimestamp;
+
+    @Column(name = "platform")
+    private String platform;
 }

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

@@ -8,7 +8,9 @@ import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.google.common.collect.Lists;
 import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.ProduceContentAuditStatusEnum;
+import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVideoAuditStatusEnum;
+import com.tzld.longarticle.recommend.server.common.enums.longArticle.VideoPoolPlatformEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.AccountBusinessTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
@@ -269,6 +271,13 @@ public class DataDashboardService {
             planExeRecordList.addAll(producePlanExeRecordRepository.findByPlanExeIdIn(partitions));
         }
         log.info("newSortStrategyData planExeRecordList finish");
+        List<String> videoPoolSourceIds = publishContents.stream()
+               .filter(o -> o.getSourceType().equals(PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal()))
+               .map(PublishContentDTO::getSourceId).distinct().collect(Collectors.toList());
+        List<PublishSingleVideoSource> videoPoolList = videoPoolRepository.getByContentTraceIdIn(videoPoolSourceIds);
+        Map<String, PublishSingleVideoSource> videoPoolSourceMap = videoPoolList.stream()
+              .collect(Collectors.toMap(PublishSingleVideoSource::getContentTraceId, o -> o));
+        log.info("newSortStrategyData videoPoolList finish");
         Map<String, ProducePlanExeRecord> planExeRecordMap = planExeRecordList.stream()
                 .collect(Collectors.toMap(ProducePlanExeRecord::getPlanExeId, o -> o));
         // 获取生成计划
@@ -395,7 +404,7 @@ public class DataDashboardService {
             // aigc 数据
             setObjAigcInfo(article, obj, date, publishAccountMap, publishContentMap, publishContentLayoutMap,
                     publishPlanMap, miniprogramTaskMap, planExeRecordMap, producePlanMap, inputSourceMap,
-                    resultRelMap, crawlerPlanMap, sourceTitlePlanMap);
+                    resultRelMap, crawlerPlanMap, sourceTitlePlanMap, videoPoolSourceMap);
             saveList.add(obj);
         }
         log.info("newSortStrategyData buildData finish");
@@ -452,7 +461,8 @@ public class DataDashboardService {
                                 Map<String, List<ProducePlanInputSource>> inputSourceMap,
                                 Map<String, List<CrawlerPlanResultRel>> resultRelMap,
                                 Map<String, CrawlerPlan> crawlerPlanMap,
-                                Map<String, ProducePlan> sourceTitlePlanMap) {
+                                Map<String, ProducePlan> sourceTitlePlanMap,
+                                Map<String, PublishSingleVideoSource> videoPoolSourceMap) {
         PublishAccount publishAccount = publishAccountMap.get(article.getGhId());
         obj.setAccountCreateTimestamp(publishAccount.getCreateTimestamp() / 1000);
         Map<String, Map<Long, PublishContentDTO>> titleContentMap = publishContentMap.get(publishAccount.getId());
@@ -505,6 +515,19 @@ public class DataDashboardService {
             }
             producePlanInputSourceList = inputSourceMap.get(record.getPlanId());
         }
+        if (publishContent.getSourceType().equals(PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal())) {
+            PublishSingleVideoSource videoPoolSource = videoPoolSourceMap.get(publishContent.getSourceId());
+            if (Objects.nonNull(videoPoolSource)) {
+                ContentPoolEnum poolEnum = ContentPoolEnum.from(videoPoolSource.getFlowPoolLevel());
+                obj.setProducePlanName("视频内容池-" + poolEnum.getDescription());
+                VideoPoolPlatformEnum platformEnum = VideoPoolPlatformEnum.from(videoPoolSource.getPlatform());
+                if (Objects.nonNull(platformEnum)) {
+                    obj.setCrawlerPlanName(platformEnum.getDescription());
+                } else {
+                    obj.setCrawlerPlanName(videoPoolSource.getPlatform());
+                }
+            }
+        }
         List<CrawlerPlanResultRel> crawlerPlanRelList = resultRelMap.get(publishContent.getCrawlerChannelContentId());
         if (CollectionUtil.isNotEmpty(crawlerPlanRelList) && CollectionUtil.isNotEmpty(producePlanInputSourceList)) {
             List<String> inputSourceValues = producePlanInputSourceList.stream()