Browse Source

REPORT-81241【运营产品化二期】插件中心断网后的重新加载无反应

添加url编码
提取常量
feature/x
Link.Zhao 2 years ago
parent
commit
c726fd6c07
  1. 76
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java
  2. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java
  3. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java
  4. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java
  5. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  6. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java

76
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());
}
}

10
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

4
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);

7
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();

2
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();

7
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();

Loading…
Cancel
Save