|
|
@@ -481,19 +481,44 @@ public class InsuranceServiceImpl implements InsuranceService {
|
|
|
insuranceDO.setId(id);
|
|
|
CommonResult commonResult = insuranceUtil.sendInsuranceApply(insuranceApplyReqDTO);
|
|
|
if (!commonResult.isSuccess()) {
|
|
|
- log.error("投保失败:{}", commonResult.getMsg());
|
|
|
InsuranceDO insuranceDO1 = insuranceMapper.selectByVisitorId(id);
|
|
|
- if(insuranceDO1 != null) {
|
|
|
- insuranceDO1.setInsuranceStatus(InsuranceStatusEnum.FAIL.getValue());
|
|
|
- insuranceDO1.setResMsg(commonResult.getMsg());
|
|
|
- insuranceMapper.updateById(insuranceDO1);
|
|
|
- }else {
|
|
|
- insuranceDO.setInsuranceStatus(InsuranceStatusEnum.FAIL.getValue());
|
|
|
- insuranceDO.setResMsg(commonResult.getMsg());
|
|
|
- insuranceMapper.insert(insuranceDO);
|
|
|
+ String msg = commonResult.getMsg();
|
|
|
+ log.error("投保失败:{}", msg);
|
|
|
+ if (msg.contains("重复投保")) {
|
|
|
+ String insuranceId1 = msg.substring(msg.indexOf("此前已有投保单")+7, msg.indexOf("投保成功")).trim();
|
|
|
+ String policyNo = msg.substring(msg.indexOf("对应的保单号是")+7, msg.indexOf("\"}]}"));
|
|
|
+ if(insuranceDO1 != null) {
|
|
|
+ insuranceDO1.setInsuranceStatus(InsuranceStatusEnum.SUCCESS.getValue());
|
|
|
+ insuranceMapper.deleteById(insuranceDO1.getId());
|
|
|
+ insuranceDO1.setId(Long.valueOf(insuranceId1));
|
|
|
+ insuranceDO1.setPolicyNo(policyNo);
|
|
|
+ insuranceMapper.insert(insuranceDO1);
|
|
|
+ }else {
|
|
|
+ insuranceDO.setInsuranceStatus(InsuranceStatusEnum.SUCCESS.getValue());
|
|
|
+ insuranceDO.setId(Long.valueOf(insuranceId1));
|
|
|
+ insuranceDO.setPolicyNo(policyNo);
|
|
|
+ insuranceMapper.insert(insuranceDO);
|
|
|
+ }
|
|
|
+ tradeVisitorDO.setIsInsure(InsuranceStatusEnum.SUCCESS.getValue());
|
|
|
+ tradeVisitorMapper.updateById(tradeVisitorDO);
|
|
|
+ } else {
|
|
|
+ if(insuranceDO1 != null) {
|
|
|
+ insuranceDO1.setInsuranceStatus(InsuranceStatusEnum.FAIL.getValue());
|
|
|
+ insuranceDO1.setResMsg(msg);
|
|
|
+ insuranceMapper.updateById(insuranceDO1);
|
|
|
+ }else {
|
|
|
+ insuranceDO.setInsuranceStatus(InsuranceStatusEnum.FAIL.getValue());
|
|
|
+ insuranceDO.setResMsg(msg);
|
|
|
+ insuranceMapper.insert(insuranceDO);
|
|
|
+ }
|
|
|
+ tradeVisitorDO.setIsInsure(InsuranceStatusEnum.FAIL.getValue());
|
|
|
+ tradeVisitorDO.setInsureMsg(msg);
|
|
|
+ tradeVisitorMapper.updateById(tradeVisitorDO);
|
|
|
}
|
|
|
- throw exception0(commonResult.getCode(), commonResult.getMsg());
|
|
|
+ throw exception0(commonResult.getCode(), msg);
|
|
|
}
|
|
|
+ tradeVisitorDO.setIsInsure(InsuranceStatusEnum.INSURE.getValue());
|
|
|
+ tradeVisitorMapper.updateById(tradeVisitorDO);
|
|
|
//保存投保信息
|
|
|
insuranceMapper.deleteByVisitorId(id);
|
|
|
insuranceDO.setResMsg(String.valueOf(commonResult.getCheckedData()));
|
|
|
@@ -511,7 +536,7 @@ public class InsuranceServiceImpl implements InsuranceService {
|
|
|
@Override
|
|
|
public void queryInsuranceByOrderId(Long id) {
|
|
|
InsuranceDO insuranceDO = insuranceMapper.selectById(id);
|
|
|
- CommonResult commonResult = insuranceUtil.queryInsuranceNew(insuranceDO.getInsuranceNo(),insuranceDO.getOrderId());
|
|
|
+ CommonResult commonResult = insuranceUtil.queryInsurance(id.toString());
|
|
|
if (!commonResult.isSuccess()) {
|
|
|
throw exception0(commonResult.getCode(), commonResult.getMsg());
|
|
|
}
|
|
|
@@ -551,7 +576,7 @@ public class InsuranceServiceImpl implements InsuranceService {
|
|
|
|
|
|
@Override
|
|
|
public void queryInsuranceQuey() {
|
|
|
- List<InsuranceDO> list = insuranceMapper.selectList(new LambdaQueryWrapper<InsuranceDO>().eq(InsuranceDO::getInsuranceStatus, 0).ge(InsuranceDO::getCreateTime, DateUtil.yesterday()));
|
|
|
+ List<InsuranceDO> list = insuranceMapper.selectList(new LambdaQueryWrapper<InsuranceDO>().ne(InsuranceDO::getInsuranceStatus, 1));
|
|
|
for (InsuranceDO insuranceDO : list) {
|
|
|
// CommonResult commonResult = insuranceUtil.queryInsuranceNew(insuranceDO.getInsuranceNo(), insuranceDO.getOrderId());
|
|
|
CommonResult commonResult = insuranceUtil.queryInsurance(insuranceDO.getId().toString());
|