|
|
@@ -70,83 +70,90 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
*/
|
|
|
@Override
|
|
|
public QuoteResultsVo quote(QuoteVo quoteVo) {
|
|
|
- OrderBase orderBase = quoteVo.getOrder();
|
|
|
- //配置信息
|
|
|
- HuaTaiConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(HuaTaiConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
- HuaTaiBaseRequestHead baseRequestHead = new HuaTaiBaseRequestHead(parameters);
|
|
|
- String url = getApiUrl(orderBase.getInsuranceCompanyCode());
|
|
|
-
|
|
|
- //查询车型
|
|
|
- CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
- HuaTaiModelsQueryRequest huaTaiModelsQueryRequest = new HuaTaiModelsQueryRequest(carInfoVo);
|
|
|
- huaTaiModelsQueryRequest.setHead(baseRequestHead);
|
|
|
- huaTaiModelsQueryRequest.setLoginCom(parameters.getComCode());
|
|
|
- huaTaiModelsQueryRequest.setAgentCode(parameters.getAgentCode());
|
|
|
- List<HuaTaiModelsQueryResponse.CarModelDto> carModelDtos = huataiRequestApiComponent.modelQuery(huaTaiModelsQueryRequest,
|
|
|
- HuaTaiModelsQueryResponse.class, parameters.getInsuredCode(),url);
|
|
|
- List<HuaTaiModelsQueryResponse.CarModelDto.FullCarDataDto> fullCarDataDtos = new ArrayList<>();
|
|
|
- for (HuaTaiModelsQueryResponse.CarModelDto carModelDto : carModelDtos) {
|
|
|
- fullCarDataDtos.add(carModelDto.getFullCarData());
|
|
|
- }
|
|
|
- // 2.2 过滤车型
|
|
|
- HuaTaiModelsQueryResponse.CarModelDto.FullCarDataDto fullCarDataDto = CarModelsFilterUtils.to(fullCarDataDtos, carInfoVo);
|
|
|
- //获取车辆实际价值
|
|
|
- HuaTaiActualValueResponse actualValueResponse = null;
|
|
|
- RiskInfoVo biRiskInfoVo = quoteVo.getBiRiskInfoVo();//商业险
|
|
|
- if (biRiskInfoVo != null) {
|
|
|
+ try {
|
|
|
+ OrderBase orderBase = quoteVo.getOrder();
|
|
|
+ //配置信息
|
|
|
+ HuaTaiConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(HuaTaiConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
+ HuaTaiBaseRequestHead baseRequestHead = new HuaTaiBaseRequestHead(parameters);
|
|
|
+ String url = getApiUrl(orderBase.getInsuranceCompanyCode());
|
|
|
+
|
|
|
+ //查询车型
|
|
|
+ CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
+ HuaTaiModelsQueryRequest huaTaiModelsQueryRequest = new HuaTaiModelsQueryRequest(carInfoVo);
|
|
|
+ huaTaiModelsQueryRequest.setHead(baseRequestHead);
|
|
|
+ huaTaiModelsQueryRequest.setLoginCom(parameters.getComCode());
|
|
|
+ huaTaiModelsQueryRequest.setAgentCode(parameters.getAgentCode());
|
|
|
+ List<HuaTaiModelsQueryResponse.CarModelDto> carModelDtos = huataiRequestApiComponent.modelQuery(huaTaiModelsQueryRequest,
|
|
|
+ HuaTaiModelsQueryResponse.class, parameters.getInsuredCode(), url);
|
|
|
+ List<HuaTaiModelsQueryResponse.CarModelDto.FullCarDataDto> fullCarDataDtos = new ArrayList<>();
|
|
|
+ for (HuaTaiModelsQueryResponse.CarModelDto carModelDto : carModelDtos) {
|
|
|
+ fullCarDataDtos.add(carModelDto.getFullCarData());
|
|
|
+ }
|
|
|
+ // 2.2 过滤车型
|
|
|
+ HuaTaiModelsQueryResponse.CarModelDto.FullCarDataDto fullCarDataDto = CarModelsFilterUtils.to(fullCarDataDtos, carInfoVo);
|
|
|
+ //获取车辆实际价值
|
|
|
+ HuaTaiActualValueResponse actualValueResponse = null;
|
|
|
+ RiskInfoVo biRiskInfoVo = quoteVo.getBiRiskInfoVo();//商业险
|
|
|
+ if (biRiskInfoVo != null) {
|
|
|
String startDate = biRiskInfoVo.getStartDate();
|
|
|
HuaTaiActualValueRequest huaTaiActualValueRequest = new HuaTaiActualValueRequest(carInfoVo, fullCarDataDto, startDate,
|
|
|
parameters.getComCode());
|
|
|
huaTaiActualValueRequest.setHead(baseRequestHead);
|
|
|
- actualValueResponse = huataiRequestApiComponent.actualValue(huaTaiActualValueRequest, HuaTaiActualValueResponse.class, parameters.getInsuredCode(),url);
|
|
|
- }
|
|
|
- //组装报价参数
|
|
|
- AccidentalDrivingVo accidentalDrivingVo = new AccidentalDrivingVo();
|
|
|
- List<AccidentalDrivingVo> accidentalDrivings = quoteVo.getAccidentalDrivings();
|
|
|
- if (CollectionUtil.isNotEmpty(accidentalDrivings)){
|
|
|
- accidentalDrivingVo = accidentalDrivings.get(0);
|
|
|
- }
|
|
|
+ actualValueResponse = huataiRequestApiComponent.actualValue(huaTaiActualValueRequest, HuaTaiActualValueResponse.class, parameters.getInsuredCode(), url);
|
|
|
+ }
|
|
|
+ //组装报价参数
|
|
|
+ AccidentalDrivingVo accidentalDrivingVo = new AccidentalDrivingVo();
|
|
|
+ List<AccidentalDrivingVo> accidentalDrivings = quoteVo.getAccidentalDrivings();
|
|
|
+ if (CollectionUtil.isNotEmpty(accidentalDrivings)) {
|
|
|
+ accidentalDrivingVo = accidentalDrivings.get(0);
|
|
|
+ }
|
|
|
|
|
|
- HuaTaiQuotedPriceRequest quotedPriceRequest = new HuaTaiQuotedPriceRequest(quoteVo, fullCarDataDto, actualValueResponse,
|
|
|
- accidentalDrivingVo, parameters);
|
|
|
- quotedPriceRequest.setHead(baseRequestHead);
|
|
|
- //调用报价接口
|
|
|
- HuaTaiQuotedPriceResponse quotedPriceResponse = huataiRequestApiComponent.quotedPrice(quotedPriceRequest,
|
|
|
- HuaTaiQuotedPriceResponse.class, parameters.getInsuredCode(),url);
|
|
|
- if (ObjectUtil.isNotNull(quotedPriceResponse) && !quotedPriceResponse.getHead().getReturnCode().equals("0")){
|
|
|
- log.error("报价失败,返回信息:{}", quotedPriceResponse.getHead().getReturnMessage());
|
|
|
- throw new SystemException("报价失败");
|
|
|
- }
|
|
|
- QuoteResultsVo quoteResultsVo = HuaTaiApiQuoteResultsVoBuild.buildQuoteResultsVo(orderBase.getOrdersNo(), quoteVo, quotedPriceResponse);
|
|
|
- //数据保存到mongodb,后续接口需要的数据
|
|
|
- HuaTaiApiOrder huaTaiApiOrder = new HuaTaiApiOrder();
|
|
|
- huaTaiApiOrder.setCarInfo(carInfoVo);
|
|
|
- huaTaiApiOrder.setOrdersNo(orderBase.getOrdersNo());
|
|
|
- //设置商业险数据
|
|
|
- HuaTaiQuotedPriceResponse.ContractDto biContractDto = HuaTaiApiQuoteResultsVoBuild.getBiContractDto(quotedPriceResponse);
|
|
|
- if (ObjectUtil.isNotNull(biContractDto)){
|
|
|
- huaTaiApiOrder.setSyQuerySequenceNo(biContractDto.getPlatFormMessage().getQuerySequenceNo());
|
|
|
- huaTaiApiOrder.setSyApplyNo(biContractDto.getContractMain().getContractNo());
|
|
|
- huaTaiApiOrder.setSyPremium(String.valueOf(biContractDto.getContractMain().getTotalPremium()));
|
|
|
+ HuaTaiQuotedPriceRequest quotedPriceRequest = new HuaTaiQuotedPriceRequest(quoteVo, fullCarDataDto, actualValueResponse,
|
|
|
+ accidentalDrivingVo, parameters);
|
|
|
+ quotedPriceRequest.setHead(baseRequestHead);
|
|
|
+ //调用报价接口
|
|
|
+ HuaTaiQuotedPriceResponse quotedPriceResponse = huataiRequestApiComponent.quotedPrice(quotedPriceRequest,
|
|
|
+ HuaTaiQuotedPriceResponse.class, parameters.getInsuredCode(), url);
|
|
|
+ if (ObjectUtil.isNotNull(quotedPriceResponse) && !quotedPriceResponse.getHead().getReturnCode().equals("0")) {
|
|
|
+ log.error("报价失败,返回信息:{}", quotedPriceResponse.getHead().getReturnMessage());
|
|
|
+ throw new SystemException("报价失败");
|
|
|
+ }else {
|
|
|
+ log.info("报价成功,返回信息:{}", JSONObject.toJSONString(quotedPriceResponse));
|
|
|
+ }
|
|
|
+ QuoteResultsVo quoteResultsVo = HuaTaiApiQuoteResultsVoBuild.buildQuoteResultsVo(orderBase.getOrdersNo(), quoteVo, quotedPriceResponse);
|
|
|
+ //数据保存到mongodb,后续接口需要的数据
|
|
|
+ HuaTaiApiOrder huaTaiApiOrder = new HuaTaiApiOrder();
|
|
|
+ huaTaiApiOrder.setCarInfo(carInfoVo);
|
|
|
+ huaTaiApiOrder.setOrdersNo(orderBase.getOrdersNo());
|
|
|
+ //设置商业险数据
|
|
|
+ HuaTaiQuotedPriceResponse.ContractDto biContractDto = HuaTaiApiQuoteResultsVoBuild.getBiContractDto(quotedPriceResponse);
|
|
|
+ if (ObjectUtil.isNotNull(biContractDto)) {
|
|
|
+ huaTaiApiOrder.setSyQuerySequenceNo(biContractDto.getPlatFormMessage().getQuerySequenceNo());
|
|
|
+ huaTaiApiOrder.setSyApplyNo(biContractDto.getContractMain().getContractNo());
|
|
|
+ huaTaiApiOrder.setSyPremium(String.valueOf(biContractDto.getContractMain().getTotalPremium()));
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- //设置交强险数据
|
|
|
- HuaTaiQuotedPriceResponse.ContractDto ciContractDto = HuaTaiApiQuoteResultsVoBuild.getCiContractDto(quotedPriceResponse);
|
|
|
- if (ObjectUtil.isNotNull(ciContractDto)){
|
|
|
- huaTaiApiOrder.setJqQuerySequenceNo(ciContractDto.getPlatFormMessage().getQuerySequenceNo());
|
|
|
- huaTaiApiOrder.setJqApplyNo(ciContractDto.getContractMain().getContractNo());
|
|
|
- huaTaiApiOrder.setJqPremium(String.valueOf(ciContractDto.getContractMain().getTotalPremium()));
|
|
|
+ //设置交强险数据
|
|
|
+ HuaTaiQuotedPriceResponse.ContractDto ciContractDto = HuaTaiApiQuoteResultsVoBuild.getCiContractDto(quotedPriceResponse);
|
|
|
+ if (ObjectUtil.isNotNull(ciContractDto)) {
|
|
|
+ huaTaiApiOrder.setJqQuerySequenceNo(ciContractDto.getPlatFormMessage().getQuerySequenceNo());
|
|
|
+ huaTaiApiOrder.setJqApplyNo(ciContractDto.getContractMain().getContractNo());
|
|
|
+ huaTaiApiOrder.setJqPremium(String.valueOf(ciContractDto.getContractMain().getTotalPremium()));
|
|
|
+ }
|
|
|
+ huaTaiApiOrder.setOwnersInfo(quoteVo.getOwnersInfo());
|
|
|
+ huaTaiApiOrder.setPolicyHolderInfo(quoteVo.getPolicyHolderInfo());
|
|
|
+ huaTaiApiOrder.setInsuredPersonInfo(quoteVo.getInsuredPersonInfo());
|
|
|
+ huaTaiApiOrder.setCiRiskInfoVo(quoteVo.getCiRiskInfoVo());
|
|
|
+ huaTaiApiOrder.setBiRiskInfoVo(quoteVo.getBiRiskInfoVo());
|
|
|
+
|
|
|
+ HuaTaiApiOrder save = huaTaiApiOrderService.save(huaTaiApiOrder);
|
|
|
+ quoteResultsVo.setQuoteStatusEnum(StringUtils.isNotBlank(save.getId()) ? InsOrderStatusEnum.WAIT_AUDIT : InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
+ return quoteResultsVo;
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("报价异常",e);
|
|
|
+ throw new SystemException("报价异常");
|
|
|
}
|
|
|
- huaTaiApiOrder.setOwnersInfo(quoteVo.getOwnersInfo());
|
|
|
- huaTaiApiOrder.setPolicyHolderInfo(quoteVo.getPolicyHolderInfo());
|
|
|
- huaTaiApiOrder.setInsuredPersonInfo(quoteVo.getInsuredPersonInfo());
|
|
|
- huaTaiApiOrder.setCiRiskInfoVo(quoteVo.getCiRiskInfoVo());
|
|
|
- huaTaiApiOrder.setBiRiskInfoVo(quoteVo.getBiRiskInfoVo());
|
|
|
-
|
|
|
- HuaTaiApiOrder save = huaTaiApiOrderService.save(huaTaiApiOrder);
|
|
|
- quoteResultsVo.setQuoteStatusEnum(StringUtils.isNotBlank(save.getId()) ? InsOrderStatusEnum.WAIT_AUDIT :InsOrderStatusEnum. QUOTE_FAIL);
|
|
|
- return quoteResultsVo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -183,6 +190,7 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
*/
|
|
|
boolean haveJQFlag = false;
|
|
|
boolean haveSYFlag = false;
|
|
|
+ String companyOrderNo = "";
|
|
|
String jqStatus = "";
|
|
|
String syStatus = "";
|
|
|
StringBuffer jqNotion = new StringBuffer();
|
|
|
@@ -193,6 +201,7 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
haveJQFlag = true;
|
|
|
if (huaTaiApiOrder.getJqApplyNo().equals(appliResult.getContractNo())) {
|
|
|
jqStatus = appliResult.getStatus();
|
|
|
+ companyOrderNo = appliResult.getContractNo();
|
|
|
for (HuaTaiSubmitResponse.Notion notion : appliResult.getNotion()) {
|
|
|
jqNotion.append(notion.getUWNotion() + "</br>");
|
|
|
}
|
|
|
@@ -202,6 +211,7 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
haveSYFlag = true;
|
|
|
if (huaTaiApiOrder.getSyApplyNo().equals(appliResult.getContractNo())) {
|
|
|
syStatus = appliResult.getStatus();
|
|
|
+ companyOrderNo = appliResult.getContractNo();
|
|
|
for (HuaTaiSubmitResponse.Notion notion : appliResult.getNotion()) {
|
|
|
syNotion.append(notion.getUWNotion() + "</br>");
|
|
|
}
|
|
|
@@ -238,10 +248,14 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
}
|
|
|
}
|
|
|
UnderwritingResultsVo underwritingResultsVo = new UnderwritingResultsVo();
|
|
|
+ underwritingResultsVo.setCompanyOrderNo(companyOrderNo);
|
|
|
if ("4".equals(totalStatus)) {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.PAY_PENDING);
|
|
|
//再调用缴费接口获取缴费链接
|
|
|
- //return getPaymentLink(insAreaCompany, huaTaiConfigureParameters);
|
|
|
+ PaymentLinkVo paymentLinkVo = new PaymentLinkVo();
|
|
|
+ paymentLinkVo.setOrder(underwritingVo.getOrder());
|
|
|
+ PaymentLinkResultsVo paymentLink = getPaymentLink(paymentLinkVo);
|
|
|
+ underwritingResultsVo.setPaymentLink(paymentLink.getPaymentLink());
|
|
|
} else if ("1".equals(totalStatus)) {
|
|
|
//人工核保
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.STAFF_PROCESS);
|
|
|
@@ -300,7 +314,7 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
public void uploadImage(InsuranceUploadImageVo insuranceUploadImageVo) {
|
|
|
try {
|
|
|
OrderBase orderBase = insuranceUploadImageVo.getOrder();
|
|
|
- String url = orderBase.getInsuranceCompanyId();
|
|
|
+ String url = getApiUrl(orderBase.getInsuranceCompanyId());
|
|
|
AttributionInformationVo attributionInformationVo = orderBase.getAttributionInformationVo();
|
|
|
//配置信息
|
|
|
HuaTaiConfigureParameters huaTaiParameters = ConfigureParametersConversion.conversionEntity(HuaTaiConfigureParameters.class, attributionInformationVo.getConfigInfo());
|