Commit ef03daf5 authored by Quxl's avatar Quxl
parents 6d0b78f0 296878ee
......@@ -123,7 +123,9 @@ public class HttpsUtil {
requestUrl = requestUrl + (requestUrl.contains("?") ? (requestUrl.endsWith("&") ? "" : "&") : "?") + requestBody;
URL GET_URL = new URL(requestUrl);
connection = (HttpsURLConnection) (proxy == null ? GET_URL.openConnection() : GET_URL.openConnection(proxy));
connection.setSSLSocketFactory(sslSocketFactory);
if(sslSocketFactory != null) {
connection.setSSLSocketFactory(sslSocketFactory);
}
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept-Charset", "utf-8");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
......@@ -142,6 +144,7 @@ public class HttpsUtil {
}
public static String post(String requestUrl, Map<String, Object> parameters, Map<String, String> headers, SSLSocketFactory sslSocketFactory, Proxy proxy) throws HttpRequestException {
System.out.println("----"+HttpUtil.toQueryString(parameters));
return HttpsUtil.post(requestUrl, HttpUtil.toQueryString(parameters), headers, sslSocketFactory, proxy);
}
......@@ -151,7 +154,10 @@ public class HttpsUtil {
byte[] bytes = text == null ? new byte[0] : text.getBytes();
URL POST_URL = new URL(requestUrl);
connection = (HttpsURLConnection) (proxy == null ? POST_URL.openConnection() : POST_URL.openConnection(proxy));
connection.setSSLSocketFactory(sslSocketFactory);
if(sslSocketFactory != null) {
connection.setSSLSocketFactory(sslSocketFactory);
}
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
......
......@@ -25,8 +25,7 @@ public class MD5Util {
Entry<?, ?> entry = (Entry<?, ?>)it.next();
String k = (String)entry.getKey();
Object v = entry.getValue();
if(null != v && !"".equals(v)&& !"sign".equals(k) ) {
System.out.println(k+"---"+v);
if(null != v && !"".equals(v)&& !"sign".equals(k) ) {
sb.append(k + "=" + v + "&");
}
}
......@@ -78,12 +77,12 @@ public class MD5Util {
SortedMap<Object,Object> parameters = new TreeMap<Object,Object> ();
parameters.put("AppID", "E34EAAAFCC714ABA");
parameters.put("AppKey", "F7FC3382E34EAAAFCC714ABA172FD00C");
parameters.put("LangID", "936");
parameters.put("ServerID", "Scan_CheckMemPointCoupon");
parameters.put("ServerTypeID", 1);
parameters.put("timestamp", "1560474936524");
parameters.put("AppID", "201909230001");
parameters.put("AppKey", "d0dd209596922ae29630ded8ba46f15f");
parameters.put("ServerID", "ThirdAgentOnStockAdd");
parameters.put("ServerTypeID", 3);
parameters.put("timestamp", "1569310600084");
parameters.put("data", "{\"dataList_0\": [{\"AgentContractNO\": \"600022001\",\"AgentID\": 22,\"WarehouseNO\": \"002\"}],\"dataList_1\": [{\"AgentContractNO\": \"600022001\",\"GoodsID\": 22,\"StockQty\": \"002\",\"CostPrice\":0 },{\"AgentContractNO\": \"600022001\",\"GoodsID\": 22,\"StockQty\": \"002\",\"CostPrice\":0}]}");
System.out.println(parameters);
String createSign = MD5Util.createSign("UTF-8", parameters);
System.out.println(createSign);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment