|
@@ -2,6 +2,8 @@ package com.jzg.quotation.huatai.api.service.Impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
|
import com.jzg.commons.core.page.HttpResult;
|
|
import com.jzg.commons.core.page.HttpResult;
|
|
@@ -17,24 +19,32 @@ import com.jzg.quotation.commons.constant.InsuranceCode;
|
|
|
import com.jzg.commons.entity.quote.vo.base.OrderBase;
|
|
import com.jzg.commons.entity.quote.vo.base.OrderBase;
|
|
|
import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
|
|
import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
|
|
|
import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
|
|
import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
|
|
|
|
|
+import com.jzg.quotation.commons.utils.DateTimeUtil;
|
|
|
|
|
+import com.jzg.quotation.commons.utils.DuplicateInsuranceUtil;
|
|
|
import com.jzg.quotation.huatai.api.build.HuaTaiApiQuoteResultsVoBuild;
|
|
import com.jzg.quotation.huatai.api.build.HuaTaiApiQuoteResultsVoBuild;
|
|
|
import com.jzg.quotation.huatai.api.component.HuaTaiRequestApiComponent;
|
|
import com.jzg.quotation.huatai.api.component.HuaTaiRequestApiComponent;
|
|
|
import com.jzg.quotation.huatai.api.component.HuiTaiUploadImageComponent;
|
|
import com.jzg.quotation.huatai.api.component.HuiTaiUploadImageComponent;
|
|
|
|
|
+import com.jzg.quotation.huatai.api.constant.HuataiBaseConstants;
|
|
|
import com.jzg.quotation.huatai.api.entity.HuaTaiApiOrder;
|
|
import com.jzg.quotation.huatai.api.entity.HuaTaiApiOrder;
|
|
|
import com.jzg.quotation.huatai.api.entity.HuaTaiBaseRequestHead;
|
|
import com.jzg.quotation.huatai.api.entity.HuaTaiBaseRequestHead;
|
|
|
import com.jzg.quotation.huatai.api.entity.HuaTaiConfigureParameters;
|
|
import com.jzg.quotation.huatai.api.entity.HuaTaiConfigureParameters;
|
|
|
import com.jzg.quotation.huatai.api.entity.request.*;
|
|
import com.jzg.quotation.huatai.api.entity.request.*;
|
|
|
import com.jzg.quotation.huatai.api.entity.response.*;
|
|
import com.jzg.quotation.huatai.api.entity.response.*;
|
|
|
import com.jzg.quotation.huatai.api.entity.vo.InsHuataiContributingVo;
|
|
import com.jzg.quotation.huatai.api.entity.vo.InsHuataiContributingVo;
|
|
|
|
|
+import com.jzg.quotation.huatai.api.entity.vo.TimeEntity;
|
|
|
import com.jzg.quotation.huatai.api.service.HuaTaiApiOrderService;
|
|
import com.jzg.quotation.huatai.api.service.HuaTaiApiOrderService;
|
|
|
import com.jzg.quotation.huatai.api.service.HuaTaiApiRequest;
|
|
import com.jzg.quotation.huatai.api.service.HuaTaiApiRequest;
|
|
|
import com.jzg.quotation.huatai.api.utils.InMemoryZipExtractor;
|
|
import com.jzg.quotation.huatai.api.utils.InMemoryZipExtractor;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -56,6 +66,8 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
|
|
|
|
|
private final PlatformClient platformClient;
|
|
private final PlatformClient platformClient;
|
|
|
|
|
|
|
|
|
|
+ private static final Logger logger = LoggerFactory.getLogger(HuaTaiApiRequestImpl.class);
|
|
|
|
|
+
|
|
|
public String getApiUrl(String companyId) {
|
|
public String getApiUrl(String companyId) {
|
|
|
// 获取保司配置url地址
|
|
// 获取保司配置url地址
|
|
|
HttpResult<PtlAgreementUrl> ptlAgreementUrl = platformClient.getAgreementUrlByCompanyId(companyId);
|
|
HttpResult<PtlAgreementUrl> ptlAgreementUrl = platformClient.getAgreementUrlByCompanyId(companyId);
|
|
@@ -108,22 +120,55 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
accidentalDrivingVo = accidentalDrivings.get(0);
|
|
accidentalDrivingVo = accidentalDrivings.get(0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ QuoteResultsVo quoteResultsVo = new QuoteResultsVo();
|
|
|
HuaTaiQuotedPriceRequest quotedPriceRequest = new HuaTaiQuotedPriceRequest(quoteVo, fullCarDataDto, actualValueResponse,
|
|
HuaTaiQuotedPriceRequest quotedPriceRequest = new HuaTaiQuotedPriceRequest(quoteVo, fullCarDataDto, actualValueResponse,
|
|
|
accidentalDrivingVo, parameters);
|
|
accidentalDrivingVo, parameters);
|
|
|
quotedPriceRequest.setHead(baseRequestHead);
|
|
quotedPriceRequest.setHead(baseRequestHead);
|
|
|
//调用报价接口
|
|
//调用报价接口
|
|
|
HuaTaiQuotedPriceResponse quotedPriceResponse = huataiRequestApiComponent.quotedPrice(quotedPriceRequest,
|
|
HuaTaiQuotedPriceResponse quotedPriceResponse = huataiRequestApiComponent.quotedPrice(quotedPriceRequest,
|
|
|
HuaTaiQuotedPriceResponse.class, parameters.getInsuredCode(), url);
|
|
HuaTaiQuotedPriceResponse.class, parameters.getInsuredCode(), url);
|
|
|
|
|
+ String returnMessage = quotedPriceResponse.getHead().getReturnMessage();
|
|
|
|
|
+ if (StrUtil.isNotBlank(returnMessage) && returnMessage.contains("重复投保")) {
|
|
|
|
|
+ // 处理返回信息
|
|
|
|
|
+ // 1、交强险重复投保处理
|
|
|
|
|
+ TimeEntity jqTime = ciRepetitionInsure(quotedPriceResponse);
|
|
|
|
|
+ // 2、商业险重复投保处理
|
|
|
|
|
+ TimeEntity syTime = commerceRepetitionInsure(quotedPriceResponse);
|
|
|
|
|
+
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(jqTime)) {
|
|
|
|
|
+ quoteResultsVo.setCiStartDate(jqTime.getNewStartDate());
|
|
|
|
|
+ quoteResultsVo.setCiEndDate(jqTime.getNewEndDate());
|
|
|
|
|
+ // 重新调报价接口组装的交强参数
|
|
|
|
|
+ quoteVo.getCiRiskInfoVo().setStartDate(quoteResultsVo.getCiStartDate());
|
|
|
|
|
+ quoteVo.getCiRiskInfoVo().setEndDate(quoteResultsVo.getCiEndDate());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(syTime)) {
|
|
|
|
|
+ quoteResultsVo.setBiStartDate(syTime.getNewStartDate());
|
|
|
|
|
+ quoteResultsVo.setBiEndDate(syTime.getNewEndDate());
|
|
|
|
|
+ // 重新调报价接口组装的商业参数
|
|
|
|
|
+ quoteVo.getBiRiskInfoVo().setStartDate(quoteResultsVo.getBiStartDate());
|
|
|
|
|
+ quoteVo.getBiRiskInfoVo().setEndDate(quoteResultsVo.getBiEndDate());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 如果发生重复投保,且可以投保的时间在一个月内,则将投保时间重新设置之后,再次调用计算保费的方法
|
|
|
|
|
+ if (StrUtil.isNotBlank(quoteResultsVo.getCiStartDate()) || StrUtil.isNotBlank(quoteResultsVo.getBiStartDate())) {
|
|
|
|
|
+ HuaTaiQuotedPriceRequest reQuotedPriceRequest = new HuaTaiQuotedPriceRequest(quoteVo, fullCarDataDto, actualValueResponse,
|
|
|
|
|
+ accidentalDrivingVo, parameters);
|
|
|
|
|
+ reQuotedPriceRequest.setHead(baseRequestHead);
|
|
|
|
|
+ //调用报价接口
|
|
|
|
|
+ quotedPriceResponse = huataiRequestApiComponent.quotedPrice(reQuotedPriceRequest,
|
|
|
|
|
+ HuaTaiQuotedPriceResponse.class, parameters.getInsuredCode(), url);
|
|
|
|
|
+ logger.info("华泰再次请求保费计算接口,结果为:{}", JSON.toJSONString(quotedPriceResponse));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (ObjectUtil.isNotNull(quotedPriceResponse) && !quotedPriceResponse.getHead().getReturnCode().equals("0")) {
|
|
if (ObjectUtil.isNotNull(quotedPriceResponse) && !quotedPriceResponse.getHead().getReturnCode().equals("0")) {
|
|
|
log.error("报价失败,返回信息:{}", quotedPriceResponse.getHead().getReturnMessage());
|
|
log.error("报价失败,返回信息:{}", quotedPriceResponse.getHead().getReturnMessage());
|
|
|
- QuoteResultsVo quoteResultsVo = new QuoteResultsVo();
|
|
|
|
|
quoteResultsVo.setErrorMessage(quotedPriceResponse.getHead().getReturnMessage());
|
|
quoteResultsVo.setErrorMessage(quotedPriceResponse.getHead().getReturnMessage());
|
|
|
quoteResultsVo.setQuoteStatusEnum(InsOrderStatusEnum.QUOTE_FAIL);
|
|
quoteResultsVo.setQuoteStatusEnum(InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
return quoteResultsVo;
|
|
return quoteResultsVo;
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
log.info("报价成功,返回信息:{}", JSONObject.toJSONString(quotedPriceResponse));
|
|
log.info("报价成功,返回信息:{}", JSONObject.toJSONString(quotedPriceResponse));
|
|
|
}
|
|
}
|
|
|
- QuoteResultsVo quoteResultsVo = HuaTaiApiQuoteResultsVoBuild.buildQuoteResultsVo(orderBase.getOrdersNo(), quoteVo, quotedPriceResponse);
|
|
|
|
|
|
|
+ quoteResultsVo = HuaTaiApiQuoteResultsVoBuild.buildQuoteResultsVo(orderBase.getOrdersNo(), quoteVo, quotedPriceResponse);
|
|
|
//数据保存到mongodb,后续接口需要的数据
|
|
//数据保存到mongodb,后续接口需要的数据
|
|
|
HuaTaiApiOrder huaTaiApiOrder = new HuaTaiApiOrder();
|
|
HuaTaiApiOrder huaTaiApiOrder = new HuaTaiApiOrder();
|
|
|
huaTaiApiOrder.setCarInfo(carInfoVo);
|
|
huaTaiApiOrder.setCarInfo(carInfoVo);
|
|
@@ -153,8 +198,8 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
HuaTaiApiOrder save = huaTaiApiOrderService.save(huaTaiApiOrder);
|
|
HuaTaiApiOrder save = huaTaiApiOrderService.save(huaTaiApiOrder);
|
|
|
quoteResultsVo.setQuoteStatusEnum(StringUtils.isNotBlank(save.getId()) ? InsOrderStatusEnum.WAIT_AUDIT : InsOrderStatusEnum.QUOTE_FAIL);
|
|
quoteResultsVo.setQuoteStatusEnum(StringUtils.isNotBlank(save.getId()) ? InsOrderStatusEnum.WAIT_AUDIT : InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
return quoteResultsVo;
|
|
return quoteResultsVo;
|
|
|
- }catch (Exception e){
|
|
|
|
|
- log.error("报价异常",e);
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("报价异常", e);
|
|
|
throw new SystemException("报价异常");
|
|
throw new SystemException("报价异常");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -176,7 +221,7 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
List<InsHuataiContributingVo> engageList = new ArrayList<>();//报价接口未返回特约信息
|
|
List<InsHuataiContributingVo> engageList = new ArrayList<>();//报价接口未返回特约信息
|
|
|
HuaTaiApiOrder huaTaiApiOrder = huaTaiApiOrderService.findByOrdersNo(orderBase.getOrdersNo());
|
|
HuaTaiApiOrder huaTaiApiOrder = huaTaiApiOrderService.findByOrdersNo(orderBase.getOrdersNo());
|
|
|
HuaTaiSubmitRequest submitRequest = new HuaTaiSubmitRequest(huaTaiApiOrder, huaTaiParameters, engageList);
|
|
HuaTaiSubmitRequest submitRequest = new HuaTaiSubmitRequest(huaTaiApiOrder, huaTaiParameters, engageList);
|
|
|
- HuaTaiSubmitResponse submitResponse = huataiRequestApiComponent.submit(submitRequest, HuaTaiSubmitResponse.class, huaTaiParameters.getInsuredCode(),url);
|
|
|
|
|
|
|
+ HuaTaiSubmitResponse submitResponse = huataiRequestApiComponent.submit(submitRequest, HuaTaiSubmitResponse.class, huaTaiParameters.getInsuredCode(), url);
|
|
|
|
|
|
|
|
log.info("提交保单返回信息:{}", JSONObject.toJSONString(submitResponse));
|
|
log.info("提交保单返回信息:{}", JSONObject.toJSONString(submitResponse));
|
|
|
if ("-1".equals(submitResponse.getHead().getReturnCode())) {
|
|
if ("-1".equals(submitResponse.getHead().getReturnCode())) {
|
|
@@ -264,14 +309,14 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.STAFF_PROCESS);
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.STAFF_PROCESS);
|
|
|
underwritingResultsVo.setUnderwritingResult("人工处理");
|
|
underwritingResultsVo.setUnderwritingResult("人工处理");
|
|
|
//调用提交核保接口
|
|
//调用提交核保接口
|
|
|
- HuaTaiSubmitStatusQueryResponse huaTaiSubmitStatusQueryResponse = submitStatus(huaTaiApiOrder, huaTaiParameters, "1",url);
|
|
|
|
|
|
|
+ HuaTaiSubmitStatusQueryResponse huaTaiSubmitStatusQueryResponse = submitStatus(huaTaiApiOrder, huaTaiParameters, "1", url);
|
|
|
|
|
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
//核保退回
|
|
//核保退回
|
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
|
for (HuaTaiSubmitResponse.AppliResult appliResult : submitResponse.getAppliResult()) {
|
|
for (HuaTaiSubmitResponse.AppliResult appliResult : submitResponse.getAppliResult()) {
|
|
|
for (HuaTaiSubmitResponse.Notion notion : appliResult.getNotion()) {
|
|
for (HuaTaiSubmitResponse.Notion notion : appliResult.getNotion()) {
|
|
|
- sb.append(StringUtils.equals("C1",notion.getUWType()) ? "交强险提示信息:%s" : " 商业险提示信息:%s").append(notion.getUWNotion());
|
|
|
|
|
|
|
+ sb.append(StringUtils.equals("C1", notion.getUWType()) ? "交强险提示信息:%s" : " 商业险提示信息:%s").append(notion.getUWNotion());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
underwritingResultsVo.setUnderwritingResult(sb.toString());
|
|
underwritingResultsVo.setUnderwritingResult(sb.toString());
|
|
@@ -297,7 +342,7 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
HuaTaiPaymentUrlRequest huaTaiPaymentUrlRequest = new HuaTaiPaymentUrlRequest(huaTaiApiOrder, huaTaiParameters);
|
|
HuaTaiPaymentUrlRequest huaTaiPaymentUrlRequest = new HuaTaiPaymentUrlRequest(huaTaiApiOrder, huaTaiParameters);
|
|
|
huaTaiPaymentUrlRequest.setHead(new HuaTaiBaseRequestHead(huaTaiParameters));
|
|
huaTaiPaymentUrlRequest.setHead(new HuaTaiBaseRequestHead(huaTaiParameters));
|
|
|
|
|
|
|
|
- HuaTaiPaymentUrlResponse paymentUrlResponse = huataiRequestApiComponent.getPaymentUrl(huaTaiPaymentUrlRequest, HuaTaiPaymentUrlResponse.class, huaTaiParameters.getInsuredCode(),url);
|
|
|
|
|
|
|
+ HuaTaiPaymentUrlResponse paymentUrlResponse = huataiRequestApiComponent.getPaymentUrl(huaTaiPaymentUrlRequest, HuaTaiPaymentUrlResponse.class, huaTaiParameters.getInsuredCode(), url);
|
|
|
|
|
|
|
|
String payUrl = "";
|
|
String payUrl = "";
|
|
|
if (StringUtils.isNotEmpty(paymentUrlResponse.getPayUrl())) {
|
|
if (StringUtils.isNotEmpty(paymentUrlResponse.getPayUrl())) {
|
|
@@ -326,12 +371,12 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
HuaTaiUploadImageRequest uploadImageRequest = new HuaTaiUploadImageRequest(huaTaiApiOrder, huaTaiParameters);
|
|
HuaTaiUploadImageRequest uploadImageRequest = new HuaTaiUploadImageRequest(huaTaiApiOrder, huaTaiParameters);
|
|
|
uploadImageRequest.setHead(new HuaTaiBaseRequestHead(huaTaiParameters));
|
|
uploadImageRequest.setHead(new HuaTaiBaseRequestHead(huaTaiParameters));
|
|
|
//返回影像上传url
|
|
//返回影像上传url
|
|
|
- HuaTaiUploadImageResponse huaTaiUploadImageResponse = huataiRequestApiComponent.uploadImage(uploadImageRequest, HuaTaiUploadImageResponse.class, huaTaiParameters.getInsuredCode(),url);
|
|
|
|
|
|
|
+ HuaTaiUploadImageResponse huaTaiUploadImageResponse = huataiRequestApiComponent.uploadImage(uploadImageRequest, HuaTaiUploadImageResponse.class, huaTaiParameters.getInsuredCode(), url);
|
|
|
|
|
|
|
|
//爬虫方式进行图片上传
|
|
//爬虫方式进行图片上传
|
|
|
huiTaiUploadImageComponent.uploadImage(orderBase.getInsuranceCompanyCode(), huaTaiUploadImageResponse.getUrl(), insuranceUploadImageVo.getImageVoList());
|
|
huiTaiUploadImageComponent.uploadImage(orderBase.getInsuranceCompanyCode(), huaTaiUploadImageResponse.getUrl(), insuranceUploadImageVo.getImageVoList());
|
|
|
- }catch (Exception e){
|
|
|
|
|
- log.error("华泰影像上传失败",e.getMessage());
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("华泰影像上传失败", e.getMessage());
|
|
|
throw new RuntimeException("华泰影像上传失败");
|
|
throw new RuntimeException("华泰影像上传失败");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -343,12 +388,13 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 下载保单
|
|
* 下载保单
|
|
|
|
|
+ *
|
|
|
* @param downloadPolicyVo
|
|
* @param downloadPolicyVo
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public DownloadPolicyResultVo downloadPolicy(DownloadPolicyVo downloadPolicyVo) {
|
|
public DownloadPolicyResultVo downloadPolicy(DownloadPolicyVo downloadPolicyVo) {
|
|
|
InsOrdersPolicy police = downloadPolicyVo.getPolicie();
|
|
InsOrdersPolicy police = downloadPolicyVo.getPolicie();
|
|
|
- if (ObjectUtil.isNull(police)){
|
|
|
|
|
|
|
+ if (ObjectUtil.isNull(police)) {
|
|
|
throw new RuntimeException("请选择保单");
|
|
throw new RuntimeException("请选择保单");
|
|
|
}
|
|
}
|
|
|
String url = getApiUrl(downloadPolicyVo.getOrder().getInsuranceCompanyId());
|
|
String url = getApiUrl(downloadPolicyVo.getOrder().getInsuranceCompanyId());
|
|
@@ -359,16 +405,16 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
HuaTaiInsurancePolicyPrintRequest request = new HuaTaiInsurancePolicyPrintRequest();
|
|
HuaTaiInsurancePolicyPrintRequest request = new HuaTaiInsurancePolicyPrintRequest();
|
|
|
request.setHead(new HuaTaiBaseRequestHead(huaTaiParameters));
|
|
request.setHead(new HuaTaiBaseRequestHead(huaTaiParameters));
|
|
|
HuaTaiApiOrder huaTaiApiOrder = huaTaiApiOrderService.findByOrdersNo(downloadPolicyVo.getOrder().getOrdersNo());
|
|
HuaTaiApiOrder huaTaiApiOrder = huaTaiApiOrderService.findByOrdersNo(downloadPolicyVo.getOrder().getOrdersNo());
|
|
|
- if (StringUtils.isNotBlank(police.getJqPolicyNo())){
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(police.getJqPolicyNo())) {
|
|
|
request.setBusinessNo(police.getJqPolicyNo());
|
|
request.setBusinessNo(police.getJqPolicyNo());
|
|
|
- HuaTaiInsurancePolicyPrintResponse response = huataiRequestApiComponent.insurancePolicyPrint(request, HuaTaiInsurancePolicyPrintResponse.class, huaTaiParameters.getInsuredCode(),url);
|
|
|
|
|
|
|
+ HuaTaiInsurancePolicyPrintResponse response = huataiRequestApiComponent.insurancePolicyPrint(request, HuaTaiInsurancePolicyPrintResponse.class, huaTaiParameters.getInsuredCode(), url);
|
|
|
response.getElecDownLoadResultList().forEach(elecDownLoadResultDto -> {
|
|
response.getElecDownLoadResultList().forEach(elecDownLoadResultDto -> {
|
|
|
- getPdfLink(elecDownLoadResultDto.getDownURL(), resultVo, true,huaTaiApiOrder.getOwnersInfo().getIdentifyNumber());
|
|
|
|
|
|
|
+ getPdfLink(elecDownLoadResultDto.getDownURL(), resultVo, true, huaTaiApiOrder.getOwnersInfo().getIdentifyNumber());
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isNotBlank(police.getJyPolicyNo())){
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(police.getJyPolicyNo())) {
|
|
|
request.setBusinessNo(police.getJyPolicyNo());
|
|
request.setBusinessNo(police.getJyPolicyNo());
|
|
|
- HuaTaiInsurancePolicyPrintResponse response = huataiRequestApiComponent.insurancePolicyPrint(request, HuaTaiInsurancePolicyPrintResponse.class, huaTaiParameters.getInsuredCode(),url);
|
|
|
|
|
|
|
+ HuaTaiInsurancePolicyPrintResponse response = huataiRequestApiComponent.insurancePolicyPrint(request, HuaTaiInsurancePolicyPrintResponse.class, huaTaiParameters.getInsuredCode(), url);
|
|
|
response.getElecDownLoadResultList().forEach(elecDownLoadResultDto -> {
|
|
response.getElecDownLoadResultList().forEach(elecDownLoadResultDto -> {
|
|
|
resultVo.setJyUrl(elecDownLoadResultDto.getDownURL());
|
|
resultVo.setJyUrl(elecDownLoadResultDto.getDownURL());
|
|
|
});
|
|
});
|
|
@@ -377,33 +423,34 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- public void getPdfLink(String downURL,DownloadPolicyResultVo resultVo, boolean type,String idCar){
|
|
|
|
|
|
|
+ public void getPdfLink(String downURL, DownloadPolicyResultVo resultVo, boolean type, String idCar) {
|
|
|
try {
|
|
try {
|
|
|
Map<String, MultipartFile> inputStreamMap = InMemoryZipExtractor.extractFromUrl(downURL, idCar);
|
|
Map<String, MultipartFile> inputStreamMap = InMemoryZipExtractor.extractFromUrl(downURL, idCar);
|
|
|
inputStreamMap.forEach((fileName, file) -> {
|
|
inputStreamMap.forEach((fileName, file) -> {
|
|
|
//saveFile(file);
|
|
//saveFile(file);
|
|
|
HttpResult<SysUploadFiles> upload = platformClient.upload(file);
|
|
HttpResult<SysUploadFiles> upload = platformClient.upload(file);
|
|
|
System.out.println("文件名: " + upload.getData().getDownloadUrl());
|
|
System.out.println("文件名: " + upload.getData().getDownloadUrl());
|
|
|
- if (type){
|
|
|
|
|
- if (fileName.contains("bz")){
|
|
|
|
|
|
|
+ if (type) {
|
|
|
|
|
+ if (fileName.contains("bz")) {
|
|
|
resultVo.setJqFlagUrl(upload.getData().getDownloadUrl());
|
|
resultVo.setJqFlagUrl(upload.getData().getDownloadUrl());
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
resultVo.setJqUrl(upload.getData().getDownloadUrl());
|
|
resultVo.setJqUrl(upload.getData().getDownloadUrl());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- }catch (Exception e){
|
|
|
|
|
- log.error("获取保单失败",e);
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("获取保单失败", e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 测试文件
|
|
* 测试文件
|
|
|
|
|
+ *
|
|
|
* @param file
|
|
* @param file
|
|
|
*/
|
|
*/
|
|
|
- public void saveFile(MultipartFile file){
|
|
|
|
|
|
|
+ public void saveFile(MultipartFile file) {
|
|
|
String targetDir = "F:\\img\\xx";
|
|
String targetDir = "F:\\img\\xx";
|
|
|
if (file.isEmpty()) {
|
|
if (file.isEmpty()) {
|
|
|
throw new IllegalArgumentException("文件不能为空");
|
|
throw new IllegalArgumentException("文件不能为空");
|
|
@@ -414,13 +461,12 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
file.transferTo(new File(targetDir + File.separator + file.getOriginalFilename()));
|
|
file.transferTo(new File(targetDir + File.separator + file.getOriginalFilename()));
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询订单状态
|
|
* 查询订单状态
|
|
|
*
|
|
*
|
|
@@ -437,7 +483,7 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
|
|
|
|
|
HuaTaiApiOrder huaTaiApiOrder = huaTaiApiOrderService.findByOrdersNo(orderStatusVo.getOrder().getOrdersNo());
|
|
HuaTaiApiOrder huaTaiApiOrder = huaTaiApiOrderService.findByOrdersNo(orderStatusVo.getOrder().getOrdersNo());
|
|
|
//获取核保状态
|
|
//获取核保状态
|
|
|
- HuaTaiSubmitStatusQueryResponse submitStatusQueryResponse = submitStatus(huaTaiApiOrder, huaTaiParameters, "2",url);
|
|
|
|
|
|
|
+ HuaTaiSubmitStatusQueryResponse submitStatusQueryResponse = submitStatus(huaTaiApiOrder, huaTaiParameters, "2", url);
|
|
|
/**
|
|
/**
|
|
|
* 0 初始状态默认值
|
|
* 0 初始状态默认值
|
|
|
* 1 已通过核保已实收
|
|
* 1 已通过核保已实收
|
|
@@ -447,13 +493,13 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
* 8 已通过核保未实收
|
|
* 8 已通过核保未实收
|
|
|
* 9 待核保
|
|
* 9 待核保
|
|
|
*/
|
|
*/
|
|
|
- if (StringUtils.equals("-1",submitStatusQueryResponse.getHead().getReturnCode())){
|
|
|
|
|
|
|
+ if (StringUtils.equals("-1", submitStatusQueryResponse.getHead().getReturnCode())) {
|
|
|
throw new SystemException("查询订单状态失败");
|
|
throw new SystemException("查询订单状态失败");
|
|
|
}
|
|
}
|
|
|
List<HuaTaiSubmitStatusQueryResponse.AppliResult> appliResult = submitStatusQueryResponse.getAppliResult();
|
|
List<HuaTaiSubmitStatusQueryResponse.AppliResult> appliResult = submitStatusQueryResponse.getAppliResult();
|
|
|
for (HuaTaiSubmitStatusQueryResponse.AppliResult result : appliResult) {
|
|
for (HuaTaiSubmitStatusQueryResponse.AppliResult result : appliResult) {
|
|
|
String underWriteFlag = result.getUnderWriteFlag();
|
|
String underWriteFlag = result.getUnderWriteFlag();
|
|
|
- switch (underWriteFlag){
|
|
|
|
|
|
|
+ switch (underWriteFlag) {
|
|
|
case "0":
|
|
case "0":
|
|
|
orderStatusResultVo.setOrderStatus(InsOrderStatusEnum.QUOTE_ING);
|
|
orderStatusResultVo.setOrderStatus(InsOrderStatusEnum.QUOTE_ING);
|
|
|
break;
|
|
break;
|
|
@@ -476,23 +522,23 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- log.info("核保状态:{}",JSONObject.toJSONString(submitStatusQueryResponse.getAppliResult()));
|
|
|
|
|
|
|
+ log.info("核保状态:{}", JSONObject.toJSONString(submitStatusQueryResponse.getAppliResult()));
|
|
|
|
|
|
|
|
//获取见费出单结果
|
|
//获取见费出单结果
|
|
|
HuaTaiOrderStatusRequest orderStatusRequest = new HuaTaiOrderStatusRequest(huaTaiApiOrder, huaTaiParameters);
|
|
HuaTaiOrderStatusRequest orderStatusRequest = new HuaTaiOrderStatusRequest(huaTaiApiOrder, huaTaiParameters);
|
|
|
orderStatusRequest.setHead(baseRequestHead);
|
|
orderStatusRequest.setHead(baseRequestHead);
|
|
|
- HuaTaiOrderStatusResponse orderStatusResponse = huataiRequestApiComponent.orderStatus(orderStatusRequest, HuaTaiOrderStatusResponse.class, huaTaiParameters.getInsuredCode(),url);
|
|
|
|
|
- log.info("见费出单结果:{}",JSONObject.toJSONString(orderStatusResponse));
|
|
|
|
|
|
|
+ HuaTaiOrderStatusResponse orderStatusResponse = huataiRequestApiComponent.orderStatus(orderStatusRequest, HuaTaiOrderStatusResponse.class, huaTaiParameters.getInsuredCode(), url);
|
|
|
|
|
+ log.info("见费出单结果:{}", JSONObject.toJSONString(orderStatusResponse));
|
|
|
for (HuaTaiOrderStatusResponse.PayDetaiDto payDetaiDto : orderStatusResponse.getPayDetaiList()) {
|
|
for (HuaTaiOrderStatusResponse.PayDetaiDto payDetaiDto : orderStatusResponse.getPayDetaiList()) {
|
|
|
- if (StringUtils.equals("1002",payDetaiDto.getRiskCode())){
|
|
|
|
|
|
|
+ if (StringUtils.equals("1002", payDetaiDto.getRiskCode())) {
|
|
|
orderStatusResultVo.setJqApplyNo(payDetaiDto.getBUSINESSNO());
|
|
orderStatusResultVo.setJqApplyNo(payDetaiDto.getBUSINESSNO());
|
|
|
orderStatusResultVo.setJqPolicyno(payDetaiDto.getPOLICYNO());
|
|
orderStatusResultVo.setJqPolicyno(payDetaiDto.getPOLICYNO());
|
|
|
- }else if(StringUtils.equals("1251",payDetaiDto.getRiskCode())){
|
|
|
|
|
|
|
+ } else if (StringUtils.equals("1251", payDetaiDto.getRiskCode())) {
|
|
|
orderStatusResultVo.setSyApplyNo(payDetaiDto.getBUSINESSNO());
|
|
orderStatusResultVo.setSyApplyNo(payDetaiDto.getBUSINESSNO());
|
|
|
orderStatusResultVo.setSyPolicyno(payDetaiDto.getPOLICYNO());
|
|
orderStatusResultVo.setSyPolicyno(payDetaiDto.getPOLICYNO());
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
//
|
|
//
|
|
|
- log.info("未知的险种:{}",payDetaiDto.getRiskCode());
|
|
|
|
|
|
|
+ log.info("未知的险种:{}", payDetaiDto.getRiskCode());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return orderStatusResultVo;
|
|
return orderStatusResultVo;
|
|
@@ -501,17 +547,105 @@ public class HuaTaiApiRequestImpl implements HuaTaiApiRequest {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 提交核保或核保查询接口
|
|
* 提交核保或核保查询接口
|
|
|
|
|
+ *
|
|
|
* @param huaTaiApiOrder
|
|
* @param huaTaiApiOrder
|
|
|
* @param huaTaiConfigureParameters
|
|
* @param huaTaiConfigureParameters
|
|
|
- * @param operateType 1为提交核保 2为查询核保状态
|
|
|
|
|
|
|
+ * @param operateType 1为提交核保 2为查询核保状态
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- private HuaTaiSubmitStatusQueryResponse submitStatus(HuaTaiApiOrder huaTaiApiOrder, HuaTaiConfigureParameters huaTaiConfigureParameters, String operateType,String url) {
|
|
|
|
|
|
|
+ private HuaTaiSubmitStatusQueryResponse submitStatus(HuaTaiApiOrder huaTaiApiOrder, HuaTaiConfigureParameters huaTaiConfigureParameters, String operateType, String url) {
|
|
|
HuaTaiSubmitStatusQueryRequest huaTaiSubmitStatusQueryRequest = new HuaTaiSubmitStatusQueryRequest(huaTaiApiOrder,
|
|
HuaTaiSubmitStatusQueryRequest huaTaiSubmitStatusQueryRequest = new HuaTaiSubmitStatusQueryRequest(huaTaiApiOrder,
|
|
|
huaTaiConfigureParameters, operateType);
|
|
huaTaiConfigureParameters, operateType);
|
|
|
huaTaiSubmitStatusQueryRequest.setHead(new HuaTaiBaseRequestHead(huaTaiConfigureParameters));
|
|
huaTaiSubmitStatusQueryRequest.setHead(new HuaTaiBaseRequestHead(huaTaiConfigureParameters));
|
|
|
HuaTaiSubmitStatusQueryResponse submitStatusQueryResponse =
|
|
HuaTaiSubmitStatusQueryResponse submitStatusQueryResponse =
|
|
|
- huataiRequestApiComponent.submitStatus(huaTaiSubmitStatusQueryRequest, HuaTaiSubmitStatusQueryResponse.class, huaTaiConfigureParameters.getInsuredCode(),url);
|
|
|
|
|
|
|
+ huataiRequestApiComponent.submitStatus(huaTaiSubmitStatusQueryRequest, HuaTaiSubmitStatusQueryResponse.class, huaTaiConfigureParameters.getInsuredCode(), url);
|
|
|
return submitStatusQueryResponse;
|
|
return submitStatusQueryResponse;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public TimeEntity ciRepetitionInsure(HuaTaiQuotedPriceResponse quotedPriceResponse) {
|
|
|
|
|
+ String returnMessage = quotedPriceResponse.getHead().getReturnMessage();
|
|
|
|
|
+
|
|
|
|
|
+ logger.info("华泰API方式 -------------报价 -> 交强重复投保----------------");
|
|
|
|
|
+
|
|
|
|
|
+ TimeEntity timeEntity = getRepeatStartEndTime(returnMessage, HuataiBaseConstants.JQ_REGEX, HuataiBaseConstants.JQ_RULE);
|
|
|
|
|
+
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isEmpty(timeEntity.getCoverageEndDate())) {
|
|
|
|
|
+ //重试第二种过户 及时起保的错误
|
|
|
|
|
+ TimeEntity repeatStartEndTime = getRepeatStartEndTime(returnMessage, HuataiBaseConstants.JQ_GUOHU_AND_JISHI_REGEX, "");
|
|
|
|
|
+ if (StringUtils.isEmpty(repeatStartEndTime.getCoverageEndDate())) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //如果是及时起保的则 终保日期 + 1天
|
|
|
|
|
+ // 定义时间格式
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ // 解析原始时间
|
|
|
|
|
+ LocalDateTime dateTime = LocalDateTime.parse(repeatStartEndTime.getCoverageEndDate(), formatter);
|
|
|
|
|
+ LocalDateTime tomorrowMidnight = dateTime;
|
|
|
|
|
+ //判断是否是整点 如果是整点则不进行明天的零点操作
|
|
|
|
|
+ if (dateTime.getHour() != 0 || dateTime.getMinute() != 0 || dateTime.getSecond() != 0) {
|
|
|
|
|
+ tomorrowMidnight = dateTime.toLocalDate().plusDays(1).atStartOfDay();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ timeEntity.setCoverageEndDate(tomorrowMidnight.format(formatter));
|
|
|
|
|
+ LocalDateTime end = tomorrowMidnight.plusYears(1L);
|
|
|
|
|
+ timeEntity.setNewStartDate(DateTimeUtil.format(tomorrowMidnight, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
+ LocalDateTime localDateTime = end.minusSeconds(1L);
|
|
|
|
|
+ timeEntity.setNewEndDate(DateTimeUtil.format(localDateTime, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ logger.error("----------华泰交强险新起:{}", timeEntity.getNewStartDate());
|
|
|
|
|
+ logger.error("----------华泰交强险新止:{}", timeEntity.getNewEndDate());
|
|
|
|
|
+ return timeEntity;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public TimeEntity commerceRepetitionInsure(HuaTaiQuotedPriceResponse quotedPriceResponse) {
|
|
|
|
|
+ String returnMessage = quotedPriceResponse.getHead().getReturnMessage();
|
|
|
|
|
+
|
|
|
|
|
+ logger.info("华泰API方式 - ------------报价 -> 商业险重复投保----------------");
|
|
|
|
|
+ TimeEntity timeEntity = getRepeatStartEndTime(returnMessage, HuataiBaseConstants.SY_REGEX, HuataiBaseConstants.SY_RULE);
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isEmpty(timeEntity.getCoverageEndDate())) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ logger.error("----------华泰商业险新起:{}", timeEntity.getNewStartDate());
|
|
|
|
|
+ logger.error("----------华泰商业险新止:{}", timeEntity.getNewEndDate());
|
|
|
|
|
+ return timeEntity;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private TimeEntity getRepeatStartEndTime(String errorMsg, String regex, String rule) {
|
|
|
|
|
+ String coverageEndDate = processingTime(errorMsg, regex, rule);
|
|
|
|
|
+ TimeEntity timeEntity = new TimeEntity();
|
|
|
|
|
+
|
|
|
|
|
+ if (coverageEndDate.isEmpty()) {
|
|
|
|
|
+ return timeEntity;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ timeEntity.setCoverageEndDate(coverageEndDate);
|
|
|
|
|
+ LocalDateTime start;
|
|
|
|
|
+ if (coverageEndDate.contains(HuataiBaseConstants.END_TIME)) {
|
|
|
|
|
+ start = DateTimeUtil.parseLocalDateTime(coverageEndDate, DateTimeUtil.DATETIME_PATTERN).plusSeconds(1);
|
|
|
|
|
+ LocalDateTime end = start.plusYears(1L).minusDays(1L);
|
|
|
|
|
+ timeEntity.setNewStartDate(DateTimeUtil.getStartTimeOfDayStr(start, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
+ timeEntity.setNewEndDate(DateTimeUtil.getEndTimeOfDayStr(end, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ start = DateTimeUtil.parseLocalDateTime(coverageEndDate, DateTimeUtil.DATETIME_PATTERN);
|
|
|
|
|
+ LocalDateTime end = start.plusYears(1L);
|
|
|
|
|
+ timeEntity.setNewStartDate(DateTimeUtil.format(start, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
+ LocalDateTime localDateTime = end.minusSeconds(1L);
|
|
|
|
|
+ timeEntity.setNewEndDate(DateTimeUtil.format(localDateTime, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return timeEntity;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private String processingTime(String errorMsg, String regex, String rule) {
|
|
|
|
|
+ String coverageEndDate = DuplicateInsuranceUtil.getEndDate(errorMsg, regex);
|
|
|
|
|
+
|
|
|
|
|
+ if (coverageEndDate.isEmpty() && errorMsg.contains(rule)) {
|
|
|
|
|
+ coverageEndDate = DuplicateInsuranceUtil.getEndDate(errorMsg, HuataiBaseConstants.REGEX_ALONE);
|
|
|
|
|
+ }
|
|
|
|
|
+ return coverageEndDate;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|