| | |
| | | |
| | | if(CollectionUtils.isNotEmpty(applyDetailList)){ |
| | | List<MemberInsurance> memberInsuranceList = new ArrayList<>(); |
| | | List<String> idCodeList = new ArrayList<>(); |
| | | for (ApplyDetail applyDetail:applyDetailList) { |
| | | idCodeList.add(applyDetail.getIdcardNo()); |
| | | } |
| | | List<ApplyDetail> allDetailList = this.getMemberSolutionList(solutions.getParentId(),idCodeList, update.getStartTime() |
| | | ,update.getEndTime(),insuranceApply.getId()); |
| | | |
| | | for (ApplyDetail applyDetail:applyDetailList) { |
| | | //查询人员信息是否存在相同的方案下是否存在 冲突数据 |
| | | this.checkMemberSolution(solutions.getParentId(),applyDetail.getIdcardNo(),applyDetail.getMemberName(),update.getStartTime() |
| | | ,update.getEndTime(),insuranceApply.getId()); |
| | | |
| | | this.checkMemberSolution( applyDetail.getIdcardNo(),allDetailList,applyDetail.getMemberName()); |
| | | MemberInsurance memberInsurance = new MemberInsurance(applyDetail,user.getId()); |
| | | memberInsurance.setRelationType(Constants.ZERO); |
| | | memberInsuranceList.add(memberInsurance); |
| | | |
| | | memberMapper.update(null,new UpdateWrapper<Member>() |
| | | .lambda() |
| | | .set(Member::getStartTime,memberInsurance.getStartTime()) |
| | |
| | | List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda() |
| | | .eq(Member::getCompanyId,insuranceApply.getCompanyId()) |
| | | .eq(Member::getIsdeleted,Constants.ZERO)); |
| | | |
| | | List<String> idCodeList = new ArrayList<>(); |
| | | for (ApplyDetail applyDetail:applyDetailList) { |
| | | idCodeList.add(applyDetail.getIdcardNo()); |
| | | } |
| | | List<ApplyDetail> allDetailList = this.getMemberSolutionList(solutions.getParentId(),idCodeList, insuranceApply.getStartTime() |
| | | ,insuranceApply.getEndTime(),insuranceApply.getId()); |
| | | List<Member> addMemberList = new ArrayList<>(); |
| | | for (int i = 0; i < applyDetailList.size(); i++) { |
| | | ApplyDetail applyDetail = applyDetailList.get(i); |
| | |
| | | addMemberList.add(member); |
| | | } |
| | | //查询人员信息是否存在相同的方案下是否存在 冲突数据 |
| | | this.checkMemberSolution(solutions.getParentId(),member.getIdcardNo(),member.getName(),insuranceApply.getStartTime(),insuranceApply.getEndTime(),insuranceApply.getId()); |
| | | this.checkMemberSolution( applyDetail.getIdcardNo(),allDetailList,applyDetail.getMemberName()); |
| | | // this.checkMemberSolutionOld(solutions.getParentId(),member.getIdcardNo(),member.getName(),insuranceApply.getStartTime(),insuranceApply.getEndTime(),insuranceApply.getId()); |
| | | } |
| | | if(CollectionUtils.isNotEmpty(addMemberList)){ |
| | | memberJoinMapper.insert(addMemberList); |
| | |
| | | |
| | | /** |
| | | * 查询 会员信息在方案下是否存在冲突数据 |
| | | * @param startTime |
| | | * @param endTime |
| | | */ |
| | | public void checkMemberSolution(String idCode,List<ApplyDetail> allDetailList,String memberName){ |
| | | List<ApplyDetail> applyDetailList = getMemberSolutionListByIdcode(idCode,allDetailList); |
| | | if(applyDetailList.size() >Constants.ZERO){ |
| | | String companyName = applyDetailList.get(Constants.ZERO).getCompanyName(); |
| | | if(StringUtils.isNotBlank(companyName)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"该员工【"+memberName+" "+idCode+"】已在【"+companyName+"】存在保险,请联系客服确认"); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"该员工【"+memberName+" "+idCode+"】在该保险方案下已存在投保记录,无法进行该操作"); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | @Override |
| | | public void checkMemberSolution(Integer solutionParentId,String idCode,String memberName,Date startTime,Date endTime,Integer applyId){ |
| | | List<ApplyDetail> applyDetailList = new ArrayList<ApplyDetail>(); |
| | | public void checkMemberSolutionOld(Integer solutionParentId,String idCode, String memberName, Date startTime,Date endTime,Integer applyId){ |
| | | List<ApplyDetail> applyDetailList = new ArrayList<>(); |
| | | try { |
| | | applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class, |
| | | new MPJLambdaWrapper<ApplyDetail>() |
| | |
| | | |
| | | }; |
| | | } |
| | | private List<ApplyDetail> getMemberSolutionListByIdcode(String idCode, List<ApplyDetail> allDetailList) { |
| | | if(allDetailList == null || allDetailList.size()==0){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<ApplyDetail> list = new ArrayList<>(); |
| | | for(ApplyDetail d : allDetailList){ |
| | | if(StringUtils.equals(d.getIdcardNo(),idCode)){ |
| | | list.add(d); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public List<ApplyDetail> getMemberSolutionList(Integer solutionParentId,List<String> idCodeList, Date startTime,Date endTime,Integer applyId){ |
| | | List<ApplyDetail> applyDetailList = new ArrayList<ApplyDetail>(); |
| | | try { |
| | | applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class, |
| | | new MPJLambdaWrapper<ApplyDetail>() |
| | | .selectAll(ApplyDetail.class) |
| | | .selectAs(InsuranceApply::getCode,ApplyDetail::getApplyCode) |
| | | .selectAs(Company::getName,ApplyDetail::getCompanyName) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .in(ApplyDetail::getIdcardNo,idCodeList) |
| | | .eq(ApplyDetail::getIsdeleted,Constants.ZERO) |
| | | .eq(Solutions::getParentId,solutionParentId) |
| | | .ne(Objects.nonNull(applyId),InsuranceApply::getId,applyId) |
| | | .notIn(InsuranceApply::getStatus |
| | | ,Constants.InsuranceApplyStatus.FAIL_RETURN.getKey() |
| | | ,Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_PASS.getKey() |
| | | ,Constants.InsuranceApplyStatus.CLOSE.getKey() |
| | | ,Constants.InsuranceApplyStatus.WTB_RETURN.getKey() |
| | | ,Constants.InsuranceApplyStatus.WTB_CLOSED.getKey() ) |
| | | .apply(" ( " + |
| | | " '"+DateUtil.getPlusTime(startTime)+"' <= t.start_time AND t.start_time < '"+DateUtil.getPlusTime(endTime)+"' " + |
| | | " or " + |
| | | " ( '"+DateUtil.getPlusTime(startTime)+"' < t.end_time AND t.end_time < '"+DateUtil.getPlusTime(endTime)+"' ) " + |
| | | " or " + |
| | | " ( '"+DateUtil.getPlusTime(startTime)+"' > t.start_time AND '"+DateUtil.getPlusTime(endTime)+"' < t.end_time )" + |
| | | " ) " )); |
| | | }catch (Exception e){ |
| | | } |
| | | return applyDetailList; |
| | | } |
| | | |
| | | public static void checkStaticMemberSolution(Integer solutionId,Integer memberId,String memberIdCard,String memberName,Date startTime, |
| | | Date endTime,ApplyDetailJoinMapper applyDetailJoinMapper){ |