Browse Source

REPORT-81246【运营产品化二期10.0】模板商城断网后的刷新点击无反应(联网后仍存在报错)

url编码
Link.Zhao 2 years ago
parent
commit
7bd960abc9
  1. 15
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java
  2. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java
  3. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java

15
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;
@ -56,12 +58,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=10.0";
public static final String VERSION = "version";
public static final String CURRENT_VERSION = "10.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";
@ -280,8 +283,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<String, String> 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)) {
@ -335,7 +340,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);

11
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.mainframe.alphafine.AlphaFineCloudConstants;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
@ -7,8 +8,13 @@ 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;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
/**
* @author alex.sung created on 2018/7/23.
@ -40,8 +46,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();

10
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.mainframe.alphafine.AlphaFineCloudConstants;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
@ -13,8 +14,12 @@ 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;
import java.util.HashMap;
import java.util.Map;
/**
* Created by alex.sung on 2018/8/3.
*/
@ -47,8 +52,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