소스 검색

Merge branch 'wyp/1213-articlePromotion' of Server/long-article-recommend into master

wangyunpeng 7 달 전
부모
커밋
ad7ccdcc25

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/crawler/PublishSortLog.java

@@ -26,6 +26,8 @@ public class PublishSortLog {
     private String publishContentId;
     @Column(name = "crawler_channel_content_id")
     private String crawlerChannelContentId;
+    @Column(name = "source_type")
+    private Integer sourceType;
     @Column(name = "source_id")
     private String sourceId;
     @Column(name = "title")

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

@@ -126,6 +126,10 @@ public class DatastatSortStrategy implements Serializable {
     private Integer publishMiniProgramNum;
     @Column(name = "source_produce_plan_name")
     private String sourceProducePlanName;
+    @Column(name = "source_type")
+    private Integer sourceType;
+    @Column(name = "source_id")
+    private String sourceId;
 
 
     @Data

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

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.recommend;
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 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.PublishPlanInputSourceTypesEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticlePoolPromotionSourceStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotIdEnum;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
@@ -90,7 +91,8 @@ public class ArticlePromotionService {
         list = list.stream().filter(o -> {
             long publishTime = DateUtils.dateStrToTimestamp(o.getDateStr(), "yyyyMMdd");
             Long accountCreateTime = publishAccountCreateTimeMap.get(o.getGhId());
-            return publishTime * 1000 > accountCreateTime;
+            return publishTime * 1000 > accountCreateTime
+                    && !PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal().equals(o.getSourceType());
         }).collect(Collectors.toList());
         return list;
     }

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

@@ -197,10 +197,10 @@ public class DataDashboardService {
                 .collect(Collectors.groupingBy(ArticleDetailInfo::getWxSn));
         List<PublishSortLog> sortLogList = publishSortLogRepository.findByGhIdInAndDateStrBetween(ghIds, beginDate, endDate);
         log.info("newSortStrategyData sortLogList finish");
-        Map<String, Map<String, Map<String, String>>> sortStrategyMap = sortLogList.stream()
+        Map<String, Map<String, Map<String, PublishSortLog>>> sortStrategyMap = sortLogList.stream()
                 .collect(Collectors.groupingBy(PublishSortLog::getGhId,
                         Collectors.groupingBy(PublishSortLog::getDateStr, Collectors.toMap(PublishSortLog::getTitle,
-                                PublishSortLog::getStrategy, (existing, replacement) -> existing))));
+                                Function.identity(), (existing, replacement) -> existing))));
         Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap = accountAvgInfoList.stream()
                 .filter(o -> Objects.nonNull(o.getReadAvg()) && o.getReadAvg() > 0 && o.getFans() > 1000)
                 .collect(Collectors.groupingBy(AccountAvgInfo::getGhId, Collectors.groupingBy(AccountAvgInfo::getUpdateTime,
@@ -338,7 +338,7 @@ public class DataDashboardService {
             List<ArticleDetailInfo> articleDetailInfos = articleDetailInfoMap.get(article.getWxSn());
             setObjArticleDetailInfo(article, obj, articleDetailInfos);
             Article firstArticle = articleMap.get(article.getGhId()).get(article.getAppMsgId()).get(1);
-            Map<String, Map<String, String>> dateStrategy = sortStrategyMap.get(article.getGhId());
+            Map<String, Map<String, PublishSortLog>> dateStrategy = sortStrategyMap.get(article.getGhId());
             AccountAvgInfo avgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, article.getGhId(),
                     article.getPublishTimestamp(), article.getItemIndex());
             AccountAvgInfo firstAvgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, article.getGhId(),
@@ -352,20 +352,23 @@ public class DataDashboardService {
                 obj.setFirstAvgViewCount(firstAvgInfo.getReadAvg());
             }
             if (Objects.nonNull(dateStrategy)) {
-                Map<String, String> titleStrategyMap = dateStrategy.get(date);
+                Map<String, PublishSortLog> titleStrategyMap = dateStrategy.get(date);
                 if (Objects.nonNull(titleStrategyMap)) {
-                    String strategy = titleStrategyMap.get(article.getTitle());
-                    if (!StringUtils.hasText(strategy)) {
-                        if (Objects.equals(articleType, ArticleTypeEnum.WUXIANLIU.getVal())) {
-                            strategy = RankStrategyEnum.INFINITE_STRATEGY.getStrategy();
-                        } else {
-                            for (Map.Entry<String, String> entry : titleStrategyMap.entrySet()) {
-                                strategy = entry.getValue();
-                                break;
+                    PublishSortLog sortLog = titleStrategyMap.get(article.getTitle());
+                    if (Objects.nonNull(sortLog)) {
+                        String strategy = sortLog.getStrategy();
+                        if (!StringUtils.hasText(sortLog.getStrategy())) {
+                            if (Objects.equals(articleType, ArticleTypeEnum.WUXIANLIU.getVal())) {
+                                strategy = RankStrategyEnum.INFINITE_STRATEGY.getStrategy();
+                            } else {
+                                for (Map.Entry<String, PublishSortLog> entry : titleStrategyMap.entrySet()) {
+                                    strategy = entry.getValue().getStrategy();
+                                    break;
+                                }
                             }
                         }
+                        obj.setStrategy(strategy);
                     }
-                    obj.setStrategy(strategy);
                 }
             }
             if (!StringUtils.hasText(obj.getStrategy()) &&
@@ -399,6 +402,17 @@ public class DataDashboardService {
                 item.setAccountCreateTimestamp(publishAccount.getCreateTimestamp() / 1000);
                 Article article = wxSnMap.get(item.getWxSn());
                 item.setPublishTimestamp(article.getPublishTimestamp());
+                Map<String, Map<String, PublishSortLog>> dateStrategy = sortStrategyMap.get(article.getGhId());
+                if (Objects.nonNull(dateStrategy)) {
+                    Map<String, PublishSortLog> titleStrategyMap = dateStrategy.get(newSortStrategyExport.getDateStr());
+                    if (Objects.nonNull(titleStrategyMap)) {
+                        PublishSortLog sortLog = titleStrategyMap.get(article.getTitle());
+                        if (Objects.nonNull(sortLog)) {
+                            item.setSourceType(sortLog.getSourceType());
+                            item.setSourceId(sortLog.getSourceId());
+                        }
+                    }
+                }
                 saveList.add(item);
             }
             for (List<DatastatSortStrategy> saveListPartition : Lists.partition(saveList, 1000)) {

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

@@ -297,6 +297,7 @@ public class RecommendService {
             sortLog.setAccountName(param.getAccountName());
             sortLog.setPublishContentId(content.getId());
             sortLog.setCrawlerChannelContentId(content.getCrawlerChannelContentId());
+            sortLog.setSourceType(content.getSourceType());
             sortLog.setSourceId(content.getSourceId());
             sortLog.setTitle(content.getTitle());
             sortLog.setIndex(i);

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

@@ -25,7 +25,7 @@
         link, wx_sn, fission0_read_avg_100_rate, fission0_read_avg_500_rate, fission0_read_avg_1000_rate,
         crawler_plan_name, crawler_plan_tag, produce_plan_name, produce_plan_tag, publish_plan_name,
         publish_mini_program_insert_strategy, publish_mini_program_insert_use_type, publish_mini_program_num,
-        source_produce_plan_name, account_create_timestamp, publish_timestamp, type)
+        source_produce_plan_name, account_create_timestamp, publish_timestamp, type, source_type, source_id)
         VALUES
         <foreach collection="list" item="item" separator=",">
             (#{item.dateStr}, #{item.publishTime}, #{item.accountMode}, #{item.accountSource}, #{item.accountType},
@@ -42,7 +42,7 @@
             #{item.producePlanName}, #{item.producePlanTag}, #{item.publishPlanName},
             #{item.publishMiniProgramInsertStrategy}, #{item.publishMiniProgramInsertUseType},
             #{item.publishMiniProgramNum}, #{item.sourceProducePlanName}, #{item.accountCreateTimestamp},
-            #{item.publishTimestamp}, #{item.type})
+            #{item.publishTimestamp}, #{item.type}, #{item.sourceType}, #{item.sourceId})
         </foreach>
     </insert>