|
@@ -62,19 +62,19 @@ public class DaJiaRequestApiComponents {
|
|
|
httpHeaders.set("User-Agent","");
|
|
httpHeaders.set("User-Agent","");
|
|
|
|
|
|
|
|
InsuranceLog.infoLog(InsuranceEnum.DJPC.getPinyin(), "\n\t---------> URl: {} \n---------> 保险公司:{} {}\n---------> 请求参数:{}", url, InsuranceEnum.DJPC.getName(), tradeCode.getDesc(), JSONObject.toJSONString(q));
|
|
InsuranceLog.infoLog(InsuranceEnum.DJPC.getPinyin(), "\n\t---------> URl: {} \n---------> 保险公司:{} {}\n---------> 请求参数:{}", url, InsuranceEnum.DJPC.getName(), tradeCode.getDesc(), JSONObject.toJSONString(q));
|
|
|
- String encrypt = AESEncrypt.encrypt(JSONObject.toJSONString(q), encryptKey);
|
|
|
|
|
|
|
+ String encrypt = AESEncrypt.encrypt(JSON.toJSONString(q), encryptKey);
|
|
|
HttpEntity<String> httpEntity = new HttpEntity<>(encrypt, httpHeaders);
|
|
HttpEntity<String> httpEntity = new HttpEntity<>(encrypt, httpHeaders);
|
|
|
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
|
|
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
|
|
|
String body = response.getBody();
|
|
String body = response.getBody();
|
|
|
InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> 响应参数:{}", body);
|
|
InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> 响应参数:{}", body);
|
|
|
//统一处理错误
|
|
//统一处理错误
|
|
|
- JSONObject resultObj = JSONObject.parseObject(body);
|
|
|
|
|
|
|
+ JSONObject resultObj = JSON.parseObject(body);
|
|
|
String code = resultObj.getString("code");
|
|
String code = resultObj.getString("code");
|
|
|
if(!code.equals("2000")) {
|
|
if(!code.equals("2000")) {
|
|
|
throw new SystemException(resultObj.getString("msg"));
|
|
throw new SystemException(resultObj.getString("msg"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- S s = JSONObject.parseObject(resultObj.getJSONObject("body").toJSONString(),tClass);
|
|
|
|
|
|
|
+ S s = JSON.parseObject(resultObj.getJSONObject("body").toJSONString(),tClass);
|
|
|
if (ObjectUtils.isEmpty(s)) {
|
|
if (ObjectUtils.isEmpty(s)) {
|
|
|
throw new SystemException("请求失败");
|
|
throw new SystemException("请求失败");
|
|
|
}
|
|
}
|