|
@@ -355,7 +355,8 @@ public class DoorUtils {
|
|
|
Map<String, Object> encryptMap = encrypt(param);
|
|
|
log.warn("request param: " + param.toString());
|
|
|
log.info("request url: "+ url);
|
|
|
- log.info("encryptMap param: "+JSON.toJSONString(encryptMap));
|
|
|
+ String resJsonStr = JSON.toJSONString(encryptMap);
|
|
|
+ log.info("encryptMap param: "+ resJsonStr);
|
|
|
String result = HttpUtil.post(url, encryptMap);
|
|
|
log.info("result: {}", result);
|
|
|
JSONObject resultJson = JSON.parseObject(result);
|
|
@@ -370,6 +371,35 @@ public class DoorUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 涉及敏感信息以及为确保隐私安全,此接口返回值进行了AES加密处理;
|
|
|
+ * by owen 2022-07-11
|
|
|
+ * 使用json 请求
|
|
|
+ */
|
|
|
+ public static Result doPostDecryptJson(String url, TreeMap<String, Object> param) throws Exception {
|
|
|
+ Map<String, Object> encryptMap = encrypt(param);
|
|
|
+ log.warn("request param: " + param.toString());
|
|
|
+ log.info("request url: "+ url);
|
|
|
+ String resJsonStr = JSON.toJSONString(encryptMap);
|
|
|
+ log.info("encryptMap param: "+ resJsonStr);
|
|
|
+ String result = HttpUtil.createPost(url).body(resJsonStr, "application/json").execute().body();
|
|
|
+ log.info("result: {}", result);
|
|
|
+ JSONObject resultJson = JSON.parseObject(result);
|
|
|
+ int code = resultJson.getInteger("code");
|
|
|
+ if (code == 2000) {
|
|
|
+ // 解密
|
|
|
+ String data = resultJson.get("data").toString();
|
|
|
+ return Result.success(decrypt(data, encryptMap.get("aesKey").toString()));
|
|
|
+ } else {
|
|
|
+ log.error(result);
|
|
|
+ return Result.failure(resultJson.getString("msg"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
public static Result doPost(String url, TreeMap<String, Object> param) throws Exception {
|
|
|
log.info("request url: "+ url);
|