From 1a49e536029074c7204514d3e3054c0d17bbea46 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 May 2022 19:51:37 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-67417=20=E6=90=9C=E7=B4=A2=E5=8E=86?= =?UTF-8?q?=E5=8F=B2/=E5=B7=B2=E8=AF=BB=E5=8A=A8=E6=80=81=20=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E6=8C=81=E4=B9=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConfigManager.java | 66 ++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index a8970f9d10..892c57ff88 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -9,7 +9,7 @@ import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLableReader; -import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -99,7 +99,6 @@ public class AlphaFineConfigManager implements XMLable { private String cacheBuildNO; - // todo 暂不持久化 方便测试 /** * key: 登录的bbs用户 * value: alphaFine历史搜索记录 @@ -154,6 +153,10 @@ public class AlphaFineConfigManager implements XMLable { } else if (reader.isChildNode()) { if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) { readActionSearchTextCacheXML(reader); + } else if ("SearchHistory".equals(reader.getTagName())) { + readHistorySearch(reader); + } else if ("ReadSet".equals(reader.getTagName())) { + readReadSet(reader); } } } @@ -180,6 +183,47 @@ public class AlphaFineConfigManager implements XMLable { }); } + private void readHistorySearch(XMLableReader reader) { + reader.readXMLObject(new XMLReadable() { + @Override + public void readXML(XMLableReader xmLableReader) { + if (ComparatorUtils.equals(reader.getTagName(), "history")) { + String tmpVal = reader.getElementValue(); + if (tmpVal != null) { + tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); + Stack stack = new SizedStack<>(3); + List historyList = Arrays.asList(tmpVal.split(",")); + for (String history : historyList) { + stack.add(history.trim()); + } + historySearchMap.put(reader.getAttrAsString("user", StringUtils.EMPTY), stack); + } + } + } + }); + } + + + private void readReadSet(XMLableReader reader) { + reader.readXMLObject(new XMLReadable() { + @Override + public void readXML(XMLableReader xmLableReader) { + if (ComparatorUtils.equals(reader.getTagName(), "readId")) { + String tmpVal = reader.getElementValue(); + if (tmpVal != null) { + tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); + String[] idArr = tmpVal.split(","); + Set setId = new HashSet<>(); + for (String id : idArr) { + setId.add(Long.parseLong(id.trim())); + } + readSetMap.put(reader.getAttrAsString("user", StringUtils.EMPTY), setId); + } + } + } + }); + } + @Override public void writeXML(XMLPrintWriter writer) { writer.startTAG("AlphaFineConfigManager"); @@ -198,6 +242,8 @@ public class AlphaFineConfigManager implements XMLable { .attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()) .attr("productDynamics", this.isProductDynamics()); writeActionSearchTextCacheXML(writer); + writeSearchHistory(writer); + writeReadSet(writer); writer.end(); } @@ -212,6 +258,22 @@ public class AlphaFineConfigManager implements XMLable { writer.end(); } + private void writeSearchHistory(XMLPrintWriter writer) { + writer.startTAG("SearchHistory"); + for (Map.Entry> entry : historySearchMap.entrySet()) { + writer.startTAG("history").attr("user", entry.getKey()).textNode(entry.getValue().toString()).end(); + } + writer.end(); + } + + private void writeReadSet(XMLPrintWriter writer) { + writer.startTAG("ReadSet"); + for (Map.Entry> entry : readSetMap.entrySet()) { + writer.startTAG("readId").attr("user", entry.getKey()).textNode(entry.getValue().toString()).end(); + } + writer.end(); + } + public boolean isSearchOnLine() { return searchOnLine; }