Commit f21a1fb3 authored by 李灿灿's avatar 李灿灿

商险明细,新增是否标记投保成功标识

parent 1e5ca149
...@@ -125,9 +125,9 @@ public class InsurancesConstants { ...@@ -125,9 +125,9 @@ public class InsurancesConstants {
*/ */
public static final String REDUCE_REPLACE_IS_NOT_ALLOW = "当前记录在减员流程中,无法替换"; public static final String REDUCE_REPLACE_IS_NOT_ALLOW = "当前记录在减员流程中,无法替换";
/** /**
* 已减员,无法退回 * 投保状态不是投保中或已投保,无法退回
*/ */
public static final String REDUCE_ROLLBACK_IS_NOT_ALLOW = "已减员,无法退回"; public static final String REDUCE_ROLLBACK_IS_NOT_ALLOW = "投保状态不是投保中或已投保,无法退回";
/** /**
* 员工姓名不能为空 * 员工姓名不能为空
*/ */
...@@ -320,6 +320,10 @@ public class InsurancesConstants { ...@@ -320,6 +320,10 @@ public class InsurancesConstants {
* 商险投保中,无法登记保单保费 * 商险投保中,无法登记保单保费
*/ */
public static final String BUY_HANDLE_TWO_NOT_REGISTERED = "商险投保中,无法登记保单保费"; public static final String BUY_HANDLE_TWO_NOT_REGISTERED = "商险投保中,无法登记保单保费";
/**
* 非投保中状态,无法标记投保成功
*/
public static final String INSURANCE_BUY_STATUS_NOT_TWO = "非投保中状态,无法标记投保成功";
/** /**
* 商险投保退回,无法登记保单保费 * 商险投保退回,无法登记保单保费
*/ */
......
...@@ -203,6 +203,12 @@ public class TInsuranceDetail extends BaseEntity { ...@@ -203,6 +203,12 @@ public class TInsuranceDetail extends BaseEntity {
@Schema(description = "预估保费") @Schema(description = "预估保费")
private BigDecimal estimatePremium; private BigDecimal estimatePremium;
/**
* 是否标记投保成功标识 0 未标记过 1标记过
*/
@Schema(description = "是否标记投保成功标识 0 未标记过 1标记过")
private Integer signFlag;
/** /**
* 投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员 * 投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
*/ */
......
...@@ -560,7 +560,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -560,7 +560,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceDetail> successList = new ArrayList<>(); List<TInsuranceDetail> successList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(detailList)){ if (CollectionUtils.isNotEmpty(detailList)){
for (TInsuranceDetail detail : detailList) { for (TInsuranceDetail detail : detailList) {
if (detail.getBuyHandleStatus() == CommonConstants.FIVE_INT){ if (detail.getBuyHandleStatus() != CommonConstants.TWO_INT
&& detail.getBuyHandleStatus() != CommonConstants.THREE_INT){
InsuranceListVO listVO = new InsuranceListVO(); InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO); BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.REDUCE_ROLLBACK_IS_NOT_ALLOW); listVO.setErrorMessage(InsurancesConstants.REDUCE_ROLLBACK_IS_NOT_ALLOW);
...@@ -577,6 +578,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -577,6 +578,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isNotEmpty(successList)){ if (CollectionUtils.isNotEmpty(successList)){
//更新状态 //更新状态
this.saveOrUpdateBatch(successList); this.saveOrUpdateBatch(successList);
//todo 判断是否推送过保费到ekp,如果推送过就新增一条负的,将结算表中的数据求和放到明细表中
} }
//根据项目编码获取项目名称 //根据项目编码获取项目名称
setProjectNameByDeptNo(errorList); setProjectNameByDeptNo(errorList);
...@@ -608,50 +611,88 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -608,50 +611,88 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceDetail> successList = new ArrayList<>(); List<TInsuranceDetail> successList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(detailList)){ if (CollectionUtils.isNotEmpty(detailList)){
for (TInsuranceDetail detail : detailList) { for (TInsuranceDetail detail : detailList) {
//根据结算类型判断是否需要计算预估保费 //先判断投保状态是不是投保中,如果不是不给标记办理成功,防止重复推数据
//预估 if(detail.getBuyHandleStatus() != CommonConstants.TWO_INT){
if (detail.getSettleType() == CommonConstants.ZERO_INT){ InsuranceListVO listVO = new InsuranceListVO();
//根据险种获取费率,没费率返回错误 BeanCopyUtils.copyProperties(detail,listVO);
TInsuranceType insuranceType = tInsuranceTypeService.getById(detail.getInsuranceTypeId()); listVO.setErrorMessage(InsurancesConstants.INSURANCE_BUY_STATUS_NOT_TWO);
//险种存不存在 errorList.add(listVO);
if (!Optional.ofNullable(insuranceType).isPresent()){ }else {
InsuranceListVO listVO = new InsuranceListVO(); //根据结算类型判断是否需要计算预估保费
BeanCopyUtils.copyProperties(detail,listVO); //预估
listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST); if (detail.getSettleType() == CommonConstants.ZERO_INT){
errorList.add(listVO); //根据险种获取费率,没费率返回错误
}else { TInsuranceType insuranceType = tInsuranceTypeService.getById(detail.getInsuranceTypeId());
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getById(insuranceType.getInsuranceCompanyId()); //险种存不存在
//保险公司存不存在 if (!Optional.ofNullable(insuranceType).isPresent()){
if (!Optional.ofNullable(insuranceCompany).isPresent()){
InsuranceListVO listVO = new InsuranceListVO(); InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO); BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST); listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
errorList.add(listVO); errorList.add(listVO);
}else { }else {
if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){ TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getById(insuranceType.getInsuranceCompanyId());
//按月查费率 //保险公司存不存在
//计算起止时间的月数 if (!Optional.ofNullable(insuranceCompany).isPresent()){
long month = LocalDateUtil.betweenMonth(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString()); InsuranceListVO listVO = new InsuranceListVO();
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda() BeanCopyUtils.copyProperties(detail,listVO);
.eq(TInsuranceTypeRate::getInsuranceTypeId, detail.getInsuranceTypeId()) listVO.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
.eq(TInsuranceTypeRate::getMonth, month) errorList.add(listVO);
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT) }else {
.last(CommonConstants.LAST_ONE_SQL) if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){
); //按月查费率
if (!Optional.ofNullable(typeRate).isPresent()){ //计算起止时间的月数
InsuranceListVO listVO = new InsuranceListVO(); long month = LocalDateUtil.betweenMonth(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
BeanCopyUtils.copyProperties(detail,listVO); TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_RATE_NOT_EXIST); .eq(TInsuranceTypeRate::getInsuranceTypeId, detail.getInsuranceTypeId())
errorList.add(listVO); .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);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
settle.setIsEstimatePush(CommonConstants.ZERO_INT);
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}
}else { }else {
// 预估保费 = 费率 * 购买标准 //按天
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).multiply(new BigDecimal(typeRate.getRate())).setScale(2,BigDecimal.ROUND_HALF_UP); //计算起止时间的天数
long day = LocalDateUtil.betweenDay(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
//预估保费 = (购买标准 / 365) * 天数
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).divide(new BigDecimal("365")).multiply(new BigDecimal(day)).setScale(2,BigDecimal.ROUND_HALF_UP);
detail.setEstimatePremium(estimatePremium); detail.setEstimatePremium(estimatePremium);
if (detail.getBuyType() == CommonConstants.THREE_INT){ if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT)); detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
} }
//记录状态均置为「已投保」 //记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT); detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」 //记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT); detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT); detail.setIsOverdue(CommonConstants.ZERO_INT);
...@@ -669,49 +710,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -669,49 +710,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
successList.add(detail); 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")).multiply(new BigDecimal(day)).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.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
settle.setIsEstimatePush(CommonConstants.ZERO_INT);
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
} }
} }
} }
} //实缴
//实缴 if(detail.getSettleType() == CommonConstants.ONE_INT){
if(detail.getSettleType() == CommonConstants.ONE_INT){ if (detail.getBuyType() == CommonConstants.THREE_INT){
if (detail.getBuyType() == CommonConstants.THREE_INT){ detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_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);
successList.add(detail);
} }
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
successList.add(detail);
} }
} }
} }
...@@ -719,7 +733,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -719,7 +733,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//更新 //更新
this.saveOrUpdateBatch(successList); this.saveOrUpdateBatch(successList);
//todo 根据结算类型推送预估保费到ekp //todo 根据结算类型是合并结算,推送预估保费到ekp(上面已经算好,这里直接判断有预估保费的就推送)
//结算状态是待结算,结算中、已结算是ekp反馈的,如果结算失败,反馈到我们这边的状态是待结算
} }
//根据项目编码获取项目名称 //根据项目编码获取项目名称
setProjectNameByDeptNo(errorList); setProjectNameByDeptNo(errorList);
...@@ -770,7 +785,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -770,7 +785,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setUpdateTime(LocalDateTime.now()); detail.setUpdateTime(LocalDateTime.now());
this.updateById(detail); this.updateById(detail);
}else { }else {
// todo 根据结算类型判断推送ekp // todo 判断是否推送过ekp,没推送过调新增接口,推送过调更新接口
} }
detailList.add(detail); detailList.add(detail);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
<result property="settleType" column="SETTLE_TYPE" jdbcType="TINYINT"/> <result property="settleType" column="SETTLE_TYPE" jdbcType="TINYINT"/>
<result property="actualPremium" column="ACTUAL_PREMIUM" jdbcType="DECIMAL"/> <result property="actualPremium" column="ACTUAL_PREMIUM" jdbcType="DECIMAL"/>
<result property="estimatePremium" column="ESTIMATE_PREMIUM" jdbcType="DECIMAL"/> <result property="estimatePremium" column="ESTIMATE_PREMIUM" jdbcType="DECIMAL"/>
<result property="signFlag" column="SIGN_FLAG" jdbcType="TINYINT"/>
<result property="buyHandleStatus" column="BUY_HANDLE_STATUS" jdbcType="TINYINT"/> <result property="buyHandleStatus" column="BUY_HANDLE_STATUS" jdbcType="TINYINT"/>
<result property="defaultSettleId" column="DEFAULT_SETTLE_ID" jdbcType="VARCHAR"/> <result property="defaultSettleId" column="DEFAULT_SETTLE_ID" jdbcType="VARCHAR"/>
<result property="reduceHandleStatus" column="REDUCE_HANDLE_STATUS" jdbcType="TINYINT"/> <result property="reduceHandleStatus" column="REDUCE_HANDLE_STATUS" jdbcType="TINYINT"/>
...@@ -58,7 +59,7 @@ ...@@ -58,7 +59,7 @@
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,
INSURANCE_HANDLE_PROVINCE,INSURANCE_HANDLE_PROVINCE_NAME,INSURANCE_HANDLE_CITY,INSURANCE_HANDLE_CITY_NAME,SETTLE_TYPE, INSURANCE_HANDLE_PROVINCE,INSURANCE_HANDLE_PROVINCE_NAME,INSURANCE_HANDLE_CITY,INSURANCE_HANDLE_CITY_NAME,SETTLE_TYPE,
ACTUAL_PREMIUM,ESTIMATE_PREMIUM, ACTUAL_PREMIUM,ESTIMATE_PREMIUM,SIGN_FLAG,
BUY_HANDLE_STATUS,DEFAULT_SETTLE_ID,REDUCE_HANDLE_STATUS, BUY_HANDLE_STATUS,DEFAULT_SETTLE_ID,REDUCE_HANDLE_STATUS,
IS_USE,IS_EFFECT,IS_OVERDUE,REMARK, IS_USE,IS_EFFECT,IS_OVERDUE,REMARK,
CREATE_BY,CREATE_NAME,CREATE_TIME, CREATE_BY,CREATE_NAME,CREATE_TIME,
......
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