|
@@ -126,113 +126,9 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
@Resource(name = "restTemplateIgnoreSSL")
|
|
@Resource(name = "restTemplateIgnoreSSL")
|
|
|
private RestTemplate restTemplateIgnoreSSL;
|
|
private RestTemplate restTemplateIgnoreSSL;
|
|
|
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public HttpResult<QuoteRespVo> quoteApi(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo) throws Exception {
|
|
|
|
|
-// Integer maxQuoteNum = quoteVo.getMaxQuoteNum();
|
|
|
|
|
-//
|
|
|
|
|
-// List<SysQuoteRecord> sysQuoteRecords = new ArrayList<>();
|
|
|
|
|
-//
|
|
|
|
|
-// /** 1. 协议id获取配置实体 */
|
|
|
|
|
-// String agreementId = quoteVo.getAgreementId();
|
|
|
|
|
-// // 1.1 账号信息
|
|
|
|
|
-// PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(agreementId);
|
|
|
|
|
-// // 1.2 通过 协议id获取配置实体
|
|
|
|
|
-// ChengTaiConfigureParameters parameters = configureParametersComponents.toEntity(ChengTaiConfigureParameters.class,
|
|
|
|
|
-// ptlAgreementAttribution);
|
|
|
|
|
-// HttpHeaders httpHeaders = chengTaiRequestApiComponents.getHttpHeaders(parameters,ChengTaiRequestApiComponents.RECURSIVE_HIERARCHY);
|
|
|
|
|
-// /** 2. 查询车型 */
|
|
|
|
|
-// CarInfoRequest carInfoRequest = new CarInfoRequest(quoteInfoVo.getCarInfo(), parameters);
|
|
|
|
|
-// CarInfoResponse carInfoResponse = chengTaiRequestApiComponents.carinfoQuery(carInfoRequest, httpHeaders);
|
|
|
|
|
-// // 2.1 过滤车型
|
|
|
|
|
-// CarInfoResponse.CarModelListDTO carModelListDTO =
|
|
|
|
|
-// new CarModelsFilterUtils<CarInfoResponse.CarModelListDTO>().to(carInfoResponse.getCarModelList(),
|
|
|
|
|
-// quoteInfoVo.getCarInfo());
|
|
|
|
|
-// /** 3. 计算车辆实际价值 */
|
|
|
|
|
-// QueryCarActualValueRequest carActualValueRequest = new QueryCarActualValueRequest(quoteInfoVo,carModelListDTO, parameters);
|
|
|
|
|
-// QueryCarActualValueResponse carActualValueResponse = chengTaiRequestApiComponents.queryActualValue(carActualValueRequest,httpHeaders);
|
|
|
|
|
-//
|
|
|
|
|
-// CustomerInfoVo applyInfo = quoteInfoVo.getPolicyHolderInfo();
|
|
|
|
|
-// CustomerInfoVo insureInfo = quoteInfoVo.getInsuredPersonInfo();
|
|
|
|
|
-// String applyProperty = applyInfo.getProperty();
|
|
|
|
|
-// String insureProperty = insureInfo.getProperty();
|
|
|
|
|
-// PersonAreaVo applyPersonAreaVo;
|
|
|
|
|
-// PersonAreaVo insurePersonAreaVo;
|
|
|
|
|
-// if ("0".equals(applyProperty)) {
|
|
|
|
|
-// applyPersonAreaVo = new PersonAreaVo(applyInfo);
|
|
|
|
|
-// }else{
|
|
|
|
|
-// applyPersonAreaVo = sysAreaService.queryByAddressYc(applyInfo.getAddr(), applyInfo.getIdentifyNumber());
|
|
|
|
|
-// }
|
|
|
|
|
-// if ("0".equals(insureProperty)) {
|
|
|
|
|
-// insurePersonAreaVo = new PersonAreaVo(insureInfo);
|
|
|
|
|
-// }else{
|
|
|
|
|
-// insurePersonAreaVo = sysAreaService.queryByAddressYc(insureInfo.getAddr(), insureInfo.getIdentifyNumber());
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// /** 4. 报价 */
|
|
|
|
|
-// InsurePremiumRequest insurePremiumRequest = new InsurePremiumRequest(quoteInfoVo,carModelListDTO, carActualValueResponse,parameters,quoteVo,applyPersonAreaVo,insurePersonAreaVo);
|
|
|
|
|
-// // 重复报价
|
|
|
|
|
-// InsurePremiumResponse insurePremiumResponse = this.getResponse(insurePremiumRequest, httpHeaders,quoteInfoVo, quoteVo,maxQuoteNum,sysQuoteRecords);
|
|
|
|
|
-//
|
|
|
|
|
-// String message = "";
|
|
|
|
|
-// if(!ResponseCode.R_000.getCode().equals(insurePremiumResponse.getCode())){
|
|
|
|
|
-// QuoteRespVo resp = new QuoteRespVo();
|
|
|
|
|
-// InsOrders order = insOrdersService.getById(quoteVo.getOrderNo());
|
|
|
|
|
-// InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
|
|
|
|
|
-// if(insurePremiumResponse.getMessage().contains("重复投保"))
|
|
|
|
|
-// {
|
|
|
|
|
-// insOrderStatusEnum = InsOrderStatusEnum.REPEAT_INSURE;
|
|
|
|
|
-// }
|
|
|
|
|
-// String subOrderNo = insOrdersService.responseFailedOrder(quoteVo,quoteInfoVo, ptlAgreementAttribution, order, insurePremiumResponse.getMessage(), insOrderStatusEnum);
|
|
|
|
|
-// SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
-// QuoteNumberConstant.QuoteAction.QUOTE_FAILED.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
|
|
|
|
|
-// sysQuoteRecords.add(sysQuoteRecord);
|
|
|
|
|
-// //存储报价记录
|
|
|
|
|
-// sysQuoteRecords.forEach(item->{
|
|
|
|
|
-// item.setSubOrderNo(subOrderNo);
|
|
|
|
|
-// });
|
|
|
|
|
-//
|
|
|
|
|
-// sysQuoteRecordMapper.insertBatch(sysQuoteRecords);
|
|
|
|
|
-// //刷新redis中的报价次数
|
|
|
|
|
-// sysQuoteRedisService.refreshQuoteNum(quoteVo.getCompanyId(),quoteInfoVo.getUserid(),sysQuoteRecords);
|
|
|
|
|
-// throw new SystemException(insurePremiumResponse.getMessage());
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// // 新车需要备案
|
|
|
|
|
-// if(StringUtils.isNotBlank(insurePremiumResponse.getCarRegistFlag())){
|
|
|
|
|
-// if(insurePremiumResponse.getCarRegistFlag().equals("1")){
|
|
|
|
|
-// throw new SystemException("该车辆需要进行新车备案,请填写新车备案信息重新进行保费试算!");
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// // 警告信息
|
|
|
|
|
-// CarInfoVo carInfo = quoteInfoVo.getCarInfo();
|
|
|
|
|
-// boolean isEnergy = carInfo.isNewEnergy();
|
|
|
|
|
-// QuoteRespVo quoteRespVo = getQuoteRespVo(insurePremiumResponse, quoteInfoVo, isEnergy,quoteVo);
|
|
|
|
|
-// if (!StringUtils.isEmpty(message)) {
|
|
|
|
|
-// ArrayList<String> objects = new ArrayList<>();
|
|
|
|
|
-// objects.add(message);
|
|
|
|
|
-// quoteRespVo.setWarnMessageList(objects);
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// // 设置核心报价车型
|
|
|
|
|
-// quoteRespVo.setCoreModels(carModelListDTO.toCoreModelsVo());
|
|
|
|
|
-// HttpResult<QuoteRespVo> quoteRespVoHttpResult = responseOrder(insurePremiumResponse, quoteRespVo, ptlAgreementAttribution, insurePremiumResponse.getOrderId(),quoteInfoVo);
|
|
|
|
|
-// SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
-// QuoteNumberConstant.QuoteAction.QUOTE_SUCCESS.getCode().toString(),QuoteNumberConstant.QuoteResult.SUCCESS.getCode().toString());
|
|
|
|
|
-// sysQuoteRecords.add(sysQuoteRecord);
|
|
|
|
|
-// //存储报价记录
|
|
|
|
|
-// sysQuoteRecords.forEach(item->{
|
|
|
|
|
-// item.setSubOrderNo(quoteRespVoHttpResult.getData().getCompanyId());
|
|
|
|
|
-// });
|
|
|
|
|
-// sysQuoteRecordMapper.insertBatch(sysQuoteRecords);
|
|
|
|
|
-//
|
|
|
|
|
-// sysQuoteRedisService.refreshQuoteNum(quoteVo.getCompanyId(),quoteInfoVo.getUserid(),sysQuoteRecords);
|
|
|
|
|
-//
|
|
|
|
|
-// return quoteRespVoHttpResult;
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo) throws Exception {
|
|
public HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo) throws Exception {
|
|
|
-// Integer maxQuoteNum = quoteVo.getMaxQuoteNum();
|
|
|
|
|
|
|
+ Integer maxQuoteNum = quoteVo.getMaxQuoteNum();
|
|
|
|
|
|
|
|
List<SysQuoteRecord> sysQuoteRecords = new ArrayList<>();
|
|
List<SysQuoteRecord> sysQuoteRecords = new ArrayList<>();
|
|
|
/** 1. 协议id获取配置实体 */
|
|
/** 1. 协议id获取配置实体 */
|
|
@@ -252,80 +148,35 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
BigDecimal carActualValue = calculateCarActualValue(vehicle,quoteInfoVo.getCarInfo());
|
|
BigDecimal carActualValue = calculateCarActualValue(vehicle,quoteInfoVo.getCarInfo());
|
|
|
/** 4. 报价 */
|
|
/** 4. 报价 */
|
|
|
PremiumCalculationRequest premiumCalculationRequest = new PremiumCalculationRequest(quoteInfoVo,carActualValue,parameters,vehicle,quoteVo,quoteInfoVo.getRiskList(),null);
|
|
PremiumCalculationRequest premiumCalculationRequest = new PremiumCalculationRequest(quoteInfoVo,carActualValue,parameters,vehicle,quoteVo,quoteInfoVo.getRiskList(),null);
|
|
|
- PremiumCalculationResponse premiumCalculationResponse = chengTaiRequestApiComponent.premiumCalculation(premiumCalculationRequest);
|
|
|
|
|
|
|
+ PremiumCalculationResponse premiumCalculationResponse
|
|
|
|
|
+ = getResponse(premiumCalculationRequest,quoteInfoVo,maxQuoteNum,sysQuoteRecords,carActualValue,parameters,vehicle,quoteVo);
|
|
|
// 报价失败
|
|
// 报价失败
|
|
|
if (!premiumCalculationResponse.getHead().getResponseCode().equals("0000")) {
|
|
if (!premiumCalculationResponse.getHead().getResponseCode().equals("0000")) {
|
|
|
- /**
|
|
|
|
|
- * 重复投保
|
|
|
|
|
- */
|
|
|
|
|
- // 获取新起保时间 终保时间
|
|
|
|
|
- final String startDate = extractEndDate(premiumCalculationResponse);
|
|
|
|
|
- String endDate;
|
|
|
|
|
- if (startDate != null){
|
|
|
|
|
- if (startDate.endsWith("00:00:00")) {
|
|
|
|
|
- endDate = TimeProcessing.minusOneSecondAfterYear(startDate);
|
|
|
|
|
- } else {
|
|
|
|
|
- endDate = TimeProcessing.minusOneDayAfterYear(startDate);
|
|
|
|
|
- }
|
|
|
|
|
- final String formatStartDate = XmlDateTimeFormatter.format(startDate);
|
|
|
|
|
- final String formatEndDate = XmlDateTimeFormatter.format(endDate);
|
|
|
|
|
- quoteInfoVo.getRiskList().forEach(riskInfoVo -> {
|
|
|
|
|
- riskInfoVo.setStartDate(formatStartDate);
|
|
|
|
|
- riskInfoVo.setEndDate(formatEndDate);
|
|
|
|
|
- });
|
|
|
|
|
- premiumCalculationRequest = new PremiumCalculationRequest(quoteInfoVo,carActualValue,parameters,vehicle,quoteVo,quoteInfoVo.getRiskList(),null);
|
|
|
|
|
- premiumCalculationResponse = chengTaiRequestApiComponent.premiumCalculation(premiumCalculationRequest);
|
|
|
|
|
- } else {
|
|
|
|
|
- InsOrders insOrders = insOrdersService.getById(quoteVo.getOrderNo());
|
|
|
|
|
- InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
|
|
|
|
|
- String subOrderNo = insOrdersService.responseFailedOrder(quoteVo,quoteInfoVo, ptlAgreementAttribution, insOrders, premiumCalculationResponse.getHead().getErrorMessage(), insOrderStatusEnum);
|
|
|
|
|
- SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
- QuoteNumberConstant.QuoteAction.QUOTE_FAILED.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
|
|
|
|
|
- sysQuoteRecords.add(sysQuoteRecord);
|
|
|
|
|
- //存储报价记录
|
|
|
|
|
- sysQuoteRecords.forEach(item->{
|
|
|
|
|
- item.setSubOrderNo(subOrderNo);
|
|
|
|
|
- });
|
|
|
|
|
- sysQuoteRecordMapper.insertBatch(sysQuoteRecords);
|
|
|
|
|
- //刷新redis中的报价次数
|
|
|
|
|
- sysQuoteRedisService.refreshQuoteNum(quoteVo.getCompanyId(),quoteInfoVo.getUserid(),sysQuoteRecords);
|
|
|
|
|
- throw new SystemException(premiumCalculationResponse.getHead().getErrorMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ InsOrders insOrders = insOrdersService.getById(quoteVo.getOrderNo());
|
|
|
|
|
+ InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
|
|
|
|
|
+ String subOrderNo = insOrdersService.responseFailedOrder(quoteVo,quoteInfoVo, ptlAgreementAttribution, insOrders, premiumCalculationResponse.getHead().getErrorMessage(), insOrderStatusEnum);
|
|
|
|
|
+ SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
+ QuoteNumberConstant.QuoteAction.QUOTE_FAILED.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
|
|
|
|
|
+ sysQuoteRecords.add(sysQuoteRecord);
|
|
|
|
|
+ //存储报价记录
|
|
|
|
|
+ sysQuoteRecords.forEach(item->{
|
|
|
|
|
+ item.setSubOrderNo(subOrderNo);
|
|
|
|
|
+ });
|
|
|
|
|
+ sysQuoteRecordMapper.insertBatch(sysQuoteRecords);
|
|
|
|
|
+ //刷新redis中的报价次数
|
|
|
|
|
+ sysQuoteRedisService.refreshQuoteNum(quoteVo.getCompanyId(),quoteInfoVo.getUserid(),sysQuoteRecords);
|
|
|
|
|
+ throw new SystemException(premiumCalculationResponse.getHead().getErrorMessage());
|
|
|
}
|
|
}
|
|
|
- // 转保处理
|
|
|
|
|
- String ciQuestion = premiumCalculationResponse.getCompRisk() != null
|
|
|
|
|
- ? premiumCalculationResponse.getCompRisk().getBasePart().getQuestion()
|
|
|
|
|
- : null;
|
|
|
|
|
- String biQuestion = premiumCalculationResponse.getCommRisk() != null
|
|
|
|
|
- ? premiumCalculationResponse.getCommRisk().getBasePart().getQuestion()
|
|
|
|
|
- : null;
|
|
|
|
|
// 订单号
|
|
// 订单号
|
|
|
String orderNumber = premiumCalculationResponse.getCompRisk() != null
|
|
String orderNumber = premiumCalculationResponse.getCompRisk() != null
|
|
|
? premiumCalculationResponse.getCompRisk().getFtrno().getOrderNumber()
|
|
? premiumCalculationResponse.getCompRisk().getFtrno().getOrderNumber()
|
|
|
: premiumCalculationResponse.getCommRisk().getFtrno().getOrderNumber();
|
|
: premiumCalculationResponse.getCommRisk().getFtrno().getOrderNumber();
|
|
|
- Map<String, String> bodyMap = new HashMap<>();
|
|
|
|
|
- if (Objects.nonNull(ciQuestion)) {
|
|
|
|
|
- bodyMap.put("jqImage", ciQuestion);
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.nonNull(biQuestion)) {
|
|
|
|
|
- bodyMap.put("syImage", biQuestion);
|
|
|
|
|
- }
|
|
|
|
|
- String sendBody = JsonUtils.toJson(bodyMap);
|
|
|
|
|
- if (!"{}".equals(sendBody)) {
|
|
|
|
|
- String ocrStr = HttpUtil.sendPost("http://39.98.41.104:8088/getres", sendBody);
|
|
|
|
|
- CheckCodeResp resp = JSONUtil.toBean(ocrStr, CheckCodeResp.class);
|
|
|
|
|
- quoteVo.setRenewalCodeJq(resp.getJqImageCode());
|
|
|
|
|
- quoteVo.setRenewalCodeSy(resp.getSyImageCode());
|
|
|
|
|
- premiumCalculationRequest = new PremiumCalculationRequest(quoteInfoVo,carActualValue,parameters,vehicle,quoteVo,quoteInfoVo.getRiskList(),orderNumber);
|
|
|
|
|
- premiumCalculationResponse = chengTaiRequestApiComponent.premiumCalculation(premiumCalculationRequest);
|
|
|
|
|
- }
|
|
|
|
|
// 处理报价数据
|
|
// 处理报价数据
|
|
|
QuoteRespVo quoteRespVo = getQuoteRespVo(premiumCalculationResponse, quoteInfoVo);
|
|
QuoteRespVo quoteRespVo = getQuoteRespVo(premiumCalculationResponse, quoteInfoVo);
|
|
|
quoteRespVo.setCoreModels(vehicle.toCoreModelsVo());
|
|
quoteRespVo.setCoreModels(vehicle.toCoreModelsVo());
|
|
|
HttpResult<QuoteRespVo> quoteRespVoHttpResult = respOrder(premiumCalculationResponse, quoteRespVo, ptlAgreementAttribution, orderNumber, quoteInfoVo,premiumCalculationRequest);
|
|
HttpResult<QuoteRespVo> quoteRespVoHttpResult = respOrder(premiumCalculationResponse, quoteRespVo, ptlAgreementAttribution, orderNumber, quoteInfoVo,premiumCalculationRequest);
|
|
|
-
|
|
|
|
|
- SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
- QuoteNumberConstant.QuoteAction.QUOTE_SUCCESS.getCode().toString(),QuoteNumberConstant.QuoteResult.SUCCESS.getCode().toString());
|
|
|
|
|
|
|
+ SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
+ QuoteNumberConstant.QuoteAction.QUOTE_SUCCESS.getCode().toString(),QuoteNumberConstant.QuoteResult.SUCCESS.getCode().toString());
|
|
|
sysQuoteRecords.add(sysQuoteRecord);
|
|
sysQuoteRecords.add(sysQuoteRecord);
|
|
|
//存储报价记录
|
|
//存储报价记录
|
|
|
sysQuoteRecords.forEach(item->{
|
|
sysQuoteRecords.forEach(item->{
|
|
@@ -390,248 +241,88 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 重复报价
|
|
|
|
|
-// * @param insurePremiumRequest
|
|
|
|
|
-// * @param httpHeaders
|
|
|
|
|
-// * @return
|
|
|
|
|
-// */
|
|
|
|
|
-// private InsurePremiumResponse getResponse(InsurePremiumRequest insurePremiumRequest, HttpHeaders httpHeaders,BaseQuoteInfoVo quoteInfoVo,
|
|
|
|
|
-// BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo ,Integer maxQuoteNum,List<SysQuoteRecord> sysQuoteRecords) throws Exception {
|
|
|
|
|
-//
|
|
|
|
|
-// InsurePremiumResponse insurePremiumResponse = chengTaiRequestApiComponents.quoteApi(insurePremiumRequest,httpHeaders);
|
|
|
|
|
-// maxQuoteNum--;
|
|
|
|
|
-// if(!ResponseCode.R_000.getCode().equals(insurePremiumResponse.getCode()) && insurePremiumResponse.getMessage().contains("重复投保")){
|
|
|
|
|
-// // 交强险 商业险 重复投保处理
|
|
|
|
|
-// this.repetitionInsure(insurePremiumResponse,insurePremiumRequest);
|
|
|
|
|
-// SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
-// QuoteNumberConstant.QuoteAction.DATE_DEAL.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
|
|
|
|
|
-// sysQuoteRecords.add(sysQuoteRecord);
|
|
|
|
|
-// if(maxQuoteNum <= 0){
|
|
|
|
|
-// return insurePremiumResponse;
|
|
|
|
|
-// }
|
|
|
|
|
-// insurePremiumResponse = chengTaiRequestApiComponents.quoteApi(insurePremiumRequest,httpHeaders);
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// // 转保车处理
|
|
|
|
|
-// InsurePremiumResponse.BiContractDTO biContract = insurePremiumResponse.getBiContract();
|
|
|
|
|
-// InsurePremiumResponse.CiContractDTO ciContract = insurePremiumResponse.getCiContract();
|
|
|
|
|
-//
|
|
|
|
|
-// Double biTotalPremium = null;
|
|
|
|
|
-// Double ciTotalPremium = null;
|
|
|
|
|
-// Boolean biBoo = false;
|
|
|
|
|
-// Boolean ciBoo = false;
|
|
|
|
|
-// Boolean biDiscountBoo = false;
|
|
|
|
|
-// if(Objects.nonNull(biContract)){
|
|
|
|
|
-// biTotalPremium = biContract.getContractMain().getTotalPremium();
|
|
|
|
|
-// if(Objects.isNull(biTotalPremium)){
|
|
|
|
|
-// biBoo = true;
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// if(Objects.nonNull(ciContract)){
|
|
|
|
|
-// ciTotalPremium = ciContract.getContractMain().getTotalPremium();
|
|
|
|
|
-// if(Objects.isNull(ciTotalPremium)){
|
|
|
|
|
-// ciBoo = true;
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// if(switchConfigService.ctDiscountSwitches()){ //是否自动计算折扣
|
|
|
|
|
-// if(biContract != null) {
|
|
|
|
|
-// String EntireInitialDiscountStr = biContract.getDiscountInfo().getEntireInitialDiscount();
|
|
|
|
|
-// String hopeDiscountStr = biContract.getContractMain().getHopeDiscount();
|
|
|
|
|
-//// String hopeCoefficientStr = biContract.getContractMain().getHopeCoefficient();
|
|
|
|
|
-// if (StringUtils.isNotBlank(hopeDiscountStr) && StringUtils.isNotBlank(EntireInitialDiscountStr)) {
|
|
|
|
|
-// // 获取商业险的初始建议折扣 和 期望折扣
|
|
|
|
|
-// Double entireInitialDiscount = Double.parseDouble(EntireInitialDiscountStr); //初始建议折扣
|
|
|
|
|
-// Double hopeDiscount = Double.parseDouble(hopeDiscountStr); // 期望折扣
|
|
|
|
|
-// if (entireInitialDiscount > hopeDiscount) {
|
|
|
|
|
-// biDiscountBoo = true;
|
|
|
|
|
-// }
|
|
|
|
|
-// if (biDiscountBoo) {
|
|
|
|
|
-// entireInitialDiscount = entireInitialDiscount + 0.01;
|
|
|
|
|
-// this.replaceDiscount(insurePremiumRequest, entireInitialDiscount);
|
|
|
|
|
-// insurePremiumResponse = chengTaiRequestApiComponents.quoteApi(insurePremiumRequest, httpHeaders);
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// if (biBoo || ciBoo) {
|
|
|
|
|
-// this.platRepetition(insurePremiumResponse,insurePremiumRequest);
|
|
|
|
|
-// insurePremiumResponse = chengTaiRequestApiComponents.quoteApi(insurePremiumRequest,httpHeaders);
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// if(!ResponseCode.R_000.getCode().equals(insurePremiumResponse.getCode()) && insurePremiumResponse.getMessage().contains("录入的校验码有误")){
|
|
|
|
|
-// this.replaceByte(insurePremiumRequest);
|
|
|
|
|
-// insurePremiumResponse = chengTaiRequestApiComponents.quoteApi(insurePremiumRequest,httpHeaders);
|
|
|
|
|
-// }
|
|
|
|
|
-// return insurePremiumResponse;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// private void replaceDiscount(InsurePremiumRequest insurePremiumRequest, Double entireInitialDiscount) {
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO biContractReq = insurePremiumRequest.getBiContract();
|
|
|
|
|
-// if(Objects.nonNull(biContractReq)){
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO.ContractMainDTO mainDTO = biContractReq.getContractMain();
|
|
|
|
|
-// mainDTO.setHopeDiscount(entireInitialDiscount);
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 错误字符替换
|
|
|
|
|
-// * @param insurePremiumRequest
|
|
|
|
|
-// */
|
|
|
|
|
-// private void replaceByte(InsurePremiumRequest insurePremiumRequest) {
|
|
|
|
|
-// InsurePremiumRequest.CiContractDTO ciContractReq = insurePremiumRequest.getCiContract();
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO biContractReq = insurePremiumRequest.getBiContract();
|
|
|
|
|
-// if(Objects.nonNull(ciContractReq)){
|
|
|
|
|
-// InsurePremiumRequest.CiContractDTO.PlatFormMessageDTO platFormMessageDTO = ciContractReq.getPlatFormMessage();
|
|
|
|
|
-// platFormMessageDTO.setAnswer(replacingStrings(platFormMessageDTO.getAnswer()));
|
|
|
|
|
-// }
|
|
|
|
|
-// if(Objects.nonNull(biContractReq)){
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO.PlatFormMessageDTO platFormMessageDTO = biContractReq.getPlatFormMessage();
|
|
|
|
|
-// platFormMessageDTO.setAnswer(replacingStrings(platFormMessageDTO.getAnswer()));
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// public static String replacingStrings(String code) {
|
|
|
|
|
-// if (StringUtils.isEmpty(code)) {
|
|
|
|
|
-// return code;
|
|
|
|
|
-// }
|
|
|
|
|
-// if (code.length() > 4) {
|
|
|
|
|
-// return code.substring(code.length() - 4);
|
|
|
|
|
-// }
|
|
|
|
|
-// return code
|
|
|
|
|
-// .replace("3", "j")
|
|
|
|
|
-// .replace("0", "o");
|
|
|
|
|
-// }
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 转保车处理
|
|
|
|
|
-// * @param insurePremiumRequest
|
|
|
|
|
-// */
|
|
|
|
|
-// private void platRepetition(InsurePremiumResponse response, InsurePremiumRequest insurePremiumRequest) {
|
|
|
|
|
-// String jqImageStr = null;
|
|
|
|
|
-// String syImageStr = null;
|
|
|
|
|
-// insurePremiumRequest.setOrderId(response.getOrderId());
|
|
|
|
|
-// InsurePremiumResponse.CiContractDTO ciContract = response.getCiContract();
|
|
|
|
|
-// InsurePremiumResponse.BiContractDTO biContract = response.getBiContract();
|
|
|
|
|
-// //交强险
|
|
|
|
|
-// if (Objects.nonNull(ciContract)) {
|
|
|
|
|
-// jqImageStr = ciContract.getPlatFormMessage().getQuestion();
|
|
|
|
|
-// }
|
|
|
|
|
-// //商业险
|
|
|
|
|
-// if (Objects.nonNull(biContract)) {
|
|
|
|
|
-// syImageStr = biContract.getPlatFormMessage().getQuestion();
|
|
|
|
|
-// }
|
|
|
|
|
-// Map<String, String> bodyMap = new HashMap<>();
|
|
|
|
|
-// bodyMap.put("jqImage", com.ydtech.utils.StringUtils.toString(jqImageStr, ""));
|
|
|
|
|
-// bodyMap.put("syImage", com.ydtech.utils.StringUtils.toString(syImageStr, ""));
|
|
|
|
|
-// String sendBody = JsonUtils.toJson(bodyMap);
|
|
|
|
|
-// String ocrStr = HttpUtil.sendPost("http://39.98.41.104:8088/getres", sendBody);
|
|
|
|
|
-// CheckCodeResp resp = JSONUtil.toBean(ocrStr, CheckCodeResp.class);
|
|
|
|
|
-//
|
|
|
|
|
-// if(Objects.nonNull(ciContract)){
|
|
|
|
|
-// InsurePremiumRequest.CiContractDTO ciContractReq = insurePremiumRequest.getCiContract();
|
|
|
|
|
-// InsurePremiumRequest.CiContractDTO.PlatFormMessageDTO platFormMessage = ciContractReq.getPlatFormMessage();
|
|
|
|
|
-// if(Objects.isNull(platFormMessage)){
|
|
|
|
|
-// platFormMessage = new InsurePremiumRequest.CiContractDTO.PlatFormMessageDTO();
|
|
|
|
|
-// }
|
|
|
|
|
-// BeanUtils.copyProperties(ciContract.getPlatFormMessage(), platFormMessage);
|
|
|
|
|
-// platFormMessage.setAnswer(resp.jqImageCode);
|
|
|
|
|
-// ciContractReq.setPlatFormMessage(platFormMessage);
|
|
|
|
|
-// insurePremiumRequest.setCiContract(ciContractReq);
|
|
|
|
|
-// }
|
|
|
|
|
-// if(Objects.nonNull(biContract)){
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO biContractReq = insurePremiumRequest.getBiContract();
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO.PlatFormMessageDTO platFormMessage = biContractReq.getPlatFormMessage();
|
|
|
|
|
-// if(Objects.isNull(platFormMessage)){
|
|
|
|
|
-// platFormMessage = new InsurePremiumRequest.BiContractDTO.PlatFormMessageDTO();
|
|
|
|
|
-// }
|
|
|
|
|
-// BeanUtils.copyProperties(biContract.getPlatFormMessage(), platFormMessage);
|
|
|
|
|
-// platFormMessage.setAnswer(resp.syImageCode);
|
|
|
|
|
-// biContractReq.setPlatFormMessage(platFormMessage);
|
|
|
|
|
-// insurePremiumRequest.setBiContract(biContractReq);
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 重复投保时间处理
|
|
|
|
|
-// *
|
|
|
|
|
-// * @param insurePremiumResponse
|
|
|
|
|
-// * @param insurePremiumRequest
|
|
|
|
|
-// */
|
|
|
|
|
-// private void repetitionInsure(InsurePremiumResponse insurePremiumResponse, InsurePremiumRequest insurePremiumRequest) {
|
|
|
|
|
-// String err = insurePremiumResponse.getMessage();
|
|
|
|
|
-// List<String> errList = Arrays.asList(err.split("。"));
|
|
|
|
|
-// if(CollUtil.isEmpty(errList)){ return; }
|
|
|
|
|
-//
|
|
|
|
|
-// // 定义时间格式
|
|
|
|
|
-// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
-// DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
|
|
|
|
-// errList.stream().forEach(a ->{
|
|
|
|
|
-// if (a.contains("交强险平台") && a.contains("重复投保")){
|
|
|
|
|
-// InsurePremiumRequest.CiContractDTO ciContract = insurePremiumRequest.getCiContract();
|
|
|
|
|
-// InsurePremiumRequest.CiContractDTO.ContractMainDTO contractMain = ciContract.getContractMain();
|
|
|
|
|
-//
|
|
|
|
|
-// LocalDateTime dateTime = null;
|
|
|
|
|
-// if(a.contains("终保日期")){
|
|
|
|
|
-// String startTime = a.substring(a.indexOf("终保日期")+5,a.indexOf("终保日期")+21);
|
|
|
|
|
-// // 解析原始时间
|
|
|
|
|
-// dateTime = LocalDateTime.parse(startTime, formatter1);
|
|
|
|
|
-// }else{
|
|
|
|
|
-// String startTime = contractMain.getExpiryDate();
|
|
|
|
|
-// // 解析原始时间
|
|
|
|
|
-// dateTime = LocalDateTime.parse(startTime, formatter);
|
|
|
|
|
-// }
|
|
|
|
|
-// LocalDateTime tomorrowMidnight = dateTime;
|
|
|
|
|
-// //判断是否是整点 如果是整点则不进行明天的零点操作
|
|
|
|
|
-// if(dateTime.getHour() != 0 || dateTime.getMinute() != 0 || dateTime.getSecond() != 0)
|
|
|
|
|
-// {
|
|
|
|
|
-// tomorrowMidnight = dateTime.toLocalDate().plusDays(1).atStartOfDay();
|
|
|
|
|
-// }
|
|
|
|
|
-// LocalDateTime end = tomorrowMidnight.plusYears(1L);
|
|
|
|
|
-// contractMain.setValidDate(DateTimeUtil.format(tomorrowMidnight, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
-// LocalDateTime localDateTime = end.minusSeconds(1L);
|
|
|
|
|
-// contractMain.setExpiryDate(DateTimeUtil.format(localDateTime, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
-// ciContract.setContractMain(contractMain);
|
|
|
|
|
-// insurePremiumRequest.setCiContract(ciContract);
|
|
|
|
|
-// if(Objects.nonNull(insurePremiumRequest.getBiContract())){
|
|
|
|
|
-// // 如果存在商业险的话 交强险重复投保 则也修改商业险的投保时间
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO biContract = insurePremiumRequest.getBiContract();
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO.ContractMainDTO biContractMain = biContract.getContractMain();
|
|
|
|
|
-// biContractMain.setValidDate(DateTimeUtil.format(tomorrowMidnight, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
-// biContractMain.setExpiryDate(DateTimeUtil.format(localDateTime, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
-// biContract.setContractMain(biContractMain);
|
|
|
|
|
-// insurePremiumRequest.setBiContract(biContract);
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// if (a.contains("商业险险平台") && a.contains("重复投保")){
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO biContract = insurePremiumRequest.getBiContract();
|
|
|
|
|
-// InsurePremiumRequest.BiContractDTO.ContractMainDTO contractMain = biContract.getContractMain();
|
|
|
|
|
-// LocalDateTime dateTime = null;
|
|
|
|
|
-// if(a.contains("终保日期")){
|
|
|
|
|
-// String startTime = a.substring(a.indexOf("终保日期")+5,a.indexOf("终保日期")+21);
|
|
|
|
|
-// // 解析原始时间
|
|
|
|
|
-// dateTime = LocalDateTime.parse(startTime, formatter1);
|
|
|
|
|
-// }else{
|
|
|
|
|
-// String startTime = contractMain.getExpiryDate();
|
|
|
|
|
-// // 解析原始时间
|
|
|
|
|
-// dateTime = LocalDateTime.parse(startTime, formatter);
|
|
|
|
|
-// }
|
|
|
|
|
-// LocalDateTime tomorrowMidnight = dateTime;
|
|
|
|
|
-// //判断是否是整点 如果是整点则不进行明天的零点操作
|
|
|
|
|
-// if(dateTime.getHour() != 0 || dateTime.getMinute() != 0 || dateTime.getSecond() != 0)
|
|
|
|
|
-// {
|
|
|
|
|
-// tomorrowMidnight = dateTime.toLocalDate().plusDays(1).atStartOfDay();
|
|
|
|
|
-// }
|
|
|
|
|
-// LocalDateTime end = tomorrowMidnight.plusYears(1L);
|
|
|
|
|
-// contractMain.setValidDate(DateTimeUtil.format(tomorrowMidnight, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
-// LocalDateTime localDateTime = end.minusSeconds(1L);
|
|
|
|
|
-// contractMain.setExpiryDate(DateTimeUtil.format(localDateTime, DateTimeUtil.DATETIME_PATTERN));
|
|
|
|
|
-// biContract.setContractMain(contractMain);
|
|
|
|
|
-// insurePremiumRequest.setBiContract(biContract);
|
|
|
|
|
-// }
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 重复报价
|
|
|
|
|
+ * @param premiumCalculationRequest
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private PremiumCalculationResponse getResponse(PremiumCalculationRequest premiumCalculationRequest,BaseQuoteInfoVo quoteInfoVo,Integer maxQuoteNum,List<SysQuoteRecord> sysQuoteRecords
|
|
|
|
|
+ ,BigDecimal carActualValue,ChengTaiConfigureParameters parameters,CarModelQueryResponse.vehicle vehicle,BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo) throws Exception {
|
|
|
|
|
+
|
|
|
|
|
+ PremiumCalculationResponse premiumCalculationResponse = chengTaiRequestApiComponent.premiumCalculation(premiumCalculationRequest);
|
|
|
|
|
+ maxQuoteNum--;
|
|
|
|
|
+ if (!premiumCalculationResponse.getHead().getResponseCode().equals("0000")) {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 重复投保
|
|
|
|
|
+ */
|
|
|
|
|
+ // 获取新起保时间 终保时间
|
|
|
|
|
+ final String startDate = extractEndDate(premiumCalculationResponse);
|
|
|
|
|
+ String endDate;
|
|
|
|
|
+ if (startDate != null){
|
|
|
|
|
+ if (startDate.endsWith("00:00:00")) {
|
|
|
|
|
+ endDate = TimeProcessing.minusOneSecondAfterYear(startDate);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ endDate = TimeProcessing.minusOneDayAfterYear(startDate);
|
|
|
|
|
+ }
|
|
|
|
|
+ final String formatStartDate = XmlDateTimeFormatter.format(startDate);
|
|
|
|
|
+ final String formatEndDate = XmlDateTimeFormatter.format(endDate);
|
|
|
|
|
+ quoteInfoVo.getRiskList().forEach(riskInfoVo -> {
|
|
|
|
|
+ riskInfoVo.setStartDate(formatStartDate);
|
|
|
|
|
+ riskInfoVo.setEndDate(formatEndDate);
|
|
|
|
|
+ });
|
|
|
|
|
+ premiumCalculationRequest = new PremiumCalculationRequest(quoteInfoVo,carActualValue,parameters,vehicle,quoteVo,quoteInfoVo.getRiskList(),null);
|
|
|
|
|
+ premiumCalculationResponse = chengTaiRequestApiComponent.premiumCalculation(premiumCalculationRequest);
|
|
|
|
|
+ maxQuoteNum--;
|
|
|
|
|
+ SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
+ QuoteNumberConstant.QuoteAction.DATE_DEAL.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
|
|
|
|
|
+ sysQuoteRecords.add(sysQuoteRecord);
|
|
|
|
|
+ if(maxQuoteNum <= 0){
|
|
|
|
|
+ sysQuoteRecordMapper.insertBatch(sysQuoteRecords);
|
|
|
|
|
+ //刷新redis中的报价次数
|
|
|
|
|
+ sysQuoteRedisService.refreshQuoteNum(quoteVo.getCompanyId(),quoteInfoVo.getUserid(),sysQuoteRecords);
|
|
|
|
|
+ throw new SystemException("报价次数限制");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 转保车处理
|
|
|
|
|
+ String ciQuestion = premiumCalculationResponse.getCompRisk() != null
|
|
|
|
|
+ ? premiumCalculationResponse.getCompRisk().getBasePart().getQuestion()
|
|
|
|
|
+ : null;
|
|
|
|
|
+ String biQuestion = premiumCalculationResponse.getCommRisk() != null
|
|
|
|
|
+ ? premiumCalculationResponse.getCommRisk().getBasePart().getQuestion()
|
|
|
|
|
+ : null;
|
|
|
|
|
+ // 订单号
|
|
|
|
|
+ String orderNumber = premiumCalculationResponse.getCompRisk() != null
|
|
|
|
|
+ ? premiumCalculationResponse.getCompRisk().getFtrno().getOrderNumber()
|
|
|
|
|
+ : premiumCalculationResponse.getCommRisk().getFtrno().getOrderNumber();
|
|
|
|
|
+ Map<String, String> bodyMap = new HashMap<>();
|
|
|
|
|
+ if (Objects.nonNull(ciQuestion)) {
|
|
|
|
|
+ bodyMap.put("jqImage", ciQuestion);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Objects.nonNull(biQuestion)) {
|
|
|
|
|
+ bodyMap.put("syImage", biQuestion);
|
|
|
|
|
+ }
|
|
|
|
|
+ String sendBody = JsonUtils.toJson(bodyMap);
|
|
|
|
|
+ if (!"{}".equals(sendBody)) {
|
|
|
|
|
+ String ocrStr = HttpUtil.sendPost("http://39.98.41.104:8088/getres", sendBody);
|
|
|
|
|
+ CheckCodeResp resp = JSONUtil.toBean(ocrStr, CheckCodeResp.class);
|
|
|
|
|
+ quoteVo.setRenewalCodeJq(resp.getJqImageCode());
|
|
|
|
|
+ quoteVo.setRenewalCodeSy(resp.getSyImageCode());
|
|
|
|
|
+ premiumCalculationRequest = new PremiumCalculationRequest(quoteInfoVo,carActualValue,parameters,vehicle,quoteVo,quoteInfoVo.getRiskList(),orderNumber);
|
|
|
|
|
+ premiumCalculationResponse = chengTaiRequestApiComponent.premiumCalculation(premiumCalculationRequest);
|
|
|
|
|
+ maxQuoteNum--;
|
|
|
|
|
+ SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),quoteVo.getCompanyId(),quoteInfoVo.getCarInfo().getLicenseNo(),
|
|
|
|
|
+ QuoteNumberConstant.QuoteAction.DATE_DEAL.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
|
|
|
|
|
+ sysQuoteRecords.add(sysQuoteRecord);
|
|
|
|
|
+ if(maxQuoteNum <= 0){
|
|
|
|
|
+ sysQuoteRecordMapper.insertBatch(sysQuoteRecords);
|
|
|
|
|
+ //刷新redis中的报价次数
|
|
|
|
|
+ sysQuoteRedisService.refreshQuoteNum(quoteVo.getCompanyId(),quoteInfoVo.getUserid(),sysQuoteRecords);
|
|
|
|
|
+ throw new SystemException("报价次数限制");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return premiumCalculationResponse;
|
|
|
|
|
+ }
|
|
|
private HttpResult<QuoteRespVo> respOrder(PremiumCalculationResponse premiumCalculationResponse, QuoteRespVo quoteRespVo, PtlAgreementAttribution ptlAgreementAttribution, String orderNumber,
|
|
private HttpResult<QuoteRespVo> respOrder(PremiumCalculationResponse premiumCalculationResponse, QuoteRespVo quoteRespVo, PtlAgreementAttribution ptlAgreementAttribution, String orderNumber,
|
|
|
BaseQuoteInfoVo quoteInfoVo,PremiumCalculationRequest premiumCalculationRequest) {
|
|
BaseQuoteInfoVo quoteInfoVo,PremiumCalculationRequest premiumCalculationRequest) {
|
|
|
// 保存订单信息
|
|
// 保存订单信息
|
|
@@ -671,56 +362,6 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
return HttpResult.ok("报价成功", quoteRespVo);
|
|
return HttpResult.ok("报价成功", quoteRespVo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-// private HttpResult<QuoteRespVo> responseOrder(InsurePremiumResponse insurePremiumResponse, QuoteRespVo quoteRespVo, PtlAgreementAttribution ptlAgreementAttribution, String orderId,
|
|
|
|
|
-// BaseQuoteInfoVo quoteInfoVo) {
|
|
|
|
|
-// // 保存订单信息
|
|
|
|
|
-// InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
|
|
|
|
|
-//
|
|
|
|
|
-// // 子订单的车辆 人员信息存储
|
|
|
|
|
-// insAreaCompany.setCarInfo(JSON.toJSONString(quoteInfoVo.getCarInfo()));
|
|
|
|
|
-// insAreaCompany.setOwnerInfo(JSON.toJSONString(quoteInfoVo.getOwnerInfo()));
|
|
|
|
|
-// insAreaCompany.setApplyInfo(JSON.toJSONString(quoteInfoVo.getPolicyHolderInfo()));
|
|
|
|
|
-// insAreaCompany.setInsureInfo(JSON.toJSONString(quoteInfoVo.getInsuredPersonInfo()));
|
|
|
|
|
-//
|
|
|
|
|
-// // 协议id
|
|
|
|
|
-// insAreaCompany.setReptxt(JSON.parseObject(JSON.toJSONString(insurePremiumResponse)));
|
|
|
|
|
-// insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
|
|
|
|
|
-// insAreaCompany.setInsOrderNo(orderId);
|
|
|
|
|
-//
|
|
|
|
|
-// // 车船税
|
|
|
|
|
-// if(Objects.nonNull(insurePremiumResponse.getCiContract())){
|
|
|
|
|
-// if(Objects.nonNull(insurePremiumResponse.getCiContract().getTax())){
|
|
|
|
|
-// InsurePremiumResponse.CiContractDTO.TaxDTO taxDTO = insurePremiumResponse.getCiContract().getTax();
|
|
|
|
|
-// TaxArrears taxArrears = new TaxArrears("往年欠税", taxDTO.getAnnualTaxDue(),
|
|
|
|
|
-// taxDTO.getSumOverdue());
|
|
|
|
|
-// List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
|
|
|
|
|
-// insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(taxArrearsList)));
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// List<AccidentResponseVo> accident = quoteRespVo.getAccidentInfo();
|
|
|
|
|
-// List<InsAreaCompanyAccidentalDriving> insAreaCompanyAccidentalDrivings = new ArrayList<>();
|
|
|
|
|
-// accident.forEach(accidentalDriving -> {
|
|
|
|
|
-// InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving = new InsAreaCompanyAccidentalDriving();
|
|
|
|
|
-// insAreaCompanyAccidentalDriving.setCompanyId(insAreaCompany.getId());
|
|
|
|
|
-// insAreaCompanyAccidentalDriving.setQuantity(Integer.parseInt(accidentalDriving.getQuantity()));
|
|
|
|
|
-// insAreaCompanyAccidentalDriving.setRideRiskCode(accidentalDriving.getProjectCode());
|
|
|
|
|
-// insAreaCompanyAccidentalDriving.setRideRiskName(accidentalDriving.getProjectName());
|
|
|
|
|
-// insAreaCompanyAccidentalDrivings.add(insAreaCompanyAccidentalDriving);
|
|
|
|
|
-// });
|
|
|
|
|
-// insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDrivings);
|
|
|
|
|
-// // 保存交强特约信息
|
|
|
|
|
-// InsAreaCompanyRelatedInfo info = new InsAreaCompanyRelatedInfo();
|
|
|
|
|
-// info.setCompanyId(insAreaCompany.getId());
|
|
|
|
|
-// info.setJqappoint(quoteRespVo.getJqappoint());
|
|
|
|
|
-// info.setSyappoint(quoteRespVo.getSyappoint());
|
|
|
|
|
-// insAreaCompanyRelatedInfoService.save(info);
|
|
|
|
|
-// quoteRespVo.setCompanyId(insAreaCompany.getId());
|
|
|
|
|
-// return HttpResult.ok("报价成功", quoteRespVo);
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
private QuoteRespVo getQuoteRespVo(PremiumCalculationResponse premiumCalculationResponse,
|
|
private QuoteRespVo getQuoteRespVo(PremiumCalculationResponse premiumCalculationResponse,
|
|
|
BaseQuoteInfoVo yaQuoteInfoVo) {
|
|
BaseQuoteInfoVo yaQuoteInfoVo) {
|
|
|
double jqPremium = 0D;
|
|
double jqPremium = 0D;
|
|
@@ -819,110 +460,6 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
return quoteRespVo;
|
|
return quoteRespVo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// private QuoteRespVo getQuoteRespVo(InsurePremiumResponse insurePremiumResponse,
|
|
|
|
|
-// BaseQuoteInfoVo quoteInfoVo,
|
|
|
|
|
-// boolean isEnergy, BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo) {
|
|
|
|
|
-// Double jqPremium = 0D;
|
|
|
|
|
-// Double syPremium = 0D;
|
|
|
|
|
-// Double sumPayTax = 0D;
|
|
|
|
|
-// Double jyPremium = 0D;
|
|
|
|
|
-// QuoteRespVo quoteRespVo = new QuoteRespVo();
|
|
|
|
|
-// // 交强
|
|
|
|
|
-// if(Objects.nonNull(insurePremiumResponse.getCiContract())){
|
|
|
|
|
-// InsurePremiumResponse.CiContractDTO.ContractMainDTO ciContractMain = insurePremiumResponse.getCiContract().getContractMain();
|
|
|
|
|
-// jqPremium = ciContractMain.getTotalPremium();
|
|
|
|
|
-// quoteRespVo.setStartDateJq(ciContractMain.getValidDate());
|
|
|
|
|
-// quoteRespVo.setEndDateJq(ciContractMain.getExpiryDate());
|
|
|
|
|
-// //车船税
|
|
|
|
|
-// InsurePremiumResponse.CiContractDTO.TaxDTO taxDTO = insurePremiumResponse.getCiContract().getTax();
|
|
|
|
|
-// sumPayTax = taxDTO.getSumTax();
|
|
|
|
|
-// }
|
|
|
|
|
-// //商业
|
|
|
|
|
-// if(Objects.nonNull(insurePremiumResponse.getBiContract())){
|
|
|
|
|
-// InsurePremiumResponse.BiContractDTO.ContractMainDTO biContractMain = insurePremiumResponse.getBiContract().getContractMain();
|
|
|
|
|
-// syPremium = biContractMain.getTotalPremium();
|
|
|
|
|
-// String hopeDiscount = biContractMain.getHopeDiscount();
|
|
|
|
|
-// String hopeCoefficient = biContractMain.getHopeCoefficient();
|
|
|
|
|
-// String entireInitialDiscount = insurePremiumResponse.getBiContract().getDiscountInfo().getEntireInitialDiscount();
|
|
|
|
|
-// quoteRespVo.setInitialProposalDiscount(entireInitialDiscount);
|
|
|
|
|
-// quoteRespVo.setExpectedDiscount(hopeDiscount);
|
|
|
|
|
-// quoteRespVo.setPricingCoefficient(hopeCoefficient);
|
|
|
|
|
-// quoteRespVo.setStartDateSy(biContractMain.getValidDate());
|
|
|
|
|
-// quoteRespVo.setEndDateSy(biContractMain.getExpiryDate());
|
|
|
|
|
-// }
|
|
|
|
|
-// // 意外险
|
|
|
|
|
-// InsurePremiumResponse.AccContractDTO accContract = insurePremiumResponse.getAccContract();
|
|
|
|
|
-// if(Objects.nonNull(accContract)){
|
|
|
|
|
-// List<AccidentResponseVo> accidentResponseVos =
|
|
|
|
|
-// InsurePremiumResponse.AccContractDTO.toAccidentResponseVoList(accContract,quoteVo);
|
|
|
|
|
-// quoteRespVo.setAccident(accidentResponseVos);
|
|
|
|
|
-// // 驾意险价格
|
|
|
|
|
-// jyPremium = accContract.getContractMain().getTotalPremium();
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// List<QuoteKindRespVo> kindList1 = new ArrayList<>();
|
|
|
|
|
-// List<RiskInfoVo> riskList = quoteInfoVo.getRiskList();
|
|
|
|
|
-// // 报价险种放入保费
|
|
|
|
|
-// List<QuoteRiskRespVo> riskList1 = QuoteRiskRespVo.toQuoteRiskRespVoList(riskList, jqPremium, syPremium);
|
|
|
|
|
-//
|
|
|
|
|
-// QuoteKindRespVo kind;
|
|
|
|
|
-// List<InsurePremiumResponse.BiContractDTO.CoverageDTO> coverage = new ArrayList<>();
|
|
|
|
|
-// if(Objects.nonNull(insurePremiumResponse.getBiContract())){
|
|
|
|
|
-// coverage = insurePremiumResponse.getBiContract().getCoverage();
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// // 商业险险种
|
|
|
|
|
-// List<KindInfoVo> kindList = quoteInfoVo.getKindList();
|
|
|
|
|
-// if (CollUtil.isNotEmpty(coverage)){
|
|
|
|
|
-// for (KindInfoVo kindInfoVo : kindList) {
|
|
|
|
|
-// kind = new QuoteKindRespVo();
|
|
|
|
|
-// kind.setKindCode(kindInfoVo.getKindCode());
|
|
|
|
|
-// kind.setKindName(kindInfoVo.getKindName());
|
|
|
|
|
-// CtKindCodeEnum ctKindCodeEnum = Enum.valueOf(CtKindCodeEnum.class, kindInfoVo.getKindCode());
|
|
|
|
|
-// InsurePremiumResponse.BiContractDTO.CoverageDTO coverageDTO = coverage.stream().filter(a -> a.getKindCode().equals(ctKindCodeEnum.getCode())).collect(Collectors.toList()).get(0);
|
|
|
|
|
-// kind.setAmount(coverageDTO.getAmount().doubleValue());
|
|
|
|
|
-// kind.setCoveragePremium(coverageDTO.getCoveragePremium());
|
|
|
|
|
-// kind.setUnitAmount(Objects.isNull(coverageDTO.getUnitAmount()) ? 0 : coverageDTO.getUnitAmount() );
|
|
|
|
|
-// kind.setServiceTimes(coverageDTO.getQuantity());
|
|
|
|
|
-// if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
|
|
|
|
|
-// kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
-// }
|
|
|
|
|
-// kindList1.add(kind);
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// quoteRespVo.setRiskList(riskList1);
|
|
|
|
|
-// quoteRespVo.setKindList(kindList1);
|
|
|
|
|
-// quoteRespVo.setJqPremium(jqPremium);
|
|
|
|
|
-// quoteRespVo.setSyPremium(syPremium);
|
|
|
|
|
-// quoteRespVo.setTaxAmount(sumPayTax);
|
|
|
|
|
-// quoteRespVo.setJyPremium(jyPremium);
|
|
|
|
|
-// quoteRespVo.setCiSumPermium(CalculateUtils.add(jqPremium, sumPayTax));//交强险和车船税合计
|
|
|
|
|
-// quoteRespVo.setSumPermium(CalculateUtils.add(jqPremium, syPremium, sumPayTax, jyPremium));//保费合计
|
|
|
|
|
-// quoteRespVo.setTotalAdjustRate(0);
|
|
|
|
|
-// quoteRespVo.setOrderno(quoteInfoVo.getOrderNo()); //订单号
|
|
|
|
|
-// // 交强特约
|
|
|
|
|
-// if(Objects.nonNull(insurePremiumResponse.getCiContract())){
|
|
|
|
|
-// List<InsurePremiumResponse.CiContractDTO.EngageDTO> ciEngageDTOS = insurePremiumResponse.getCiContract().getEngage();
|
|
|
|
|
-// if(CollUtil.isNotEmpty(ciEngageDTOS)){
|
|
|
|
|
-// quoteRespVo.setJqappoint(JSON.toJSONString(ciEngageDTOS));
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// // 商业特约
|
|
|
|
|
-// if(Objects.nonNull(insurePremiumResponse.getBiContract())){
|
|
|
|
|
-// List<InsurePremiumResponse.BiContractDTO.EngageDTO> biEngageDTOS = insurePremiumResponse.getBiContract().getEngage();
|
|
|
|
|
-// if(CollUtil.isNotEmpty(biEngageDTOS)){
|
|
|
|
|
-// quoteRespVo.setSyappoint(JSON.toJSONString(biEngageDTOS));
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// // 评分
|
|
|
|
|
-// if(insurePremiumResponse.getYztScore() != null) {
|
|
|
|
|
-// quoteRespVo.setILogPreUdwMess(insurePremiumResponse.getYztScore().getCentile() + "");
|
|
|
|
|
-// }
|
|
|
|
|
-// return quoteRespVo;
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
public HttpResult<Object> submitImages(String companyId) {
|
|
public HttpResult<Object> submitImages(String companyId) {
|
|
|
try {
|
|
try {
|
|
|
InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
|
|
InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
|