瀏覽代碼

溯源入口改为发布记录

wangyunpeng 8 月之前
父節點
當前提交
e9c4b75439

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

@@ -34,7 +34,7 @@ public interface AigcBaseMapper {
 
     List<PublishContent> getHisPublishByTitles(List<String> titleList);
 
-    List<PublishContent> getNearestPublishContent(String publishAccountId, Integer size);
+    List<PublishContent> getNearestPublishContent(String publishAccountId, Long publishTimestamp, Integer size);
 
     CrawlerContent getCrawlerContentByChannelContentId(String channelContentId);
 

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

@@ -23,6 +23,8 @@ public class ArticlePoolPromotionSource implements Serializable {
     private String rootPublishContentId;
     @Column(name = "root_produce_content_id")
     private String rootProduceContentId;
+    @Column(name = "gh_id")
+    private String ghId;
     @Column(name = "title")
     private String title;
     @Column(name = "title_md5")

+ 16 - 8
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleService.java

@@ -112,14 +112,15 @@ public class ArticleService {
         Article article = articleRepository.getByWxSn(wxSn);
         String ghId = article.getGhId();
         String title = article.getTitle();
+        Long publishTimestamp = article.getUpdateTime() * 1000;
         PublishAccount publishAccount = publishAccountRepository.getByGhId(ghId);
-        List<PublishContent> publishContentList = aigcBaseMapper.getNearestPublishContent(publishAccount.getId(), null);
+        List<PublishContent> publishContentList = aigcBaseMapper.getNearestPublishContent(publishAccount.getId(), publishTimestamp, 100);
         if (CollectionUtils.isEmpty(publishContentList)) {
             return;
         }
         String publishContentId = null;
         String channelContentId = null;
-        Long publishTimestamp = article.getUpdateTime() * 1000;
+
         PublishContent publishContent = findPublishContent(publishContentList, title, publishTimestamp);
         if (Objects.nonNull(publishContent)) {
             publishContentId = publishContent.getId();
@@ -221,11 +222,11 @@ public class ArticleService {
             return result;
         }
         String title = crawlerContent.getTitle();
-        List<PublishContent> publishContentList = aigcBaseMapper.getNearestPublishContent(publishAccount.getId(), null);
+        Long publishTimestamp = crawlerContent.getPublishTimestamp();
+        List<PublishContent> publishContentList = aigcBaseMapper.getNearestPublishContent(publishAccount.getId(), publishTimestamp, 100);
         if (CollectionUtils.isEmpty(publishContentList)) {
             return result;
         }
-        Long publishTimestamp = crawlerContent.getPublishTimestamp();
         PublishContent publishContent = findPublishContent(publishContentList, title, publishTimestamp);
         if (Objects.nonNull(publishContent)) {
             if (!StringUtils.hasText(sourcePublishContentId)) {
@@ -260,6 +261,15 @@ public class ArticleService {
         long now = System.currentTimeMillis();
         for (ArticlePoolPromotionSource task : tasks) {
             // 溯源
+            PublishAccount publishAccount = publishAccountRepository.getByGhId(task.getGhId());
+            if (Objects.isNull(publishAccount)) {
+                continue;
+            }
+            List<PublishContent> publishContentList = aigcBaseMapper.getNearestPublishContent(publishAccount.getId(), now, null);
+            PublishContent publishContent = findPublishContent(publishContentList, task.getTitle(), now);
+            if (Objects.isNull(publishContent)) {
+                continue;
+            }
             RootPublishContentVO source = getRootPublishContent(task.getChannelContentId(), null, null, null, 0);
             // 更新
             if (StringUtils.hasText(source.getRootProduceContentId())) {
@@ -291,10 +301,8 @@ public class ArticleService {
                 }
                 longArticleBaseMapper.updateRootProduceContentLevel(task.getRootProduceContentId(), task.getLevel());
             } else {
-                if (task.getCreateTimestamp() < now - 86400) {
-                    task.setDeleted(StatusEnum.SUCCESS.getCode());
-                    articlePoolPromotionSourceRepository.save(task);
-                }
+                task.setDeleted(StatusEnum.SUCCESS.getCode());
+                articlePoolPromotionSourceRepository.save(task);
             }
         }
     }

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

@@ -151,6 +151,9 @@
         where publish_account_id = #{publishAccountId}
           and channel = 5
           and status = 2
+          <if test="publishTimestamp != null">
+            and publish_timestamp &lt; #{publishTimestamp}
+          </if>
         order by publish_timestamp desc
         <if test="size != null">
             limit #{size}