Commit 207499ab authored by 赵啸非's avatar 赵啸非

添加站点参数

parent f760f997
......@@ -160,7 +160,6 @@ public class MidSignApiController {
});
*/
String request = Base64.encodeBase64String(object.toJSONString().getBytes("UTF-8"));
headerMap.entrySet().forEach(item->{
log.info("{}={} \n", item.getKey(), item.getValue());
});
......@@ -183,67 +182,4 @@ public class MidSignApiController {
}
}
/**
* 透传请求 -rsa鉴权
*
* @param midReq
* @return
*/
@PostMapping(value = "transRsa")
@UnAuth
public Rest<String> transByRsa(@RequestBody MidReq midReq) {
try {
Map<String, String> headerMap = new HashMap<>();
StringBuilder signSb = new StringBuilder();
headerMap.put("appId", appId);
headerMap.put("appKey", appKey);
String timeStamp = System.currentTimeMillis() + "";
headerMap.put("timeStamp", timeStamp);
String nonce = RandomUtil.randomNumbers(6);
headerMap.put("nonce", nonce);
headerMap.put("secretKey", secretKey);
if ("post".equalsIgnoreCase(midReq.getMethod())) {
JSONObject object1 = JSONObject.parseObject(midReq.getBody());
headerMap.put("body", object1.toJSONString());
} else if ("get".equalsIgnoreCase(midReq.getMethod())) {
/* HashMap<String, String> paramsMap = JSON.parseObject(midReq.getBody(), HashMap.class);
if (!paramsMap.isEmpty()) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
headerMap.put(entry.getKey(), entry.getValue());
}
}*/
} else {
JSONObject object1 = JSONObject.parseObject(midReq.getBody());
headerMap.put("body", object1.toJSONString());
}
signSb.append("appId").append("=").append(headerMap.get("appId")).append("&");
signSb.append("appKey").append("=").append(headerMap.get("appKey")).append("&");
signSb.append("body").append("=").append(headerMap.get("body")).append("&");
signSb.append("nonce").append("=").append(headerMap.get("nonce")).append("&");
signSb.append("secretKey").append("=").append(headerMap.get("secretKey")).append("&");
signSb.append("timeStamp").append("=").append(headerMap.get("timeStamp")).append("&");
String signStr = signSb.substring(0, signSb.length() - 1);
log.info("签名源字符串: " + signStr);
String sign = EncryptionUtils.SHA256(signStr);
log.info("签名计算结果: " + sign);
headerMap.put("sign", sign);
//请求转发
String fullUrl = UrlBuilder.ofHttp(midUrl).addPath(midReq.getPath()).build();
//String fullUrl = URLUtil.completeUrl(midUrl, midReq.getPath());
log.info("mid url:{},body:{}", fullUrl, headerMap.get("body"));
String body = HttpUtil.createRequest(Method.POST, fullUrl).headerMap(headerMap, true).body(headerMap.get("body")).execute().body();
JSONObject bodyJson = JSONObject.parseObject(body);
log.info("mid resp:" + bodyJson.toJSONString());
return Rest.ok(bodyJson.toJSONString());
} catch (Exception e) {
log.error("透传请求异常", e);
return Rest.fail("透传请求异常!");
}
}
}
......@@ -100,11 +100,12 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
SiteBusinessEntity params = this.findBefore(entity, pageInfo, context);
Result<SiteBusinessEntity> result = this.dao.getList(params, pageInfo);
List<SiteBusinessEntity> list = result.getList();
//重新内存分页
result.getPageInfo().setCurrPage(params.getPage());
result.getPageInfo().setPrePageResult(params.getSize());
list = MemoryPagination.pagination(list, params.getSize() == -1 ? list.size() : params.getSize(), params.getPage());
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
//重新内存分页
result.getPageInfo().setCurrPage(params.getPage());
result.getPageInfo().setPrePageResult(params.getSize());
list = MemoryPagination.pagination(list, params.getSize() == -1 ? list.size() : params.getSize(), params.getPage());
//排除掉已经存在的ids
log.info("idNotList:{}", JSON.toJSONString(params.getIdNotList()));
Iterator<SiteBusinessEntity> iterator = list.iterator();
......
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