|
@@ -41,13 +41,22 @@ public class ZhongmeiRequestApiComponents {
|
|
|
this.restTemplate = restTemplate;
|
|
this.restTemplate = restTemplate;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+// /**
|
|
|
|
|
+// * 加密请求
|
|
|
|
|
+// * @param q 请求参数
|
|
|
|
|
+// * @param url 请求url
|
|
|
|
|
+// * @param tClass 响应类型
|
|
|
|
|
+// * @param <Q> Request 请求体
|
|
|
|
|
+// * @param <S> Response 响应体
|
|
|
|
|
+// * @return <S>
|
|
|
|
|
+// */
|
|
|
// private <Q extends BaseRequest, S extends BaseResponse> S post(Q q, String url, Class<S> tClass) {
|
|
// private <Q extends BaseRequest, S extends BaseResponse> S post(Q q, String url, Class<S> tClass) {
|
|
|
-// String jsonString = JSON.toJSONString(q, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
|
|
|
|
|
-// log.info("---------> 请求参数:{}", jsonString);
|
|
|
|
|
-//
|
|
|
|
|
// HttpHeaders httpHeaders = new HttpHeaders();
|
|
// HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
// httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
// httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
|
//
|
|
//
|
|
|
|
|
+// String jsonString = JSON.toJSONString(q, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
|
|
|
|
|
+// log.info("---------> 请求参数:{}", jsonString);
|
|
|
// // 加密
|
|
// // 加密
|
|
|
// String s = AESUtilsWithDataBase.encryptECBPK5Hex(jsonString);
|
|
// String s = AESUtilsWithDataBase.encryptECBPK5Hex(jsonString);
|
|
|
// log.info("---------> 加密后的参数:{}", s);
|
|
// log.info("---------> 加密后的参数:{}", s);
|
|
@@ -55,12 +64,7 @@ public class ZhongmeiRequestApiComponents {
|
|
|
//
|
|
//
|
|
|
// ResponseEntity<String> response = restTemplate.postForEntity(url, httpEntity, String.class);
|
|
// ResponseEntity<String> response = restTemplate.postForEntity(url, httpEntity, String.class);
|
|
|
// String body = response.getBody();
|
|
// String body = response.getBody();
|
|
|
-// log.info("---------> 解密前的参数:{}", body);
|
|
|
|
|
-// // 解密
|
|
|
|
|
-// String s1 = AESUtilsWithDataBase.decryptECBPK5Hex(body);
|
|
|
|
|
-// log.info("---------> 响应参数:{}", s1);
|
|
|
|
|
-//
|
|
|
|
|
-// S t = JSON.parseObject(s1, tClass);
|
|
|
|
|
|
|
+// S t = AESUtilsWithDataBase.decryptMessage(body, tClass, "响应参数");
|
|
|
// if (ObjectUtils.isEmpty(t)) {
|
|
// if (ObjectUtils.isEmpty(t)) {
|
|
|
// throw new SystemException("请求失败");
|
|
// throw new SystemException("请求失败");
|
|
|
// }
|
|
// }
|
|
@@ -106,7 +110,6 @@ public class ZhongmeiRequestApiComponents {
|
|
|
*/
|
|
*/
|
|
|
private <Q extends BaseRequest, S extends BaseResponse> S request(Q request, Class<S> tClass, boolean verify, String domain) {
|
|
private <Q extends BaseRequest, S extends BaseResponse> S request(Q request, Class<S> tClass, boolean verify, String domain) {
|
|
|
String url = domain + request.getHead().getTransCode() + ".do";
|
|
String url = domain + request.getHead().getTransCode() + ".do";
|
|
|
- System.out.println(url);
|
|
|
|
|
S response = post(request, url, tClass);
|
|
S response = post(request, url, tClass);
|
|
|
if (verify) {
|
|
if (verify) {
|
|
|
validationResults(response);
|
|
validationResults(response);
|