Sfoglia il codice sorgente

topContentReSendJob

wangyunpeng 1 giorno fa
parent
commit
3b9d412cf6

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

@@ -91,7 +91,7 @@ public interface LongArticleBaseMapper {
 
     List<String> getPassContentIds();
 
-    List<DatastatSortStrategy> getTopContent(String dateStr);
+    List<DatastatSortStrategy> getTopContent(String dateStr, String lastPublishDateStr);
 
     VideoEndScreenTransformationTask getVideoEndScreenTransformationTask(Long videoOriginId);
 

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

@@ -651,11 +651,18 @@ public class ArticlePromotionService {
 
     @XxlJob("topContentReSendJob")
     public ReturnT<String> topContentReSend(String param) {
-        String dateStr = DateUtils.getBeforeDaysDateStr("yyyyMMdd", 60);
+        String dateStr = DateUtils.getBeforeDaysDateStr("yyyyMMdd", 20);
         if (StringUtils.hasText(param)) {
             dateStr = param;
         }
-        List<DatastatSortStrategy> topList = longArticleBaseMapper.getTopContent(dateStr);
+        // 获取TOP内容最近发布表现
+        String lastPublishDateStr = DateUtils.getBeforeDaysDateStr("yyyyMMdd", 100);
+        List<PublishedTopContentDTO> lastTopContent = longArticleBaseMapper.getPublishedTopContent(lastPublishDateStr);
+        Map<String, PublishedTopContentDTO> lastTopContentMap = lastTopContent.stream().collect(Collectors.toMap(
+                PublishedTopContentDTO::getTitle, Function.identity()));
+        // 获取晋级内容
+        List<DatastatSortStrategy> topList = longArticleBaseMapper.getTopContent(dateStr, lastPublishDateStr);
+        topList.removeIf(top -> lastTopContentMap.containsKey(top.getTitle()));
         List<String> ghIds = topList.stream().map(DatastatSortStrategy::getGhId).distinct().collect(Collectors.toList());
         List<PublishAccount> publishAccountList = publishAccountRepository.getAllByGhIdIn(ghIds);
         Map<String, String> publishContentMap = publishAccountList.stream().collect(Collectors.toMap(
@@ -679,11 +686,6 @@ public class ArticlePromotionService {
             log.error("topContentReSendJob detail is null");
             return ReturnT.FAIL;
         }
-        // 获取TOP内容最近发布表现
-        String lastPublishDateStr = DateUtils.getBeforeDaysDateStr("yyyyMMdd", 100);
-        List<PublishedTopContentDTO> lastTopContent = longArticleBaseMapper.getPublishedTopContent(lastPublishDateStr);
-        Map<String, PublishedTopContentDTO> lastTopContentMap = lastTopContent.stream().collect(Collectors.toMap(
-                PublishedTopContentDTO::getTitle, Function.identity()));
         for (PublishContentDTO item : publishContentList) {
             if (TitleSimilarCheckUtil.isDuplicateContent(item.getTitle(), existsTitles, TitleSimilarCheckUtil.ARTICLE_PROMOTION_THRESHOLD)) {
                 continue;

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

@@ -344,7 +344,7 @@
         from datastat_sort_strategy dss
              join (select title, max(read_rate) as read_rate
                    from datastat_sort_strategy
-                   where date_str &lt; #{dateStr}
+                   where date_str between #{lastPublishDateStr} and #{dateStr}
                      and type = 9
                      and read_rate > 1.3
                      and view_count > 10000