| | |
| | | applyChange.setIsdeleted(Constants.ZERO); |
| | | //根据申请日期 处理加减保的 实际生效日期 |
| | | if(applyChange.getType().equals(Constants.ZERO)){ |
| | | if(Objects.nonNull(solutions.getAddValidDays())){ |
| | | applyChange.setApplyStartTime( |
| | | DateUtil.afterDateByType(applyChange.getValidTime(),0,solutions.getAddValidDays()) |
| | | ); |
| | | initJJBValidTime(applyChange,insuranceApply,solutions); |
| | | }else{ |
| | | applyChange.setApplyStartTime(applyChange.getValidTime()); |
| | | } |
| | | if(Objects.nonNull(solutions.getDelValidDays())){ |
| | | applyChange.setDelValidTime( |
| | | DateUtil.afterDateByType(applyChange.getValidTime(),0,solutions.getDelValidDays()) |
| | | ); |
| | | }else{ |
| | | applyChange.setDelValidTime(applyChange.getValidTime()); |
| | | } |
| | | //仅支持替换 保证加减保日期为同一天 |
| | | if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE)){ |
| | | applyChange.setApplyStartTime( |
| | | applyChange.getDelValidTime() |
| | | ); |
| | | } |
| | | }else{ |
| | | applyChange.setApplyStartTime(applyChange.getValidTime()); |
| | | } |
| | | |
| | | applyChange.setStatus(Constants.ZERO); |
| | | applyChangeMapper.insert(applyChange); |
| | | |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "保单已过保,无法进行该操作"); |
| | | } |
| | | if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) > Constants.ZERO) { |
| | | //如果保单尚未生效,设置期望生效日期为保单生效开始时间 |
| | | applyChange.setValidTime(insuranceApply.getStartTime()); |
| | | } |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | |
| | | }; |
| | | |
| | | if(applyChange.getType().equals(Constants.ZERO)){ |
| | | if(Objects.nonNull(solutions.getAddValidDays())){ |
| | | applyChange.setApplyStartTime( |
| | | DateUtil.afterDateByType(applyChange.getValidTime(),0,solutions.getAddValidDays()) |
| | | ); |
| | | }else{ |
| | | applyChange.setApplyStartTime(applyChange.getValidTime()); |
| | | } |
| | | if(Objects.nonNull(solutions.getDelValidDays())){ |
| | | applyChange.setDelValidTime( |
| | | DateUtil.afterDateByType(applyChange.getValidTime(),0,solutions.getDelValidDays()) |
| | | ); |
| | | }else{ |
| | | applyChange.setDelValidTime(applyChange.getValidTime()); |
| | | } |
| | | //仅支持替换 保证加减保日期为同一天 |
| | | if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE)){ |
| | | applyChange.setApplyStartTime( |
| | | applyChange.getDelValidTime() |
| | | ); |
| | | } |
| | | |
| | | //处理期望生效日期 |
| | | initJJBValidTime(applyChange,insuranceApply,solutions); |
| | | }else{ |
| | | applyChange.setApplyStartTime(applyChange.getValidTime()); |
| | | } |
| | |
| | | return applyChange.getId(); |
| | | } |
| | | |
| | | private void initJJBValidTime(ApplyChange applyChange, InsuranceApply insuranceApply, Solutions solutions) { |
| | | if( applyChange.getValidTime().getTime()>=insuranceApply.getStartTime().getTime() |
| | | && Objects.nonNull(solutions.getAddValidDays())){ |
| | | //如果保单已生效,按照t+n的规则 |
| | | applyChange.setApplyStartTime( |
| | | DateUtil.afterDateByType(applyChange.getValidTime(),0,solutions.getAddValidDays()) |
| | | ); |
| | | }else{ |
| | | //如果保单未生或者没有配置生效天数,设置期望生效日期为保单生效开始时间 |
| | | applyChange.setApplyStartTime(applyChange.getValidTime()); |
| | | } |
| | | if(applyChange.getValidTime().getTime()>=insuranceApply.getStartTime().getTime() |
| | | &&Objects.nonNull(solutions.getDelValidDays())){ |
| | | applyChange.setDelValidTime( |
| | | DateUtil.afterDateByType(applyChange.getValidTime(),0,solutions.getDelValidDays()) |
| | | ); |
| | | }else{ |
| | | applyChange.setDelValidTime(applyChange.getValidTime()); |
| | | } |
| | | //仅支持替换 保证加减保日期为同一天 |
| | | if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE)){ |
| | | applyChange.setApplyStartTime( |
| | | applyChange.getDelValidTime() |
| | | ); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public BigDecimal dealApplyChangeData(ApplyChange applyChange,InsuranceApply insuranceApply |
| | | ,CompanySolution companySolution,Solutions solutions,LoginUserInfo loginUserInfo,BigDecimal fee){ |