From 50fb58286ed3b718c39a97e0987ee7561a295651 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 04 七月 2025 17:56:41 +0800 Subject: [PATCH] git ch --- server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java | 99 +++++++++++++++++++++++++++++++++---------------- 1 files changed, 66 insertions(+), 33 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java index ed874fd..17d9b02 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java @@ -40,6 +40,8 @@ import java.math.BigDecimal; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -228,6 +230,13 @@ //浼佷笟浜哄憳鏌ョ湅鏈紒涓氭暟鎹� if(loginUserInfo.getType().equals(Constants.ONE)){ queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId()); +// .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id where a.member_id = t.id and b.company_id = "+loginUserInfo.getCompanyId()+" and b.status in (" + +// " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " + +// " and a.end_time >= now() ) ", Member::getValidNum ) +// +// .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id where a.member_id = t.id and b.company_id = "+loginUserInfo.getCompanyId()+" and b.status in (" + +// " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " + +// " and a.end_time < now() ) ", Member::getInvalidNum ); }else{ if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){ queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList()); @@ -235,44 +244,31 @@ queryWrapper.eq(InsuranceApply::getCompanyId, -1); } queryWrapper.eq(pageWrap.getModel().getCompanyId()!=null,InsuranceApply::getCompanyId, pageWrap.getModel().getCompanyId()); +// .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id where a.member_id = t.id and b.status in (" + +// " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " + +// " and a.end_time >= now() ) ", Member::getValidNum ) +// .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id where a.member_id = t.id and b.status in (" + +// " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " + +// " and a.end_time < now() ) ", Member::getInvalidNum ); } queryWrapper.selectAll(Member.class) - .selectAs(DispatchUnit::getName,Member::getDuName) - .selectAs(Worktype::getName,Member::getWorkTypeName) - .selectAs(Solutions::getName,Member::getSolutionName) - .selectAs(Company::getName,Member::getCompanyName) - .select(" case when now() between t.start_time and t.end_time then 1 else 2 end solutionsStatus ") - .leftJoin(InsuranceApply.class,InsuranceApply::getId,Member::getApplyId) - .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) - .leftJoin(DispatchUnit.class,DispatchUnit::getId,Member::getDuId) - .leftJoin(Worktype.class,Worktype::getId,Member::getWorktypeId) - .leftJoin(Company.class,Company::getId,Member::getCompanyId) .and(StringUtils.isNotBlank(memberQueryDTO.getKeywords()), i->i.like(Member::getName, memberQueryDTO.getKeywords()).or().like( Member::getIdcardNo,memberQueryDTO.getKeywords() )) .eq(Member::getIsdeleted, Constants.ZERO) -// .eq(Member::getCompanyId, memberQueryDTO.getCompanyId()) .like(StringUtils.isNotBlank(memberQueryDTO.getName()),Member::getName, memberQueryDTO.getName()) .like(StringUtils.isNotBlank(memberQueryDTO.getIdCard()),Member::getIdcardNo, memberQueryDTO.getIdCard()) .like(StringUtils.isNotBlank(memberQueryDTO.getIdcardNo()),Member::getIdcardNo, memberQueryDTO.getIdcardNo()) - .like(StringUtils.isNotBlank(memberQueryDTO.getDuName()),DispatchUnit::getName, memberQueryDTO.getDuName()) - .eq(!Objects.isNull(memberQueryDTO.getDuId()),Member::getDuId, memberQueryDTO.getDuId()) - .eq(!Objects.isNull(memberQueryDTO.getSolutionsId()),Solutions::getBaseId, memberQueryDTO.getSolutionsId()) - .apply(!Objects.isNull(memberQueryDTO.getSolutionsStatus())&&memberQueryDTO.getSolutionsStatus().equals(Constants.ONE),"now() between t.start_time and t.end_time") - .apply(!Objects.isNull(memberQueryDTO.getSolutionsStatus())&&memberQueryDTO.getSolutionsStatus().equals(Constants.TWO),"now() > t.end_time") + + .apply(!Objects.isNull(memberQueryDTO.getSolutionsId())," t.id in( select a.member_id from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id " + + "inner join solutions s on b.solution_id = s.id where s.base_id = '"+memberQueryDTO.getSolutionsId()+"' ) ") ; queryWrapper.orderByAsc(DispatchUnit::getName); queryWrapper.orderByAsc(Member::getName); -// for(PageWrap.SortData sortData: pageWrap.getSorts()) { -// if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { -// queryWrapper.orderByDesc(sortData.getProperty()); -// } else { -// queryWrapper.orderByAsc(sortData.getProperty()); -// } -// } PageData<Member> pageData = PageData.from(memberJoinMapper.selectJoinPage(page,Member.class, queryWrapper)); + this.getValidNum(pageData,loginUserInfo); Integer sn = 0; for (Member member:pageData.getRecords()) { sn = sn + 1; @@ -280,9 +276,40 @@ if(StringUtils.isNotBlank(member.getIdcardNo())){ member.setAge(Constants.getAgeByIdCard(member.getIdcardNo())); } + member.setTotalNum(member.getInvalidNum()+member.getValidNum()); } return pageData; } + + public void getValidNum(PageData<Member> pageData,LoginUserInfo loginUserInfo){ + List<Integer> listId = pageData.getRecords().stream().map(i->i.getId()).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(listId)){ + Integer companyId = null; + if(Objects.nonNull(loginUserInfo.getType())&&Constants.equalsInteger(loginUserInfo.getType(),Constants.ONE)){ + companyId = loginUserInfo.getShowCompany().getId(); + } + List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class, + new MPJLambdaWrapper<ApplyDetail>() + .select(ApplyDetail::getMemberId,ApplyDetail::getStartTime,ApplyDetail::getEndTime,ApplyDetail::getId) + .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId) + .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_DONE.getKey(),Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()) + .in(ApplyDetail::getMemberId,listId) + .eq(Objects.nonNull(companyId) + ,InsuranceApply::getCompanyId,companyId) + ); + + if(CollectionUtils.isNotEmpty(applyDetailList)){ + for (Member member:pageData.getRecords()) { + member.setInvalidNum(applyDetailList.stream().filter(i->Constants.equalsInteger(i.getMemberId(),member.getId())&&i.getEndTime().getTime()<System.currentTimeMillis()).collect(Collectors.toList()).size()); + member.setValidNum( + applyDetailList.stream().filter(i->Constants.equalsInteger(i.getMemberId(),member.getId())&&i.getEndTime().getTime()>=System.currentTimeMillis()).collect(Collectors.toList()).size() + ); + } + } + } + } + + @Override public long count(Member member) { @@ -387,9 +414,9 @@ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇烽�夋嫨鏈夋晥鐨勬柟妗堝啀杩涜鎿嶄綔锛�"); } LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); - if(!loginUserInfo.getType().equals(Constants.ONE)){ - throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氫汉鍛樻棤娉曡繘琛岃鎿嶄綔"); - } +// if(!loginUserInfo.getType().equals(Constants.ONE)){ +// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氫汉鍛樻棤娉曡繘琛岃鎿嶄綔"); +// } ExcelImporter ie = null; List<MemberReduceImport> dataList =null; try { @@ -403,9 +430,9 @@ } InsuranceApply insuranceApply = insuranceApplyMapper.selectById(applyId); - if (Objects.isNull(insuranceApply) || !Constants.equalsInteger(insuranceApply.getCompanyId(),loginUserInfo.getCompanyId())) { - throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝淇濆崟淇℃伅涓嶅瓨鍦紝璇峰埛鏂伴〉闈㈤噸璇曪紒"); - } +// if (Objects.isNull(insuranceApply) || !Constants.equalsInteger(insuranceApply.getCompanyId(),loginUserInfo.getCompanyId())) { +// throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝淇濆崟淇℃伅涓嶅瓨鍦紝璇峰埛鏂伴〉闈㈤噸璇曪紒"); +// } if (!(Constants.equalsInteger(insuranceApply.getStatus(), Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()) ||Constants.equalsInteger(insuranceApply.getStatus(), Constants.InsuranceApplyStatus.WTB_DONE.getKey()) )) { @@ -506,9 +533,9 @@ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇烽�夋嫨鏈夋晥鐨勬柟妗堝啀杩涜鎿嶄綔锛�"); } LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); - if(!loginUserInfo.getType().equals(Constants.ONE)){ - throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氫汉鍛樻棤娉曡繘琛岃鎿嶄綔"); - } +// if(!loginUserInfo.getType().equals(Constants.ONE)){ +// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氫汉鍛樻棤娉曡繘琛岃鎿嶄綔"); +// } if(Objects.isNull(solutionId)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍙傛暟閿欒 - 鏂规淇℃伅"); } @@ -573,9 +600,15 @@ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝淇濋櫓鏂规涓嬫湭鏌ヨ鍒板伐绉嶄俊鎭�"); } } - + //String pattern = "^[\\u4e00-\\u9fa5\\d路]+$"; + String pattern = "^[\\u4e00-\\u9fa5路]*$"; + Pattern r = Pattern.compile(pattern); index = Constants.TWO; for(MemberImport model : dataList){ + Matcher m = r.matcher(model.getName()); + if (!m.matches()) { + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝"+model.getName() + "濮撳悕鏃犳晥锛岃妫�鏌ュ悗閲嶈瘯"); + } //妫�鏌ユ淳閬e崟浣嶅拰宸ョ鏈夋晥鎬� dealDuAndWorktype(model,index,dispatchUnitList,solutions,solutionWorktypeList); index += 1; -- Gitblit v1.9.3