| | |
| | | private MemberInsuranceJoinMapper memberInsuranceJoinMapper; |
| | | |
| | | @Autowired |
| | | private ApplyChangeDetailJoinMapper applyChangeDetailJoinMapper; |
| | | |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | |
| | | @Autowired |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~"); |
| | | } |
| | | |
| | | InsuranceApply insuranceApply = insuranceApplyMapper.selectById(model.getApplyId()); |
| | | if(Objects.isNull(insuranceApply)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保单信息"); |
| | | } |
| | | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | ApplyChange update = new ApplyChange(); |
| | | update.setEditDate(new Date()); |
| | |
| | | update.setCheckUserId(user.getId()); |
| | | update.setId(model.getId()); |
| | | update.setValidCode(param.getValidCode()); |
| | | update.setApplyStartTime(model.getApplyStartTime()); |
| | | applyChangeMapper.updateById(update); |
| | | update.setApplyStartTime(param.getApplyStartTime()); |
| | | update.setCode(model.getCode()); |
| | | |
| | | param.getPidanFile().setIsdeleted(Constants.ZERO); |
| | | param.getPidanFile().setCreator(user.getId()); |
| | |
| | | multifileMapper.insert(param.getPidanFile()); |
| | | |
| | | update.setApplyId(model.getApplyId()); |
| | | |
| | | |
| | | if(Constants.equalsInteger(model.getType(),Constants.ZERO)){ |
| | | //如果是加减保申请 处理加减保明细数据 |
| | | dealDetailsValidTime(update); |
| | |
| | | //如果是换厂申请 处理明细数据 |
| | | dealDetailsDUdata(update); |
| | | } |
| | | |
| | | applyChangeMapper.updateById(update); |
| | | |
| | | // if(1==1){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | |
| | | .selectAll(ApplyChagneDetail.class) |
| | | .selectAs(Solutions::getTimeUnit,ApplyChagneDetail::getSolutionTimeUnit) |
| | | .selectAs(Solutions::getPrice,ApplyChagneDetail::getSolutionPrice) |
| | | .selectAs(Solutions::getName,ApplyChagneDetail::getSolutionsName) |
| | | .selectAs(Worktype::getName,ApplyChagneDetail::getWorkTypeName) |
| | | .selectAs(DispatchUnit::getName,ApplyChagneDetail::getDuName) |
| | | .selectAs(Member::getIdcardNo,ApplyChagneDetail::getIdcardNo) |
| | | .selectAs(Member::getName, ApplyChagneDetail::getMemberName) |
| | | .selectAs(InsuranceApply::getCode,ApplyChagneDetail::getApplyCode) |
| | | .leftJoin(Member.class, Member::getId, ApplyChagneDetail::getMemberId) |
| | | .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId) |
| | | .leftJoin(InsuranceApply.class, InsuranceApply::getId, ApplyChange::getApplyId) |
| | | .leftJoin(Solutions.class, Solutions::getId, InsuranceApply::getSolutionId) |
| | |
| | | .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getDuId) |
| | | .eq(ApplyChagneDetail::getApplyChangeId,update.getId()) |
| | | .eq(ApplyChagneDetail::getIsdeleted,Constants.ZERO) ); |
| | | |
| | | if(detailList ==null || detailList.size()==0){ |
| | | return; |
| | | } |
| | | //实际批单生效日期 |
| | | Date applyStartTime = DateUtil.getMontageDate(update.getApplyStartTime(),1); |
| | | for(ApplyChagneDetail detail : detailList){ |
| | | //查询减保人员是否存在 冲突的 保单明细数据 |
| | | if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>() |
| | | .lambda() |
| | | .eq(ApplyDetail::getApplyId,update.getApplyId()) |
| | | .eq(ApplyDetail::getIdcardNo,detail.getIdcardNo()) |
| | | .le(ApplyDetail::getStartTime,applyStartTime) |
| | | .ge(ApplyDetail::getEndTime,applyStartTime) |
| | | )<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,换厂人员【" + detail.getMemberName() + "】未查询到符合批单日期的数据"); |
| | | } |
| | | |
| | | //查询员工是在主单下 是否存在生效中的数据 |
| | | ApplyDetail oldModel = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda() |
| | | .eq(ApplyDetail::getApplyId, update.getApplyId()) |
| | |
| | | applyDetail.setCreateDate(new Date()); |
| | | applyDetail.setCreator(update.getEditor()); |
| | | applyDetail.setMemberId(oldModel.getMemberId()); |
| | | applyDetail.setIdcardNo(detail.getIdcardNo()); |
| | | applyDetail.setSex(Constants.getSexByIdCard(detail.getIdcardNo())); |
| | | applyDetail.setMemberName(detail.getMemberName()); |
| | | applyDetail.setStartTime(DateUtil.getMontageDate(update.getApplyStartTime(),1)); |
| | | applyDetail.setEndTime(endDate); |
| | | applyDetail.setDuId(detail.getDuId()); |
| | | applyDetail.setWorktypeId(detail.getWorktypeId()); |
| | | applyDetail.setIdcardNo(oldModel.getIdcardNo()); |
| | | applyDetail.setFee(fee.subtract(oldFee)); |
| | | applyDetail.setIsdeleted(Constants.ZERO); |
| | | if(flag){ |
| | | applyDetail.setCurrentFee(oldCurrentFee.multiply(oldFee)); |
| | | }else{ |
| | |
| | | member.setStartTime(detail.getStartTime()); |
| | | member.setEndTime(detail.getEndTime()); |
| | | memberMapper.updateById(member); |
| | | |
| | | applyChangeDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda() |
| | | .set(ApplyChagneDetail::getStartTime,DateUtil.getMontageDate(update.getApplyStartTime(), 1)) |
| | | .eq(ApplyChagneDetail::getId,detail.getId()) |
| | | ); |
| | | } |
| | | } |
| | | /** |
| | |
| | | List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class, |
| | | new MPJLambdaWrapper<ApplyChagneDetail>() |
| | | .selectAll(ApplyChagneDetail.class) |
| | | .selectAs(Member::getIdcardNo,ApplyChagneDetail::getIdcardNo) |
| | | .selectAs(Solutions::getTimeUnit, ApplyChagneDetail::getSolutionTimeUnit) |
| | | .selectAs(Solutions::getPrice, ApplyChagneDetail::getSolutionPrice) |
| | | .selectAs(Worktype::getName, ApplyChagneDetail::getWorkTypeName) |
| | | .selectAs(DispatchUnit::getName, ApplyChagneDetail::getDuName) |
| | | .selectAs(Member::getName, ApplyChagneDetail::getMemberName) |
| | | .selectAs(Solutions::getName,ApplyChagneDetail::getSolutionsName) |
| | | .selectAs(InsuranceApply::getCode,ApplyChagneDetail::getApplyCode) |
| | | .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId) |
| | | .leftJoin(Member.class, Member::getId, ApplyChagneDetail::getMemberId) |
| | | .leftJoin(InsuranceApply.class, InsuranceApply::getId, ApplyChange::getApplyId) |
| | | .leftJoin(Solutions.class, Solutions::getId, InsuranceApply::getSolutionId) |
| | | .leftJoin(Worktype.class, Worktype::getId, ApplyChagneDetail::getWorktypeId) |
| | |
| | | //投保记录 加保数据加入新数据 减保数据 修改老数据 |
| | | List<MemberInsurance> memberInsuranceList = new ArrayList<>(); |
| | | |
| | | |
| | | //加保业务 使用的加保金额 |
| | | ApplyChangeCyclePriceDTO applyChangeCyclePriceDTO_add = new ApplyChangeCyclePriceDTO(); |
| | | applyChangeCyclePriceDTO_add.setApplyId(update.getApplyId()); |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到员工数据"); |
| | | } |
| | | if (Constants.equalsInteger(detail.getType(), Constants.ZERO)) { |
| | | |
| | | //查询加保人员是否存在 冲突的 保单明细数据 |
| | | if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>() |
| | | .lambda() |
| | | .eq(ApplyDetail::getApplyId,update.getApplyId()) |
| | | .eq(ApplyDetail::getIdcardNo,detail.getIdcardNo()) |
| | | .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(update.getApplyStartTime(),1)) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(),3)) |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,加保人员【" + detail.getMemberName() + "】存在日期冲突的数据"); |
| | | } |
| | | |
| | | |
| | | //加保 |
| | | ApplyDetail add = new ApplyDetail(); |
| | | add.setApplyId(update.getApplyId()); |
| | |
| | | add.setMemberId(detail.getMemberId()); |
| | | add.setMemberName(detail.getMemberName()); |
| | | add.setWorktypeId(detail.getWorktypeId()); |
| | | add.setIsdeleted(Constants.ZERO); |
| | | add.setIdcardNo(detail.getIdcardNo()); |
| | | add.setSex(Constants.getSexByIdCard(detail.getIdcardNo())); |
| | | add.setMemberName(detail.getMemberName()); |
| | | add.setDuId(detail.getDuId()); |
| | | add.setStartTime(update.getApplyStartTime()); |
| | | add.setEndTime(detail.getEndTime()); |
| | | add.setStartTime(DateUtil.getMontageDate(update.getApplyStartTime(), 1)); |
| | | add.setEndTime(DateUtil.getMontageDate(detail.getEndTime(), 2)); |
| | | add.setFee(countCyclePriceVO_add.getCyclePrice()); |
| | |
| | | |
| | | MemberInsurance memberInsurance = new MemberInsurance(detail, update, update.getEditor(), add.getId()); |
| | | memberInsuranceList.add(memberInsurance); |
| | | |
| | | applyChangeDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda() |
| | | .set(ApplyChagneDetail::getFee,add.getFee()) |
| | | .set(ApplyChagneDetail::getStartTime,DateUtil.getMontageDate(update.getApplyStartTime(), 1)) |
| | | .eq(ApplyChagneDetail::getId,detail.getId()) |
| | | ); |
| | | |
| | | } else { |
| | | //减保操作 |
| | | //查询员工是在主单下 是否存在生效中的数据 |
| | |
| | | .set(MemberInsurance::getEndTime, update.getApplyStartTime()) |
| | | .eq(MemberInsurance::getRelationId, oldModel.getId()) |
| | | ); |
| | | |
| | | //修改业务明细行数据实际批单日期 |
| | | applyChangeDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda() |
| | | .set(ApplyChagneDetail::getFee,updateFee) |
| | | .set(ApplyChagneDetail::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 3)) |
| | | .eq(ApplyChagneDetail::getId,detail.getId()) |
| | | ); |
| | | |
| | | } |
| | | |
| | | member.setApplyId(update.getApplyId()); |
| | |
| | | .set(InsuranceApply::getEditDate, update.getEditDate()) |
| | | .eq(InsuranceApply::getId, update.getApplyId()) |
| | | ); |
| | | |
| | | update.setFee(totalFee); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | applyChangeFee.setId(applyChange.getId()); |
| | | applyChangeFee.setFee(fee); |
| | | applyChangeMapper.updateById(applyChangeFee); |
| | | |
| | | // if(1==1){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | // } |
| | | |
| | | |
| | | |
| | | Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_COMPANY_COMMIT; |
| | | String info =applyLogType.getInfo(); |
| | |
| | | if (Objects.isNull(applyChagneDetail.getMemberId())) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】必填项缺失"); |
| | | } |
| | | |
| | | //查询减保人员是否存在 冲突的 保单明细数据 |
| | | if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>() |
| | | .lambda() |
| | | .eq(ApplyDetail::getApplyId,applyChange.getApplyId()) |
| | | .eq(ApplyDetail::getIdcardNo,applyChagneDetail.getIdcardNo()) |
| | | .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1)) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),3)) |
| | | )<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,减保人员【" + applyChagneDetail.getMemberName() + "】未查询到符合批单日期的数据"); |
| | | } |
| | | |
| | | Member member = memberMapper.selectById(applyChagneDetail.getMemberId()); |
| | | if (Objects.isNull(member)) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】未查询到系统人员信息"); |
| | |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda() |
| | | .eq(ApplyDetail::getApplyId, applyChange.getApplyId()) |
| | | .eq(ApplyDetail::getMemberId, applyChagneDetail.getMemberId()) |
| | | .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1)) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),3)) |
| | | .orderByDesc(ApplyDetail::getCreateDate)); |
| | | if (applyDetailList.size() > Constants.ONE) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】保单信息异常,存在多条数据"); |
| | |
| | | * @param duSolutionList |
| | | * @param loginUserInfo |
| | | */ |
| | | public void addChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> addDetailList,List<DuWorktype> duWorktypeList,List<DuSolution> duSolutionList,InsuranceApply insuranceApply,Solutions solutions,LoginUserInfo loginUserInfo,BigDecimal detailFee){ |
| | | public void addChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> addDetailList, |
| | | List<DuWorktype> duWorktypeList,List<DuSolution> duSolutionList, |
| | | InsuranceApply insuranceApply,Solutions solutions,LoginUserInfo loginUserInfo,BigDecimal detailFee){ |
| | | for (ApplyChagneDetail applyChagneDetail : addDetailList) { |
| | | if ( Objects.isNull(applyChagneDetail.getDuId()) |
| | | || Objects.isNull(applyChagneDetail.getWorktypeId()) |
| | | || StringUtils.isBlank(applyChagneDetail.getIdcardNo()) |
| | | ) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "加保人员【" + applyChagneDetail.getMemberName() + "】必填项缺失"); |
| | | } |
| | | //查询加保人员是否存在 冲突的 保单明细数据 |
| | | if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>() |
| | | .lambda() |
| | | .eq(ApplyDetail::getApplyId,applyChange.getApplyId()) |
| | | .eq(ApplyDetail::getIdcardNo,applyChagneDetail.getIdcardNo()) |
| | | .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1)) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),3)) |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,加保人员【" + applyChagneDetail.getMemberName() + "】存在日期冲突的数据"); |
| | | } |
| | | |
| | | applyChagneDetail.setCreateDate(new Date()); |
| | |
| | | ) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "换厂人员【" + applyChagneDetail.getMemberName() + "】必填项缺失"); |
| | | } |
| | | |
| | | //查询换厂人员是否存在 有效的保单明细数据 |
| | | if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>() |
| | | .lambda() |
| | | .eq(ApplyDetail::getApplyId,applyChange.getApplyId()) |
| | | .eq(ApplyDetail::getIdcardNo,applyChagneDetail.getIdcardNo()) |
| | | .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1)) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1)) |
| | | )<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,换厂人员【" + applyChagneDetail.getMemberName() + "】未查询到符合批单日期的数据"); |
| | | } |
| | | |
| | | Member member = memberMapper.selectById(applyChagneDetail.getMemberId()); |
| | | if (Objects.isNull(member)) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "换厂人员【" + applyChagneDetail.getMemberName() + "】未查询到系统人员信息"); |
| | |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda() |
| | | .eq(ApplyDetail::getApplyId, applyChange.getApplyId()) |
| | | .eq(ApplyDetail::getMemberId, applyChagneDetail.getMemberId()) |
| | | .ge(ApplyDetail::getEndTime, new Date())); |
| | | .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1)) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))); |
| | | if(applyDetailList.size()>Constants.ONE){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "换厂人员【" + applyChagneDetail.getMemberName() + "】保单信息异常,存在多条数据"); |
| | | }else if(applyDetailList.size()==Constants.ZERO){ |
| | |
| | | Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey()) |
| | | // .eq(!Objects.isNull(model.getCompanyId()),InsuranceApply::getCompanyId,model.getCompanyId()) |
| | | // .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId()) |
| | | .eq(!Objects.isNull(model.getApplyId()),ApplyChange::getApplyId,model.getApplyId()) |
| | | .eq(!Objects.isNull(model.getBaseSolutionsId()),Solutions::getBaseId,model.getBaseSolutionsId()) |
| | | .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" ) |
| | | .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" ); |
| | |
| | | } |
| | | queryWrapper.eq(pageWrap.getModel().getCompanyId()!=null,InsuranceApply::getCompanyId, pageWrap.getModel().getCompanyId()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | |
| | | queryWrapper.orderByDesc(ApplyDetail::getCreateDate); |
| | | |
| | | // for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | // if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | // queryWrapper.orderByDesc(sortData.getProperty()); |
| | | // } else { |
| | | // queryWrapper.orderByAsc(sortData.getProperty()); |
| | | // } |
| | | // } |
| | | PageData<ApplyChange> pageData = PageData.from(applyChangeJoinMapper.selectJoinPage(page,ApplyChange.class, queryWrapper)); |
| | | return pageData; |
| | | } |
| | |
| | | //删除其他待办 |
| | | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,applyChange.getId())); |
| | | Notices notices = new Notices(noticeObjectType,Constants.ZERO,applyChange.getId(),solutions.getName(), |
| | | applyChange.getCompanyId(), Constants.NoticeType.THREE); |
| | | insuranceApply.getCompanyId(), Constants.NoticeType.THREE); |
| | | noticesMapper.insert(notices); |
| | | |
| | | |
| | |
| | | applyChangeMapper.updateById(applyChange); |
| | | |
| | | String info = applyLogType.getInfo(); |
| | | if(StringUtils.isNotBlank(applyChangeOptDTO.getOptIllustration())){ |
| | | info = info.replace("${param}", applyChangeOptDTO.getOptIllustration()); |
| | | } |
| | | ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),info,applyChange.getId(),applyLogType.getKey(), null, null); |
| | | applyLogMapper.insert(log); |
| | | } |
| | |
| | | .selectAs(InsuranceApply::getCompanyId,ApplyChange::getCompanyId) |
| | | .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode) |
| | | .selectAs(InsuranceApply::getStartTime,ApplyChange::getStartTime) |
| | | .selectAs(InsuranceApply::getStartTime,ApplyChange::getEndTime) |
| | | .selectAs(InsuranceApply::getEndTime,ApplyChange::getEndTime) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |