wangyunpeng před 3 měsíci
rodič
revize
f5e94632ab

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

@@ -4,6 +4,7 @@ import lombok.Data;
 
 @Data
 public class CrawlerContent {
+    private Long id;
     private String channelContentId;
     private String crawlerPlanId;
     private String ghId;

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

@@ -11,6 +11,7 @@ import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotI
 import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
 import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
+import com.tzld.longarticle.recommend.server.model.dto.CrawlerContent;
 import com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.PublishSortLog;
@@ -467,13 +468,21 @@ public class ArticlePromotionService {
         }).collect(Collectors.toList());
         List<PublishContentDTO> publishContentList = publishContentMapper.getPublishContentByTitle(publishContentParamList);
         List<String> existsTitles = aigcBaseMapper.getProduceContentTitleByPlanId(topProducePlanId);
+        List<String> channelContentIds = publishContentList.stream().map(PublishContentDTO::getCrawlerChannelContentId).collect(Collectors.toList());
+        List<CrawlerContent> crawlerContentList = aigcBaseMapper.getCrawlerContentByChannelContentIdIn(channelContentIds);
+        Map<String, Long> crawlerContentMap = crawlerContentList.stream().collect(Collectors.toMap(
+                CrawlerContent::getChannelContentId, CrawlerContent::getId));
         for (PublishContentDTO item : publishContentList) {
             if (TitleSimilarCheckUtil.isDuplicateContent(item.getTitle(), existsTitles, TitleSimilarCheckUtil.ARTICLE_PROMOTION_THRESHOLD)) {
                 continue;
             }
             existsTitles.add(item.getTitle());
             String inputSourceLabel = String.format("原始帖子-长文-微信公众号-内容IDs-%s", item.getTitle());
-            articleAddDependPlan(topProducePlanId, item.getCrawlerChannelContentId(), inputSourceLabel,
+            Long crawlerContentId = crawlerContentMap.get(item.getCrawlerChannelContentId());
+            if (Objects.isNull(crawlerContentId)) {
+                continue;
+            }
+            articleAddDependPlan(topProducePlanId, String.valueOf(crawlerContentId), inputSourceLabel,
                     ProducePlanInputSourceTypeEnum.contentID.getVal());
         }
         return ReturnT.SUCCESS;

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

@@ -1,6 +1,7 @@
 package com.tzld.longarticle.recommend.server.web;
 
 import com.tzld.longarticle.recommend.server.service.XxlJobService;
+import com.tzld.longarticle.recommend.server.service.recommend.ArticlePromotionService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -13,6 +14,8 @@ import org.springframework.web.bind.annotation.RestController;
 public class XxlJobController {
     @Autowired
     private XxlJobService service;
+    @Autowired
+    private ArticlePromotionService articlePromotionService;
 
     @GetMapping("/checkPublishPlan")
     public void checkPublishPlan() {
@@ -99,4 +102,9 @@ public class XxlJobController {
         service.badAccountContentReject(null);
     }
 
+    @GetMapping("/topContentReSend")
+    public void topContentReSend() {
+        articlePromotionService.topContentReSend(null);
+    }
+
 }

+ 2 - 2
long-article-recommend-service/src/main/resources/mapper/aigc/AigcBaseMapper.xml

@@ -20,7 +20,7 @@
 
     <select id="getCrawlerContentByChannelContentId"
             resultType="com.tzld.longarticle.recommend.server.model.dto.CrawlerContent">
-        select cc.channel_content_id, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
+        select cc.id, cc.channel_content_id, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
         from crawler_content cc
         join crawler_account ca on cc.channel_account_id = ca.channel_account_id
         where cc.channel_content_id = #{channelContentId}
@@ -48,7 +48,7 @@
 
     <select id="getCrawlerContentByChannelContentIdIn"
             resultType="com.tzld.longarticle.recommend.server.model.dto.CrawlerContent">
-        select cc.channel_content_id, cprr.plan_id as crawlerPlanId, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
+        select cc.id, cc.channel_content_id, cprr.plan_id as crawlerPlanId, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
         from crawler_content cc
         join (select channel_source_id, max(plan_id) as plan_id from crawler_plan_result_rel group by channel_source_id) cprr
             on cc.channel_content_id = cprr.channel_source_id