|
|
@@ -3,7 +3,6 @@ package com.ydtech.modules.order.service.impl;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
import com.ydtech.config.properties.GuorenApiConfigurationProperties;
|
|
|
@@ -29,12 +28,8 @@ import com.ydtech.modules.order.entity.api.guoren.constants.GoodsClassifyList;
|
|
|
import com.ydtech.modules.order.entity.api.guoren.constants.PlatformInterfaceCode;
|
|
|
import com.ydtech.modules.order.entity.api.guoren.request.ApplicationDetailsRequest;
|
|
|
import com.ydtech.modules.order.entity.api.guoren.request.NonAutoInsuranceRequest;
|
|
|
-import com.ydtech.modules.order.entity.api.guoren.request.QueryNoCarPolicyNoRequest;
|
|
|
-import com.ydtech.modules.order.entity.api.guoren.request.SignatureRequest;
|
|
|
import com.ydtech.modules.order.entity.api.guoren.response.NonAutoInsOrderResponse;
|
|
|
-import com.ydtech.modules.order.entity.api.guoren.response.QueryNoCarPolicyNoResponse;
|
|
|
import com.ydtech.modules.order.entity.api.guoren.response.SignatureResponse;
|
|
|
-import com.ydtech.modules.order.entity.dto.DrivingInsuranceDto;
|
|
|
import com.ydtech.modules.order.entity.dto.InsUploadImagesDto;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
|
@@ -55,7 +50,6 @@ import org.apache.commons.httpclient.methods.multipart.StringPart;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -100,9 +94,13 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
|
|
|
private final GuorenRequestApiComponent guorenRequestApiComponent;
|
|
|
|
|
|
- private final GuorenDuplicateInsuranceComponent guorenDuplicateInsuranceComponent;
|
|
|
|
|
|
- public GuorenOrderApiServiceImpl(GuorenApiConfigurationProperties properties, InsOrdersComponents insOrdersComponents, GuorenRequestApiComponent guorenRequestApiComponent, InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService, EsmInsCompanyService esmInsCompanyService, ConfigureParametersComponents configureParametersComponents, InsTaskImagesMapper insTaskImagesMapper, GuorenDuplicateInsuranceComponent guorenDuplicateInsuranceComponent) {
|
|
|
+
|
|
|
+ public GuorenOrderApiServiceImpl(GuorenApiConfigurationProperties properties, InsOrdersComponents insOrdersComponents,
|
|
|
+ GuorenRequestApiComponent guorenRequestApiComponent, InsAreaCompanyService insAreaCompanyService,
|
|
|
+ InsOrdersService insOrdersService, EsmInsCompanyService esmInsCompanyService,
|
|
|
+ ConfigureParametersComponents configureParametersComponents, InsTaskImagesMapper insTaskImagesMapper
|
|
|
+ ) {
|
|
|
this.properties = properties;
|
|
|
this.insOrdersComponents = insOrdersComponents;
|
|
|
this.guorenRequestApiComponent = guorenRequestApiComponent;
|
|
|
@@ -111,7 +109,7 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
this.esmInsCompanyService = esmInsCompanyService;
|
|
|
this.configureParametersComponents = configureParametersComponents;
|
|
|
this.insTaskImagesMapper = insTaskImagesMapper;
|
|
|
- this.guorenDuplicateInsuranceComponent = guorenDuplicateInsuranceComponent;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -170,7 +168,8 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
String orderCode = null;
|
|
|
GuorenAccidentalDrivingVo accidentalDrivingVo = quoteVo.getAccidentalDrivingVo();
|
|
|
if (GoodsClassifyList.verificationGoodsCode(accidentalDrivingVo.getGoodsCode())) {
|
|
|
- NonAutoInsOrderResponse nonAutoInsOrderResponse = nonAutoInsOrder(yaQuoteInfoVo, accidentalDrivingVo, carPriceResult.getInputvo(), channelInfo, vinQ);
|
|
|
+ NonAutoInsOrderResponse nonAutoInsOrderResponse = nonAutoInsOrder(yaQuoteInfoVo, accidentalDrivingVo,
|
|
|
+ carPriceResult.getInputvo(), channelInfo, vinQ);
|
|
|
AssertionUtils.isEmpty(nonAutoInsOrderResponse.getData(), nonAutoInsOrderResponse.getMessage());
|
|
|
orderCode = nonAutoInsOrderResponse.getData().getOrderCode();
|
|
|
isNoCar = true;
|
|
|
@@ -295,8 +294,10 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
InsOrderStatusResp iosr = insOrderStatus(iac);
|
|
|
|
|
|
if (null != iosr && CollUtil.isNotEmpty(iosr.getData())) {
|
|
|
- InsOrderStatusResp.DataDTO jqDataDTO = iosr.getData().stream().filter(a -> a.getProposalNo().equals(iac.getJqapplyno())).findFirst().orElse(null);
|
|
|
- InsOrderStatusResp.DataDTO syDataDTO = iosr.getData().stream().filter(b -> b.getProposalNo().equals(iac.getSyapplyno())).findFirst().orElse(null);
|
|
|
+ InsOrderStatusResp.DataDTO jqDataDTO =
|
|
|
+ iosr.getData().stream().filter(a -> a.getProposalNo().equals(iac.getJqapplyno())).findFirst().orElse(null);
|
|
|
+ InsOrderStatusResp.DataDTO syDataDTO =
|
|
|
+ iosr.getData().stream().filter(b -> b.getProposalNo().equals(iac.getSyapplyno())).findFirst().orElse(null);
|
|
|
|
|
|
//待核保订单处理
|
|
|
if (iac.getOrderstatus().equals(InsOrderStatusEnum.WAIT_AUDIT.getCode())) {
|
|
|
@@ -305,7 +306,8 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
//单商
|
|
|
boolean syBoo = null != syDataDTO && null == jqDataDTO && syDataDTO.getUnderwriteFlag().equals("1");
|
|
|
//交商
|
|
|
- boolean jqSyBoo = null != syDataDTO && null != jqDataDTO && syDataDTO.getUnderwriteFlag().equals("1") && jqDataDTO.getUnderwriteFlag().equals("1");
|
|
|
+ boolean jqSyBoo =
|
|
|
+ null != syDataDTO && null != jqDataDTO && syDataDTO.getUnderwriteFlag().equals("1") && jqDataDTO.getUnderwriteFlag().equals("1");
|
|
|
if (jqBoo || syBoo || jqSyBoo) {
|
|
|
iac.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
//更新支付链接
|
|
|
@@ -397,7 +399,9 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
try {
|
|
|
FilePart file1 = new FilePart("file", new File(a.getFilePath()));
|
|
|
|
|
|
- Part[] parts = {file1, new StringPart("businessNo", formMap.get("businessNo").toString()), new StringPart("operatorCode", formMap.get("operatorCode").toString()), new StringPart("comCode", formMap.get("comCode").toString()), new StringPart("fileGroup", formMap.get("fileGroup").toString())};
|
|
|
+ Part[] parts = {file1, new StringPart("businessNo", formMap.get("businessNo").toString()), new StringPart("operatorCode",
|
|
|
+ formMap.get("operatorCode").toString()), new StringPart("comCode", formMap.get("comCode").toString()),
|
|
|
+ new StringPart("fileGroup", formMap.get("fileGroup").toString())};
|
|
|
|
|
|
String result = HttpUtil.sendPostFromFile(parts, properties.getUploadUrl());
|
|
|
if (StringUtils.isEmpty(result)) {
|
|
|
@@ -808,20 +812,24 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
CarInfoVo carInfo = yaQuoteInfoVo.getCarInfo();
|
|
|
// //匹配车型
|
|
|
//车辆年款不能超过注册日期
|
|
|
- List<CarPriceMuchResp.DataDTO.CarsDTO> vehicleInfoList = respMuch.getData().getCars().stream().filter(a -> DateTimeUtil.dateIsAfter(carInfo.getRegisterDate(), a.getCarYear())).collect(Collectors.toList());
|
|
|
+ List<CarPriceMuchResp.DataDTO.CarsDTO> vehicleInfoList =
|
|
|
+ respMuch.getData().getCars().stream().filter(a -> DateTimeUtil.dateIsAfter(carInfo.getRegisterDate(),
|
|
|
+ a.getCarYear())).collect(Collectors.toList());
|
|
|
|
|
|
//匹配的车辆信息数据 为空
|
|
|
if (CollUtil.isEmpty(vehicleInfoList)) {
|
|
|
confirmCarMuch = respMuch.getData().getCars().get(0);
|
|
|
} else {
|
|
|
//匹配的车辆信息数据
|
|
|
- CarPriceMuchResp.DataDTO.CarsDTO matchVehicleInfo = vehicleInfoList.stream().filter(a -> a.getCarYear().equals(carInfo.getPurchasePrice())).findFirst().orElse(null);
|
|
|
+ CarPriceMuchResp.DataDTO.CarsDTO matchVehicleInfo =
|
|
|
+ vehicleInfoList.stream().filter(a -> a.getCarYear().equals(carInfo.getPurchasePrice())).findFirst().orElse(null);
|
|
|
if (null != matchVehicleInfo) {
|
|
|
confirmCarMuch = matchVehicleInfo;
|
|
|
} else {
|
|
|
//匹配的车辆信息数据里 未匹配成功 默认选择第一条
|
|
|
//排序 年款降序 金额升序
|
|
|
- vehicleInfoList = vehicleInfoList.stream().sorted(Comparator.comparing(CarPriceMuchResp.DataDTO.CarsDTO::getCarYear).thenComparing((o1, o2) -> Integer.compare(StringUtils.toInt(o2.getCarYear()), StringUtils.toInt(o1.getCarYear()))).reversed()).collect(Collectors.toList());
|
|
|
+ vehicleInfoList =
|
|
|
+ vehicleInfoList.stream().sorted(Comparator.comparing(CarPriceMuchResp.DataDTO.CarsDTO::getCarYear).thenComparing((o1, o2) -> Integer.compare(StringUtils.toInt(o2.getCarYear()), StringUtils.toInt(o1.getCarYear()))).reversed()).collect(Collectors.toList());
|
|
|
|
|
|
confirmCarMuch = vehicleInfoList.get(0);
|
|
|
}
|
|
|
@@ -853,7 +861,8 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
/**
|
|
|
* 保费计算
|
|
|
*/
|
|
|
- public PremiumResp.DataDTO premiumQuery(BaseQuoteInfoVo yaQuoteInfoVo, CarPriceResp.DataDTO carPriceResult, VinQueryResp.DataDTO vinQ, boolean isNoCar) {
|
|
|
+ public PremiumResp.DataDTO premiumQuery(BaseQuoteInfoVo yaQuoteInfoVo, CarPriceResp.DataDTO carPriceResult, VinQueryResp.DataDTO vinQ
|
|
|
+ , boolean isNoCar) {
|
|
|
|
|
|
//请求信息列表
|
|
|
List<String> requestInfoList = new ArrayList<>();
|
|
|
@@ -861,28 +870,28 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
//构造请求参数
|
|
|
PremiumReq req = PremiumReq.buildQuoteParam(yaQuoteInfoVo, carPriceResult, vinQ, isNoCar);
|
|
|
PremiumResp resp;
|
|
|
- StringBuilder flag = new StringBuilder();
|
|
|
|
|
|
for (; ; ) {
|
|
|
resp = guorenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00004, PremiumResp.class);
|
|
|
req.getCi().getPrpTmain().setAnswer(null);
|
|
|
req.getBi().getPrpTmain().setAnswer(null);
|
|
|
//1、 交强险重复投保 替换时间
|
|
|
- boo = guorenDuplicateInsuranceComponent.processor(resp, requestInfoList, req);
|
|
|
+ boo = GuorenDuplicateInsuranceComponent.processor(resp, requestInfoList, req);
|
|
|
if (boo) {
|
|
|
- flag.append("重复投保处理 |");
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
+ boo = GuorenDuplicateInsuranceComponent.theCheckCodeIsWrong(resp);
|
|
|
+ if (boo) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
//2、 转保
|
|
|
- boo = buildCheckCodeParam(resp, requestInfoList, req);
|
|
|
+ boo = GuorenDuplicateInsuranceComponent.buildCheckCodeParam(resp, requestInfoList, req);
|
|
|
if (boo) {
|
|
|
- flag.append("转保处理 |");
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
- if (!boo) {
|
|
|
- break;
|
|
|
- }
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
resp.getData().setCiStartDate(req.getCi().getPrpTmain().getStartDate());
|
|
|
@@ -917,8 +926,10 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
@Override
|
|
|
public List<NonAutoInsuranceList> gainNonAutoInsList(NonAutoInsuranceQueryVo nonAutoInsuranceQueryVo) {
|
|
|
// 1 构造非车请求
|
|
|
- NonAutoInsuranceRequest nonAutoInsuranceRequest = new NonAutoInsuranceRequest(nonAutoInsuranceQueryVo.getGoodsCode(), properties.getChannelCode());
|
|
|
- NonAutoInsResp resp = guorenRequestApiComponent.request(nonAutoInsuranceRequest, PlatformInterfaceCode.API_IIIRBT00053, NonAutoInsResp.class);
|
|
|
+ NonAutoInsuranceRequest nonAutoInsuranceRequest = new NonAutoInsuranceRequest(nonAutoInsuranceQueryVo.getGoodsCode(),
|
|
|
+ properties.getChannelCode());
|
|
|
+ NonAutoInsResp resp = guorenRequestApiComponent.request(nonAutoInsuranceRequest, PlatformInterfaceCode.API_IIIRBT00053,
|
|
|
+ NonAutoInsResp.class);
|
|
|
// 2 构造返回参数
|
|
|
NonAutoInsResp.DataDTO data = resp.getData();
|
|
|
// 2.1 无法获取数据
|
|
|
@@ -931,7 +942,8 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
BeanUtils.copyProperties(prodListDTO, nonAutoInsuranceList);
|
|
|
NonAutoInsResp.DataDTO.ProdListDTO.ProdRiskListDTO prodRiskListDTO = prodListDTO.getProdRiskList().get(0);
|
|
|
String riskCode = prodRiskListDTO.getRiskCode();
|
|
|
- List<NonAutoInsResp.DataDTO.ProdListDTO.ProdRiskListDTO.ProdCvgLiabListDTO> prodCvgLiabList = prodRiskListDTO.getProdCvgLiabList();
|
|
|
+ List<NonAutoInsResp.DataDTO.ProdListDTO.ProdRiskListDTO.ProdCvgLiabListDTO> prodCvgLiabList =
|
|
|
+ prodRiskListDTO.getProdCvgLiabList();
|
|
|
nonAutoInsuranceList.setProdCvgLiabList(prodCvgLiabList);
|
|
|
nonAutoInsuranceList.setRiskCode(riskCode);
|
|
|
nonAutoInsuranceLists.add(nonAutoInsuranceList);
|
|
|
@@ -946,58 +958,17 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
* @author: lig
|
|
|
* @date: 2023-09-28
|
|
|
*/
|
|
|
- public NonAutoInsOrderResponse nonAutoInsOrder(BaseQuoteInfoVo yaQuoteInfoVo, GuorenAccidentalDrivingVo accidentalDrivingVo, String carPriceUuid, ChannelInfoDto channelInfo, VinQueryResp.DataDTO vinQ) {
|
|
|
+ public NonAutoInsOrderResponse nonAutoInsOrder(BaseQuoteInfoVo yaQuoteInfoVo, GuorenAccidentalDrivingVo accidentalDrivingVo,
|
|
|
+ String carPriceUuid, ChannelInfoDto channelInfo, VinQueryResp.DataDTO vinQ) {
|
|
|
//构造请求参数
|
|
|
- NonAutoInsOrderReq nonAutoInsOrderReq = new NonAutoInsOrderReq(yaQuoteInfoVo, vinQ, accidentalDrivingVo, channelInfo, carPriceUuid, properties.getChannelCode());
|
|
|
+ NonAutoInsOrderReq nonAutoInsOrderReq = new NonAutoInsOrderReq(yaQuoteInfoVo, vinQ, accidentalDrivingVo, channelInfo,
|
|
|
+ carPriceUuid, properties.getChannelCode());
|
|
|
return guorenRequestApiComponent.request(nonAutoInsOrderReq, PlatformInterfaceCode.API_IIIRBT00054, NonAutoInsOrderResponse.class);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 构造交强险 商业险 转报code
|
|
|
- *
|
|
|
- * @author: lig
|
|
|
- * @date: 2023年10月13日 0013
|
|
|
- */
|
|
|
- private boolean buildCheckCodeParam(PremiumResp resp, List<String> requestInfoList, PremiumReq req) {
|
|
|
- String ciCheckCode = resp.getData().getCicheckCode();
|
|
|
- String biCheckCode = resp.getData().getBicheckCode();
|
|
|
- if (StringUtils.isNotEmpty(ciCheckCode) || StringUtils.isNotEmpty(biCheckCode)) {
|
|
|
- CheckCodeResp ccResp = gainCheckCode(ciCheckCode, biCheckCode);
|
|
|
- req.getCi().getPrpTmain().setAnswer(ccResp.getJqImageCode());
|
|
|
- req.getBi().getPrpTmain().setAnswer(ccResp.getSyImageCode());
|
|
|
- requestInfoList.add("转保单");
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取图片验证码 校验的code
|
|
|
- *
|
|
|
- * @author: lig
|
|
|
- * @date: 2023年10月13日 0013
|
|
|
- */
|
|
|
- private CheckCodeResp gainCheckCode(String jqImageStr, String syImageStr) {
|
|
|
- Map<String, String> bodyMap = new HashMap<>();
|
|
|
- bodyMap.put("jqImage", StringUtils.toString(jqImageStr, ""));
|
|
|
- bodyMap.put("syImage", StringUtils.toString(syImageStr, ""));
|
|
|
- String sendBody = JsonUtils.toJson(bodyMap);
|
|
|
- String ocrStr = HttpUtil.sendPost("http://47.92.254.66:8088/getres", sendBody);
|
|
|
- return JSONUtil.toBean(ocrStr, CheckCodeResp.class);
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
- @Data
|
|
|
- class CheckCodeResp {
|
|
|
|
|
|
- @JsonProperty(value = "jqImageCode")
|
|
|
- String jqImageCode;
|
|
|
|
|
|
- @JsonProperty(value = "syImageCode")
|
|
|
- String syImageCode;
|
|
|
|
|
|
- }
|
|
|
|
|
|
}
|