|
|
@@ -1,5 +1,7 @@
|
|
|
package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
@@ -246,6 +248,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
}
|
|
|
//增值服务核保传入开关,打开时保费计算无需传入,保费计算返回增值服务信息,核保传入
|
|
|
String clauseCaseSwitch = indexResponse.getClauseCaseSwitch();
|
|
|
+ // 中保信平台车型信息返回开关,机构维度
|
|
|
+ String showCircModelsSwitch = indexResponse.getShowCircModelsSwitch();
|
|
|
// 此处返回的 flowid 4.1.续保确认 4.2.车辆信息确认 001 平安车型搜索接口 需要使用
|
|
|
String flowid = indexResponse.getFlowid();
|
|
|
|
|
|
@@ -259,42 +263,10 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
if (searchPAVehicleListResponse == null || !"0".equals(searchPAVehicleListResponse.getResultCode())) {
|
|
|
throw new SystemException(searchPAVehicleListResponse.getResultMessage());
|
|
|
}
|
|
|
- if(searchPAVehicleListResponse.getModels()==null || searchPAVehicleListResponse.getModels().size()==0){
|
|
|
- throw new SystemException("未匹配到车型,请输入正确车型");
|
|
|
- }
|
|
|
- List<SearchPAVehicleListResponse.ModelsDto> models = searchPAVehicleListResponse.getModels();
|
|
|
- SearchPAVehicleListResponse.ModelsDto model = new SearchPAVehicleListResponse.ModelsDto();
|
|
|
- if (models != null && models.size() == 1) {
|
|
|
- model = models.get(0);
|
|
|
- } else if (models != null && models.size() > 1) {
|
|
|
- //通过年款和新车购置价确定唯一
|
|
|
- String purchasePrice = carInfo.getPurchasePrice();
|
|
|
- String caryear = carInfo.getPurchasePrice();
|
|
|
- Iterator<SearchPAVehicleListResponse.ModelsDto> it = models.iterator();
|
|
|
- while(it.hasNext()){
|
|
|
- SearchPAVehicleListResponse.ModelsDto x = it.next();
|
|
|
- if(!purchasePrice.equals(x.getPrice())){
|
|
|
- it.remove();
|
|
|
- }
|
|
|
- }
|
|
|
- if(StringUtils.isNotBlank(caryear) && models.size()>1){
|
|
|
- Iterator<SearchPAVehicleListResponse.ModelsDto> itNew = models.iterator();
|
|
|
- while(it.hasNext()){
|
|
|
- SearchPAVehicleListResponse.ModelsDto x = itNew.next();
|
|
|
- if(!caryear.contains(x.getMarketDate())){
|
|
|
- it.remove();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(models.size()>1){
|
|
|
- model = models.get(0);
|
|
|
- }else if(models.size()==0){
|
|
|
- throw new SystemException("未匹配到车型");
|
|
|
- }else if(models.size()==1){
|
|
|
- model = models.get(0);
|
|
|
- }
|
|
|
- //model = models.get(0);
|
|
|
+ if (searchPAVehicleListResponse == null || StringUtils.isNotBlank(searchPAVehicleListResponse.getValidMessage())) {
|
|
|
+ throw new SystemException(searchPAVehicleListResponse.getValidMessage());
|
|
|
}
|
|
|
+ SearchPAVehicleListResponse.ModelsDto model = getModelsDto(searchPAVehicleListResponse, carInfo,showCircModelsSwitch,parameters.getUserId(),flowid,carInfo.getModelcname());
|
|
|
//能源车 判断 赋值能源参数
|
|
|
String flag="";
|
|
|
if("1,2,3,".contains(carInfo.getEnergyType())){
|
|
|
@@ -332,6 +304,79 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
throw new SystemException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/8/29 10:50
|
|
|
+ * @Description: 判断是否
|
|
|
+ */
|
|
|
+ private static SearchPAVehicleListResponse.ModelsDto getModelsDto(SearchPAVehicleListResponse searchPAVehicleListResponse, CarInfoVo carInfo,String showCircModelsSwitch,String userId,String flowid,String modelName) {
|
|
|
+ //判断
|
|
|
+ SearchPAVehicleListResponse.ModelsDto model = new SearchPAVehicleListResponse.ModelsDto();
|
|
|
+
|
|
|
+ //中保信返回
|
|
|
+ List<SearchPAVehicleListResponse.VehicleModelsDto> vehicleModels = searchPAVehicleListResponse.getVehicleModels();
|
|
|
+ if("false".equals(showCircModelsSwitch)){
|
|
|
+ if(searchPAVehicleListResponse.getModels()==null || searchPAVehicleListResponse.getModels().size()==0){
|
|
|
+ throw new SystemException("未匹配到车型,请输入正确车型");
|
|
|
+ }
|
|
|
+ List<SearchPAVehicleListResponse.ModelsDto> models = searchPAVehicleListResponse.getModels();
|
|
|
+ model = getModelsDto(carInfo, models, model);
|
|
|
+ }else{
|
|
|
+ SearchPAVehicleListResponse.VehicleModelsDto vehicleModelsDto = vehicleModels.get(0);
|
|
|
+ List<SearchPAVehicleListResponse.ModelsDto> circModels = vehicleModelsDto.getCircModels();
|
|
|
+ if(circModels==null || circModels.size()==0){
|
|
|
+ throw new SystemException("未匹配到车型,请输入正确车型");
|
|
|
+ }
|
|
|
+ model = getModelsDto(carInfo, circModels, model);
|
|
|
+
|
|
|
+ }
|
|
|
+ return model;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/8/29 11:13
|
|
|
+ * @Description: 判断车型唯一
|
|
|
+ */
|
|
|
+ private static SearchPAVehicleListResponse.ModelsDto getModelsDto(CarInfoVo carInfo, List<SearchPAVehicleListResponse.ModelsDto> models, SearchPAVehicleListResponse.ModelsDto model) {
|
|
|
+ if (models != null && models.size() == 1) {
|
|
|
+ model = models.get(0);
|
|
|
+ } else if (models != null && models.size() > 1) {
|
|
|
+ //通过年款和新车购置价确定唯一
|
|
|
+ String purchasePrice = carInfo.getPurchasePrice();
|
|
|
+ String caryear = carInfo.getPurchasePrice();
|
|
|
+ List<SearchPAVehicleListResponse.ModelsDto> modelsNew = new ArrayList<>(models);
|
|
|
+ Iterator<SearchPAVehicleListResponse.ModelsDto> it = models.iterator();
|
|
|
+ while(it.hasNext()){
|
|
|
+ SearchPAVehicleListResponse.ModelsDto x = it.next();
|
|
|
+ if(!purchasePrice.equals(x.getPrice())){
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(caryear) && models.size()>1){
|
|
|
+ Iterator<SearchPAVehicleListResponse.ModelsDto> itNew = models.iterator();
|
|
|
+ while(it.hasNext()){
|
|
|
+ SearchPAVehicleListResponse.ModelsDto x = itNew.next();
|
|
|
+ if(!caryear.contains(x.getMarketDate())){
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(models.size()>1){
|
|
|
+ model = models.get(0);
|
|
|
+ }else if(models.size()==0){
|
|
|
+ if(modelsNew.size()>0){
|
|
|
+ model =modelsNew.get(0);
|
|
|
+ }else{
|
|
|
+ throw new SystemException("未匹配到车型");
|
|
|
+ }
|
|
|
+ }else if(models.size()==1){
|
|
|
+ model = models.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return model;
|
|
|
+ }
|
|
|
/**
|
|
|
* @version
|
|
|
* @author: hxl
|
|
|
@@ -619,12 +664,12 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
String fileName = file.getName();
|
|
|
String documentName = fileName.split("\\.")[0];
|
|
|
String documentFormat = fileName.split("\\.")[1];
|
|
|
- if(StringUtils.isBlank(insUploadImagesDto.getPinganKey())){
|
|
|
- boolean upLoadFileFlag = PingAnUpLoadUtils.getUpLoadFile(properties.getHost(), properties.getBucket(), properties.getAk(), properties.getSk(), file, key);
|
|
|
- if(!upLoadFileFlag){
|
|
|
- throw new SystemException("上传影像文件失败");
|
|
|
- }
|
|
|
- }
|
|
|
+ // if(StringUtils.isBlank(insUploadImagesDto.getPinganKey())){
|
|
|
+ // boolean upLoadFileFlag = PingAnUpLoadUtils.getUpLoadFile(properties.getHost(), properties.getBucket(), properties.getAk(), properties.getSk(), file, key);
|
|
|
+ // if(!upLoadFileFlag){
|
|
|
+ // throw new SystemException("上传影像文件失败");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
UploadFilesRequest.DocListDTO docListDTO = new UploadFilesRequest.DocListDTO(key, documentClass, documentType, documentName,documentFormat ,
|
|
|
null);
|
|
|
list.add(docListDTO);
|
|
|
@@ -962,20 +1007,41 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
insAreaCompany.setCrossInsurance(objects);
|
|
|
}
|
|
|
pinganApiLog.setId(null);
|
|
|
+ String url ="";
|
|
|
//更新狀態
|
|
|
if((OrderStatusCodeEnum.ORDER_STATUS_CODE_B2.getCode().equals(status) || OrderStatusCodeEnum.ORDER_STATUS_CODE_B2.getCode().equals(status)) && ("0".equals(insAreaCompany.getOrderstatus()) || "1".equals(insAreaCompany.getOrderstatus()))){
|
|
|
//说明核保成功,更新大订单和小订单的状态为2 更新为已核保待缴费
|
|
|
+ String signatureUrl = properties.getSignatureUrl();
|
|
|
+ signatureUrl=signatureUrl+"?companyId=" +insAreaCompany.getId();
|
|
|
+ SignEleApplyRequest signEleApplyRequest = new SignEleApplyRequest(parameters.getUserId(), bizApplyNo, forceApplyNo, String.valueOf(System.currentTimeMillis()), "GET", signatureUrl);
|
|
|
+ SignEleApplyResponse signEleApplyResponse = null;
|
|
|
+ try {
|
|
|
+ signEleApplyResponse = pinganRequestApiComponents.signEleApply(signEleApplyRequest,pinganApiLog);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
+ }
|
|
|
+ if (signEleApplyResponse != null && StringUtils.isNotBlank(signEleApplyResponse.getResultMessage())) {
|
|
|
+ url = signEleApplyResponse.getResultMessage();
|
|
|
+ }
|
|
|
+ insAreaCompany.setPaymentLink(url);
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
}else if((OrderStatusCodeEnum.ORDER_STATUS_CODE_BH.getCode().equals(status) || OrderStatusCodeEnum.ORDER_STATUS_CODE_BE.getCode().equals(status)
|
|
|
|| OrderStatusCodeEnum.ORDER_STATUS_CODE_B1.getCode().equals(status) || OrderStatusCodeEnum.ORDER_STATUS_CODE_B6.getCode().equals(status) ) && ("0".equals(insAreaCompany.getOrderstatus()))){
|
|
|
// 待验车 BH 资料人工审核-BE B1 B6
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_AUDIT.getCode());
|
|
|
+ }else if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B4.getCode().equals(status)){
|
|
|
+ //变为核保退回
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.TO_BACK.getCode());
|
|
|
}
|
|
|
+
|
|
|
insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
//UploadFilesResponse uploadFilesResponse = getUploadResponseByParam(insAreaCompany, pinganApiLog, parameters.getUserId());
|
|
|
//if (uploadFilesResponse != null & !"0".equals(uploadFilesResponse.getResultCode()) ) {
|
|
|
// throw new SystemException(uploadFilesResponse.getResultMessage());
|
|
|
// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return HttpResult.ok("提交核保成功");
|
|
|
}
|
|
|
} else {
|
|
|
@@ -1611,6 +1677,20 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
logger.info(documentStatusListResponse.toString()+"调用状态查询接口");
|
|
|
if((OrderStatusCodeEnum.ORDER_STATUS_CODE_B2.getCode().equals(status) || OrderStatusCodeEnum.ORDER_STATUS_CODE_B2.getCode().equals(status)) && ("0".equals(insAreaCompany.getOrderstatus()) || "1".equals(insAreaCompany.getOrderstatus()) )){
|
|
|
//说明核保成功,更新大订单和小订单的状态为1 更新为已核保待缴费 B6 自核
|
|
|
+ String url="";
|
|
|
+ String signatureUrl = properties.getSignatureUrl();
|
|
|
+ signatureUrl=signatureUrl+"?companyId=" +insAreaCompany.getId();
|
|
|
+ SignEleApplyRequest signEleApplyRequest = new SignEleApplyRequest(parameters.getUserId(), bizApplyNo, forceApplyNo, String.valueOf(System.currentTimeMillis()), "GET", signatureUrl);
|
|
|
+ SignEleApplyResponse signEleApplyResponse = null;
|
|
|
+ try {
|
|
|
+ signEleApplyResponse = pinganRequestApiComponents.signEleApply(signEleApplyRequest,pinganApiLog);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
+ }
|
|
|
+ if (signEleApplyResponse != null && StringUtils.isNotBlank(signEleApplyResponse.getResultMessage())) {
|
|
|
+ url = signEleApplyResponse.getResultMessage();
|
|
|
+ }
|
|
|
+ insAreaCompany.setPaymentLink(url);
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode() );
|
|
|
insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
}else if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status) && ("0".equals(insAreaCompany.getOrderstatus()) || "1".equals(insAreaCompany.getOrderstatus()) || "2".equals(insAreaCompany.getOrderstatus()))) {
|
|
|
@@ -1623,6 +1703,9 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
|| OrderStatusCodeEnum.ORDER_STATUS_CODE_B1.getCode().equals(status) || OrderStatusCodeEnum.ORDER_STATUS_CODE_B6.getCode().equals(status)){
|
|
|
// 待验车 BH 资料人工审核-BE B1 B6
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_AUDIT.getCode());
|
|
|
+ }else if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B4.getCode().equals(status)){
|
|
|
+ //变为核保退回
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.TO_BACK.getCode());
|
|
|
}
|
|
|
}
|
|
|
return HttpResult.ok(documentStatusListResponse);
|