Commit 8e46b986 authored by 赵啸非's avatar 赵啸非

添加站点参数

parent e25c3aa6
...@@ -131,7 +131,6 @@ public class MidSignApiController { ...@@ -131,7 +131,6 @@ public class MidSignApiController {
JSONObject object = JSONObject.parseObject(midReq.getBody()); JSONObject object = JSONObject.parseObject(midReq.getBody());
headerMap.put("body", object.toJSONString()); headerMap.put("body", object.toJSONString());
signSb.append("appId").append("=").append(headerMap.get("appId")).append("&"); signSb.append("appId").append("=").append(headerMap.get("appId")).append("&");
signSb.append("appKey").append("=").append(headerMap.get("appKey")).append("&"); signSb.append("appKey").append("=").append(headerMap.get("appKey")).append("&");
signSb.append("body").append("=").append(headerMap.get("body")).append("&"); signSb.append("body").append("=").append(headerMap.get("body")).append("&");
...@@ -146,29 +145,27 @@ public class MidSignApiController { ...@@ -146,29 +145,27 @@ public class MidSignApiController {
headerMap.put("sign", sign); headerMap.put("sign", sign);
//todo 添加rsa非对称加密 //todo 添加rsa非对称加密
String pwdRsa = pwd + "#" + timeStamp; /* String pwdRsa = pwd + "#" + timeStamp;
pwdRsa = EncryptionUtils.encrypt(pwdRsa, publickey); pwdRsa = EncryptionUtils.encrypt(pwdRsa, publickey);
String param = "{\"USER\":\"" + user + "\",\"PWD\":\"" + pwdRsa + "\"}"; String param = "{\"USER\":\"" + user + "\",\"PWD\":\"" + pwdRsa + "\"}";
param = Base64.encodeBase64String(param.getBytes("UTF-8")); param = Base64.encodeBase64String(param.getBytes("UTF-8"));
headerMap.put("param", param); headerMap.put("param", param);
String request = Base64.encodeBase64String(object.toJSONString().getBytes("UTF-8")); String request = Base64.encodeBase64String(object.toJSONString().getBytes("UTF-8"));
JSONObject reqBody = new JSONObject(); JSONObject reqBody = new JSONObject();
reqBody.put("request", request); reqBody.put("request", request);
log.info("mid url:{},body:{}", fullUrl, reqBody.toJSONString());
headerMap.entrySet().forEach(item->{
log.info("head name:{},value:{}", item.getKey(), item.getValue());
});
*/
//请求转发 //请求转发
String fullUrl = UrlBuilder.ofHttp(midUrl).addPath(midReq.getPath()).build(); String fullUrl = UrlBuilder.ofHttp(midUrl).addPath(midReq.getPath()).build();
//String fullUrl = URLUtil.completeUrl(midUrl, midReq.getPath()); //String fullUrl = URLUtil.completeUrl(midUrl, midReq.getPath());
//log.info("mid url:{},body:{}", fullUrl, headerMap.get("body")); //log.info("mid url:{},body:{}", fullUrl, headerMap.get("body"));
log.info("mid url:{},body:{}", fullUrl, reqBody.toJSONString()); String body = HttpUtil.createRequest(Method.POST, fullUrl).headerMap(headerMap, true).body(headerMap.get("body")).execute().body();
headerMap.entrySet().forEach(item->{ //String body = HttpUtil.createRequest(Method.POST, fullUrl).headerMap(headerMap, true).body(reqBody.toJSONString()).execute().body();
log.info("head name:{},value:{}", item.getKey(), item.getValue());
});
//String body = HttpUtil.createRequest(Method.POST, fullUrl).headerMap(headerMap, true).body(headerMap.get("body")).execute().body();
String body = HttpUtil.createRequest(Method.POST, fullUrl).headerMap(headerMap, true).body(reqBody.toJSONString()).execute().body();
JSONObject bodyJson = JSONObject.parseObject(body); JSONObject bodyJson = JSONObject.parseObject(body);
log.info("mid resp:" + bodyJson.toJSONString()); log.info("mid resp:" + bodyJson.toJSONString());
......
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