丁云鹏 11 kuukautta sitten
vanhempi
commit
7e2ac15b0c

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

@@ -33,10 +33,10 @@ public class AccountPreDistributeStrategy implements FilterStrategy {
         List<String> result = new ArrayList<>();
         List<Content> contents = param.getContents();
         List<Content> filterContents = new ArrayList<>();
+        Set<String> articles = new HashSet<>();
         String[] pools = accountContentPoolConfigService.getContentPools(param.getAccountName());
         if (pools.length >= 3) {
             Optional<ArticlePreDistributeAccount> optional = articlePreDistributeAccountRepository.findTopByGhId(param.getGhId());
-            Set<String> articles = new HashSet<>();
             if (optional.isPresent() && StringUtils.isNotEmpty(optional.get().getArticleList())) {
                 List<String[]> list = JSONUtils.fromJson(optional.get().getArticleList(), new TypeToken<List<String[]>>() {
                 }, Collections.emptyList());
@@ -44,15 +44,15 @@ public class AccountPreDistributeStrategy implements FilterStrategy {
                     articles.add(s[0]);
                 }
             }
+        }
 
-            for (Content content : contents) {
-                if (StringUtils.equals(pools[2], content.getContentPoolType())) {
-                    if (articles.contains(content.getCrawlerChannelContentId())) {
-                        result.add(content.getId());
-                    }
-                } else {
+        for (Content content : contents) {
+            if (StringUtils.equals(pools[2], content.getContentPoolType())) {
+                if (articles.contains(content.getCrawlerChannelContentId())) {
                     result.add(content.getId());
                 }
+            } else {
+                result.add(content.getId());
             }
         }
         filterResult.setContentIds(result);