From f0854ca7d60e1094d53ad0c8758dfffdfdb1fd53 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 14 Sep 2018 12:02:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-11121=20=E7=BB=9F=E4=B8=80=E7=94=A8u?= =?UTF-8?q?nix=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E5=88=86=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/HistoryTemplateListCache.java | 12 ++++++------ .../com/fr/design/file/MutilTempalteTabPane.java | 11 +++-------- .../java/com/fr/design/mainframe/DesignerFrame.java | 2 +- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 7aaff7be8..b73805ee6 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -184,9 +184,9 @@ public class HistoryTemplateListCache implements CallbackEvent { */ public int contains(String filename) { for (int i = 0; i < historyList.size(); i++) { - String historyPath = historyList.get(i).getPath().replaceAll("/", "\\\\"); - //文件路径是全路径,历史路径是reportlets/模板名 - if (filename.endsWith(historyPath)) { + String historyPath = historyList.get(i).getPath(); + //文件路径和历史路径都是 reportlets/xxx/xxx/xxx/xx.suffix + if (filename.equals(historyPath)) { return i; } } @@ -233,16 +233,16 @@ public class HistoryTemplateListCache implements CallbackEvent { public void deleteFile(FileNodeFILE file) { boolean isDir = file.isDirectory(); - String suffix = isDir ? "\\" : StringUtils.EMPTY; + String suffix = isDir ? CoreConstants.SEPARATOR : StringUtils.EMPTY; // path like reportlets/xx/xxx/xxx - String path = file.getPath().replaceAll("/", "\\\\") + suffix; + String path = file.getPath() + suffix; ListIterator> iterator = historyList.listIterator(); while (iterator.hasNext()) { JTemplate template = iterator.next(); - String tPath = template.getPath().replaceAll("/", "\\\\"); + String tPath = template.getPath(); if (isDir ? tPath.startsWith(path) : tPath.equals(path)) { iterator.remove(); int index = iterator.nextIndex(); diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index e4d592c77..b1a3b8e34 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -13,12 +13,10 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.file.FILE; -import com.fr.file.FileNodeFILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.ProductConstants; -import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; @@ -54,7 +52,6 @@ import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; -import java.io.File; import java.util.List; /** @@ -679,12 +676,10 @@ public class MutilTempalteTabPane extends JComponent { } //当前激活的模板 - String filename = openedTemplate.get(selectedIndex).getEditingFILE().getPath(); - if (filename.startsWith(ProjectConstants.REPORTLETS_NAME)) { - filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename; - } + String filename = openedTemplate.get(selectedIndex).getPath(); + - filename = FilenameUtils.normalize(filename); + filename = FilenameUtils.standard(filename); if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index a8802553c..af5723d05 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -757,7 +757,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { path = workspace.getPath() + File.separator + path; } - defaultTitleSB.append(" " + path); + defaultTitleSB.append(" ").append(path); } setTitle(defaultTitleSB.toString()); From 8185971723e9d0b07e35014edcacb3a2139cc3ad Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 14 Sep 2018 19:07:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-11328=20&=20REPORT-10946=20&=20REPOR?= =?UTF-8?q?T-10928=20&=20REPORT-11196=201.=E4=BF=AE=E5=A4=8D=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E9=A2=84=E8=A7=88=E5=86=85=E5=AE=B9=E8=BF=87=E5=AE=BD?= =?UTF-8?q?=EF=BC=8C=E6=B2=A1=E6=9C=89=E6=A8=AA=E5=90=91=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1=E7=9A=84=E9=97=AE=E9=A2=98=202.=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=96=AD=E7=BD=91=E6=97=B6=EF=BC=8C=E6=98=BE=E7=A4=BA=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E5=A4=B1=E8=B4=A5=E7=9A=84=E4=B8=80=E5=A4=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=80=BB=E8=BE=91=203.list=E4=B8=AD=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E5=8E=BB=E9=87=8D=204.=E5=8E=9F=E5=85=88?= =?UTF-8?q?=E5=86=99=E6=B3=95=E4=B8=8D=E8=A7=84=E8=8C=83=EF=BC=8C=E5=BA=94?= =?UTF-8?q?=E7=94=B3=E6=98=8E=E4=B8=BAprivate=EF=BC=8Cset=EF=BC=8Cget?= =?UTF-8?q?=E5=8F=96=E5=AD=98=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineDialog.java | 32 ++++++++++++------- .../alphafine/preview/RobotPreviewPane.java | 16 ++++++---- .../manager/fun/AlphaFineSearchProvider.java | 2 +- .../manager/impl/ActionSearchManager.java | 13 ++++---- .../manager/impl/DocumentSearchManager.java | 20 +++++------- .../manager/impl/FileSearchManager.java | 2 +- .../manager/impl/PluginSearchManager.java | 22 ++++++------- .../manager/impl/RecentSearchManager.java | 2 +- .../manager/impl/RecommendSearchManager.java | 17 +++++----- .../manager/impl/SimilarSearchManeger.java | 13 ++++---- 10 files changed, 70 insertions(+), 69 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index de66ad3d5..ff61edda0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -143,7 +143,15 @@ public class AlphaFineDialog extends UIDialog { private static String beforeSearchStr = ""; private static boolean alreadySearch = false; private static boolean alreadyInitHot = false; - public static String[][] data; + private String[][] hotData; + + public String[][] getHotData() { + return hotData; + } + + public void setHotData(String[][] hotData) { + this.hotData = hotData; + } public AlphaFineDialog(Frame parent, boolean forceOpen) { super(parent); @@ -242,14 +250,14 @@ public class AlphaFineDialog extends UIDialog { try { HttpGet getHelp = new HttpGet(AlphaFineConstants.ALPHA_HOT_SEARCH); HttpToolbox.getHttpClient(AlphaFineConstants.ALPHA_HOT_SEARCH).execute(getHelp).getStatusLine(); - if (data == null) { - data = HotIssuesManager.getInstance().getHotIssues(); + if (hotData == null) { + hotData = HotIssuesManager.getInstance().getHotIssues(); } - for (int i = 0; i < data.length; i++) { - panel.add(new HotIssueJpanel(data[i], i + 1)); + for (int i = 0; i < hotData.length; i++) { + panel.add(new HotIssueJpanel(hotData[i], i + 1)); } } catch (Exception e) { - data = null; + hotData = null; for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) { panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1)); } @@ -544,7 +552,7 @@ public class AlphaFineDialog extends UIDialog { } private void buildDocumentList(final String[] searchText) { - addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText)); + addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); } private void buildFileList(String searchStr, final String[] searchText) { @@ -552,24 +560,24 @@ public class AlphaFineDialog extends UIDialog { } private void buildActionList(final String[] searchText) { - addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText)); + addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); } private void buildPluginList(final String[] searchText) { - addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText)); + addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); } private void buildRecommendList(final String[] searchText) { - addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText)); + addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); } private void buildRecentList(final String[] searchText) { - addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText)); + addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); } private void buildSimilarList(final String[] searchText) { - addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(searchText)); + addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(getHotData(), searchText)); } private synchronized void addSearchResult(SearchResult searchResult) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java index 336e64dce..120d15f2b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java @@ -28,6 +28,8 @@ import java.net.URL; */ public class RobotPreviewPane extends JPanel { + private static final int TITLE_AREA_HEIGHT = 30; + public RobotPreviewPane(String title, String content) { this.setLayout(new BorderLayout()); this.setBackground(Color.WHITE); @@ -41,17 +43,17 @@ public class RobotPreviewPane extends JPanel { final JEditorPane editorPane = new JEditorPane(); editorPane.setEditorKit(new HTMLEditorKit()); - editorPane.setText(content+"


"); + editorPane.setText(content + "


"); editorPane.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) { return; } - if(e.getDescription().startsWith(AlphaFineConstants.JAVASCRIPT_PREFIX)){ - String s = e.getDescription().replaceAll(AlphaFineConstants.JAVASCRIPT_PREFIX,StringUtils.EMPTY) - .replaceAll("\\('",StringUtils.EMPTY) - .replaceAll("'\\)",StringUtils.EMPTY); + if (e.getDescription().startsWith(AlphaFineConstants.JAVASCRIPT_PREFIX)) { + String s = e.getDescription().replaceAll(AlphaFineConstants.JAVASCRIPT_PREFIX, StringUtils.EMPTY) + .replaceAll("\\('", StringUtils.EMPTY) + .replaceAll("'\\)", StringUtils.EMPTY); try { Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + s)); } catch (IOException e1) { @@ -60,7 +62,8 @@ public class RobotPreviewPane extends JPanel { FineLoggerFactory.getLogger().error(e1.getMessage()); } } - URL linkUrl = e.getURL();if (linkUrl != null) { + URL linkUrl = e.getURL(); + if (linkUrl != null) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (IOException | URISyntaxException e1) { @@ -73,6 +76,7 @@ public class RobotPreviewPane extends JPanel { UIScrollPane jScrollPane = new UIScrollPane(editorPane); jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); jScrollPane.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 10, Color.white)); + this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - TITLE_AREA_HEIGHT)); add(jScrollPane, BorderLayout.CENTER); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java index b75aa894c..154e7c858 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java @@ -12,7 +12,7 @@ public interface AlphaFineSearchProvider { * @param searchText * @return */ - SearchResult getLessSearchResult(String[] searchText); + SearchResult getLessSearchResult(String[][] data, String[] searchText); /** * 获取剩余条数 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java index 1ba95926a..97bfde18d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java @@ -12,10 +12,9 @@ import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvi import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.design.mainframe.toolbar.UpdateActionModel; import com.fr.general.ComparatorUtils; - import com.fr.json.JSONObject; -import com.fr.stable.StringUtils; import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; import java.util.List; @@ -58,15 +57,15 @@ public class ActionSearchManager implements AlphaFineSearchProvider { } @Override - public SearchResult getLessSearchResult(String[] searchText) { + public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { filterModelList = new SearchResult(); lessModelList = new SearchResult(); moreModelList = new SearchResult(); - if (ArrayUtils.isEmpty(searchText)) { - lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"))); - return lessModelList; - } if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) { + if (ArrayUtils.isEmpty(searchText)) { + lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"))); + return lessModelList; + } List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); for (UpdateActionModel updateActionModel : updateActions) { for (int j = 0; j < searchText.length; j++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java index cb1f91cda..1003c0e21 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java @@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; -import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.http.HttpToolbox; @@ -52,19 +51,16 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { } @Override - public SearchResult getLessSearchResult(String[] searchText) { - if (ArrayUtils.isEmpty(searchText)) { - return new SearchResult(); - } else if (AlphaFineDialog.data == null) { - return AlphaFineHelper.getNoConnectList(instance); - } + public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { lessModelList = new SearchResult(); moreModelList = new SearchResult(); - if (ArrayUtils.isEmpty(searchText)) { - lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"))); - return lessModelList; - } if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) { + if (ArrayUtils.isEmpty(searchText)) { + lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"))); + return lessModelList; + } else if (hotData == null) { + return AlphaFineHelper.getNoConnectList(instance); + } SearchResult searchResult = new SearchResult(); for (int j = 0; j < searchText.length; j++) { String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText[j] + AlphaFineConstants.FIRST_PAGE; @@ -78,7 +74,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { for (int i = 0; i < jsonArray.length(); i++) { AlphaFineHelper.checkCancel(); DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i)); - if (!AlphaFineHelper.getFilterResult().contains(cellModel)) { + if (!AlphaFineHelper.getFilterResult().contains(cellModel) && !searchResult.contains(cellModel)) { searchResult.add(cellModel); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 17c58998d..c7972753c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -96,7 +96,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { } @Override - public SearchResult getLessSearchResult(String[] searchText) { + public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { return null; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 5aafe29fa..0feff5521 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.PluginModel; -import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.ComparatorUtils; @@ -17,8 +16,8 @@ import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.basic.version.Version; import com.fr.plugin.basic.version.VersionIntervalFactory; -import com.fr.stable.EncodeConstants; import com.fr.stable.ArrayUtils; +import com.fr.stable.EncodeConstants; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -97,20 +96,17 @@ public class PluginSearchManager implements AlphaFineSearchProvider { } @Override - public SearchResult getLessSearchResult(String[] searchText) { - if (ArrayUtils.isEmpty(searchText)) { - return new SearchResult(); - } else if (AlphaFineDialog.data == null) { - return AlphaFineHelper.getNoConnectList(instance); - } + public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); - if (ArrayUtils.isEmpty(searchText)) { - lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"))); - return lessModelList; - } SearchResult searchResult = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) { + if (ArrayUtils.isEmpty(searchText)) { + lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"))); + return lessModelList; + } else if (hotData == null) { + return AlphaFineHelper.getNoConnectList(instance); + } for (int j = 0; j < searchText.length; j++) { try { String encodedKey = URLEncoder.encode(searchText[j], EncodeConstants.ENCODING_UTF_8); @@ -123,7 +119,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { for (int i = 0; i < jsonArray.length(); i++) { AlphaFineHelper.checkCancel(); PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); - if (cellModel != null && !AlphaFineHelper.getFilterResult().contains(cellModel)) { + if (cellModel != null && !AlphaFineHelper.getFilterResult().contains(cellModel) && !searchResult.contains(cellModel)) { searchResult.add(cellModel); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java index 866c2c734..38f413423 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java @@ -72,7 +72,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider { } @Override - public SearchResult getLessSearchResult(String[] searchText) { + public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { this.modelList = new SearchResult(); for (int j = 0; j < searchText.length; j++) { recentModelList = getRecentModelList(searchText[j]); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java index 7a234838a..de527d551 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java @@ -8,7 +8,6 @@ import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; -import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.http.HttpToolbox; @@ -16,9 +15,9 @@ import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; import com.fr.stable.CodeUtils; import com.fr.stable.StringUtils; -import com.fr.stable.ArrayUtils; import java.io.IOException; import java.util.Iterator; @@ -47,15 +46,15 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { } @Override - public SearchResult getLessSearchResult(String[] searchText) { - if (ArrayUtils.isEmpty(searchText)) { - return new SearchResult(); - } else if(AlphaFineDialog.data == null){ - return AlphaFineHelper.getNoConnectList(instance); - } + public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { this.modelList = new SearchResult(); this.recommendModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) { + if (ArrayUtils.isEmpty(searchText)) { + return new SearchResult(); + } else if(hotData == null){ + return AlphaFineHelper.getNoConnectList(instance); + } for (int j = 0; j < searchText.length; j++) { searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY); try { @@ -69,7 +68,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { for (int i = 0; i < jsonArray.length(); i++) { AlphaFineHelper.checkCancel(); AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); - if (alphaCellModel != null && !alreadyContain(alphaCellModel)) { + if (alphaCellModel != null && !alreadyContain(alphaCellModel) && !this.recommendModelList.contains(alphaCellModel)) { this.recommendModelList.add(alphaCellModel); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java index 661eba0ff..90d048932 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java @@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel; -import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.http.HttpToolbox; @@ -38,14 +37,14 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider { } @Override - public SearchResult getLessSearchResult(String[] searchText) { - if (ArrayUtils.isEmpty(searchText)) { - return new SearchResult(); - } else if (AlphaFineDialog.data == null) { - return AlphaFineHelper.getNoConnectList(instance); - } + public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { lessModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { + if (ArrayUtils.isEmpty(searchText)) { + return new SearchResult(); + } else if (hotData == null) { + return AlphaFineHelper.getNoConnectList(instance); + } SearchResult allModelList = new SearchResult(); for (int j = 0; j < searchText.length; j++) { String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]);