From cd7fa16fa186189d2e8edcab23a24b6895ae7f6f Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Wed, 28 Sep 2022 16:13:21 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-81241=E3=80=90=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=E3=80=91=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83=E6=96=AD=E7=BD=91=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E6=97=A0=E5=8F=8D=E5=BA=94?= =?UTF-8?q?=201=E3=80=81=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E4=BA=91?= =?UTF-8?q?=E7=AB=AF=E5=8F=98=E9=87=8F=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineCloudConstants.java | 204 +++++++++++++----- .../alphafine/cell/model/BottomModel.java | 2 +- .../alphafine/cell/model/DocumentModel.java | 4 +- .../alphafine/cell/model/PluginModel.java | 6 +- .../alphafine/cell/model/RobotModel.java | 4 +- .../alphafine/component/AlphaFineDialog.java | 2 +- .../preview/HelpDocumentNoResultPane.java | 2 +- .../preview/NoResultWithLinkPane.java | 2 +- .../alphafine/preview/RobotPreviewPane.java | 2 +- .../manager/impl/ComplementAdviceManager.java | 2 +- .../search/manager/impl/HotIssuesManager.java | 2 +- .../manager/impl/PluginSearchManager.java | 6 +- .../impl/ProductNewsSearchManager.java | 4 +- .../manager/impl/RecommendSearchManager.java | 2 +- .../manager/impl/SimilarSearchManager.java | 2 +- .../alphafine/cell/model/ModelTest.java | 4 +- 16 files changed, 174 insertions(+), 76 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java index 5e527d9916..b1ff5d8606 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java @@ -3,8 +3,7 @@ package com.fr.design.actions.help.alphafine; import com.fr.general.CloudCenter; /** - * 需要从云端获取的常量单独放一起 - * 以防AlphaFineConstants被加载时,CloudCenter还没启动,导致常量获取不到。 + * 云端变量统一管理 * * @author Link * @version 11.0 @@ -12,55 +11,154 @@ import com.fr.general.CloudCenter; */ public class AlphaFineCloudConstants { - public static final String PLUGIN_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); - - public static final String SEARCH_ALL_PLUGIN_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.all.searchAPI"); - - public static final String PLUGIN_URL = CloudCenter.getInstance().acquireUrlByKind("af.pluginInfo"); - - public static final String REUSE_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo"); - - public static final String DOCUMENT_DOC_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_view"); - - public static final String DOCUMENT_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_search"); - - public static final String DOCUMENT_INFORMATION_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_info"); - - public static final String PLUGIN_IMAGE_URL = CloudCenter.getInstance().acquireUrlByKind("af.plugin_image"); - - public static final String CLOUD_SERVER_URL = CloudCenter.getInstance().acquireUrlByKind("af.record"); - - public static final String SEARCH_API = CloudCenter.getInstance().acquireUrlByKind("af.cloud_search"); - - public static final String SIMILAR_SEARCH_URL_PREFIX = CloudCenter.getInstance().acquireUrlByKind("af.similar_search"); - - public static final String COMPLEMENT_ADVICE_SEARCH_URL_PREFIX = CloudCenter.getInstance().acquireUrlByKind("af.advice_search"); - - public static final String ALPHA_HOT_SEARCH = CloudCenter.getInstance().acquireUrlByKind("af.hot_search"); - - public static final String ALPHA_GO_TO_FORUM = CloudCenter.getInstance().acquireUrlByKind("af.go_fourm"); - - public static final String ALPHA_GO_TO_WEB = CloudCenter.getInstance().acquireUrlByKind("af.go_web"); - - public static final String ALPHA_PREVIEW = CloudCenter.getInstance().acquireUrlByKind("af.preview"); - - public static final String ALPHA_CID = CloudCenter.getInstance().acquireUrlByKind("af.cid.new"); - - public static final String ALPHA_CID_USER_GROUP_INFO = CloudCenter.getInstance().acquireUrlByKind("af.cid.user.group.info"); - - private static final String QUICK_START_URL = CloudCenter.getInstance().acquireUrlByKind("af.help.quick.start"); - - private static final String REPORT_LEARNING_PATH = CloudCenter.getInstance().acquireUrlByKind("af.help.report.learning.path"); - - private static final String PARAMETER_LEARNING_PATH = CloudCenter.getInstance().acquireUrlByKind("af.help.param.learning.path"); - - private static final String FILL_LEARNING_PATH = CloudCenter.getInstance().acquireUrlByKind("af.help.fill.learning.path"); - - private static final String API_SUMMARY = CloudCenter.getInstance().acquireUrlByKind("af.help.api.summary"); - - private static final String MONTHLY_DOCUMENT = CloudCenter.getInstance().acquireUrlByKind("af.help.monthly.document"); - - private static final String DEFAULT_RECOMMEND = "[ { \"name\":\"快速入门指南\", \"link\":\"" + QUICK_START_URL + "\" }, { \"name\":\"报表应用学习路径\", \"link\":\"" + REPORT_LEARNING_PATH + "\" }, { \"name\":\"参数应用学习路径\", \"link\":\"" + PARAMETER_LEARNING_PATH + "\" }, { \"name\":\"填报学习路径\", \"link\":\"" + FILL_LEARNING_PATH + "\" }, { \"name\":\"API接口汇总\", \"link\":\"" + API_SUMMARY + "\" }, { \"name\":\"文档月刊\", \"link\":\"" + MONTHLY_DOCUMENT + "\" } ]"; - - public static final String ALPHA_HELP_RECOMMEND = CloudCenter.getInstance().acquireUrlByKind("af.recommend", DEFAULT_RECOMMEND); + /** + * get PluginSearchUrl + */ + public static String getPluginSearchUrl() { + return CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); + }; + + /** + * get SearchAllPluginUrl + */ + public static String getSearchAllPluginUrl() { + return CloudCenter.getInstance().acquireUrlByKind("plugin.all.searchAPI"); + } + + /** + * get PluginUrl + */ + public static String getPluginUrl() { + return CloudCenter.getInstance().acquireUrlByKind("af.pluginInfo"); + } + + /** + * get ReuseUrl + */ + public static String getReuseUrl() { + return CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo"); + } + + /** + * get DocumentDocUrl + */ + public static String getDocumentDocUrl() { + return CloudCenter.getInstance().acquireUrlByKind("af.doc_view"); + } + + /** + * get DocumentSearchUrl + */ + public static String getDocumentSearchUrl() { + return CloudCenter.getInstance().acquireUrlByKind("af.doc_search"); + } + + /** + * get DocumentInformationUrl + */ + public static String getDocumentInformationUrl() { + return CloudCenter.getInstance().acquireUrlByKind("af.doc_info"); + } + + /** + * get PluginImageUrl + */ + public static String getPluginImageUrl() { + return CloudCenter.getInstance().acquireUrlByKind("af.plugin_image"); + } + + /** + * get CloudServerUrl + */ + public static String getCloudServerUrl() { + return CloudCenter.getInstance().acquireUrlByKind("af.record"); + } + + /** + * get SearchApi + */ + public static String getSearchApi() { + return CloudCenter.getInstance().acquireUrlByKind("af.cloud_search"); + } + + /** + * get SimilarSearchUrlPrefix + */ + public static String getSimilarSearchUrlPrefix() { + return CloudCenter.getInstance().acquireUrlByKind("af.similar_search"); + } + + /** + * get ComplementAdviceSearchUrlPrefix + */ + public static String getComplementAdviceSearchUrlPrefix() { + return CloudCenter.getInstance().acquireUrlByKind("af.advice_search"); + } + + /** + * get AlphaHotSearch + */ + public static String getAlphaHotSearch() { + return CloudCenter.getInstance().acquireUrlByKind("af.hot_search"); + } + + /** + * get AlphaGoToForum + */ + public static String getAlphaGoToForum() { + return CloudCenter.getInstance().acquireUrlByKind("af.go_fourm"); + } + + /** + * get AlphaGoToWeb + */ + public static String getAlphaGoToWeb() { + return CloudCenter.getInstance().acquireUrlByKind("af.go_web"); + } + + /** + * get AlphaPreview + */ + public static String getAlphaPreview() { + return CloudCenter.getInstance().acquireUrlByKind("af.preview"); + } + + /** + * get AlphaCid + */ + public static String getAlphaCid() { + return CloudCenter.getInstance().acquireUrlByKind("af.cid.new"); + } + + /** + * get AlphaCidUserGroupInfo + */ + public static String getAlphaCidUserGroupInfo() { + return CloudCenter.getInstance().acquireUrlByKind("af.cid.user.group.info"); + } + + /** + * get DefaultRecommend + */ + public static String getDefaultRecommend() { + String quickStartUrl = CloudCenter.getInstance().acquireUrlByKind("af.help.quick.start"); + String reportLearningPath = CloudCenter.getInstance().acquireUrlByKind("af.help.report.learning.path"); + String parameterLearningPath = CloudCenter.getInstance().acquireUrlByKind("af.help.param.learning.path"); + String fillLearningPath = CloudCenter.getInstance().acquireUrlByKind("af.help.fill.learning.path"); + String apiSummary = CloudCenter.getInstance().acquireUrlByKind("af.help.api.summary"); + String monthlyDocument = CloudCenter.getInstance().acquireUrlByKind("af.help.monthly.document"); + return "[{\"name\":\"快速入门指南\", \"link\":\"" + quickStartUrl + "\"}," + + "{\"name\":\"报表应用学习路径\", \"link\":\"" + reportLearningPath + "\"}," + + "{\"name\":\"参数应用学习路径\", \"link\":\"" + parameterLearningPath + "\"}," + + "{\"name\":\"填报学习路径\", \"link\":\"" + fillLearningPath + "\"}," + + "{\"name\":\"API接口汇总\", \"link\":\"" + apiSummary + "\"}," + + "{\"name\":\"文档月刊\", \"link\":\"" + monthlyDocument + "\"} ]"; + } + + /** + * get AlphaHelpRecommend + */ + public static String getAlphaHelpRecommend() { + return CloudCenter.getInstance().acquireUrlByKind("af.recommend", getDefaultRecommend()); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/BottomModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/BottomModel.java index fff60ea1f6..7699879484 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/BottomModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/BottomModel.java @@ -48,7 +48,7 @@ public class BottomModel extends AlphaCellModel { @Override public void doAction() { try { - Desktop.getDesktop().browse(new URI(AlphaFineCloudConstants.ALPHA_GO_TO_FORUM)); + Desktop.getDesktop().browse(new URI(AlphaFineCloudConstants.getAlphaGoToForum())); } catch (IOException | URISyntaxException e) { FineLoggerFactory.getLogger().error(e.getMessage()); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java index 8fa7ca2515..e5c1638f75 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java @@ -26,8 +26,8 @@ public class DocumentModel extends AlphaCellModel { public DocumentModel(String name, String content, int documentId) { super(name, content, CellType.DOCUMENT); this.documentId = documentId; - this.informationUrl = AlphaFineCloudConstants.DOCUMENT_INFORMATION_URL + documentId; - this.documentUrl = AlphaFineCloudConstants.DOCUMENT_DOC_URL + documentId + ".html"; + this.informationUrl = AlphaFineCloudConstants.getDocumentInformationUrl() + documentId; + this.documentUrl = AlphaFineCloudConstants.getDocumentDocUrl() + documentId + ".html"; } public DocumentModel(String name, String content, int documentId, int searchCount) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java index 7eda90015d..f936376bb2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java @@ -36,9 +36,9 @@ public class PluginModel extends AlphaCellModel { this.price = price; this.pluginId = pluginId; if (getType() == CellType.PLUGIN) { - this.informationUrl = AlphaFineCloudConstants.PLUGIN_URL + id; + this.informationUrl = AlphaFineCloudConstants.getPluginUrl() + id; } else { - this.informationUrl = AlphaFineCloudConstants.REUSE_URL + id; + this.informationUrl = AlphaFineCloudConstants.getReuseUrl() + id; } } @@ -99,7 +99,7 @@ public class PluginModel extends AlphaCellModel { @Override public void doAction() { - if (StringUtils.isBlank(this.pluginId) || !WorkContext.getCurrent().isLocal()) { + if ((StringUtils.isBlank(this.pluginId) && StringUtils.isBlank(this.getName())) || !WorkContext.getCurrent().isLocal()) { return; } WebViewDlgHelper.createPluginDialog(getName()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java index 79e02f18e0..4c304d107f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java @@ -47,7 +47,7 @@ public class RobotModel extends AlphaCellModel { public static String getContent(String titleStr) { String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + titleStr); - String url = AlphaFineCloudConstants.ALPHA_GO_TO_WEB + titleStr + "&token=" + token; + String url = AlphaFineCloudConstants.getAlphaGoToWeb() + titleStr + "&token=" + token; try { String result = HttpToolbox.get(url); @@ -84,7 +84,7 @@ public class RobotModel extends AlphaCellModel { @Override public void doAction() { try { - Desktop.getDesktop().browse(new URI(AlphaFineCloudConstants.ALPHA_PREVIEW + URLEncoder.encode(super.getName(), EncodeConstants.ENCODING_UTF_8))); + Desktop.getDesktop().browse(new URI(AlphaFineCloudConstants.getAlphaPreview() + URLEncoder.encode(super.getName(), EncodeConstants.ENCODING_UTF_8))); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage()); } catch (URISyntaxException e) { 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 f7112c27a6..dab1051258 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 @@ -969,7 +969,7 @@ public class AlphaFineDialog extends UIDialog { String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); para.put("token", CodeUtils.md5Encode(date, StringUtils.EMPTY, "MD5")); para.put("content", object.toString()); - HttpClient httpClient = new HttpClient(AlphaFineCloudConstants.CLOUD_SERVER_URL, para, true); + HttpClient httpClient = new HttpClient(AlphaFineCloudConstants.getCloudServerUrl(), para, true); httpClient.asGet(); if (!httpClient.isServerAlive()) { FineLoggerFactory.getLogger().error("Failed to sent data to server!"); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java index 87a27cd29d..bee71f5859 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java @@ -98,7 +98,7 @@ public class HelpDocumentNoResultPane extends JPanel { private Map generateMap() { - JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, AlphaFineCloudConstants.ALPHA_HELP_RECOMMEND); + JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, AlphaFineCloudConstants.getAlphaHelpRecommend()); Map linkMap = new LinkedHashMap<>(); for (int i = 0, len = jsonArray.size(); i < len; i++) { JSONObject json = jsonArray.getJSONObject(i); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java index 31082f9e44..0159959de2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java @@ -34,7 +34,7 @@ public class NoResultWithLinkPane extends NoResultPane { String[] para1 = title.split(TAG_A_START); String[] para2 = para1[1].split(TAG_A_END); - MessageWithLink messageWithLink = new MessageWithLink(para1[0], para2[0], AlphaFineCloudConstants.ALPHA_GO_TO_FORUM, para2[1], Color.WHITE, DesignUtils.getDefaultGUIFont().applySize(14), AlphaFineConstants.MEDIUM_GRAY) { + MessageWithLink messageWithLink = new MessageWithLink(para1[0], para2[0], AlphaFineCloudConstants.getAlphaGoToForum(), para2[1], Color.WHITE, DesignUtils.getDefaultGUIFont().applySize(14), AlphaFineConstants.MEDIUM_GRAY) { @Override protected void initListener(String link) { 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 7df9e3d4cc..2340766925 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 @@ -61,7 +61,7 @@ public class RobotPreviewPane extends JPanel { .replaceAll("\\('", StringUtils.EMPTY) .replaceAll("'\\)", StringUtils.EMPTY); try { - Desktop.getDesktop().browse(new URI(AlphaFineCloudConstants.ALPHA_PREVIEW + URLEncoder.encode(s, EncodeConstants.ENCODING_UTF_8))); + Desktop.getDesktop().browse(new URI(AlphaFineCloudConstants.getAlphaPreview() + URLEncoder.encode(s, EncodeConstants.ENCODING_UTF_8))); } catch (IOException | URISyntaxException e1) { FineLoggerFactory.getLogger().error(e1.getMessage()); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java index 8a9acb87c6..8aaa0abd5e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java @@ -41,7 +41,7 @@ public class ComplementAdviceManager { SearchResult searchResult = new SearchResult(); for (int j = 0; j < searchText.length; j++) { String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]); - String url = AlphaFineCloudConstants.COMPLEMENT_ADVICE_SEARCH_URL_PREFIX + "msg=" + searchText[j] + "&token=" + token; + String url = AlphaFineCloudConstants.getComplementAdviceSearchUrlPrefix() + "msg=" + searchText[j] + "&token=" + token; try { String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java index 5346e05ec1..a0815c2e3b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java @@ -75,7 +75,7 @@ public class HotIssuesManager { public String[][] getHotIssues() { try { - String result = HttpToolbox.get(AlphaFineCloudConstants.ALPHA_HOT_SEARCH); + String result = HttpToolbox.get(AlphaFineCloudConstants.getAlphaHotSearch()); JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, result); if(jsonArray != null){ for (int i = 0; i < HOT_ITEM_NUM; i++) { 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 f9729d1712..babf9f4865 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 @@ -74,7 +74,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { int searchCount = object.optInt("searchCount"); String imageUrl = null; try { - imageUrl = isFromCloud ? AlphaFineCloudConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.optString("pic").toString().substring(AlphaFineCloudConstants.PLUGIN_IMAGE_URL.length()), "utf8") : object.optString("pic"); + imageUrl = isFromCloud ? AlphaFineCloudConstants.getPluginImageUrl() + URLEncoder.encode(object.optString("pic").toString().substring(AlphaFineCloudConstants.getPluginImageUrl().length()), "utf8") : object.optString("pic"); } catch (UnsupportedEncodingException e) { FineLoggerFactory.getLogger().error("plugin icon error: " + e.getMessage()); } @@ -126,7 +126,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { for (int j = 0; j < searchText.length; j++) { try { String encodedKey = URLEncoder.encode(searchText[j], EncodeConstants.ENCODING_UTF_8); - String url = AlphaFineCloudConstants.PLUGIN_SEARCH_URL + "?keyword=" + encodedKey; + String url = AlphaFineCloudConstants.getPluginSearchUrl() + "?keyword=" + encodedKey; String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); JSONObject jsonObject = new JSONObject(result); @@ -174,7 +174,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { public SearchResult getDefaultResult() { this.defaultModelList = new SearchResult(); try { - String url = AlphaFineCloudConstants.SEARCH_ALL_PLUGIN_URL; + String url = AlphaFineCloudConstants.getSearchAllPluginUrl(); String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); JSONObject jsonObject = new JSONObject(result); 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 c20d3bb48b..f4299fc7e3 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 @@ -83,7 +83,7 @@ public class ProductNewsSearchManager { public List getProductNewsList() throws Exception { productNewsList = new ArrayList<>(); idSet = new HashSet<>(); - String jsonStr = HttpToolbox.get(AlphaFineCloudConstants.ALPHA_CID); + String jsonStr = HttpToolbox.get(AlphaFineCloudConstants.getAlphaCid()); AlphaFineHelper.checkCancel(); JSONObject cidJSON = JSONFactory.createJSON(JSON.OBJECT, jsonStr); JSONArray jsonArray = cidJSON.getJSONArray("data"); @@ -151,7 +151,7 @@ public class ProductNewsSearchManager { * 根据用户组id,查询用户组信息(改用户组中的所有设计器id) * */ private Set searchUserGroupInfo(String userGroupId) { - String url = AlphaFineCloudConstants.ALPHA_CID_USER_GROUP_INFO + AlphaFineConstants.SEARCH_BY_ID + userGroupId; + String url = AlphaFineCloudConstants.getAlphaCidUserGroupInfo() + AlphaFineConstants.SEARCH_BY_ID + userGroupId; Set idSet = new HashSet<>(); try { String jsonStr = HttpToolbox.get(url); 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 88872d2d8b..d0fcbd3b0c 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 @@ -60,7 +60,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { for (int j = 0; j < searchText.length; j++) { searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY); try { - String url = AlphaFineCloudConstants.SEARCH_API + CodeUtils.cjkEncode(searchText[j]); + String url = AlphaFineCloudConstants.getSearchApi() + CodeUtils.cjkEncode(searchText[j]); String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); JSONObject jsonObject = new JSONObject(result); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java index 5e08795ef1..18afdcaeba 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java @@ -48,7 +48,7 @@ public class SimilarSearchManager implements AlphaFineSearchProvider { SearchResult allModelList = new SearchResult(); for (int j = 0; j < searchText.length; j++) { String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]); - String url = AlphaFineCloudConstants.SIMILAR_SEARCH_URL_PREFIX + "msg=" + searchText[j] + "&token=" + token; + String url = AlphaFineCloudConstants.getSimilarSearchUrlPrefix() + "msg=" + searchText[j] + "&token=" + token; try { String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java b/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java index 2311514d17..8c62b827ee 100644 --- a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java +++ b/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java @@ -14,8 +14,8 @@ public class ModelTest { Assert.assertEquals("name", documentModel.getName()); Assert.assertEquals("content", documentModel.getContent()); Assert.assertEquals(1, documentModel.getDocumentId()); - Assert.assertEquals(AlphaFineCloudConstants.DOCUMENT_DOC_URL + documentModel.getDocumentId() + ".html", documentModel.getDocumentUrl()); - Assert.assertEquals(AlphaFineCloudConstants.DOCUMENT_INFORMATION_URL + documentModel.getDocumentId(), documentModel.getInformationUrl()); + Assert.assertEquals(AlphaFineCloudConstants.getDocumentDocUrl() + documentModel.getDocumentId() + ".html", documentModel.getDocumentUrl()); + Assert.assertEquals(AlphaFineCloudConstants.getDocumentInformationUrl() + documentModel.getDocumentId(), documentModel.getInformationUrl()); Assert.assertEquals(documentModel.getStoreInformation(), documentModel.getInformationUrl()); Assert.assertEquals(CellType.DOCUMENT, documentModel.getType()); Assert.assertEquals(true, documentModel.hasAction()); From f4b7b83f913d786320f748449b65a6e9676bca59 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Wed, 28 Sep 2022 16:17:45 +0800 Subject: [PATCH 2/7] =?UTF-8?q?REPORT-81241=E3=80=90=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=E3=80=91=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83=E6=96=AD=E7=BD=91=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E6=97=A0=E5=8F=8D=E5=BA=94?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9pr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/cell/model/PluginModel.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java index f936376bb2..0bdb1ec669 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java @@ -98,8 +98,10 @@ public class PluginModel extends AlphaCellModel { @Override public void doAction() { - - if ((StringUtils.isBlank(this.pluginId) && StringUtils.isBlank(this.getName())) || !WorkContext.getCurrent().isLocal()) { + if (StringUtils.isBlank(this.pluginId) && StringUtils.isBlank(this.getName())) { + return; + } + if (!WorkContext.getCurrent().isLocal()) { return; } WebViewDlgHelper.createPluginDialog(getName()); From 22d54f426c60f698d8eafc551f487cfd7bc3eb37 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Wed, 28 Sep 2022 16:57:51 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-81324=20alphafine=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=B8=86=E8=BD=AF=E5=B8=82=E5=9C=BA=E6=8E=A5=E5=8F=A3=2011?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=90=9C=E5=88=B010=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/helper/FineMarketClientHelper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java index f4add755e5..22c6b4c45c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java @@ -48,6 +48,7 @@ public class FineMarketClientHelper { private static final String CERTIFICATE_PUBLIC_KEY = FineMarketPublicKeyHolder.getInstance().getDefaultKey(); public static final String FINE_MARKET_TEMPLATE_INFO = CloudCenter.getInstance().acquireUrlByKind("market.template.info"); public static final String FINE_MARKET_TEMPLATE_URL = CloudCenter.getInstance().acquireUrlByKind("market.template.url"); + public static final String VERSION = "&version=11.0"; public static final String FILE_DOWNLOAD = "file/download/"; public static final String PACKAGE_DOWNLOAD = "package/download/"; public static final String TEMPLATES_PARENT_PACKAGE = "parent/"; @@ -268,7 +269,7 @@ public class FineMarketClientHelper { } public @Nullable JSONArray getTemplateInfoByName(String name) throws IOException { - String url = FINE_MARKET_TEMPLATE_INFO + NAME_SEARCH + name; + String url = FINE_MARKET_TEMPLATE_INFO + NAME_SEARCH + name + VERSION; String jsonString = HttpToolbox.get(url); JSONObject jsonObject = new JSONObject(jsonString); String responseState = (String) jsonObject.get(RESPONSE_STATE); From da5b635450794685b542129bb48ec3b8aec4c231 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Wed, 28 Sep 2022 21:40:20 +0800 Subject: [PATCH 4/7] =?UTF-8?q?REPORT-81241=E3=80=90=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=E3=80=91=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83=E6=96=AD=E7=BD=91=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E6=97=A0=E5=8F=8D=E5=BA=94?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9pr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineCloudConstants.java | 25 ++++++++----------- .../search/helper/FineMarketClientHelper.java | 11 +++++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java index b1ff5d8606..ee85b7078d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java @@ -12,14 +12,14 @@ import com.fr.general.CloudCenter; public class AlphaFineCloudConstants { /** - * get PluginSearchUrl + * 获取插件搜索api */ public static String getPluginSearchUrl() { return CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); }; /** - * get SearchAllPluginUrl + * 帆软市场里全部插件api */ public static String getSearchAllPluginUrl() { return CloudCenter.getInstance().acquireUrlByKind("plugin.all.searchAPI"); @@ -47,21 +47,21 @@ public class AlphaFineCloudConstants { } /** - * get DocumentSearchUrl + * 帮助文档搜索api */ public static String getDocumentSearchUrl() { return CloudCenter.getInstance().acquireUrlByKind("af.doc_search"); } /** - * get DocumentInformationUrl + * 帮助文档信息api */ public static String getDocumentInformationUrl() { return CloudCenter.getInstance().acquireUrlByKind("af.doc_info"); } /** - * get PluginImageUrl + * 插件图片api */ public static String getPluginImageUrl() { return CloudCenter.getInstance().acquireUrlByKind("af.plugin_image"); @@ -96,14 +96,14 @@ public class AlphaFineCloudConstants { } /** - * get AlphaHotSearch + * 获取热门问题 */ public static String getAlphaHotSearch() { return CloudCenter.getInstance().acquireUrlByKind("af.hot_search"); } /** - * get AlphaGoToForum + * 跳转论坛url */ public static String getAlphaGoToForum() { return CloudCenter.getInstance().acquireUrlByKind("af.go_fourm"); @@ -124,23 +124,20 @@ public class AlphaFineCloudConstants { } /** - * get AlphaCid + * cid系统的产品动态api */ public static String getAlphaCid() { return CloudCenter.getInstance().acquireUrlByKind("af.cid.new"); } /** - * get AlphaCidUserGroupInfo + * cid系统的 用户组信息api */ public static String getAlphaCidUserGroupInfo() { return CloudCenter.getInstance().acquireUrlByKind("af.cid.user.group.info"); } - /** - * get DefaultRecommend - */ - public static String getDefaultRecommend() { + private static String getDefaultRecommend() { String quickStartUrl = CloudCenter.getInstance().acquireUrlByKind("af.help.quick.start"); String reportLearningPath = CloudCenter.getInstance().acquireUrlByKind("af.help.report.learning.path"); String parameterLearningPath = CloudCenter.getInstance().acquireUrlByKind("af.help.param.learning.path"); @@ -156,7 +153,7 @@ public class AlphaFineCloudConstants { } /** - * get AlphaHelpRecommend + * 获取默认推荐帮助文档url */ public static String getAlphaHelpRecommend() { return CloudCenter.getInstance().acquireUrlByKind("af.recommend", getDefaultRecommend()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java index 22c6b4c45c..1f9d5fb09a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java @@ -48,12 +48,13 @@ public class FineMarketClientHelper { private static final String CERTIFICATE_PUBLIC_KEY = FineMarketPublicKeyHolder.getInstance().getDefaultKey(); public static final String FINE_MARKET_TEMPLATE_INFO = CloudCenter.getInstance().acquireUrlByKind("market.template.info"); public static final String FINE_MARKET_TEMPLATE_URL = CloudCenter.getInstance().acquireUrlByKind("market.template.url"); - public static final String VERSION = "&version=11.0"; + public static final String VERSION = "version"; + private static final String CURRENT_VERSION = "11.0"; public static final String FILE_DOWNLOAD = "file/download/"; public static final String PACKAGE_DOWNLOAD = "package/download/"; public static final String TEMPLATES_PARENT_PACKAGE = "parent/"; public static final String TEMPLATES_TAGS = "filter"; - public static final String NAME_SEARCH = "?searchKeyword="; + public static final String NAME_SEARCH = "searchKeyword"; public static final String RESPONSE_STATE = "state"; public static final String RESPONSE_SUCCESS = "ok"; @@ -269,8 +270,10 @@ public class FineMarketClientHelper { } public @Nullable JSONArray getTemplateInfoByName(String name) throws IOException { - String url = FINE_MARKET_TEMPLATE_INFO + NAME_SEARCH + name + VERSION; - String jsonString = HttpToolbox.get(url); + Map params = new HashMap(); + params.put(NAME_SEARCH, name); + params.put(VERSION, CURRENT_VERSION); + String jsonString = HttpToolbox.get(FINE_MARKET_TEMPLATE_INFO, params); JSONObject jsonObject = new JSONObject(jsonString); String responseState = (String) jsonObject.get(RESPONSE_STATE); if (RESPONSE_SUCCESS.equals(responseState)) { From c726fd6c071148ff4bc8d4b3c362a4799a9aebb9 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Thu, 29 Sep 2022 11:47:49 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-81241=E3=80=90=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=E3=80=91=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83=E6=96=AD=E7=BD=91=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E6=97=A0=E5=8F=8D=E5=BA=94?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0url=E7=BC=96=E7=A0=81=20=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineCloudConstants.java | 76 +++++++++++++------ .../alphafine/cell/model/PluginModel.java | 10 ++- .../search/helper/FineMarketClientHelper.java | 4 +- .../manager/impl/ComplementAdviceManager.java | 7 +- .../manager/impl/DocumentSearchManager.java | 2 +- .../manager/impl/SimilarSearchManager.java | 7 +- 6 files changed, 74 insertions(+), 32 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java index ee85b7078d..35b363eb71 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java @@ -11,139 +11,165 @@ import com.fr.general.CloudCenter; */ public class AlphaFineCloudConstants { + private static final String PLUGIN_SEARCH_API = "plugin.searchAPI"; + private static final String PLUGIN_ALL_SEARCH_API = "plugin.all.searchAPI"; + private static final String AF_PLUGIN_INFO = "af.pluginInfo"; + private static final String AF_REUSE_INFO = "af.reuseInfo"; + private static final String AF_DOC_VIEW = "af.doc_view"; + private static final String AF_DOC_SEARCH = "af.doc_search"; + private static final String AF_DOC_INFO = "af.doc_info"; + private static final String AF_PLUGIN_IMAGE = "af.plugin_image"; + private static final String AF_RECORD = "af.record"; + private static final String AF_CLOUD_SEARCH = "af.cloud_search"; + private static final String AF_SIMILAR_SEARCH = "af.similar_search"; + private static final String AF_ADVICE_SEARCH = "af.advice_search"; + private static final String AF_HOT_SEARCH = "af.hot_search"; + private static final String AF_GO_FORUM = "af.go_fourm"; + private static final String AF_GO_WEB = "af.go_web"; + private static final String AF_PREVIEW = "af.preview"; + private static final String AF_CID_NEW = "af.cid.new"; + private static final String AF_CID_USER_GROUP_INFO = "af.cid.user.group.info"; + private static final String AF_HELP_QUICK_START = "af.help.quick.start"; + private static final String AF_HELP_REPORT_LEARNING_PATH = "af.help.report.learning.path"; + private static final String AF_HELP_PARAM_LEARNING_PATH = "af.help.param.learning.path"; + private static final String AF_HELP_FILL_LEARNING_PATH = "af.help.fill.learning.path"; + private static final String AF_HELP_API_SUMMARY = "af.help.api.summary"; + private static final String AF_HELP_MONTHLY_DOCUMENT = "af.help.monthly.document"; + private static final String AF_RECOMMEND = "af.recommend"; + /** * 获取插件搜索api */ public static String getPluginSearchUrl() { - return CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); + return CloudCenter.getInstance().acquireUrlByKind(PLUGIN_SEARCH_API); }; /** * 帆软市场里全部插件api */ public static String getSearchAllPluginUrl() { - return CloudCenter.getInstance().acquireUrlByKind("plugin.all.searchAPI"); + return CloudCenter.getInstance().acquireUrlByKind(PLUGIN_ALL_SEARCH_API); } /** * get PluginUrl */ public static String getPluginUrl() { - return CloudCenter.getInstance().acquireUrlByKind("af.pluginInfo"); + return CloudCenter.getInstance().acquireUrlByKind(AF_PLUGIN_INFO); } /** * get ReuseUrl */ public static String getReuseUrl() { - return CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo"); + return CloudCenter.getInstance().acquireUrlByKind(AF_REUSE_INFO); } /** * get DocumentDocUrl */ public static String getDocumentDocUrl() { - return CloudCenter.getInstance().acquireUrlByKind("af.doc_view"); + return CloudCenter.getInstance().acquireUrlByKind(AF_DOC_VIEW); } /** * 帮助文档搜索api */ public static String getDocumentSearchUrl() { - return CloudCenter.getInstance().acquireUrlByKind("af.doc_search"); + return CloudCenter.getInstance().acquireUrlByKind(AF_DOC_SEARCH); } /** * 帮助文档信息api */ public static String getDocumentInformationUrl() { - return CloudCenter.getInstance().acquireUrlByKind("af.doc_info"); + return CloudCenter.getInstance().acquireUrlByKind(AF_DOC_INFO); } /** * 插件图片api */ public static String getPluginImageUrl() { - return CloudCenter.getInstance().acquireUrlByKind("af.plugin_image"); + return CloudCenter.getInstance().acquireUrlByKind(AF_PLUGIN_IMAGE); } /** * get CloudServerUrl */ public static String getCloudServerUrl() { - return CloudCenter.getInstance().acquireUrlByKind("af.record"); + return CloudCenter.getInstance().acquireUrlByKind(AF_RECORD); } /** * get SearchApi */ public static String getSearchApi() { - return CloudCenter.getInstance().acquireUrlByKind("af.cloud_search"); + return CloudCenter.getInstance().acquireUrlByKind(AF_CLOUD_SEARCH); } /** * get SimilarSearchUrlPrefix */ public static String getSimilarSearchUrlPrefix() { - return CloudCenter.getInstance().acquireUrlByKind("af.similar_search"); + return CloudCenter.getInstance().acquireUrlByKind(AF_SIMILAR_SEARCH); } /** * get ComplementAdviceSearchUrlPrefix */ public static String getComplementAdviceSearchUrlPrefix() { - return CloudCenter.getInstance().acquireUrlByKind("af.advice_search"); + return CloudCenter.getInstance().acquireUrlByKind(AF_ADVICE_SEARCH); } /** * 获取热门问题 */ public static String getAlphaHotSearch() { - return CloudCenter.getInstance().acquireUrlByKind("af.hot_search"); + return CloudCenter.getInstance().acquireUrlByKind(AF_HOT_SEARCH); } /** * 跳转论坛url */ public static String getAlphaGoToForum() { - return CloudCenter.getInstance().acquireUrlByKind("af.go_fourm"); + return CloudCenter.getInstance().acquireUrlByKind(AF_GO_FORUM); } /** * get AlphaGoToWeb */ public static String getAlphaGoToWeb() { - return CloudCenter.getInstance().acquireUrlByKind("af.go_web"); + return CloudCenter.getInstance().acquireUrlByKind(AF_GO_WEB); } /** * get AlphaPreview */ public static String getAlphaPreview() { - return CloudCenter.getInstance().acquireUrlByKind("af.preview"); + return CloudCenter.getInstance().acquireUrlByKind(AF_PREVIEW); } /** * cid系统的产品动态api */ public static String getAlphaCid() { - return CloudCenter.getInstance().acquireUrlByKind("af.cid.new"); + return CloudCenter.getInstance().acquireUrlByKind(AF_CID_NEW); } /** * cid系统的 用户组信息api */ public static String getAlphaCidUserGroupInfo() { - return CloudCenter.getInstance().acquireUrlByKind("af.cid.user.group.info"); + return CloudCenter.getInstance().acquireUrlByKind(AF_CID_USER_GROUP_INFO); } private static String getDefaultRecommend() { - String quickStartUrl = CloudCenter.getInstance().acquireUrlByKind("af.help.quick.start"); - String reportLearningPath = CloudCenter.getInstance().acquireUrlByKind("af.help.report.learning.path"); - String parameterLearningPath = CloudCenter.getInstance().acquireUrlByKind("af.help.param.learning.path"); - String fillLearningPath = CloudCenter.getInstance().acquireUrlByKind("af.help.fill.learning.path"); - String apiSummary = CloudCenter.getInstance().acquireUrlByKind("af.help.api.summary"); - String monthlyDocument = CloudCenter.getInstance().acquireUrlByKind("af.help.monthly.document"); + String quickStartUrl = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_QUICK_START); + String reportLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_REPORT_LEARNING_PATH); + String parameterLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_PARAM_LEARNING_PATH); + String fillLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_FILL_LEARNING_PATH); + String apiSummary = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_API_SUMMARY); + String monthlyDocument = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_MONTHLY_DOCUMENT); return "[{\"name\":\"快速入门指南\", \"link\":\"" + quickStartUrl + "\"}," + "{\"name\":\"报表应用学习路径\", \"link\":\"" + reportLearningPath + "\"}," + "{\"name\":\"参数应用学习路径\", \"link\":\"" + parameterLearningPath + "\"}," + @@ -156,6 +182,6 @@ public class AlphaFineCloudConstants { * 获取默认推荐帮助文档url */ public static String getAlphaHelpRecommend() { - return CloudCenter.getInstance().acquireUrlByKind("af.recommend", getDefaultRecommend()); + return CloudCenter.getInstance().acquireUrlByKind(AF_RECOMMEND, getDefaultRecommend()); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java index 0bdb1ec669..9c60db3192 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java @@ -104,7 +104,15 @@ public class PluginModel extends AlphaCellModel { if (!WorkContext.getCurrent().isLocal()) { return; } - WebViewDlgHelper.createPluginDialog(getName()); + openPluginStore(getName()); + } + + /** + * 打开插件商城 + * 方便埋点 + */ + private void openPluginStore(String name) { + WebViewDlgHelper.createPluginDialog(name); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java index 1f9d5fb09a..42b28cfe8a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.search.helper; +import com.fr.base.login.ClientHelper; import com.fr.design.DesignerEnvManager; import com.fr.design.extra.PluginConstants; import com.fr.design.mainframe.alphafine.download.FineMarketDownloadManager; @@ -12,6 +13,7 @@ import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.market.key.FineMarketPublicKeyHolder; import com.fr.security.SecurityToolbox; +import com.fr.stable.EncodeConstants; import com.fr.stable.StableUtils; import com.fr.third.org.apache.http.HttpEntity; import com.fr.third.org.apache.http.HttpException; @@ -327,7 +329,7 @@ public class FineMarketClientHelper { * */ private void initTags() throws IOException { tags = new HashMap<>(); - String url = FINE_MARKET_TEMPLATE_INFO + TEMPLATES_TAGS; + String url = FINE_MARKET_TEMPLATE_INFO + ClientHelper.urlEncode(TEMPLATES_TAGS, EncodeConstants.ENCODING_UTF_8); String jsonString = HttpToolbox.get(url); JSONObject jsonObject = new JSONObject(jsonString); String responseState = (String) jsonObject.get(RESPONSE_STATE); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java index 8aaa0abd5e..a00803210e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.search.manager.impl; +import com.fr.base.login.ClientHelper; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineCloudConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants; @@ -7,6 +8,7 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.general.http.HttpToolbox; import com.fr.log.FineLoggerFactory; +import com.fr.stable.EncodeConstants; import com.fr.third.org.apache.commons.codec.digest.DigestUtils; @@ -40,8 +42,9 @@ public class ComplementAdviceManager { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { SearchResult searchResult = new SearchResult(); for (int j = 0; j < searchText.length; j++) { - String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]); - String url = AlphaFineCloudConstants.getComplementAdviceSearchUrlPrefix() + "msg=" + searchText[j] + "&token=" + token; + String msg = ClientHelper.urlEncode(searchText[j], EncodeConstants.ENCODING_UTF_8); + String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + msg); + String url = AlphaFineCloudConstants.getComplementAdviceSearchUrlPrefix() + "msg=" + msg + "&token=" + ClientHelper.urlEncode(token, EncodeConstants.ENCODING_UTF_8); try { String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); 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 0c8ef70536..69c34ba61c 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 @@ -71,7 +71,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { searchResult = new SearchResult(); for (int j = 0; j < searchText.length; j++) { long start = System.currentTimeMillis(); - String url = AlphaFineCloudConstants.DOCUMENT_SEARCH_URL + searchText[j]; + String url = AlphaFineCloudConstants.getDocumentSearchUrl() + searchText[j]; try { String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java index 18afdcaeba..102ead1bb2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.search.manager.impl; +import com.fr.base.login.ClientHelper; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineCloudConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants; @@ -13,6 +14,7 @@ import com.fr.general.http.HttpToolbox; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; +import com.fr.stable.EncodeConstants; import com.fr.third.org.apache.commons.codec.digest.DigestUtils; /** @@ -47,8 +49,9 @@ public class SimilarSearchManager implements AlphaFineSearchProvider { } SearchResult allModelList = new SearchResult(); for (int j = 0; j < searchText.length; j++) { - String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]); - String url = AlphaFineCloudConstants.getSimilarSearchUrlPrefix() + "msg=" + searchText[j] + "&token=" + token; + String msg = ClientHelper.urlEncode(searchText[j], EncodeConstants.ENCODING_UTF_8); + String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + msg); + String url = AlphaFineCloudConstants.getSimilarSearchUrlPrefix() + "msg=" + msg + "&token=" + ClientHelper.urlEncode(token, EncodeConstants.ENCODING_UTF_8); try { String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); From 34750dd81b6c50f2e67b2b388def15a0a0076345 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Thu, 29 Sep 2022 15:18:33 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-81241=E3=80=90=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=E3=80=91=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83=E6=96=AD=E7=BD=91=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E6=97=A0=E5=8F=8D=E5=BA=94?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9Burl=E7=BC=96=E7=A0=81=20?= =?UTF-8?q?=E7=BB=99=E4=B8=80=E4=BA=9B=E5=B8=B8=E9=87=8F=E5=8A=A0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineCloudConstants.java | 31 ++++++++++--------- .../alphafine/cell/model/RobotModel.java | 4 ++- .../manager/impl/ComplementAdviceManager.java | 2 +- .../manager/impl/SimilarSearchManager.java | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java index 35b363eb71..6f8b296aaa 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java @@ -1,5 +1,6 @@ package com.fr.design.actions.help.alphafine; +import com.fr.design.i18n.Toolkit; import com.fr.general.CloudCenter; /** @@ -52,21 +53,21 @@ public class AlphaFineCloudConstants { } /** - * get PluginUrl + * 获取插件信息api */ public static String getPluginUrl() { return CloudCenter.getInstance().acquireUrlByKind(AF_PLUGIN_INFO); } /** - * get ReuseUrl + * 获取组件信息api */ public static String getReuseUrl() { return CloudCenter.getInstance().acquireUrlByKind(AF_REUSE_INFO); } /** - * get DocumentDocUrl + * 获取帮助文档url */ public static String getDocumentDocUrl() { return CloudCenter.getInstance().acquireUrlByKind(AF_DOC_VIEW); @@ -94,28 +95,28 @@ public class AlphaFineCloudConstants { } /** - * get CloudServerUrl + * 获取云端接口,用于上传alphafine搜索记录 */ public static String getCloudServerUrl() { return CloudCenter.getInstance().acquireUrlByKind(AF_RECORD); } /** - * get SearchApi + * 获取搜索api,输入搜索词,返回fr的相关功能 */ public static String getSearchApi() { return CloudCenter.getInstance().acquireUrlByKind(AF_CLOUD_SEARCH); } /** - * get SimilarSearchUrlPrefix + * 获取模糊搜索api前缀,输入搜索词,返回alphaFine相关内容,插件,文档,功能等 */ public static String getSimilarSearchUrlPrefix() { return CloudCenter.getInstance().acquireUrlByKind(AF_SIMILAR_SEARCH); } /** - * get ComplementAdviceSearchUrlPrefix + * 补全建议搜索结果 api,与AF_SIMILAR_SEARCH接口类似,但是返回的信息更全 */ public static String getComplementAdviceSearchUrlPrefix() { return CloudCenter.getInstance().acquireUrlByKind(AF_ADVICE_SEARCH); @@ -136,14 +137,14 @@ public class AlphaFineCloudConstants { } /** - * get AlphaGoToWeb + * 推荐搜索api,输入搜索词,返回猜你想搜的内容(html格式) */ public static String getAlphaGoToWeb() { return CloudCenter.getInstance().acquireUrlByKind(AF_GO_WEB); } /** - * get AlphaPreview + * 帆软智能客服页面url */ public static String getAlphaPreview() { return CloudCenter.getInstance().acquireUrlByKind(AF_PREVIEW); @@ -170,12 +171,12 @@ public class AlphaFineCloudConstants { String fillLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_FILL_LEARNING_PATH); String apiSummary = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_API_SUMMARY); String monthlyDocument = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_MONTHLY_DOCUMENT); - return "[{\"name\":\"快速入门指南\", \"link\":\"" + quickStartUrl + "\"}," + - "{\"name\":\"报表应用学习路径\", \"link\":\"" + reportLearningPath + "\"}," + - "{\"name\":\"参数应用学习路径\", \"link\":\"" + parameterLearningPath + "\"}," + - "{\"name\":\"填报学习路径\", \"link\":\"" + fillLearningPath + "\"}," + - "{\"name\":\"API接口汇总\", \"link\":\"" + apiSummary + "\"}," + - "{\"name\":\"文档月刊\", \"link\":\"" + monthlyDocument + "\"} ]"; + return "[{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Quick_Start") + "\", \"link\":\"" + quickStartUrl + "\"}," + + "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Report_Learning") + "\", \"link\":\"" + reportLearningPath + "\"}," + + "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Parameter_Learning") + "\", \"link\":\"" + parameterLearningPath + "\"}," + + "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Fill_Learning") + "\", \"link\":\"" + fillLearningPath + "\"}," + + "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Api_Summary") + "\", \"link\":\"" + apiSummary + "\"}," + + "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Monthly_Document") + "\", \"link\":\"" + monthlyDocument + "\"} ]"; } /** diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java index 4c304d107f..493bf0de7b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.cell.model; +import com.fr.base.login.ClientHelper; import com.fr.design.actions.help.alphafine.AlphaFineCloudConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; @@ -46,8 +47,9 @@ public class RobotModel extends AlphaCellModel { } public static String getContent(String titleStr) { + String encodedTitleStr = ClientHelper.urlEncode(titleStr, EncodeConstants.ENCODING_UTF_8); String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + titleStr); - String url = AlphaFineCloudConstants.getAlphaGoToWeb() + titleStr + "&token=" + token; + String url = AlphaFineCloudConstants.getAlphaGoToWeb() + encodedTitleStr + "&token=" + token; try { String result = HttpToolbox.get(url); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java index a00803210e..dbe810c8ea 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java @@ -43,7 +43,7 @@ public class ComplementAdviceManager { SearchResult searchResult = new SearchResult(); for (int j = 0; j < searchText.length; j++) { String msg = ClientHelper.urlEncode(searchText[j], EncodeConstants.ENCODING_UTF_8); - String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + msg); + String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]); String url = AlphaFineCloudConstants.getComplementAdviceSearchUrlPrefix() + "msg=" + msg + "&token=" + ClientHelper.urlEncode(token, EncodeConstants.ENCODING_UTF_8); try { String result = HttpToolbox.get(url); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java index 102ead1bb2..dc7866301e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java @@ -50,7 +50,7 @@ public class SimilarSearchManager implements AlphaFineSearchProvider { SearchResult allModelList = new SearchResult(); for (int j = 0; j < searchText.length; j++) { String msg = ClientHelper.urlEncode(searchText[j], EncodeConstants.ENCODING_UTF_8); - String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + msg); + String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]); String url = AlphaFineCloudConstants.getSimilarSearchUrlPrefix() + "msg=" + msg + "&token=" + ClientHelper.urlEncode(token, EncodeConstants.ENCODING_UTF_8); try { String result = HttpToolbox.get(url); From 3d8e0d5e6336e4b25c51fa072cd8b08d15d0c8cb Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Thu, 29 Sep 2022 15:58:03 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-81241=E3=80=90=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=E3=80=91=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83=E6=96=AD=E7=BD=91=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E6=97=A0=E5=8F=8D=E5=BA=94?= =?UTF-8?q?=20=E5=88=A0=E9=99=A4json=E5=AD=97=E7=AC=A6=E4=B8=B2=EF=BC=8C?= =?UTF-8?q?=E7=94=A8jsonarry=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineCloudConstants.java | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java index 6f8b296aaa..9fb243d1e8 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java @@ -2,6 +2,10 @@ package com.fr.design.actions.help.alphafine; import com.fr.design.i18n.Toolkit; import com.fr.general.CloudCenter; +import com.fr.json.JSONArray; + +import java.util.HashMap; +import java.util.Map; /** * 云端变量统一管理 @@ -38,6 +42,9 @@ public class AlphaFineCloudConstants { private static final String AF_HELP_MONTHLY_DOCUMENT = "af.help.monthly.document"; private static final String AF_RECOMMEND = "af.recommend"; + private static final String LINK_NAME = "name"; + private static final String LINK_URL = "link"; + /** * 获取插件搜索api */ @@ -165,18 +172,23 @@ public class AlphaFineCloudConstants { } private static String getDefaultRecommend() { - String quickStartUrl = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_QUICK_START); - String reportLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_REPORT_LEARNING_PATH); - String parameterLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_PARAM_LEARNING_PATH); - String fillLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_FILL_LEARNING_PATH); - String apiSummary = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_API_SUMMARY); - String monthlyDocument = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_MONTHLY_DOCUMENT); - return "[{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Quick_Start") + "\", \"link\":\"" + quickStartUrl + "\"}," + - "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Report_Learning") + "\", \"link\":\"" + reportLearningPath + "\"}," + - "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Parameter_Learning") + "\", \"link\":\"" + parameterLearningPath + "\"}," + - "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Fill_Learning") + "\", \"link\":\"" + fillLearningPath + "\"}," + - "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Api_Summary") + "\", \"link\":\"" + apiSummary + "\"}," + - "{\"name\":\"" + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Monthly_Document") + "\", \"link\":\"" + monthlyDocument + "\"} ]"; + String[][] links = new String[][]{ + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Quick_Start"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_QUICK_START)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Report_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_REPORT_LEARNING_PATH)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Parameter_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_PARAM_LEARNING_PATH)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Fill_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_FILL_LEARNING_PATH)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Api_Summary"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_API_SUMMARY)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Monthly_Document"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_MONTHLY_DOCUMENT)} + }; + JSONArray jsonArray = new JSONArray(); + for (String[] link : links) { + Map map = new HashMap<>(); + map.put(LINK_NAME, link[0]); + map.put(LINK_URL, link[1]); + jsonArray.put(map); + } + + return jsonArray.toString(); } /**