Преглед на файлове

历史表现仅查询有效

wangyunpeng преди 10 месеца
родител
ревизия
f3767f3c33

+ 3 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/crawler/ArticleRepository.java

@@ -12,11 +12,11 @@ public interface ArticleRepository extends JpaRepository<Article, String> {
 
     List<Article> getByAccountNameAndItemIndexInAndTypeEquals(String accountName, List<Integer> indexList, String type);
 
-    List<Article> getByTitleMd5InAndTypeEquals(List<String> titleList, String type);
+    List<Article> getByTitleMd5InAndTypeEqualsAndStatusEquals(List<String> titleList, String type, Integer status);
 
-    List<Article> getByTitleInAndTypeEquals(List<String> titleList, String type);
+    List<Article> getByTitleInAndTypeEqualsAndStatusEquals(List<String> titleList, String type, Integer status);
 
-    List<Article> getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEquals(Set<String> ghIds, Set<String> appMsgIds, Integer itemIndex, String type);
+    List<Article> getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEqualsAndStatusEquals(Set<String> ghIds, Set<String> appMsgIds, Integer itemIndex, String type, Integer status);
 
     List<Article> getByGhIdInAndUpdateTimeGreaterThanAndTypeEquals(Set<String> ghIds, Long updateTime, String type);
 

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

@@ -70,5 +70,7 @@ public class Article implements Serializable {
     private String titleMd5;
     @Column(name = "article_group")
     private String articleGroup;
+    @Column(name = "status")
+    private Integer status;
 }
 

+ 4 - 4
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recall/RecallService.java

@@ -215,7 +215,7 @@ public class RecallService implements ApplicationContextAware {
         List<Article> hisArticleList = new ArrayList<>();
         List<List<String>> titleMd5Partition = Lists.partition(new ArrayList<>(titleMd5List), 1000);
         for (List<String> titleMd5s : titleMd5Partition) {
-            hisArticleList.addAll(articleRepository.getByTitleMd5InAndTypeEquals(titleMd5s, "9"));
+            hisArticleList.addAll(articleRepository.getByTitleMd5InAndTypeEqualsAndStatusEquals(titleMd5s, "9", 1));
         }
         Map<String, Map<Integer, List<Article>>> map = hisArticleList.stream()
                 .collect(Collectors.groupingBy(Article::getTitle, Collectors.groupingBy(Article::getItemIndex)));
@@ -230,9 +230,9 @@ public class RecallService implements ApplicationContextAware {
         // 获取历史已发布文章所属头条内容
         Set<String> ghIds = hisArticleList.stream().map(Article::getGhId).collect(Collectors.toSet());
         Set<String> appMsgIds = hisArticleList.stream().map(Article::getAppMsgId).collect(Collectors.toSet());
-        List<Article> firstIndexHisArticleList = articleRepository.getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEquals(ghIds, appMsgIds, 1, "9");
-        Map<String, Map<String, Article>> firstIndexHisArticleMap = firstIndexHisArticleList.stream().collect(
-                Collectors.groupingBy(Article::getGhId, Collectors.toMap(Article::getAppMsgId, o -> o)));
+        List<Article> firstIndexHisArticleList = articleRepository.getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEqualsAndStatusEquals(ghIds, appMsgIds, 1, "9", 1);
+        Map<String, Map<String, Article>> firstIndexHisArticleMap = firstIndexHisArticleList.stream()
+                .collect(Collectors.groupingBy(Article::getGhId, Collectors.toMap(Article::getAppMsgId, o -> o)));
         // 获取发布账号 位置历史均值
         List<AccountAvgInfo> accountAvgInfoList = accountAvgInfoRepository.getAllByGhIdIn(ghIds);
         Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap = accountAvgInfoList.stream()