|
@@ -41,61 +41,61 @@ public class ZhongmeiRequestApiComponents {
|
|
|
this.restTemplate = restTemplate;
|
|
this.restTemplate = restTemplate;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- 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.setContentType(MediaType.APPLICATION_JSON);
|
|
|
|
|
-
|
|
|
|
|
- // 加密
|
|
|
|
|
- String s = AESUtilsWithDataBase.encryptECBPK5Hex(jsonString);
|
|
|
|
|
- log.info("---------> 加密后的参数:{}", s);
|
|
|
|
|
- HttpEntity<String> httpEntity = new HttpEntity<>(s, httpHeaders);
|
|
|
|
|
-
|
|
|
|
|
- ResponseEntity<String> response = restTemplate.postForEntity(url, httpEntity, String.class);
|
|
|
|
|
- String body = response.getBody();
|
|
|
|
|
- log.info("---------> 解密前的参数:{}", body);
|
|
|
|
|
- // 解密
|
|
|
|
|
- String s1 = AESUtilsWithDataBase.decryptECBPK5Hex(body);
|
|
|
|
|
- log.info("---------> 响应参数:{}", s1);
|
|
|
|
|
-
|
|
|
|
|
- S t = JSON.parseObject(s1, tClass);
|
|
|
|
|
- if (ObjectUtils.isEmpty(t)) {
|
|
|
|
|
- throw new SystemException("请求失败");
|
|
|
|
|
- }
|
|
|
|
|
- return t;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// /**
|
|
|
|
|
-// * @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);
|
|
|
|
|
|
|
+// String jsonString = JSON.toJSONString(q, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
|
|
|
// log.info("---------> 请求参数:{}", jsonString);
|
|
// log.info("---------> 请求参数:{}", jsonString);
|
|
|
//
|
|
//
|
|
|
// HttpHeaders httpHeaders = new HttpHeaders();
|
|
// HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
// httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
// httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
|
//
|
|
//
|
|
|
-// HttpEntity<Q> yaQuoteInfoVoHttpEntity = new HttpEntity<>(q, httpHeaders);
|
|
|
|
|
-// ResponseEntity<String> response = restTemplate.postForEntity(url, yaQuoteInfoVoHttpEntity, String.class);
|
|
|
|
|
|
|
+// // 加密
|
|
|
|
|
+// String s = AESUtilsWithDataBase.encryptECBPK5Hex(jsonString);
|
|
|
|
|
+// log.info("---------> 加密后的参数:{}", s);
|
|
|
|
|
+// HttpEntity<String> httpEntity = new HttpEntity<>(s, httpHeaders);
|
|
|
|
|
+//
|
|
|
|
|
+// ResponseEntity<String> response = restTemplate.postForEntity(url, httpEntity, String.class);
|
|
|
// String body = response.getBody();
|
|
// String body = response.getBody();
|
|
|
-// log.info("---------> 响应参数:{}", body);
|
|
|
|
|
|
|
+// log.info("---------> 解密前的参数:{}", body);
|
|
|
|
|
+// // 解密
|
|
|
|
|
+// String s1 = AESUtilsWithDataBase.decryptECBPK5Hex(body);
|
|
|
|
|
+// log.info("---------> 响应参数:{}", s1);
|
|
|
//
|
|
//
|
|
|
-// S t = JSON.parseObject(body, tClass);
|
|
|
|
|
|
|
+// S t = JSON.parseObject(s1, tClass);
|
|
|
// if (ObjectUtils.isEmpty(t)) {
|
|
// if (ObjectUtils.isEmpty(t)) {
|
|
|
// throw new SystemException("请求失败");
|
|
// throw new SystemException("请求失败");
|
|
|
// }
|
|
// }
|
|
|
-//
|
|
|
|
|
// return t;
|
|
// return t;
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @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) {
|
|
|
|
|
+ String jsonString = JSON.toJSONString(q);
|
|
|
|
|
+ log.info("---------> 请求参数:{}", jsonString);
|
|
|
|
|
+
|
|
|
|
|
+ HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
|
|
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
|
|
|
+
|
|
|
|
|
+ HttpEntity<Q> yaQuoteInfoVoHttpEntity = new HttpEntity<>(q, httpHeaders);
|
|
|
|
|
+ ResponseEntity<String> response = restTemplate.postForEntity(url, yaQuoteInfoVoHttpEntity, String.class);
|
|
|
|
|
+ String body = response.getBody();
|
|
|
|
|
+ log.info("---------> 响应参数:{}", body);
|
|
|
|
|
+
|
|
|
|
|
+ S t = JSON.parseObject(body, tClass);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(t)) {
|
|
|
|
|
+ throw new SystemException("请求失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return t;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @param <Q> Request 请求体
|
|
* @param <Q> Request 请求体
|
|
|
* @param <S> Response 响应体
|
|
* @param <S> Response 响应体
|
|
@@ -170,7 +170,7 @@ public class ZhongmeiRequestApiComponents {
|
|
|
* 上传影像 传入订单信息,查询是否生成保单成功
|
|
* 上传影像 传入订单信息,查询是否生成保单成功
|
|
|
*/
|
|
*/
|
|
|
public void uploadImage(UploadImageRequest request, Class<UploadImageResponse> tClass) {
|
|
public void uploadImage(UploadImageRequest request, Class<UploadImageResponse> tClass) {
|
|
|
- routineRequest(request, tClass, true);
|
|
|
|
|
|
|
+ imageRequest(request, tClass, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|