|
@@ -6,11 +6,30 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.ydtech.config.properties.PingAnApiConfigurationProperties;
|
|
import com.ydtech.config.properties.PingAnApiConfigurationProperties;
|
|
|
import com.ydtech.constants.InsuranceEnum;
|
|
import com.ydtech.constants.InsuranceEnum;
|
|
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.ins.model.vo.CarInfoVo;
|
|
import com.ydtech.modules.ins.model.vo.CarInfoVo;
|
|
|
import com.ydtech.modules.order.entity.api.pingan.constants.RequestUrl;
|
|
import com.ydtech.modules.order.entity.api.pingan.constants.RequestUrl;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.accept.AcceptResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.carConfirm.CarConfirmResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.dmvehicleInfo.DmvehicleInfoResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.documentStatusList.DocumentStatusListResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.index.IndexResposeCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.policyPdf.PolicyPdfResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.quote.QuoteResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.renewalConfirm.RenewalConfirmResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.repealDocument.RepealDocumentResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.scanCodeURL.ScanCodeURLResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.searchPAVehicleList.SearchPAVehicleListResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.serviceContract.ServiceContractResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.submitApply.SubmitApplyResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.unAutoProductDetail.UnAutoProductDetailResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.unAutoProductList.UnAutoProductListResponseCodeEnum;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.constants.uploadFiles.UploadFilesResponseCodeEnum;
|
|
|
import com.ydtech.modules.order.entity.api.pingan.request.*;
|
|
import com.ydtech.modules.order.entity.api.pingan.request.*;
|
|
|
import com.ydtech.modules.order.entity.api.pingan.response.*;
|
|
import com.ydtech.modules.order.entity.api.pingan.response.*;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.utils.PinAnEnumUtils;
|
|
|
import com.ydtech.modules.order.entity.api.pingan.utils.RSAPINGANUtils;
|
|
import com.ydtech.modules.order.entity.api.pingan.utils.RSAPINGANUtils;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.pingan.utils.checkNull.FieldEmptyException;
|
|
|
import com.ydtech.modules.order.entity.filter.CarModelsFilterUtils;
|
|
import com.ydtech.modules.order.entity.filter.CarModelsFilterUtils;
|
|
|
import com.ydtech.modules.order.utils.InsuranceLog;
|
|
import com.ydtech.modules.order.utils.InsuranceLog;
|
|
|
import com.ydtech.utils.RequestIdUtils;
|
|
import com.ydtech.utils.RequestIdUtils;
|
|
@@ -30,50 +49,47 @@ import java.util.TreeMap;
|
|
|
import java.util.TreeSet;
|
|
import java.util.TreeSet;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @version
|
|
|
|
|
- * @author: hxl
|
|
|
|
|
- * @Date: 2024/3/26 14:19
|
|
|
|
|
- * @Description: 平安接口请求封装
|
|
|
|
|
- *
|
|
|
|
|
- * 除北京、上海、深圳以外的地区
|
|
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/3/26 14:19
|
|
|
|
|
+ * @Description: 平安接口请求封装
|
|
|
|
|
+ * <p>
|
|
|
|
|
+ * 除北京、上海、深圳以外的地区
|
|
|
* index --》carConfirm---》quote--》submitApply--》signEleApply--》getApplyVerifyCode--》recoverApplyVerifyCode--》noticeDo
|
|
* index --》carConfirm---》quote--》submitApply--》signEleApply--》getApplyVerifyCode--》recoverApplyVerifyCode--》noticeDo
|
|
|
* 商业险通融报价(仅限调整折扣,部分报价拦截返回推荐折扣、手续费等信息时,其余报价拦截等通融暂不支持)
|
|
* 商业险通融报价(仅限调整折扣,部分报价拦截返回推荐折扣、手续费等信息时,其余报价拦截等通融暂不支持)
|
|
|
* index--》carConfirm--》quote--》quote (包含通融报价参数)--》 submitApply--》noticeDo
|
|
* index--》carConfirm--》quote--》quote (包含通融报价参数)--》 submitApply--》noticeDo
|
|
|
* 继续支付流程(引导跳转到平安页面完成后续流程)
|
|
* 继续支付流程(引导跳转到平安页面完成后续流程)
|
|
|
* index--》carConfirm--》quote --》submitApply--》viewToPay
|
|
* index--》carConfirm--》quote --》submitApply--》viewToPay
|
|
|
- *
|
|
|
|
|
- *
|
|
|
|
|
- * 接口协议:HTTPS
|
|
|
|
|
|
|
+ * <p>
|
|
|
|
|
+ * <p>
|
|
|
|
|
+ * 接口协议:HTTPS
|
|
|
* HTTP请求方式:POST
|
|
* HTTP请求方式:POST
|
|
|
* Content-Type:application/json;charset=utf-8;Accept:application/json;charset=utf-8
|
|
* Content-Type:application/json;charset=utf-8;Accept:application/json;charset=utf-8
|
|
|
* 接口权限校验方式:令牌
|
|
* 接口权限校验方式:令牌
|
|
|
* 接口调用地址:见附录
|
|
* 接口调用地址:见附录
|
|
|
- * 接口调用举例
|
|
|
|
|
|
|
+ * 接口调用举例
|
|
|
* 1、使用平安分配的client_id和client_secret,调用令牌地址获得令牌
|
|
* 1、使用平安分配的client_id和client_secret,调用令牌地址获得令牌
|
|
|
* https://test-api.pingan.com.cn:20443/oauth/oauth2/access_token?client_id={client_id} &grant_type=client_credentials&client_secret={client_secret}
|
|
* https://test-api.pingan.com.cn:20443/oauth/oauth2/access_token?client_id={client_id} &grant_type=client_credentials&client_secret={client_secret}
|
|
|
* 返回:
|
|
* 返回:
|
|
|
* {
|
|
* {
|
|
|
- * "ret": "0",
|
|
|
|
|
- * "data": {
|
|
|
|
|
- * "expires_in": "1438",【令牌有效时长(分钟)】
|
|
|
|
|
- * "openid": "***",
|
|
|
|
|
- * "access_token": "3FFC24C8374D4274844BD714BF01A93D"
|
|
|
|
|
- * },
|
|
|
|
|
- * "msg": ""
|
|
|
|
|
|
|
+ * "ret": "0",
|
|
|
|
|
+ * "data": {
|
|
|
|
|
+ * "expires_in": "1438",【令牌有效时长(分钟)】
|
|
|
|
|
+ * "openid": "***",
|
|
|
|
|
+ * "access_token": "3FFC24C8374D4274844BD714BF01A93D"
|
|
|
|
|
+ * },
|
|
|
|
|
+ * "msg": ""
|
|
|
* }
|
|
* }
|
|
|
* 2、发起接口调用
|
|
* 2、发起接口调用
|
|
|
* https://test-api.pingan.com.cn:20443/open/appsvr/{各接口地址}?access_token={令牌}&request_id={请求随机流水号}
|
|
* https://test-api.pingan.com.cn:20443/open/appsvr/{各接口地址}?access_token={令牌}&request_id={请求随机流水号}
|
|
|
* 返回(返回内容均在data节点中):
|
|
* 返回(返回内容均在data节点中):
|
|
|
* {
|
|
* {
|
|
|
- * "ret":"0",
|
|
|
|
|
- * "msg":"",
|
|
|
|
|
- * "requestId":"{请求随机流水号}",
|
|
|
|
|
- * "data":{
|
|
|
|
|
- *
|
|
|
|
|
- * }
|
|
|
|
|
|
|
+ * "ret":"0",
|
|
|
|
|
+ * "msg":"",
|
|
|
|
|
+ * "requestId":"{请求随机流水号}",
|
|
|
|
|
+ * "data":{
|
|
|
|
|
+ * <p>
|
|
|
|
|
+ * }
|
|
|
* }
|
|
* }
|
|
|
- *
|
|
|
|
|
- *
|
|
|
|
|
*/
|
|
*/
|
|
|
@Component
|
|
@Component
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
@@ -84,42 +100,45 @@ public class PinganRequestApiComponents {
|
|
|
private final PingAnApiConfigurationProperties properties;
|
|
private final PingAnApiConfigurationProperties properties;
|
|
|
|
|
|
|
|
public static final Logger logger = LoggerFactory.getLogger(PinganRequestApiComponents.class);
|
|
public static final Logger logger = LoggerFactory.getLogger(PinganRequestApiComponents.class);
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * @version
|
|
|
|
|
- * @author: hxl
|
|
|
|
|
- * @Date: 2024/3/26 14:52
|
|
|
|
|
- * @Description: 通过客户端id和客户端密钥获取令牌
|
|
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/3/26 14:52
|
|
|
|
|
+ * @Description: 通过客户端id和客户端密钥获取令牌
|
|
|
*/
|
|
*/
|
|
|
- private String getToken(String url){
|
|
|
|
|
|
|
+ private String getToken(String url) throws Exception {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
HttpEntity<String> entity = new HttpEntity<>(headers);
|
|
HttpEntity<String> entity = new HttpEntity<>(headers);
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
String clientId = properties.getClientId();
|
|
String clientId = properties.getClientId();
|
|
|
String clientSecret = properties.getClientSecret();
|
|
String clientSecret = properties.getClientSecret();
|
|
|
- logger.info("客户端id=========="+clientId);
|
|
|
|
|
- logger.info("客户端密钥=========="+clientSecret);
|
|
|
|
|
- if((clientId!=null && !"".equals(clientId)) && (clientSecret==null && !"".equals(clientSecret)) ){
|
|
|
|
|
- url=url+"?client_id="+clientId+"&grant_type=client_credentials&client_secret="+clientSecret;
|
|
|
|
|
- ResponseEntity<JSONObject> response = restTemplate.exchange(url , HttpMethod.GET, entity, JSONObject.class);
|
|
|
|
|
- JSONObject body = response.getBody();
|
|
|
|
|
- TokenResponse token = JSON.toJavaObject(body, TokenResponse.class);
|
|
|
|
|
- if(token!=null){
|
|
|
|
|
- String expiresIn = token.getData().getExpires_in();
|
|
|
|
|
- if(expiresIn!=null && Integer.parseInt(expiresIn)>0){
|
|
|
|
|
- return token.getData().getAccess_token();
|
|
|
|
|
- }else{
|
|
|
|
|
- logger.error("令牌已过期");
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ logger.info("客户端id==========" + clientId);
|
|
|
|
|
+ logger.info("客户端密钥==========" + clientSecret);
|
|
|
|
|
+ if ((clientId != null && !"".equals(clientId)) && (clientSecret == null && !"".equals(clientSecret))) {
|
|
|
|
|
+ url = url + "?client_id=" + clientId + "&grant_type=client_credentials&client_secret=" + clientSecret;
|
|
|
|
|
+ try {
|
|
|
|
|
+ ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET, entity, JSONObject.class);
|
|
|
|
|
+ JSONObject body = response.getBody();
|
|
|
|
|
+ TokenResponse token = JSON.toJavaObject(body, TokenResponse.class);
|
|
|
|
|
+ if (token != null) {
|
|
|
|
|
+ String expiresIn = token.getData().getExpires_in();
|
|
|
|
|
+ if (expiresIn != null && Integer.parseInt(expiresIn) > 0) {
|
|
|
|
|
+ return token.getData().getAccess_token();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new SystemException("令牌已过期");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new SystemException("返回值为空,请检查访问路径以及参数!!!");
|
|
|
}
|
|
}
|
|
|
- }else{
|
|
|
|
|
- logger.error("返回值为空,请检查访问路径以及参数!!!");
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
|
+ throw new SystemException("接口请求异常,请检查请求路径以及参数");
|
|
|
}
|
|
}
|
|
|
- }else{
|
|
|
|
|
- logger.error("clientId或clientSecret值为空,请检查配置!!!");
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new SystemException("clientId或clientSecret值为空,请检查配置!!!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 加密请求
|
|
* 加密请求
|
|
|
*
|
|
*
|
|
@@ -130,102 +149,172 @@ public class PinganRequestApiComponents {
|
|
|
* @param <S> Response 响应体
|
|
* @param <S> Response 响应体
|
|
|
* @return <S>
|
|
* @return <S>
|
|
|
*/
|
|
*/
|
|
|
- private <Q extends PingAnBaseRequest, S extends PingAnBaseResponse> S post(Q q, String url, Class<S> tClass, RequestUrl requestUrl) throws Exception {
|
|
|
|
|
- HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
|
|
- //设置请求头类型
|
|
|
|
|
- httpHeaders.add("Content-Type","application/json;charset=utf-8");
|
|
|
|
|
- httpHeaders.add("Accept","application/json;charset=utf-8");
|
|
|
|
|
- String busReqString = JSON.toJSONString(q, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
|
|
|
|
|
- //打印入参参数
|
|
|
|
|
- InsuranceLog.infoLog(InsuranceEnum.PAIC.getPinyin(), "\n\t---------> {} \n\t---------> URl: {} \n\t---------> 请求参数:{}",
|
|
|
|
|
- requestUrl.getCode()+"--"+requestUrl.getUrl()+"--"+requestUrl.getDesc(), url, busReqString);
|
|
|
|
|
|
|
+ private <Q extends PingAnBaseRequest, S extends PingAnBaseResponse> S post(Q q, String url, Class<S> tClass, RequestUrl requestUrl) throws Exception {
|
|
|
|
|
+ HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
|
|
+ //设置请求头类型
|
|
|
|
|
+ httpHeaders.add("Content-Type", "application/json;charset=utf-8");
|
|
|
|
|
+ httpHeaders.add("Accept", "application/json;charset=utf-8");
|
|
|
|
|
+ String busReqString = JSON.toJSONString(q, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
|
|
|
|
|
+ //打印入参参数
|
|
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.PAIC.getPinyin(), "\n\t---------> {} \n\t---------> URl: {} \n\t---------> 请求参数:{}",
|
|
|
|
|
+ requestUrl.getCode() + "--" + requestUrl.getUrl() + "--" + requestUrl.getDesc(), url, busReqString);
|
|
|
|
|
|
|
|
- JSONObject jsonObject = (JSONObject) JSON.toJSON(q);
|
|
|
|
|
- //获取令牌token
|
|
|
|
|
- String token = getToken(properties.getAccessUrl());
|
|
|
|
|
- if(token==null){
|
|
|
|
|
- logger.error("获取令牌接口失败!!!");
|
|
|
|
|
- throw new IllegalArgumentException("获取令牌接口失败");
|
|
|
|
|
- }
|
|
|
|
|
- //拼接token和请求id
|
|
|
|
|
- url=url+"/"+requestUrl.getUrl()+"?access_token="+token+"&request_id="+ RequestIdUtils.createID(requestUrl.getCode());
|
|
|
|
|
|
|
+ JSONObject jsonObject = (JSONObject) JSON.toJSON(q);
|
|
|
|
|
+ String token = null;
|
|
|
|
|
+ try{
|
|
|
|
|
+ //获取令牌token
|
|
|
|
|
+ token = getToken(properties.getAccessUrl());
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException("接口请求异常,请检查请求路径以及参数");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (token == null) {
|
|
|
|
|
+ throw new SystemException("获取令牌接口失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ //拼接token和请求id
|
|
|
|
|
+ url = url + "/" + requestUrl.getUrl() + "?access_token=" + token + "&request_id=" + RequestIdUtils.createID(requestUrl.getCode());
|
|
|
HttpEntity<String> httpEntity = new HttpEntity<>(jsonObject.toJSONString(), httpHeaders);
|
|
HttpEntity<String> httpEntity = new HttpEntity<>(jsonObject.toJSONString(), httpHeaders);
|
|
|
- ResponseEntity<String> response = restTemplate.postForEntity(url, httpEntity, String.class);
|
|
|
|
|
- String body = response.getBody();
|
|
|
|
|
- InsuranceLog.infoLog(InsuranceEnum.PAIC.getPinyin(), "\n\t---------> {} \n\t---------> 返回数据:{}", requestUrl.getCode()+"--"+requestUrl.getUrl()+"--"+requestUrl.getDesc(), body);
|
|
|
|
|
- return JSON.parseObject(body).toJavaObject(tClass);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ try{
|
|
|
|
|
+ ResponseEntity<String> response = restTemplate.postForEntity(url, httpEntity, String.class);
|
|
|
|
|
+ String body = response.getBody();
|
|
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.PAIC.getPinyin(), "\n\t---------> {} \n\t---------> 返回数据:{}", requestUrl.getCode() + "--" + requestUrl.getUrl() + "--" + requestUrl.getDesc(), body);
|
|
|
|
|
+ return JSON.parseObject(body).toJavaObject(tClass);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException("接口请求异常,请检查请求路径以及参数");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * @version
|
|
|
|
|
- * @author: hxl
|
|
|
|
|
- * @Date: 2024/3/26 16:07
|
|
|
|
|
- * @Description: 接口分装
|
|
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/3/26 16:07
|
|
|
|
|
+ * @Description: 接口分装
|
|
|
*/
|
|
*/
|
|
|
public <Q extends PingAnBaseRequest, S extends PingAnBaseResponse> S verificationResponse(Q q, String url, Class<S> tClass,
|
|
public <Q extends PingAnBaseRequest, S extends PingAnBaseResponse> S verificationResponse(Q q, String url, Class<S> tClass,
|
|
|
- RequestUrl requestUrl) throws Exception {
|
|
|
|
|
|
|
+ RequestUrl requestUrl) throws Exception {
|
|
|
S response = post(q, url, tClass, requestUrl);
|
|
S response = post(q, url, tClass, requestUrl);
|
|
|
- if("001".equals(requestUrl.getCode())){
|
|
|
|
|
- //处理models[]数据会使用RSA公钥进行加密,合作伙伴使用RSA私钥进行解密
|
|
|
|
|
- SearchPAVehicleListResponse res=(SearchPAVehicleListResponse)response;
|
|
|
|
|
|
|
+ if ("001".equals(requestUrl.getCode())) {
|
|
|
|
|
+ //处理models[]数据会使用RSA公钥进行加密,合作伙伴使用RSA私钥进行解密
|
|
|
|
|
+ SearchPAVehicleListResponse res = (SearchPAVehicleListResponse) response;
|
|
|
String modelsStr = JSON.toJSONString(res, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
|
|
String modelsStr = JSON.toJSONString(res, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
|
|
|
//解密
|
|
//解密
|
|
|
- logger.info("加密前的内容"+modelsStr);
|
|
|
|
|
|
|
+ logger.info("加密前的内容" + modelsStr);
|
|
|
String modelsStrDec = RSAPINGANUtils.extracted(modelsStr, properties.getSelfPrivateKey());
|
|
String modelsStrDec = RSAPINGANUtils.extracted(modelsStr, properties.getSelfPrivateKey());
|
|
|
- logger.info("解密后的内容"+modelsStrDec);
|
|
|
|
|
|
|
+ logger.info("解密后的内容" + modelsStrDec);
|
|
|
SearchPAVehicleListResponse.ModelsDto models = JSON.parseObject(modelsStrDec).toJavaObject(SearchPAVehicleListResponse.ModelsDto.class);
|
|
SearchPAVehicleListResponse.ModelsDto models = JSON.parseObject(modelsStrDec).toJavaObject(SearchPAVehicleListResponse.ModelsDto.class);
|
|
|
res.setModels((List<SearchPAVehicleListResponse.ModelsDto>) models);
|
|
res.setModels((List<SearchPAVehicleListResponse.ModelsDto>) models);
|
|
|
}
|
|
}
|
|
|
//注意002 pdf的解密文件
|
|
//注意002 pdf的解密文件
|
|
|
return response;
|
|
return response;
|
|
|
}
|
|
}
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @Description 验证入参数据
|
|
|
|
|
+ * @Author hxl
|
|
|
|
|
+ * @Date 2024/4/1 9:47
|
|
|
|
|
+ * @Param
|
|
|
|
|
+ * @Return
|
|
|
|
|
+ * @Exception
|
|
|
|
|
+ *
|
|
|
|
|
+ */
|
|
|
|
|
+ private static <Q extends PingAnBaseRequest> void checkRequestParams(Q q) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ q.validate();
|
|
|
|
|
+ } catch (FieldEmptyException e) {
|
|
|
|
|
+ throw new FieldEmptyException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @version
|
|
|
|
|
- * @author: hxl
|
|
|
|
|
- * @Date: 2024/3/26 14:14
|
|
|
|
|
- * @Description: 获取标的信息接口 3.1
|
|
|
|
|
- */
|
|
|
|
|
- public IndexResponse index(IndexRequest indexRequest) throws Exception {
|
|
|
|
|
- return verificationResponse(indexRequest, properties.getUrl(), IndexResponse.class,RequestUrl.R_31);
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @Description 返回参数验证
|
|
|
|
|
+ * @Author hxl
|
|
|
|
|
+ * @Date 2024/4/1 9:37
|
|
|
|
|
+ * @Param
|
|
|
|
|
+ * @Return
|
|
|
|
|
+ * @Exception
|
|
|
|
|
+ *
|
|
|
|
|
+ */
|
|
|
|
|
+ private <Q extends PingAnBaseRequest, S extends PingAnBaseResponse> S getCheckResponseResult(Q q,Class<S> tClass,RequestUrl requestUrl,Class enumCodeClass) {
|
|
|
|
|
+ S response;
|
|
|
|
|
+ try {
|
|
|
|
|
+ response = verificationResponse(q, properties.getUrl(), tClass, requestUrl);
|
|
|
|
|
+ if(!"0".equals(response.getResultCode())){
|
|
|
|
|
+ throw new SystemException(requestUrl.getCode()+"-"+requestUrl.getDesc()+"-"+requestUrl.getUrl()+"接口返回信息"+PinAnEnumUtils.getEnumValueByCode(enumCodeClass,response.getResultCode()));
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ throw new SystemException(requestUrl.getCode()+"-"+requestUrl.getDesc()+"-"+requestUrl.getUrl()+"接口报错,请检查请求路径及参数");
|
|
|
|
|
+ }
|
|
|
|
|
+ return response;
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/3/26 14:14
|
|
|
|
|
+ * @Description: 获取标的信息接口 3.1
|
|
|
|
|
+ */
|
|
|
|
|
+ public IndexResponse index(IndexRequest indexRequest) throws Exception {
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(indexRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ IndexResponse indexResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ indexResponse = (IndexResponse)getCheckResponseResult(indexRequest,IndexResponse.class,RequestUrl.R_31,IndexResposeCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return indexResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * @version
|
|
|
|
|
- * @author: hxl
|
|
|
|
|
- * @Date: 2024/3/26 16:29
|
|
|
|
|
- * @Description: 续保确认 4.1
|
|
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/3/26 16:29
|
|
|
|
|
+ * @Description: 续保确认 4.1 使用3.1的流程id
|
|
|
|
|
+ * 使用接口3.1出参flowid
|
|
|
|
|
+ * 3.1的index接口返回1时调用
|
|
|
|
|
+ *
|
|
|
*/
|
|
*/
|
|
|
- public RenewalConfirmResponse index(RenewalConfirmRequest renewalConfirmRequest) throws Exception {
|
|
|
|
|
|
|
+ public RenewalConfirmResponse renewalConfirm(RenewalConfirmRequest renewalConfirmRequest) throws Exception {
|
|
|
//签名加密
|
|
//签名加密
|
|
|
Map<String, String> params = new TreeMap<>();
|
|
Map<String, String> params = new TreeMap<>();
|
|
|
params.put("flowid", renewalConfirmRequest.getFlowid());
|
|
params.put("flowid", renewalConfirmRequest.getFlowid());
|
|
|
params.put("checkNo", renewalConfirmRequest.getCheckNo());
|
|
params.put("checkNo", renewalConfirmRequest.getCheckNo());
|
|
|
params.put("userId", renewalConfirmRequest.getUserId());
|
|
params.put("userId", renewalConfirmRequest.getUserId());
|
|
|
- logger.info("加密前的内容"+params.toString());
|
|
|
|
|
|
|
+ logger.info("加密前的内容" + params.toString());
|
|
|
//添加加密内容
|
|
//添加加密内容
|
|
|
- String encryptContent =RSAPINGANUtils.getStringStringMap(params, properties.getSelfPrivateKey());
|
|
|
|
|
- logger.info("加密后的内容"+encryptContent);
|
|
|
|
|
|
|
+ String encryptContent = RSAPINGANUtils.getStringStringMap(params, properties.getSelfPrivateKey());
|
|
|
|
|
+ logger.info("加密后的内容" + encryptContent);
|
|
|
renewalConfirmRequest.setSignature(encryptContent);
|
|
renewalConfirmRequest.setSignature(encryptContent);
|
|
|
- //对参数进行签名
|
|
|
|
|
- return verificationResponse(renewalConfirmRequest, properties.getUrl(), RenewalConfirmResponse.class,RequestUrl.R_41);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(renewalConfirmRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ RenewalConfirmResponse renewalConfirmResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ renewalConfirmResponse = (RenewalConfirmResponse)getCheckResponseResult(renewalConfirmRequest,RenewalConfirmResponse.class,RequestUrl.R_41, RenewalConfirmResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return renewalConfirmResponse;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * 平安车型搜索接口 001
|
|
|
|
|
|
|
+ * 平安车型搜索接口
|
|
|
*
|
|
*
|
|
|
- * @param searchPAVehicleListRequest 平安车型请求参数
|
|
|
|
|
|
|
+ * @param searchPAVehicleListResponse 平安车型相应参数
|
|
|
* @return 平安车型
|
|
* @return 平安车型
|
|
|
*/
|
|
*/
|
|
|
- public SearchPAVehicleListResponse.ModelsDto searchPAVehicle(SearchPAVehicleListRequest searchPAVehicleListRequest,
|
|
|
|
|
|
|
+ public SearchPAVehicleListResponse.ModelsDto searchPAVehicle(SearchPAVehicleListResponse searchPAVehicleListResponse,
|
|
|
CarInfoVo carInfoVo) {
|
|
CarInfoVo carInfoVo) {
|
|
|
- SearchPAVehicleListResponse searchPAVehicleListResponse = new SearchPAVehicleListResponse();
|
|
|
|
|
List<SearchPAVehicleListResponse.ModelsDto> models = searchPAVehicleListResponse.getModels();
|
|
List<SearchPAVehicleListResponse.ModelsDto> models = searchPAVehicleListResponse.getModels();
|
|
|
return new CarModelsFilterUtils<SearchPAVehicleListResponse.ModelsDto>().to(models, carInfoVo);
|
|
return new CarModelsFilterUtils<SearchPAVehicleListResponse.ModelsDto>().to(models, carInfoVo);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 平安车型请求参数 001
|
|
* 平安车型请求参数 001
|
|
|
* 对userId、keyword、flowid参数按照字段名的ASCII 码从小到大排序(字典序)后,使用URL键值对的格式(即key1=value1&key2=value2)拼接成字符串,然后对该字符串进行签名,得到signature
|
|
* 对userId、keyword、flowid参数按照字段名的ASCII 码从小到大排序(字典序)后,使用URL键值对的格式(即key1=value1&key2=value2)拼接成字符串,然后对该字符串进行签名,得到signature
|
|
|
* RSA私钥找平安获取
|
|
* RSA私钥找平安获取
|
|
|
|
|
+ * 流程id使用3.1的流程id
|
|
|
* @param searchPAVehicleListRequest
|
|
* @param searchPAVehicleListRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
@@ -235,16 +324,25 @@ public class PinganRequestApiComponents {
|
|
|
params.put("userId", searchPAVehicleListRequest.getUserId());
|
|
params.put("userId", searchPAVehicleListRequest.getUserId());
|
|
|
params.put("keyword", searchPAVehicleListRequest.getKeyword());
|
|
params.put("keyword", searchPAVehicleListRequest.getKeyword());
|
|
|
params.put("flowid", searchPAVehicleListRequest.getFlowid());
|
|
params.put("flowid", searchPAVehicleListRequest.getFlowid());
|
|
|
- logger.info("加密前的内容"+params.toString());
|
|
|
|
|
|
|
+ logger.info("加密前的内容" + params.toString());
|
|
|
//添加加密内容
|
|
//添加加密内容
|
|
|
- String encryptContent =RSAPINGANUtils.getStringStringMap(params, properties.getSelfPrivateKey());
|
|
|
|
|
- logger.info("加密后的内容"+encryptContent);
|
|
|
|
|
|
|
+ String encryptContent = RSAPINGANUtils.getStringStringMap(params, properties.getSelfPrivateKey());
|
|
|
|
|
+ logger.info("加密后的内容" + encryptContent);
|
|
|
searchPAVehicleListRequest.setSignature(encryptContent);
|
|
searchPAVehicleListRequest.setSignature(encryptContent);
|
|
|
-
|
|
|
|
|
- return verificationResponse(searchPAVehicleListRequest, properties.getUrl(), SearchPAVehicleListResponse.class,RequestUrl.R_001);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(searchPAVehicleListRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ SearchPAVehicleListResponse searchPAVehicleListResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ searchPAVehicleListResponse = (SearchPAVehicleListResponse)getCheckResponseResult(searchPAVehicleListRequest,SearchPAVehicleListResponse.class, RequestUrl.R_001, SearchPAVehicleListResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return searchPAVehicleListResponse;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * 电子保单 002
|
|
|
|
|
|
|
+ * 电子保单 pdf 002 入参不需要流程id
|
|
|
*
|
|
*
|
|
|
* @param policyPdfRequest
|
|
* @param policyPdfRequest
|
|
|
* @return
|
|
* @return
|
|
@@ -255,104 +353,217 @@ public class PinganRequestApiComponents {
|
|
|
params.put("userId", policyPdfRequest.getUserId());
|
|
params.put("userId", policyPdfRequest.getUserId());
|
|
|
params.put("documentNo", policyPdfRequest.getDocumentNo());
|
|
params.put("documentNo", policyPdfRequest.getDocumentNo());
|
|
|
params.put("checkNo", policyPdfRequest.getCheckNo());
|
|
params.put("checkNo", policyPdfRequest.getCheckNo());
|
|
|
- params.put("vehicle.licenseNo", policyPdfRequest.getVehicle()==null?"":policyPdfRequest.getVehicle().getLicenseNo());
|
|
|
|
|
- params.put("vehicle.frameNo", policyPdfRequest.getVehicle()==null?"":policyPdfRequest.getVehicle().getFrameNo());
|
|
|
|
|
- logger.info("加密前的内容"+params.toString());
|
|
|
|
|
|
|
+ params.put("vehicle.licenseNo", policyPdfRequest.getVehicle() == null ? "" : policyPdfRequest.getVehicle().getLicenseNo());
|
|
|
|
|
+ params.put("vehicle.frameNo", policyPdfRequest.getVehicle() == null ? "" : policyPdfRequest.getVehicle().getFrameNo());
|
|
|
|
|
+ logger.info("加密前的内容" + params.toString());
|
|
|
//添加加密内容
|
|
//添加加密内容
|
|
|
- String encryptContent =RSAPINGANUtils.getStringStringMap(params, properties.getSelfPrivateKey());
|
|
|
|
|
- logger.info("加密后的内容"+encryptContent);
|
|
|
|
|
|
|
+ String encryptContent = RSAPINGANUtils.getStringStringMap(params, properties.getSelfPrivateKey());
|
|
|
|
|
+ logger.info("加密后的内容" + encryptContent);
|
|
|
policyPdfRequest.setSignature(encryptContent);
|
|
policyPdfRequest.setSignature(encryptContent);
|
|
|
- return verificationResponse(policyPdfRequest, properties.getUrl(), PolicyPdfResponse.class,RequestUrl.R_002);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(policyPdfRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ PolicyPdfResponse policyPdfResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ policyPdfResponse = (PolicyPdfResponse)getCheckResponseResult(policyPdfRequest,PolicyPdfResponse.class, RequestUrl.R_002,PolicyPdfResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return policyPdfResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 车辆确认接口 4.2
|
|
* 车辆确认接口 4.2
|
|
|
- *
|
|
|
|
|
|
|
+ * 录入车辆信息,包括其他定价的字段 必调
|
|
|
|
|
+ * 流程id使用3.1返回
|
|
|
* @param carConfirmRequest
|
|
* @param carConfirmRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public CarConfirmResponse carConfirm(CarConfirmRequest carConfirmRequest) throws Exception {
|
|
public CarConfirmResponse carConfirm(CarConfirmRequest carConfirmRequest) throws Exception {
|
|
|
- return verificationResponse(carConfirmRequest, properties.getUrl(), CarConfirmResponse.class,RequestUrl.R_42);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(carConfirmRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ CarConfirmResponse carConfirmResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ carConfirmResponse = (CarConfirmResponse)getCheckResponseResult(carConfirmRequest,CarConfirmResponse.class, RequestUrl.R_42, CarConfirmResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return carConfirmResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 交管车辆验证码 4.3
|
|
|
|
|
|
|
+ * 交管车辆验证码 4.3 流程Id使用 使用 index3.1返回的流程id
|
|
|
|
|
+ * 监管要求,投保前进行交管车辆查询校验 部分机构&&本地已上牌车
|
|
|
* @param dmvehicleInfoRequst
|
|
* @param dmvehicleInfoRequst
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public DmvehicleInfoResponse getDmvehicleInfo(DmvehicleInfoRequst dmvehicleInfoRequst) throws Exception {
|
|
public DmvehicleInfoResponse getDmvehicleInfo(DmvehicleInfoRequst dmvehicleInfoRequst) throws Exception {
|
|
|
- return verificationResponse(dmvehicleInfoRequst, properties.getUrl(), DmvehicleInfoResponse.class,RequestUrl.R_43);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(dmvehicleInfoRequst);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ DmvehicleInfoResponse dmvehicleInfoResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ dmvehicleInfoResponse = (DmvehicleInfoResponse)getCheckResponseResult(dmvehicleInfoRequst,DmvehicleInfoResponse.class, RequestUrl.R_43, DmvehicleInfoResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return dmvehicleInfoResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取财意险险种套餐列表 4.4
|
|
* 获取财意险险种套餐列表 4.4
|
|
|
|
|
+ * 不需要流程id
|
|
|
* @param unAutoProductListRequest
|
|
* @param unAutoProductListRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public UnAutoProductListResponse getUnAutoProductList(UnAutoProductListRequest unAutoProductListRequest) throws Exception {
|
|
public UnAutoProductListResponse getUnAutoProductList(UnAutoProductListRequest unAutoProductListRequest) throws Exception {
|
|
|
- return verificationResponse(unAutoProductListRequest, properties.getUrl(), UnAutoProductListResponse.class,RequestUrl.R_44);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(unAutoProductListRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ UnAutoProductListResponse unAutoProductListResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ unAutoProductListResponse = (UnAutoProductListResponse)getCheckResponseResult(unAutoProductListRequest,UnAutoProductListResponse.class, RequestUrl.R_44, UnAutoProductListResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return unAutoProductListResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取财意险险种套餐责任信息 4.5
|
|
* 获取财意险险种套餐责任信息 4.5
|
|
|
|
|
+ * 不需要流程id
|
|
|
* @param unAutoProductDetailRequest
|
|
* @param unAutoProductDetailRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public UnAutoProductDetailResponse getUnAutoProductDetail(UnAutoProductDetailRequest unAutoProductDetailRequest) throws Exception {
|
|
public UnAutoProductDetailResponse getUnAutoProductDetail(UnAutoProductDetailRequest unAutoProductDetailRequest) throws Exception {
|
|
|
- return verificationResponse(unAutoProductDetailRequest, properties.getUrl(), UnAutoProductDetailResponse.class,RequestUrl.R_45);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(unAutoProductDetailRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ UnAutoProductDetailResponse unAutoProductDetailResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ unAutoProductDetailResponse = (UnAutoProductDetailResponse)getCheckResponseResult(unAutoProductDetailRequest,UnAutoProductDetailResponse.class, RequestUrl.R_45, UnAutoProductDetailResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return unAutoProductDetailResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 保费计算 5.1
|
|
|
|
|
|
|
+ * 保费计算 5.1 流程id使用??? 猜测使用 上一步的返回的流程id 暂时使用4.2返回的流程id
|
|
|
|
|
+ * 商业险+交强险(车船税)保费计算 必调
|
|
|
* @param quoteRequest
|
|
* @param quoteRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public QuoteResponse quote(QuoteRequest quoteRequest) throws Exception {
|
|
public QuoteResponse quote(QuoteRequest quoteRequest) throws Exception {
|
|
|
- return verificationResponse(quoteRequest, properties.getUrl(), QuoteResponse.class,RequestUrl.R_51);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(quoteRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ QuoteResponse quoteResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ quoteResponse = (QuoteResponse)getCheckResponseResult(quoteRequest,QuoteResponse.class, RequestUrl.R_51, QuoteResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return quoteResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 服务类特约检索 5.2
|
|
* 服务类特约检索 5.2
|
|
|
|
|
+ * flowid C 深圳地区传入流程号
|
|
|
|
|
+ * 不需要流程id
|
|
|
|
|
+ *
|
|
|
* @param serviceContractRequest
|
|
* @param serviceContractRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public ServiceContractResponse queryServiceContract(ServiceContractRequest serviceContractRequest) throws Exception {
|
|
public ServiceContractResponse queryServiceContract(ServiceContractRequest serviceContractRequest) throws Exception {
|
|
|
- return verificationResponse(serviceContractRequest, properties.getUrl(), ServiceContractResponse.class,RequestUrl.R_52);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(serviceContractRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ ServiceContractResponse serviceContractResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ serviceContractResponse = (ServiceContractResponse)getCheckResponseResult(serviceContractRequest,ServiceContractResponse.class, RequestUrl.R_52, ServiceContractResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return serviceContractResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 补充信息并核保 6.1
|
|
* 补充信息并核保 6.1
|
|
|
|
|
+ * 流程id使用????? 暂时使用5.1返回的流程id
|
|
|
|
|
+ * 补充信息并核保 查看特别约定
|
|
|
|
|
+ * 查看车辆验车状态
|
|
|
|
|
+ * 申请核保 必调
|
|
|
|
|
+ *
|
|
|
* @param submitApplyRequest
|
|
* @param submitApplyRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public SubmitApplyResponse submitApply(SubmitApplyRequest submitApplyRequest) throws Exception {
|
|
public SubmitApplyResponse submitApply(SubmitApplyRequest submitApplyRequest) throws Exception {
|
|
|
- return verificationResponse(submitApplyRequest, properties.getUrl(), SubmitApplyResponse.class,RequestUrl.R_61);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(submitApplyRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ SubmitApplyResponse submitApplyResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ submitApplyResponse = (SubmitApplyResponse)getCheckResponseResult(submitApplyRequest,SubmitApplyResponse.class,RequestUrl.R_61, SubmitApplyResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return submitApplyResponse;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 二维码支付 78
|
|
* 二维码支付 78
|
|
|
|
|
+ * 不需要流程id
|
|
|
|
|
+ * 二维码支付 返回的是一个短链接,需要合作伙伴自己生成二维码 二维码支付
|
|
|
|
|
+ *
|
|
|
* @param scanCodeURLRequest
|
|
* @param scanCodeURLRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public ScanCodeURLResponse getScanCodeURL(ScanCodeURLRequest scanCodeURLRequest) throws Exception {
|
|
public ScanCodeURLResponse getScanCodeURL(ScanCodeURLRequest scanCodeURLRequest) throws Exception {
|
|
|
- return verificationResponse(scanCodeURLRequest, properties.getUrl(),ScanCodeURLResponse.class,RequestUrl.R_78);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(scanCodeURLRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ ScanCodeURLResponse scanCodeURLResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ scanCodeURLResponse = (ScanCodeURLResponse)getCheckResponseResult(scanCodeURLRequest,ScanCodeURLResponse.class, RequestUrl.R_78, ScanCodeURLResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return scanCodeURLResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 承保接口 82
|
|
* 承保接口 82
|
|
|
|
|
+ * 承保接口
|
|
|
|
|
+ * 不需要流程id
|
|
|
|
|
+ * 承保获取保单号 承保失败,尝试重新承保。或主动获取承保保单号(主要针对验证码录入错误,补录验证码后期望承保情况)
|
|
|
* @param acceptRequest
|
|
* @param acceptRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public AcceptResponse accept(AcceptRequest acceptRequest) throws Exception {
|
|
public AcceptResponse accept(AcceptRequest acceptRequest) throws Exception {
|
|
|
- return verificationResponse(acceptRequest, properties.getUrl(), AcceptResponse.class,RequestUrl.R_82);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(acceptRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ AcceptResponse acceptResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ acceptResponse = (AcceptResponse)getCheckResponseResult(acceptRequest,AcceptResponse.class, RequestUrl.R_82, AcceptResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return acceptResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 单证状态查询 91
|
|
* 单证状态查询 91
|
|
|
- *
|
|
|
|
|
|
|
+ * 不需要流程id
|
|
|
|
|
+ * 单证状态查询 投保单概要字段 合作伙伴主动获取投保单状态(包括保单号)
|
|
|
|
|
+ * <p>
|
|
|
* 对userId 、documentNoList、参数按照字段名的ASCII 码从小到大排序(字典序)后,使用URL键值对的格式(即key1=value1&key2=value2)拼接成字符串,然后对该字符串进行签名,得到signature
|
|
* 对userId 、documentNoList、参数按照字段名的ASCII 码从小到大排序(字典序)后,使用URL键值对的格式(即key1=value1&key2=value2)拼接成字符串,然后对该字符串进行签名,得到signature
|
|
|
- * * documentNoList值中的单证号按照字典顺序从小到大排序,用逗号分隔,例如
|
|
|
|
|
- * * documentNoList=1234,2345
|
|
|
|
|
- * * RSA秘钥找平安获取
|
|
|
|
|
|
|
+ * * documentNoList值中的单证号按照字典顺序从小到大排序,用逗号分隔,例如
|
|
|
|
|
+ * * documentNoList=1234,2345
|
|
|
|
|
+ * * RSA秘钥找平安获取
|
|
|
|
|
+ *
|
|
|
* @param documentStatusListRequest
|
|
* @param documentStatusListRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
@@ -363,38 +574,69 @@ public class PinganRequestApiComponents {
|
|
|
//documentNoList排序加逗号拼接
|
|
//documentNoList排序加逗号拼接
|
|
|
String[] documentNoList = documentStatusListRequest.getDocumentNoList();
|
|
String[] documentNoList = documentStatusListRequest.getDocumentNoList();
|
|
|
TreeSet<String> treeSet = new TreeSet<>();
|
|
TreeSet<String> treeSet = new TreeSet<>();
|
|
|
- for (String documentNo : documentNoList) {
|
|
|
|
|
- treeSet.add(documentNo);
|
|
|
|
|
|
|
+ for (String documentNo : documentNoList) {
|
|
|
|
|
+ treeSet.add(documentNo);
|
|
|
}
|
|
}
|
|
|
- String documentNoListStr="";
|
|
|
|
|
|
|
+ String documentNoListStr = "";
|
|
|
for (String documentNoSort : treeSet) {
|
|
for (String documentNoSort : treeSet) {
|
|
|
- documentNoListStr+=",";
|
|
|
|
|
|
|
+ documentNoListStr += ",";
|
|
|
}
|
|
}
|
|
|
params.put("documentNoList", documentNoListStr.substring(0, documentNoListStr.length() - 1));
|
|
params.put("documentNoList", documentNoListStr.substring(0, documentNoListStr.length() - 1));
|
|
|
//添加加密内容
|
|
//添加加密内容
|
|
|
- logger.info("加密前的内容"+params.toString());
|
|
|
|
|
|
|
+ logger.info("加密前的内容" + params.toString());
|
|
|
//添加加密内容
|
|
//添加加密内容
|
|
|
- String encryptContent =RSAPINGANUtils.getStringStringMap(params, properties.getSelfPrivateKey());
|
|
|
|
|
- logger.info("加密后的内容"+encryptContent);
|
|
|
|
|
|
|
+ String encryptContent = RSAPINGANUtils.getStringStringMap(params, properties.getSelfPrivateKey());
|
|
|
|
|
+ logger.info("加密后的内容" + encryptContent);
|
|
|
documentStatusListRequest.setSignature(encryptContent);
|
|
documentStatusListRequest.setSignature(encryptContent);
|
|
|
- return verificationResponse(documentStatusListRequest, properties.getUrl(), DocumentStatusListResponse.class,RequestUrl.R_91);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(documentStatusListRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ DocumentStatusListResponse documentStatusListResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ documentStatusListResponse = (DocumentStatusListResponse)getCheckResponseResult(documentStatusListRequest,DocumentStatusListResponse.class, RequestUrl.R_91, DocumentStatusListResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return documentStatusListResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 撤销单证 92
|
|
* 撤销单证 92
|
|
|
|
|
+ * 撤销单证 撤销投保单或者通知单
|
|
|
|
|
+ * 不需要传流程id
|
|
|
* @param repealDocumentRequest
|
|
* @param repealDocumentRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public RepealDocumentResponse repealDocument(RepealDocumentRequest repealDocumentRequest) throws Exception {
|
|
public RepealDocumentResponse repealDocument(RepealDocumentRequest repealDocumentRequest) throws Exception {
|
|
|
- return verificationResponse(repealDocumentRequest, properties.getUrl(), RepealDocumentResponse.class,RequestUrl.R_92);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(repealDocumentRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ RepealDocumentResponse repealDocumentResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ repealDocumentResponse = (RepealDocumentResponse)getCheckResponseResult(repealDocumentRequest,RepealDocumentResponse.class, RequestUrl.R_92, RepealDocumentResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return repealDocumentResponse;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 资料上传 93
|
|
* 资料上传 93
|
|
|
|
|
+ * 资料上传 资料退回补传、事后资料上传
|
|
|
|
|
+ * * 不需要传流程id
|
|
|
* @param uploadFilesRequest
|
|
* @param uploadFilesRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public UploadFilesResponse uploadFiles(UploadFilesRequest uploadFilesRequest) throws Exception {
|
|
public UploadFilesResponse uploadFiles(UploadFilesRequest uploadFilesRequest) throws Exception {
|
|
|
- return verificationResponse(uploadFilesRequest, properties.getUrl(), UploadFilesResponse.class,RequestUrl.R_93);
|
|
|
|
|
|
|
+ //验证入参数据
|
|
|
|
|
+ checkRequestParams(uploadFilesRequest);
|
|
|
|
|
+ //验证出参数据
|
|
|
|
|
+ UploadFilesResponse uploadFilesResponse=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ uploadFilesResponse = (UploadFilesResponse)getCheckResponseResult(uploadFilesRequest,UploadFilesResponse.class, RequestUrl.R_93, UploadFilesResponseCodeEnum.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return uploadFilesResponse;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|