丁云鹏 11 hónapja
szülő
commit
102e47dd21

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

@@ -19,6 +19,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
         "com.tzld.longarticle.recommend.server.remote",
         "com.tzld.longarticle.recommend.server.config",
         "com.tzld.longarticle.recommend.server.web",
+        "com.tzld.longarticle.recommend.server.repository",
 })
 @EnableAspectJAutoProxy
 public class Application {

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

@@ -85,6 +85,7 @@ public class RecommendService {
         RecallParam recallParam = new RecallParam();
         BeanUtils.copyProperties(param, recallParam);
         recallParam.setStrategy(param.getStrategy());
+        recallParam.setGhId(param.getGhId());
         return recallParam;
     }
 

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

@@ -14,4 +14,5 @@ public class FilterParam {
     private List<Content> contents;
     private String accountId;
     private String strategy;
+    private String ghId;
 }

+ 10 - 7
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/filter/strategy/AccountPreDistributeStrategy.java

@@ -37,19 +37,22 @@ public class AccountPreDistributeStrategy implements FilterStrategy {
         if (pools.length >= 3) {
             ArticlePreDistributeAccount articlePreDistributeAccount =
                     articlePreDistributeAccountRepository.findByGhIdOrderByDate(param.getAccountId());
-            if (StringUtils.isNotEmpty(articlePreDistributeAccount.getArticleList())) {
+            Set<String> articles = new HashSet<>();
+            if (articlePreDistributeAccount != null && StringUtils.isNotEmpty(articlePreDistributeAccount.getArticleList())) {
                 List<String[]> list = JSONUtils.fromJson(articlePreDistributeAccount.getArticleList(), new TypeToken<List<String[]>>() {
                 }, Collections.emptyList());
-                Set<String> articles = new HashSet<>();
                 for (String[] s : list) {
                     articles.add(s[0]);
                 }
-                for (Content content : contents) {
-                    if (StringUtils.equals(pools[2], content.getContentPoolType())) {
-                        if (articles.contains(content.getId())) {
-                            result.add(content.getId());
-                        }
+            }
+
+            for (Content content : contents) {
+                if (StringUtils.equals(pools[2], content.getContentPoolType())) {
+                    if (articles.contains(content.getId())) {
+                        result.add(content.getId());
                     }
+                } else {
+                    result.add(content.getId());
                 }
             }
         }

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

@@ -15,6 +15,7 @@ public class FilterParamFactory {
         filterParam.setContents(contents);
         filterParam.setAccountId(param.getAccountId());
         filterParam.setStrategy(param.getStrategy());
+        filterParam.setGhId(param.getGhId());
         return filterParam;
     }
 }

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

@@ -12,4 +12,5 @@ public class RecallParam {
     private Integer publishNum;
     private String planId;
     private String strategy;
+    private String ghId;
 }