|
|
@@ -3,6 +3,8 @@ package com.jzg.quotation.yangguang.api.componet;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.jzg.quotation.commons.constant.enums.base.InsuranceEnum;
|
|
|
+import com.jzg.quotation.commons.utils.InsuranceLog;
|
|
|
import com.jzg.quotation.yangguang.api.entity.request.*;
|
|
|
import com.jzg.quotation.yangguang.api.entity.response.*;
|
|
|
import com.jzg.quotation.yangguang.api.properties.YangGuangApiProperties;
|
|
|
@@ -39,12 +41,15 @@ public class YangGuangApiRequestComponent {
|
|
|
this.restTemplate = restTemplate;
|
|
|
}
|
|
|
|
|
|
- private <Q extends YangGuangBaseRequest, S extends YangGuangBaseResponse> S post(Q q, Class<S> tClass) throws JsonProcessingException {
|
|
|
+ private <Q extends YangGuangBaseRequest, S extends YangGuangBaseResponse> S post(Q q, Class<S> tClass,String type) throws JsonProcessingException {
|
|
|
|
|
|
// 发送请求
|
|
|
String url = yangGuangApiProperties.getUrl();
|
|
|
String encryptRequestBody = yangGuangEncryption.encryptRequestBody
|
|
|
(q, yangGuangApiProperties.getKey());
|
|
|
+ String request = JSON.toJSONString(q);
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.YGBX.getPinyin(), "\n\t---------> {} \n\t---------> URl: {} \n\t---------> 请求参数:{}",
|
|
|
+ type,url,request);
|
|
|
//设置请求头类型
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
HttpEntity<String> entity = new HttpEntity<>(encryptRequestBody, headers);
|
|
|
@@ -54,7 +59,7 @@ public class YangGuangApiRequestComponent {
|
|
|
// 处理解密
|
|
|
String decryptedResponse = yangGuangEncryption.authcodeDecode(body, yangGuangApiProperties.getKey());
|
|
|
|
|
|
-// InsuranceLog.infoLog(InsuranceEnum.YGBX.getPinyin(), "\n\n---------> 响应参数:{}", decryptedResponse);
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.BPIC.getPinyin(), "\n\t---------> {} \n\t---------> 响应参数:{}", type, decryptedResponse);
|
|
|
JSONObject jsonObject = JSON.parseObject(decryptedResponse);
|
|
|
S t = jsonObject.toJavaObject(tClass);
|
|
|
// 反序列化响应
|
|
|
@@ -123,35 +128,35 @@ public class YangGuangApiRequestComponent {
|
|
|
* 查询车型
|
|
|
*/
|
|
|
public YangGuangQueryVehicleModelResponse queryVehicleModel(YangGuangQueryVehicleModelRequest yangGuangQueryVehicleModel) throws JsonProcessingException {
|
|
|
- return post(yangGuangQueryVehicleModel, YangGuangQueryVehicleModelResponse.class);
|
|
|
+ return post(yangGuangQueryVehicleModel, YangGuangQueryVehicleModelResponse.class, "查询车型");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 报价
|
|
|
*/
|
|
|
public YangGuangAccuracyCalculateResponse accuracyCalculaye(YangGuangAccuracyCalculateRequest yangGuangAccuracyCalculateRequest) throws JsonProcessingException {
|
|
|
- return post(yangGuangAccuracyCalculateRequest, YangGuangAccuracyCalculateResponse.class);
|
|
|
+ return post(yangGuangAccuracyCalculateRequest, YangGuangAccuracyCalculateResponse.class,"报价");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 投保单提交
|
|
|
*/
|
|
|
public YangGuangSubmitResponse submit(YangGuangSubmitRequest yangGuangSubmitRequest) throws JsonProcessingException {
|
|
|
- return post(yangGuangSubmitRequest, YangGuangSubmitResponse.class);
|
|
|
+ return post(yangGuangSubmitRequest, YangGuangSubmitResponse.class, "投保单提交");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 投保单状态查询
|
|
|
*/
|
|
|
public YangGuangProposalStatusQueryResponse proposalStatusQuery(YangGuangProposalStatusQueryRequest yangGuangProposalStatusQueryRequest) throws JsonProcessingException {
|
|
|
- return post(yangGuangProposalStatusQueryRequest, YangGuangProposalStatusQueryResponse.class);
|
|
|
+ return post(yangGuangProposalStatusQueryRequest, YangGuangProposalStatusQueryResponse.class,"投保单状态查询");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 线上支付
|
|
|
*/
|
|
|
public YangGuangPaymentResponse payment(YangGuangPaymentRequest yangGuangPaymentRequest) throws JsonProcessingException {
|
|
|
- return post(yangGuangPaymentRequest, YangGuangPaymentResponse.class);
|
|
|
+ return post(yangGuangPaymentRequest, YangGuangPaymentResponse.class,"获取支付链接");
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
@@ -161,19 +166,19 @@ public class YangGuangApiRequestComponent {
|
|
|
// return post(yangGuangCallbackRequest, YangGuangCallbackResponse.class);
|
|
|
// }
|
|
|
//
|
|
|
-// /**
|
|
|
-// * 获取驾意险套餐列表
|
|
|
-// */
|
|
|
-// public YangGuangGetNonVehicleProductsResponse getNonVehicleProducts(YangGuangGetNonVehicleProductsRequest yangGuangGetNonVehicleProductsRequest) throws JsonProcessingException {
|
|
|
-// return post(yangGuangGetNonVehicleProductsRequest, YangGuangGetNonVehicleProductsResponse.class);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取电子保单下载地址
|
|
|
-// */
|
|
|
-// public YangGuangGetEpolicyPdfUrlResponse getEpolicyPDFURL(YangGuangGetEpolicyPdfUrlRequest yangGuangGetEpolicyPdfUrlRequest) throws JsonProcessingException {
|
|
|
-// return post(yangGuangGetEpolicyPdfUrlRequest, YangGuangGetEpolicyPdfUrlResponse.class);
|
|
|
-// }
|
|
|
+ /**
|
|
|
+ * 获取驾意险套餐列表
|
|
|
+ */
|
|
|
+ public YangGuangGetNonVehicleProductsResponse getNonVehicleProducts(YangGuangGetNonVehicleProductsRequest yangGuangGetNonVehicleProductsRequest) throws JsonProcessingException {
|
|
|
+ return post(yangGuangGetNonVehicleProductsRequest, YangGuangGetNonVehicleProductsResponse.class,"获取非车套餐列表");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取电子保单下载地址
|
|
|
+ */
|
|
|
+ public YangGuangGetEpolicyPdfUrlResponse getEpolicyPDFURL(YangGuangGetEpolicyPdfUrlRequest yangGuangGetEpolicyPdfUrlRequest) throws JsonProcessingException {
|
|
|
+ return post(yangGuangGetEpolicyPdfUrlRequest, YangGuangGetEpolicyPdfUrlResponse.class, "获取电子保单下载地址");
|
|
|
+ }
|
|
|
//
|
|
|
// /**
|
|
|
// * 投保单注销
|