Pārlūkot izejas kodu

sop列表修改

wangliang 1 gadu atpakaļ
vecāks
revīzija
f587d47986

+ 3 - 2
sop-common/src/main/java/com/qmth/sop/common/util/HttpUtil.java

@@ -49,10 +49,11 @@ public class HttpUtil {
      * @param json
      * @param secret
      * @param timestamp
+     * @param encode
      * @return
      * @throws IOException
      */
-    public static String postJson(String url, String json, String secret, Long timestamp) throws IOException {
+    public static String postJson(String url, String json, String secret, Long timestamp, boolean encode) throws IOException {
         RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(SystemConstant.CONNECT_TIME_OUT)// 连接主机服务超时时间
                 .setConnectionRequestTimeout(SystemConstant.CONNECT_TIME_OUT)// 请求超时时间
                 .setSocketTimeout(SystemConstant.SOCKET_CONNECT_TIME_OUT)// 数据读取超时时间
@@ -66,7 +67,7 @@ public class HttpUtil {
         post.setHeader(HTTP.CONTENT_TYPE, "application/json; charset=utf-8");
         post.setHeader("Accept", "application/json");
 
-        String encoderJson = URLEncoder.encode(json, SystemConstant.CHARSET_NAME);
+        String encoderJson = encode ? URLEncoder.encode(json, SystemConstant.CHARSET_NAME) : json;
         StringEntity se = new StringEntity(encoderJson);
         se.setContentType("text/json");
         se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));