| | |
| | | if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey()) |
| | | ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey()) |
| | | ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){ |
| | | if( |
| | | // Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey()) |
| | | // ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey()) |
| | | // || |
| | | Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){ |
| | | //已提交和已完成状态不支持审核不通过 |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~"); |
| | | } |
| | |
| | | param.getPidanFile().setObjType(Constants.MultiFile.CA_PD_PDF.getKey()); |
| | | param.getPidanFile().setType(Constants.TWO); |
| | | multifileMapper.insert(param.getPidanFile()); |
| | | |
| | | update.setApplyId(model.getApplyId()); |
| | | |
| | | |
| | | if(Constants.equalsInteger(model.getType(),Constants.ZERO)){ |
| | | //如果是加减保申请 处理加减保明细数据 |
| | | dealDetailsValidTime(update); |
| | | dealDetailsValidTime(update,insuranceApply); |
| | | }else{ |
| | | //如果是换厂申请 处理明细数据 |
| | | dealDetailsDUdata(update); |
| | | dealDetailsDUdata(update,insuranceApply); |
| | | } |
| | | |
| | | applyChangeMapper.updateById(update); |
| | |
| | | * 处理加减保明细数据 |
| | | * @param update |
| | | */ |
| | | private void dealDetailsDUdata(ApplyChange update ) { |
| | | private void dealDetailsDUdata(ApplyChange update,InsuranceApply insuranceApply) { |
| | | List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class, |
| | | new MPJLambdaWrapper<ApplyChagneDetail>() |
| | | .selectAll(ApplyChagneDetail.class) |
| | | .selectAs(Solutions::getTimeUnit,ApplyChagneDetail::getSolutionTimeUnit) |
| | | .selectAs(Solutions::getPrice,ApplyChagneDetail::getSolutionPrice) |
| | | .selectAs(Solutions::getId,ApplyChagneDetail::getSolutionId) |
| | | .selectAs(Solutions::getName,ApplyChagneDetail::getSolutionsName) |
| | | .selectAs(Worktype::getName,ApplyChagneDetail::getWorkTypeName) |
| | | .selectAs(DispatchUnit::getName,ApplyChagneDetail::getDuName) |
| | |
| | | applyDetailJoinMapper.insert(applyDetail); |
| | | |
| | | MemberInsurance memberInsurance = new MemberInsurance(applyDetail,update.getId()); |
| | | memberInsurance.setSolutionId(detail.getSolutionId()); |
| | | memberInsurance.setWorktypeName(detail.getWorkTypeName()); |
| | | memberInsurance.setDuName(detail.getDuName()); |
| | | memberInsurance.setApplyChangeId(detail.getApplyChangeId()); |
| | | memberInsurance.setSolutionName(detail.getSolutionsName()); |
| | | memberInsurance.setPdCode(update.getValidCode()); |
| | | memberInsurance.setBdCode(insuranceApply.getCode()); |
| | | memberInsurance.setRelationType(Constants.ONE); |
| | | memberInsuranceJoinMapper.insert(memberInsurance); |
| | | }else{ |
| | | |
| | | applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda() |
| | | .set(ApplyDetail::getEditor,update.getEditor()) |
| | | .set(ApplyDetail::getEditDate,update.getEditDate()) |
| | |
| | | .set(ApplyDetail::getWorktypeId,detail.getWorktypeId()) |
| | | .eq(ApplyDetail::getId,oldModel.getId()) |
| | | ); |
| | | |
| | | //员工投保明细记录 历史数据 |
| | | memberInsuranceJoinMapper.update(null,new UpdateWrapper<MemberInsurance>().lambda() |
| | | .set(MemberInsurance::getDuId,detail.getDuId()) |
| | |
| | | * 处理加减保明细数据 |
| | | * @param update |
| | | */ |
| | | private void dealDetailsValidTime(ApplyChange update) { |
| | | private void dealDetailsValidTime(ApplyChange update,InsuranceApply insuranceApply) { |
| | | List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class, |
| | | new MPJLambdaWrapper<ApplyChagneDetail>() |
| | | .selectAll(ApplyChagneDetail.class) |
| | |
| | | //加保 添加的金额 |
| | | CountCyclePriceVO countCyclePriceVO_add = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO_add); |
| | | |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案"); |
| | | } |
| | | if(solutions.getDataType().equals(Constants.ONE)){ |
| | | solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1")); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到方案最新版本信息"); |
| | | } |
| | | } |
| | | |
| | | |
| | | for (ApplyChagneDetail detail : detailList) { |
| | |
| | | totalFee = totalFee.add(add.getFee()); |
| | | currentFee = currentFee.add(add.getCurrentFee()); |
| | | |
| | | MemberInsurance memberInsurance = new MemberInsurance(detail, update, update.getEditor(), add.getId()); |
| | | MemberInsurance memberInsurance = new MemberInsurance(detail, update, update.getEditor(), add.getId(),solutions.getId()); |
| | | memberInsurance.setStartTime(add.getStartTime()); |
| | | memberInsurance.setEndTime(add.getEndTime()); |
| | | memberInsurance.setRelationType(Constants.ONE); |
| | | memberInsuranceList.add(memberInsurance); |
| | | |
| | |
| | | CountCyclePriceVO timeoutCountCyclePriceVOReduce = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO_reduce); |
| | | updateCurrentFee = timeoutCountCyclePriceVOReduce.getCyclePrice().subtract(countCyclePriceVO_reduce.getCyclePrice()); |
| | | } |
| | | |
| | | |
| | | applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda() |
| | | .setSql(" fee = ifnull(fee,0)+" + updateFee) |
| | | .setSql(" current_fee = " + updateCurrentFee) |
| | | .set(ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 3)) |
| | | .set(insuranceApply.getStartTime().compareTo(update.getValidTime())!=0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 3)) |
| | | .set(insuranceApply.getStartTime().compareTo(update.getValidTime())==0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 2)) |
| | | .set(ApplyDetail::getEditor, update.getEditor()) |
| | | .set(ApplyDetail::getEditDate, update.getEditDate()) |
| | | .eq(ApplyDetail::getId, oldModel.getId()) |
| | |
| | | //修改 员工投保明细记录 历史数据 |
| | | memberInsuranceJoinMapper.update(null, new UpdateWrapper<MemberInsurance>().lambda() |
| | | .setSql(" fee = ifnull(fee,0)+" + updateFee) |
| | | .set(MemberInsurance::getEndTime, update.getApplyStartTime()) |
| | | .set(insuranceApply.getStartTime().compareTo(update.getValidTime())!=0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 3)) |
| | | .set(insuranceApply.getStartTime().compareTo(update.getValidTime())==0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 2)) |
| | | .set(MemberInsurance::getStartTime, update.getApplyStartTime()) |
| | | .eq(MemberInsurance::getRelationId, oldModel.getId()) |
| | | ); |
| | | |
| | |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~"); |
| | | } |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){ |
| | | update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey()); |
| | | }else { |
| | | update.setStatus(Constants.ApplyChangeStatus.UPLOAD.getKey()); |
| | | } |
| | | applyLogType = Constants.ApplyLogType.CA_PALTFORM_REFUSE_APPLY; |
| | | info = applyLogType.getInfo(); |
| | | info = info.replace("${param}", param.getCheckInfo()); |
| | | update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey()); |
| | | |
| | | noticeType = Constants.NoticeType.FIVE; |
| | | }else{ |
| | | //如果是同意,两种申请退回状态都可操作 |
| | |
| | | } |
| | | //删除其他待办 |
| | | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); |
| | | Notices notices = new Notices(noticeObjectType,Constants.ZERO,model.getId(),solutions.getName(), |
| | | Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(), |
| | | model.getCompanyId(), noticeType); |
| | | noticesMapper.insert(notices); |
| | | |
| | |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案"); |
| | | } |
| | | if(solutions.getDataType().equals(Constants.ONE)){ |
| | | solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1")); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到方案最新版本信息"); |
| | | } |
| | | } |
| | | |
| | | |
| | | CompanySolution companySolution = companySolutionMapper.selectOne(new QueryWrapper<CompanySolution>().lambda() |
| | | .eq(CompanySolution::getCompanyId,loginUserInfo.getCompanyId()) |
| | | .eq(CompanySolution::getSolutionBaseId,solutions.getBaseId()) |
| | |
| | | applyChangeMapper.updateById(applyChangeFee); |
| | | |
| | | Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_COMPANY_COMMIT; |
| | | String info =applyLogType.getInfo(); |
| | | info = info.replace("${param}", ""); |
| | | ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),info,applyChange.getId(),applyLogType.getKey(), null, null); |
| | | ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),"",applyChange.getId(),applyLogType.getKey(), null, null); |
| | | applyLogMapper.insert(log); |
| | | |
| | | |
| | |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案"); |
| | | } |
| | | if(solutions.getDataType().equals(Constants.ONE)){ |
| | | solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1")); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到方案最新版本信息"); |
| | | } |
| | | } |
| | | CompanySolution companySolution = companySolutionMapper.selectOne(new QueryWrapper<CompanySolution>().lambda() |
| | | .eq(CompanySolution::getCompanyId,loginUserInfo.getCompanyId()) |
| | | .eq(CompanySolution::getSolutionBaseId,solutions.getId()) |
| | | .eq(CompanySolution::getSolutionBaseId,solutions.getBaseId()) |
| | | .eq(CompanySolution::getIsdeleted,Constants.ZERO) |
| | | .last(" limit 1 ") |
| | | ); |
| | |
| | | if(companySolution.getCanAdd().equals(Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该企业分配保险方案无法进行加保"); |
| | | } |
| | | //验证是否存在重复数据 |
| | | List<String> idcarNo = addDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList()); |
| | | Set<String> set = new HashSet<>(idcarNo); |
| | | if(idcarNo.size() != set.size()){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起,人员录入数据存在相同数据!"); |
| | | } |
| | | |
| | | //加保明细数据 计算金额 根据批单时间 计算 |
| | | applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),1)); |
| | | CountCyclePriceVO countCyclePriceVO = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO); |
| | |
| | | //减保数据 |
| | | List<ApplyChagneDetail> delDetailList = applyChange.getDelDetailList(); |
| | | if (CollectionUtils.isNotEmpty(delDetailList)) { |
| | | //验证是否存在重复数据 |
| | | List<String> idcarNo = delDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList()); |
| | | Set<String> set = new HashSet<>(idcarNo); |
| | | if(idcarNo.size() != set.size()){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起,人员录入数据存在相同数据!"); |
| | | } |
| | | |
| | | if(companySolution.getCanReduce().equals(Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该企业分配保险方案无法进行减保"); |
| | | } |
| | |
| | | applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),2)); |
| | | CountCyclePriceVO countCyclePriceVO = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO); |
| | | BigDecimal detailFee = countCyclePriceVO.getCyclePrice(); |
| | | this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee); |
| | | this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee,applyChangeCyclePriceDTO.getValidTime()); |
| | | fee = fee.add(delDetailList.stream().map(ApplyChagneDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | } |
| | | |
| | |
| | | * @param loginUserInfo |
| | | */ |
| | | public void delChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> delDetailList,InsuranceApply insuranceApply,Solutions solutions, |
| | | LoginUserInfo loginUserInfo,BigDecimal detailFee){ |
| | | LoginUserInfo loginUserInfo,BigDecimal detailFee,Date endTime){ |
| | | for (ApplyChagneDetail applyChagneDetail : delDetailList) { |
| | | if (Objects.isNull(applyChagneDetail.getMemberId())) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】必填项缺失"); |
| | |
| | | applyChagneDetail.setType(Constants.ONE); |
| | | |
| | | applyChagneDetail.setStartTime(applyDetail.getStartTime()); |
| | | applyChagneDetail.setEndTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),3)); |
| | | applyChagneDetail.setEndTime(endTime); |
| | | |
| | | member.setApplyId(insuranceApply.getId()); |
| | | member.setDuId(applyChagneDetail.getDuId()); |
| | |
| | | String info = applyLogType.getInfo(); |
| | | if(StringUtils.isNotBlank(applyChangeOptDTO.getOptIllustration())){ |
| | | info = info.replace("${param}", applyChangeOptDTO.getOptIllustration()); |
| | | }else{ |
| | | info = info.replace("${param}", ""); |
| | | } |
| | | ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),info,applyChange.getId(),applyLogType.getKey(), null, null); |
| | | applyLogMapper.insert(log); |