Commit 783ef484 authored by 李灿灿's avatar 李灿灿

【商险-投保办理】派单后修改计费方式或费率,办理成功时未按修改前的配置计算预估保费

parent 6fd716bf
...@@ -75,6 +75,18 @@ public class TInsuranceDetail extends BaseEntity { ...@@ -75,6 +75,18 @@ public class TInsuranceDetail extends BaseEntity {
@Schema(description = "购买标准") @Schema(description = "购买标准")
private String buyStandard; private String buyStandard;
/**
* 费率
*/
@Schema(description = "费率")
private BigDecimal rate;
/**
* 计费方式
*/
@Schema(description = "计费方式(0:按天,1:按月)")
private Integer billingType;
/** /**
* 医疗额度 * 医疗额度
*/ */
......
...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; ...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
/** /**
* @author licancan * @author licancan
...@@ -134,6 +135,18 @@ public class InsuranceAddParam implements Serializable { ...@@ -134,6 +135,18 @@ public class InsuranceAddParam implements Serializable {
@JsonIgnore @JsonIgnore
private Long insuranceTypeId; private Long insuranceTypeId;
/**
* 费率
*/
@JsonIgnore
private BigDecimal rate;
/**
* 计费方式
*/
@JsonIgnore
private Integer billingType;
/** /**
* 商险购买地省code * 商险购买地省code
*/ */
......
...@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema; ...@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
/** /**
...@@ -130,6 +131,18 @@ public class InsuranceBatchParam implements Serializable { ...@@ -130,6 +131,18 @@ public class InsuranceBatchParam implements Serializable {
@JsonIgnore @JsonIgnore
private Long insuranceTypeId; private Long insuranceTypeId;
/**
* 费率
*/
@JsonIgnore
private BigDecimal rate;
/**
* 计费方式
*/
@JsonIgnore
private Integer billingType;
/** /**
* 商险购买地省code * 商险购买地省code
*/ */
......
...@@ -420,6 +420,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -420,6 +420,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (!Optional.ofNullable(insuranceCompany).isPresent()){ if (!Optional.ofNullable(insuranceCompany).isPresent()){
return R.failed(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST); return R.failed(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
}else { }else {
//冗余保险公司计费方式
byId.setBillingType(Integer.valueOf(insuranceCompany.getBillingType()));
TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda() TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda()
.eq(TInsuranceType::getName, param.getInsuranceTypeName()) .eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId()) .eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
...@@ -428,6 +431,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -428,6 +431,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (!Optional.ofNullable(insuranceType).isPresent()){ if (!Optional.ofNullable(insuranceType).isPresent()){
return R.failed(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST); return R.failed(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
}else { }else {
//购买标准
TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda() TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda()
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard()) .eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId()) .eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId())
...@@ -442,6 +446,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -442,6 +446,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setDieDisableQuota(typeStandard.getDieDisableQuota()); param.setDieDisableQuota(typeStandard.getDieDisableQuota());
param.setInsuranceTypeId(Long.parseLong(typeStandard.getInsuranceTypeId())); param.setInsuranceTypeId(Long.parseLong(typeStandard.getInsuranceTypeId()));
} }
//按月查费率
if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){
//计算起止时间的月数
long month = LocalDateUtil.betweenMonth(param.getPolicyStart(), param.getPolicyEnd());
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
.eq(TInsuranceTypeRate::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
return R.failed(InsurancesConstants.INSURANCE_TYPE_RATE_NOT_EXIST);
}else {
//冗余费率
byId.setRate(new BigDecimal(typeRate.getRate()));
}
}
} }
} }
//记录查重校验:姓名 + 身份证号 + 保险公司 + 险种 + 保单开始日期~保单结束日期区间 是唯一(剔除退回、过期状态的记录) //记录查重校验:姓名 + 身份证号 + 保险公司 + 险种 + 保单开始日期~保单结束日期区间 是唯一(剔除退回、过期状态的记录)
...@@ -717,102 +739,69 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -717,102 +739,69 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据结算类型判断是否需要计算预估保费 //根据结算类型判断是否需要计算预估保费
//预估 //预估
if (detail.getSettleType() == CommonConstants.ZERO_INT){ if (detail.getSettleType() == CommonConstants.ZERO_INT){
//根据险种获取费率,没费率返回错误 if (CommonConstants.ONE_INT == detail.getBillingType()){
TInsuranceType insuranceType = tInsuranceTypeService.getById(detail.getInsuranceTypeId()); // 按月查费率
//险种存不存在 // 预估保费 = 费率 * 购买标准
if (!Optional.ofNullable(insuranceType).isPresent()){ BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).multiply(detail.getRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
InsuranceListVO listVO = new InsuranceListVO(); detail.setEstimatePremium(estimatePremium);
BeanCopyUtils.copyProperties(detail,listVO); if (detail.getBuyType() == CommonConstants.THREE_INT){
listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST); detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
errorList.add(listVO); }
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
detail.setIsUse(CommonConstants.ZERO_INT);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}else { }else {
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getById(insuranceType.getInsuranceCompanyId()); //按天
//保险公司存不存在 //计算起止时间的天数
if (!Optional.ofNullable(insuranceCompany).isPresent()){ long day = LocalDateUtil.betweenDay(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
InsuranceListVO listVO = new InsuranceListVO(); //预估保费 = (购买标准 / 365) * 天数
BeanCopyUtils.copyProperties(detail,listVO); BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).divide(new BigDecimal("365"),CommonConstants.TWO_INT,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(day)).setScale(CommonConstants.TWO_INT,BigDecimal.ROUND_HALF_UP);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST); detail.setEstimatePremium(estimatePremium);
errorList.add(listVO); if (detail.getBuyType() == CommonConstants.THREE_INT){
}else { detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){
//按月查费率
//计算起止时间的月数
long month = LocalDateUtil.betweenMonth(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
.eq(TInsuranceTypeRate::getInsuranceTypeId, detail.getInsuranceTypeId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_RATE_NOT_EXIST);
errorList.add(listVO);
}else {
// 预估保费 = 费率 * 购买标准
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).multiply(new BigDecimal(typeRate.getRate())).setScale(2,BigDecimal.ROUND_HALF_UP);
detail.setEstimatePremium(estimatePremium);
if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
detail.setIsUse(CommonConstants.ZERO_INT);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}
}else {
//按天
//计算起止时间的天数
long day = LocalDateUtil.betweenDay(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
//预估保费 = (购买标准 / 365) * 天数
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).divide(new BigDecimal("365"),CommonConstants.TWO_INT,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(day)).setScale(CommonConstants.TWO_INT,BigDecimal.ROUND_HALF_UP);
detail.setEstimatePremium(estimatePremium);
if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
detail.setIsUse(CommonConstants.ZERO_INT);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}
} }
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
detail.setIsUse(CommonConstants.ZERO_INT);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
} }
} }
//实缴 //实缴
...@@ -1150,6 +1139,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1150,6 +1139,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
}else { }else {
//冗余保险公司计费方式
param.setBillingType(Integer.valueOf(insuranceCompany.getBillingType()));
TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda() TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda()
.eq(TInsuranceType::getName, param.getInsuranceTypeName()) .eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId()) .eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
...@@ -1160,6 +1152,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1160,6 +1152,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
}else { }else {
//购买标准
TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda() TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda()
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard()) .eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId()) .eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId())
...@@ -1176,6 +1169,26 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1176,6 +1169,26 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setDieDisableQuota(typeStandard.getDieDisableQuota()); param.setDieDisableQuota(typeStandard.getDieDisableQuota());
param.setInsuranceTypeId(Long.parseLong(typeStandard.getInsuranceTypeId())); param.setInsuranceTypeId(Long.parseLong(typeStandard.getInsuranceTypeId()));
} }
//按月查费率
if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){
//计算起止时间的月数
long month = LocalDateUtil.betweenMonth(param.getPolicyStart(), param.getPolicyEnd());
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
.eq(TInsuranceTypeRate::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_RATE_NOT_EXIST);
listResult.add(param);
continue;
}else {
//冗余费率
param.setRate(new BigDecimal(typeRate.getRate()));
}
}
} }
} }
...@@ -1439,6 +1452,32 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1439,6 +1452,32 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setInsuranceHandleCity(Integer.parseInt(redisHandleCityName)); param.setInsuranceHandleCity(Integer.parseInt(redisHandleCityName));
} }
//保单开始日期、结束日期,由系统根据保单号关联查询投保状态为 "已投保" 的商险记录的任意一条
TInsuranceDetail limitOne = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getBuyHandleStatus, CommonConstants.THREE_INT)
//有效
.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsEffect,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsEffect)
)
//未过期
.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(limitOne).isPresent()){
param.setErrorMessage(InsurancesConstants.POLICY_NO_EXIST);
listResult.add(param);
continue;
}else {
param.setPolicyStart(limitOne.getPolicyStart());
param.setPolicyEnd(limitOne.getPolicyEnd());
}
// 保险公司-险种-购买标准 是否存在 // 保险公司-险种-购买标准 是否存在
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda() TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda()
.eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName()) .eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName())
...@@ -1449,6 +1488,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1449,6 +1488,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
}else { }else {
//冗余保险公司计费方式
param.setBillingType(Integer.valueOf(insuranceCompany.getBillingType()));
TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda() TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda()
.eq(TInsuranceType::getName, param.getInsuranceTypeName()) .eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId()) .eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
...@@ -1459,6 +1501,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1459,6 +1501,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
}else { }else {
//购买标准
TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda() TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda()
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard()) .eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId()) .eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId())
...@@ -1475,9 +1518,41 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1475,9 +1518,41 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setDieDisableQuota(typeStandard.getDieDisableQuota()); param.setDieDisableQuota(typeStandard.getDieDisableQuota());
param.setInsuranceTypeId(Long.parseLong(typeStandard.getInsuranceTypeId())); param.setInsuranceTypeId(Long.parseLong(typeStandard.getInsuranceTypeId()));
} }
//按月查费率
if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){
//计算起止时间的月数
long month = LocalDateUtil.betweenMonth(param.getPolicyStart().toString(), param.getPolicyEnd().toString());
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
.eq(TInsuranceTypeRate::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_RATE_NOT_EXIST);
listResult.add(param);
continue;
}else {
//冗余费率
param.setRate(new BigDecimal(typeRate.getRate()));
}
}
} }
} }
if(!limitOne.getInsuranceCompanyName().equals(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_COMPANY_NAME_NOT_SAME);
listResult.add(param);
continue;
}
if (!limitOne.getInsuranceTypeName().equals(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_TYPE_NAME_NOT_SAME);
listResult.add(param);
continue;
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示) // 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
if(!LocalDateUtil.isDate(param.getSettleMonth(),LocalDateUtil.NORM_MONTH_PATTERN)){ if(!LocalDateUtil.isDate(param.getSettleMonth(),LocalDateUtil.NORM_MONTH_PATTERN)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_PARSE_ERROR); param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_PARSE_ERROR);
...@@ -1519,41 +1594,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1519,41 +1594,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
//保单开始日期、结束日期,由系统根据保单号关联查询投保状态为 "已投保" 的商险记录的任意一条
TInsuranceDetail limitOne = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getBuyHandleStatus, CommonConstants.THREE_INT)
//有效
.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsEffect,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsEffect)
)
//未过期
.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(limitOne).isPresent()){
param.setErrorMessage(InsurancesConstants.POLICY_NO_EXIST);
listResult.add(param);
continue;
}else {
if(!limitOne.getInsuranceCompanyName().equals(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_COMPANY_NAME_NOT_SAME);
listResult.add(param);
continue;
}else if (!limitOne.getInsuranceTypeName().equals(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_TYPE_NAME_NOT_SAME);
listResult.add(param);
continue;
}else {
param.setPolicyStart(limitOne.getPolicyStart());
param.setPolicyEnd(limitOne.getPolicyEnd());
}
}
listSuccess.add(param); listSuccess.add(param);
} }
map.put("listResult",listResult); map.put("listResult",listResult);
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
<result property="insuranceTypeName" column="INSURANCE_TYPE_NAME" jdbcType="VARCHAR"/> <result property="insuranceTypeName" column="INSURANCE_TYPE_NAME" jdbcType="VARCHAR"/>
<result property="insuranceTypeId" column="INSURANCE_TYPE_ID" jdbcType="BIGINT"/> <result property="insuranceTypeId" column="INSURANCE_TYPE_ID" jdbcType="BIGINT"/>
<result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/> <result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/>
<result property="rate" column="RATE" jdbcType="DECIMAL"/>
<result property="billingType" column="BILLING_TYPE" jdbcType="TINYINT"/>
<result property="medicalQuota" column="MEDICAL_QUOTA" jdbcType="VARCHAR"/> <result property="medicalQuota" column="MEDICAL_QUOTA" jdbcType="VARCHAR"/>
<result property="dieDisableQuota" column="DIE_DISABLE_QUOTA" jdbcType="VARCHAR"/> <result property="dieDisableQuota" column="DIE_DISABLE_QUOTA" jdbcType="VARCHAR"/>
<result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/> <result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/>
...@@ -54,7 +56,7 @@ ...@@ -54,7 +56,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
ID,EMP_NAME, ID,EMP_NAME,
EMP_IDCARD_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME, EMP_IDCARD_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
INSURANCE_TYPE_ID,BUY_STANDARD,MEDICAL_QUOTA,DIE_DISABLE_QUOTA,POLICY_NO, INSURANCE_TYPE_ID,BUY_STANDARD,RATE,BILLING_TYPE,MEDICAL_QUOTA,DIE_DISABLE_QUOTA,POLICY_NO,
POLICY_START,POLICY_END,POLICY_EFFECT, POLICY_START,POLICY_END,POLICY_EFFECT,
BATCH_DATE,SETTLE_MONTH,INVOICE_NO, BATCH_DATE,SETTLE_MONTH,INVOICE_NO,
BUY_TYPE,INSURANCE_PROVINCE,INSURANCE_PROVINCE_NAME,INSURANCE_CITY,INSURANCE_CITY_NAME, BUY_TYPE,INSURANCE_PROVINCE,INSURANCE_PROVINCE_NAME,INSURANCE_CITY,INSURANCE_CITY_NAME,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment