diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java index 66210cddc..0d23a6fc9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java @@ -1,10 +1,8 @@ package com.fr.design.mainframe.alphafine; import com.fr.design.DesignerEnvManager; -import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; import com.fr.stable.StringUtils; -import java.util.List; import java.util.Set; /** @@ -57,7 +55,7 @@ public class AlphaFineUtil { public static boolean unread() { Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); - List productNewsList = ProductNewsSearchManager.getInstance().getCachedProductNewsList(); - return !productNewsList.isEmpty() && (readSet.size() != productNewsList.size()); + Set idSet = ProductNewsSearchManager.getInstance().getIdSet(); + return !idSet.isEmpty() && !readSet.containsAll(idSet); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java index 655eec2c8..205735ab3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java @@ -16,7 +16,9 @@ import java.awt.Image; import java.net.URL; import java.util.ArrayList; import java.util.Date; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -30,6 +32,12 @@ public class ProductNewsSearchManager { private List productNewsList = new ArrayList<>(); + /** + * 单独记录一份cid的唯一id 用来判断是否已读 + */ + private Set idSet = new HashSet<>(); + + private ScheduledExecutorService service; private ProductNewsSearchManager() { @@ -71,6 +79,7 @@ public class ProductNewsSearchManager { public List getProductNewsList() throws Exception { productNewsList = new ArrayList<>(); + idSet = new HashSet<>(); String jsonStr = HttpToolbox.get(AlphaFineConstants.ALPHA_CID); AlphaFineHelper.checkCancel(); JSONObject cidJSON = JSONFactory.createJSON(JSON.OBJECT, jsonStr); @@ -88,6 +97,7 @@ public class ProductNewsSearchManager { // 推送时间check if (productNews.getPushDate().before(currentDate)) { productNewsList.add(productNews); + idSet.add(productNews.getId()); } } return productNewsList; @@ -97,6 +107,10 @@ public class ProductNewsSearchManager { return productNewsList; } + public Set getIdSet() { + return idSet; + } + @Nullable private Image getCoverImage(String url) { try {