|
|
@@ -21,11 +21,9 @@ import com.ydtech.modules.esm.model.EsmInsAttachInsure;
|
|
|
import com.ydtech.modules.esm.model.EsmInsAttachInsureDetails;
|
|
|
import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
|
-import com.ydtech.modules.ins.dao.InsAlltrustRegionMapper;
|
|
|
import com.ydtech.modules.ins.model.guoren.*;
|
|
|
import com.ydtech.modules.ins.model.vo.*;
|
|
|
import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
|
|
|
-import com.ydtech.modules.ins.service.InsApiLogService;
|
|
|
import com.ydtech.modules.order.components.ConfigureParametersComponents;
|
|
|
import com.ydtech.modules.order.components.InsOrdersComponents;
|
|
|
import com.ydtech.modules.order.components.gouren.GuorenRequestApiComponent;
|
|
|
@@ -33,6 +31,8 @@ import com.ydtech.modules.order.dao.InsTaskImagesMapper;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
import com.ydtech.modules.order.entity.api.guoren.constants.PlatformInterfaceCode;
|
|
|
+import com.ydtech.modules.order.entity.api.guoren.request.SignatureRequest;
|
|
|
+import com.ydtech.modules.order.entity.api.guoren.response.SignatureResponse;
|
|
|
import com.ydtech.modules.order.entity.dto.InsUploadImagesDto;
|
|
|
import com.ydtech.modules.order.entity.vo.*;
|
|
|
import com.ydtech.modules.order.service.GuorenOrderApiService;
|
|
|
@@ -48,7 +48,6 @@ import org.apache.commons.httpclient.methods.multipart.StringPart;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
@@ -167,27 +166,33 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
|
|
|
VinQueryResp.DataDTO vinQ = vinQuery(vinQueryReq, channelInfo);
|
|
|
if (null == vinQ) return HttpResult.error("未找到匹配的车辆信息");
|
|
|
- log.debug("vin码查询通过---");
|
|
|
|
|
|
// 2、车价查询
|
|
|
CarPriceResp.DataDTO carPriceResult = carPriceQuery(yaQuoteInfoVo, vinQ, channelInfo);
|
|
|
if (null == carPriceResult) return HttpResult.error("车价获取失败");
|
|
|
- log.debug("车价查询通过");
|
|
|
|
|
|
// 3、保费计算
|
|
|
PremiumResp.DataDTO premiumResult = premiumQuery(yaQuoteInfoVo, carPriceResult, vinQ);
|
|
|
if (null == premiumResult) return HttpResult.error("保费计算失败");
|
|
|
- log.debug("保费计算通过");
|
|
|
|
|
|
- // 创建非车订单
|
|
|
- AccidentalDrivingVo accidentalDrivingVo = quoteVo.getAccidentalDrivingVo();
|
|
|
- if (ObjectUtils.isEmpty(accidentalDrivingVo)) {
|
|
|
- nonAutoInsOrder(quoteVo.getAccidentalDrivingVo(), carPriceResult.getInputvo(), channelInfo);
|
|
|
- }
|
|
|
+// // 4、 创建非车订单
|
|
|
+// AccidentalDrivingVo accidentalDrivingVo = quoteVo.getAccidentalDrivingVo();
|
|
|
+// if (!ObjectUtils.isEmpty(accidentalDrivingVo)) {
|
|
|
+// nonAutoInsOrder(yaQuoteInfoVo, quoteVo.getAccidentalDrivingVo(), carPriceResult.getInputvo(), channelInfo);
|
|
|
+// }
|
|
|
|
|
|
QuoteRespVo quoteRespVo = buildQuoteRespVo(order, premiumResult, yaQuoteInfoVo);
|
|
|
- //8 生成订单
|
|
|
+ // 5、 生成订单
|
|
|
InsAreaCompany iac = responseOrder(order, quoteRespVo, quoteVo);
|
|
|
+
|
|
|
+ // 6、 投保单保存
|
|
|
+ InsuranceSlipResp insuranceSlip = insuranceSlip(yaQuoteInfoVo, carPriceResult.getInputvo());
|
|
|
+ if (insuranceSlip.getResultCode() == 1) {
|
|
|
+ return HttpResult.error(insuranceSlip.getResultMsg());
|
|
|
+ }
|
|
|
+ iac.setJqapplyno(insuranceSlip.getData().getProposalNoDetailVo().getProposalNoCI());
|
|
|
+ iac.setSyapplyno(insuranceSlip.getData().getProposalNoDetailVo().getProposalNoBI());
|
|
|
+
|
|
|
//生成订单扩展
|
|
|
responseOrderExtend(iac, quoteRespVo, premiumResult, carPriceResult.getInputvo());
|
|
|
insAreaCompanyService.save(iac);
|
|
|
@@ -222,7 +227,7 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
//2、核保
|
|
|
SubmitAuditResp auditResp = submitAudit(iac, channelInfo);
|
|
|
|
|
|
- //核保状态 0初始值/1通过/2不通过/3 无需核保 9待核保
|
|
|
+ //核保状态 0初始值/1通过/2不通过/3 无需核保 9 待核保
|
|
|
String statusJq = auditResp.getData().get(0).getUnderWriteFlagCI();
|
|
|
String statusSy = auditResp.getData().get(0).getUnderWriteFlagBI();
|
|
|
if (StringUtils.isEmpty(statusJq) && StringUtils.isEmpty(statusSy))
|
|
|
@@ -264,30 +269,17 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
insAreaCompanyService.updateById(iac);
|
|
|
return HttpResult.error(auditResp.getData().get(0).getMessage());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
InsUtils.buildOrderStatus(order, iac);
|
|
|
-
|
|
|
-
|
|
|
- iac.setJqappoint(""); //交强特别约定
|
|
|
- iac.setSyappoint(""); //商业特别约定
|
|
|
-
|
|
|
if (iac.getOrderstatus().equals(InsOrderStatusEnum.WAIT_PAY.getCode())) {
|
|
|
-
|
|
|
//获取签名地址
|
|
|
- SignatureResp.DataDTO signature = signature(iac);
|
|
|
- if (null == signature) log.error("核保操作:获取签名链接失败");
|
|
|
- iac.setPaymentLink(signature.getElecapplyurl());
|
|
|
-
|
|
|
+ SignatureResponse signature = signature(iac);
|
|
|
+ iac.setPaymentLink(signature.getQrCode());
|
|
|
} else {
|
|
|
return HttpResult.error("核保操作失败,状态:" + InsOrderStatusEnum.matchKey(iac.getOrderstatus()).getDesc());
|
|
|
}
|
|
|
insAreaCompanyService.updateById(iac);
|
|
|
insOrdersService.updateByOrderStatus(order.getOrderno(), order.getOrderstatus());
|
|
|
-
|
|
|
-
|
|
|
log.debug("----------核保结束,订单号:{}---------", quoteOrderNo);
|
|
|
-
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
@@ -301,19 +293,15 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
//子订单
|
|
|
InsAreaCompany iac = insAreaCompanyService.getByIdIsExist(iacNo);
|
|
|
// 获取协议配置信息
|
|
|
- ChannelInfoDto channelInfo = gainChannelConfigInfo(iac.getAgreementId());
|
|
|
-
|
|
|
InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
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);
|
|
|
|
|
|
//待核保订单处理
|
|
|
if (iac.getOrderstatus().equals(InsOrderStatusEnum.WAIT_AUDIT.getCode())) {
|
|
|
-
|
|
|
//单交
|
|
|
boolean jqBoo = null != jqDataDTO && null == syDataDTO && jqDataDTO.getUnderwriteFlag().equals("1");
|
|
|
//单商
|
|
|
@@ -324,10 +312,13 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
if (jqBoo || syBoo || jqSyBoo) {
|
|
|
iac.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
//更新支付链接
|
|
|
- PayResp.DataDTO payResp = getPaid(iac, channelInfo);
|
|
|
- iac.setPaymentLink(payResp.getPayUrl());
|
|
|
- insAreaCompanyService.updateById(iac);
|
|
|
+ SignatureResponse signature = signature(iac);
|
|
|
+ iac.setPaymentLink(signature.getQrCode());
|
|
|
+
|
|
|
+ insAreaCompanyService.updateCompanyAndOrders(iac);
|
|
|
return HttpResult.ok();
|
|
|
+ } else {
|
|
|
+ return HttpResult.ok("核保状态未更新");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -341,12 +332,17 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
iac.setSypolicyno(syDataDTO.getPolicyNo());
|
|
|
updateFlag = true;
|
|
|
}
|
|
|
+
|
|
|
+ // 支付
|
|
|
if (updateFlag) {
|
|
|
iac.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
order.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
- insAreaCompanyService.updateById(iac);
|
|
|
- insOrdersService.updateById(order);
|
|
|
+ insAreaCompanyService.updateCompanyAndOrders(iac);
|
|
|
+ return HttpResult.error("订单已支付,订单状态修改完成");
|
|
|
+ } else {
|
|
|
+ return HttpResult.error("订单还未支付哦");
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -380,24 +376,11 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
*/
|
|
|
@Override
|
|
|
public HttpResult uploadImageApi(String companyId) {
|
|
|
-
|
|
|
InsAreaCompany iac = insAreaCompanyService.getByIdIsExist(companyId);
|
|
|
// 获取协议配置信息
|
|
|
ChannelInfoDto channelInfo = gainChannelConfigInfo(iac.getAgreementId());
|
|
|
- InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
- BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(order.getOrderno());
|
|
|
- /**
|
|
|
- * 4、投保单保存
|
|
|
- */
|
|
|
- InsuranceSlipResp insuranceSlip = insuranceSlip(yaQuoteInfoVo, iac.getInsOrderNo());
|
|
|
- if (insuranceSlip.getResultCode() == 1) {
|
|
|
- return HttpResult.error(insuranceSlip.getResultMsg());
|
|
|
- }
|
|
|
- iac.setJqapplyno(insuranceSlip.getData().getProposalNoDetailVo().getProposalNoCI());
|
|
|
- iac.setSyapplyno(insuranceSlip.getData().getProposalNoDetailVo().getProposalNoBI());
|
|
|
//影像上传
|
|
|
imageUpdate(iac, channelInfo);
|
|
|
- insAreaCompanyService.updateById(iac);
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
@@ -415,7 +398,6 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
formMap.put("fileGroup", "DZ");
|
|
|
|
|
|
List<InsUploadImagesDto> insUploadImagesDtos = insTaskImagesMapper.getByOrderNoInsUploadImagesDtoList(iac.getOrderno());
|
|
|
-
|
|
|
insUploadImagesDtos.forEach(a -> {
|
|
|
try {
|
|
|
FilePart file1 = new FilePart("file", new File(a.getFilePath()));
|
|
|
@@ -460,15 +442,14 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 签名链接
|
|
|
+ * 32 通过二维码扫描获取电子投保单签名
|
|
|
*/
|
|
|
- public SignatureResp.DataDTO signature(InsAreaCompany iac) {
|
|
|
+ public SignatureResponse signature(InsAreaCompany insAreaCompany) {
|
|
|
//构造请求参数
|
|
|
- Map<String, String> req = new HashMap<>();
|
|
|
- req.put("proposalNo", StringUtils.isEmpty(iac.getJqapplyno()) ? iac.getSyapplyno() : iac.getJqapplyno());
|
|
|
- SignatureResp resp = guorenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00046, SignatureResp.class);
|
|
|
- return resp.getData();
|
|
|
-
|
|
|
+ SignatureRequest signatureRequest = new SignatureRequest();
|
|
|
+ signatureRequest.setProposalNoCI(insAreaCompany.getJqapplyno());
|
|
|
+ signatureRequest.setProposalNoCI(insAreaCompany.getSyapplyno());
|
|
|
+ return guorenRequestApiComponent.request(signatureRequest, PlatformInterfaceCode.API_IIIRBT00055, SignatureResponse.class);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -500,7 +481,7 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
//交强险标志
|
|
|
String ciFlag = properties.getPolicyFlagUrl() + policyResp.getData();
|
|
|
//交强险电子保单
|
|
|
- String ciPolicy =properties.getPolicyUrl() + policyResp.getData();
|
|
|
+ String ciPolicy = properties.getPolicyUrl() + policyResp.getData();
|
|
|
String jqFlagUrl = gainCarInsPolicy(ciFlag, "1", order.getLicenseno());
|
|
|
String jqUrl = gainCarInsPolicy(ciPolicy, "2", order.getLicenseno());
|
|
|
m.put("jqFlagUrl", jqFlagUrl);
|
|
|
@@ -564,14 +545,12 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
|
|
|
//删除已经存在的数据
|
|
|
if (CollUtil.isNotEmpty(eiaiList)) {
|
|
|
-
|
|
|
List<String> ids = new ArrayList<>();
|
|
|
eiaiList.forEach(i -> ids.add(i.getId()));
|
|
|
LambdaQueryWrapper<EsmInsAttachInsureDetails> lqwDetails = new LambdaQueryWrapper<>();
|
|
|
lqwDetails.in(EsmInsAttachInsureDetails::getAttachInsureId, ids);
|
|
|
//详情删除
|
|
|
esmInsAttachInsureDetailsMapper.delete(lqwDetails);
|
|
|
-
|
|
|
esmInsAttachInsureMapper.deleteBatchIds(ids);
|
|
|
}
|
|
|
|
|
|
@@ -678,8 +657,6 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
insAreaCompany.setSyStartDate(quoteRespVo.getStartDateSy());
|
|
|
insAreaCompany.setSyEndDate(quoteRespVo.getEndDateSy());
|
|
|
return insAreaCompany;
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -689,7 +666,6 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
* @date: 2023-10-18
|
|
|
*/
|
|
|
private void responseOrderExtend(InsAreaCompany iac, QuoteRespVo quoteRespVo, PremiumResp.DataDTO premiumResult, String carPriceUuid) {
|
|
|
-
|
|
|
//交强保费 含税
|
|
|
BigDecimal jqPremium = BigDecimal.valueOf(StringUtils.toDouble(premiumResult.getSumPremiumCI()));
|
|
|
//商业保费 含税
|
|
|
@@ -701,20 +677,17 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
iac.setJqpremium(jqPremium);
|
|
|
iac.setSypremium(syPremium);
|
|
|
iac.setTaxamount(BigDecimal.valueOf(jq_falg ? quoteRespVo.getTaxAmount() : 0));
|
|
|
-// iac.setScore(StringUtils.toString(premiumResult.getBirate().getBillcomeGroup()));
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
sb.append("出险信息,交强险:");
|
|
|
if (CollUtil.isNotEmpty(premiumResult.getCiInsureDemandPay())) {
|
|
|
sb.append(premiumResult.getCiInsureDemandPay().size());
|
|
|
} else {
|
|
|
sb.append("0");
|
|
|
-
|
|
|
}
|
|
|
//商业险出险次数
|
|
|
iac.setAccidentStrInfo(sb.toString());
|
|
|
- //@TODO 临时用保险公司订单号存放 投保单查询需要
|
|
|
+ //@TODO 临时用保险公司订单号存放 投保单查询需要
|
|
|
iac.setInsOrderNo(carPriceUuid);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public static double add(double v1, double v2) {
|
|
|
@@ -752,7 +725,6 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
BigDecimal taxPremiumBig = BigDecimal.valueOf(StringUtils.toDouble(rd.getSumPayTax()));
|
|
|
//保费合计
|
|
|
BigDecimal sumPermium = jqPremiumBig.add(syPremiumBig).add(taxPremiumBig);
|
|
|
-
|
|
|
List<QuoteKindRespVo> kindRespVoList = new ArrayList<>();
|
|
|
|
|
|
QuoteRespVo quoteRespVo = new QuoteRespVo();
|
|
|
@@ -761,7 +733,6 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
quoteRespVo.setStartDateSy(rd.getBiStartDate());
|
|
|
quoteRespVo.setEndDateSy(rd.getBiEndDate());
|
|
|
|
|
|
-
|
|
|
rd.getItemVOList().forEach(a -> {
|
|
|
//交强:0507,商业:0518
|
|
|
if (a.getRiskCode().equals("0507")) {
|
|
|
@@ -906,7 +877,6 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
throw new SystemException(resp.getResultMsg() == null ? "未找到车辆信息" : resp.getResultMsg());
|
|
|
}
|
|
|
return resp.getData().get(0);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -955,16 +925,11 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
confirmCarMuch = vehicleInfoList.get(0);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return carPriceQueryMuch(respMuch.getData().getInputvo(), confirmCarMuch, yaQuoteInfoVo.getCarInfo().getLicenseNo());
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
return null;
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1110,8 +1075,7 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
* @author: lig
|
|
|
* @date: 2023-09-28
|
|
|
*/
|
|
|
- public SubmitAuditResp nonAutoInsOrder(AccidentalDrivingVo accidentalDrivingVo, String carPriceUuid, ChannelInfoDto channelInfo) {
|
|
|
- BaseQuoteInfoVo yaQuoteInfoVo = new BaseQuoteInfoVo();
|
|
|
+ public SubmitAuditResp nonAutoInsOrder(BaseQuoteInfoVo yaQuoteInfoVo, AccidentalDrivingVo accidentalDrivingVo, String carPriceUuid, ChannelInfoDto channelInfo) {
|
|
|
VinQueryResp.DataDTO vinQ = new VinQueryResp.DataDTO();
|
|
|
//构造请求参数
|
|
|
NonAutoInsOrderReq req = NonAutoInsOrderReq.buildParam(yaQuoteInfoVo, vinQ, accidentalDrivingVo, channelInfo, carPriceUuid);
|
|
|
@@ -1147,35 +1111,27 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
|
|
|
|
|
|
req.getCi().getPrpTmain().setStartHour(StringUtils.toString(start.getHour()));
|
|
|
req.getCi().getPrpTmain().setEndHour(StringUtils.toString(start.getHour()));
|
|
|
-
|
|
|
req.getCi().getPrpTmain().setImmeValidStartDate(newStartDate);
|
|
|
req.getCi().getPrpTmain().setImmeValidEndDate(newStartDate);
|
|
|
req.getCi().getPrpTmain().setImmeValiFlag("1");
|
|
|
|
|
|
-// req.getCi().getPrpTmain()
|
|
|
-
|
|
|
} else {
|
|
|
LocalDateTime end = start.plusYears(1L).minusDays(1L);
|
|
|
newStartDate = DateTimeUtil.getStartTimeOfDayStr(start, DateTimeUtil.DATETIME_PATTERN);
|
|
|
newEndDate = DateTimeUtil.getEndTimeOfDayStr(end, DateTimeUtil.DATETIME_PATTERN);
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
req.getCi().getPrpTmain().setStartDate(newStartDate);
|
|
|
req.getCi().getPrpTmain().setEndDate(newEndDate);
|
|
|
-
|
|
|
req.getCi().getPrptitemkindList().get(0).setStartDate(newStartDate);
|
|
|
req.getCi().getPrptitemkindList().get(0).setEndDate(newEndDate);
|
|
|
|
|
|
-
|
|
|
System.err.println("国任新起:" + newStartDate);
|
|
|
System.err.println("国任新止:" + newEndDate);
|
|
|
|
|
|
-
|
|
|
return true;
|
|
|
|
|
|
-
|
|
|
}
|
|
|
return false;
|
|
|
|