| | |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "未查询到员工数据"); |
| | | } |
| | | //查询人员信息是否存在相同的方案下是否存在 冲突数据 |
| | | InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getId(), |
| | | InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getBaseId(), |
| | | member.getIdcardNo(),member.getName(),detail.getStartTime(),detail.getEndTime(), |
| | | applyDetailJoinMapper); |
| | | |
| | |
| | | .lambda() |
| | | .eq(ApplyDetail::getApplyId,update.getApplyId()) |
| | | .eq(ApplyDetail::getIdcardNo,detail.getIdcardNo()) |
| | | // .apply(" ( " + |
| | | // " '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(update.getApplyStartTime(),1))+"' <= t.start_time AND t.start_time < '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(detail.getEndTime(),2))+"' " + |
| | | // " or " + |
| | | // " ( '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(update.getApplyStartTime(),1))+"' < t.end_time AND t.end_time < '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(detail.getEndTime(),2))+"' ) " + |
| | | // " or " + |
| | | // " ( '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(update.getApplyStartTime(),1))+"' > t.start_time AND '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(detail.getEndTime(),2))+"' < t.end_time )" + |
| | | // " ) " ) |
| | | .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(update.getApplyStartTime(),1)) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(detail.getEndTime(),2)) |
| | | )>Constants.ZERO){ |
| | |
| | | add.setFee(Constants.addFee(solutions,solutions.getPrice(),insuranceApply.getStartTime(),insuranceApply.getFinalEndTime(),update.getApplyStartTime(),insuranceApply.getEndTime())); |
| | | add.setChangeStatus(Constants.ZERO); |
| | | if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE) |
| | | && Constants.equalsInteger(solutions.getTimeUnit(),solutions.getInsureCycleUnit())){ |
| | | && Constants.equalsInteger(solutions.getTimeUnit(),solutions.getInsureCycleUnit()) && i < reduceList.size()){ |
| | | add.setReduceId(reduceList.get(i).getId()); |
| | | } |
| | | if(new Date().compareTo(DateUtil.getMontageDate(detail.getStartTime(), 2))>=0){ |
| | |
| | | if (DateUtil.compareDate(insuranceApply.getEndTime(),new Date()) >= Constants.ZERO ) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "保单已过保,无法进行该操作"); |
| | | } |
| | | if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) >= Constants.ZERO) { |
| | | //如果保单尚未生效,设置期望生效日期为保单生效开始时间 |
| | | applyChange.setValidTime(insuranceApply.getStartTime()); |
| | | } |
| | | // if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) >= Constants.ZERO) { |
| | | // //如果保单尚未生效,设置期望生效日期为保单生效开始时间 |
| | | // applyChange.setValidTime(insuranceApply.getStartTime()); |
| | | // } |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案"); |
| | |
| | | ) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "保单已过保,无法进行该操作"); |
| | | } |
| | | if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) > Constants.ZERO) { |
| | | applyChange.setValidTime(insuranceApply.getStartTime()); |
| | | } |
| | | // if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) > Constants.ZERO) { |
| | | // applyChange.setValidTime(insuranceApply.getStartTime()); |
| | | // } |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案"); |
| | |
| | | ); |
| | | }else{ |
| | | //如果保单未生或者没有配置生效天数,设置期望生效日期为保单生效开始时间 |
| | | applyChange.setApplyStartTime(applyChange.getValidTime()); |
| | | applyChange.setApplyStartTime(applyChange.getValidTime().getTime()>=insuranceApply.getStartTime().getTime()?applyChange.getValidTime():insuranceApply.getStartTime()); |
| | | } |
| | | if(applyChange.getValidTime().getTime()>=insuranceApply.getStartTime().getTime() |
| | | &&Objects.nonNull(solutions.getDelValidDays())){ |
| | |
| | | DateUtil.afterDateByType(applyChange.getValidTime(),0,solutions.getDelValidDays()) |
| | | ); |
| | | }else{ |
| | | applyChange.setDelValidTime(applyChange.getValidTime()); |
| | | applyChange.setDelValidTime(applyChange.getValidTime().getTime()>=insuranceApply.getStartTime().getTime()?applyChange.getValidTime():insuranceApply.getStartTime()); |
| | | } |
| | | //仅支持替换 保证加减保日期为同一天 |
| | | if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE)){ |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "加保人员【" + applyChagneDetail.getMemberName() + "】必填项缺失"); |
| | | } |
| | | //查询人员信息是否存在相同的方案下是否存在 冲突数据 |
| | | InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getId(), |
| | | InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getBaseId(), |
| | | applyChagneDetail.getMemberIdcardNo(),applyChagneDetail.getMemberName(),insuranceApply.getStartTime(),insuranceApply.getEndTime(), |
| | | applyDetailJoinMapper); |
| | | |
| | |
| | | .lambda() |
| | | .eq(ApplyDetail::getApplyId,applyChange.getApplyId()) |
| | | .eq(ApplyDetail::getIdcardNo,applyChagneDetail.getIdcardNo()) |
| | | // .apply(" ( " + |
| | | // " '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))+"' <= t.start_time AND t.start_time < '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(insuranceApply.getEndTime(),2))+"' " + |
| | | // " or " + |
| | | // " ( '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))+"' < t.end_time AND t.end_time < '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(insuranceApply.getEndTime(),2))+"' ) " + |
| | | // " or " + |
| | | // " ( '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))+"' > t.start_time AND '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(insuranceApply.getEndTime(),2))+"' < t.end_time )" + |
| | | // " ) " ) |
| | | .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1)) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(insuranceApply.getEndTime(),2)) |
| | | //.ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),3)) |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,加保人员【" + applyChagneDetail.getMemberName() + "】存在日期冲突的数据"); |
| | | } |
| | |
| | | .selectAs(Solutions::getName,ApplyChange::getSolutionsName) |
| | | .selectAs(Solutions::getType,ApplyChange::getSolutionType) |
| | | .selectAs(Solutions::getId,ApplyChange::getSolutionsId) |
| | | .selectAs(Solutions::getDelOnlyReplace,ApplyChange::getDelOnlyReplace) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0 )",ApplyChange::getAddNum) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1 )",ApplyChange::getDelNum) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2 )",ApplyChange::getChangeNum) |