From d12c553274ba5f76d8bd993547dc746632630fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Fri, 24 Mar 2023 11:19:12 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=88=90=E5=91=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=89=80=E5=9C=A8=E5=8D=95=E4=BD=8D=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/user/manage/UserInfoManage.java | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index f22d462..9b82d84 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -9,6 +9,7 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; +import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.sys.model.entity.Role; @@ -52,18 +53,28 @@ public class UserInfoManage { private final UserInfoHelper userInfoHelper; public PageVo list(ReqUserInfoListPO reqUserInfoListPO) { + PageVo pageVo = new PageVo<>(); + String phoneNo = reqUserInfoListPO.getPhoneNo(); String orgCode = reqUserInfoListPO.getOrgCode(); String name = reqUserInfoListPO.getName(); List roleCompliantEmployeeCodeList = getRoleCompliantEmployeeCodeList(reqUserInfoListPO.getUserRoleList()); + if (roleCompliantEmployeeCodeList != null && roleCompliantEmployeeCodeList.size() == 0) { + return pageVo; + } + List orgNameCompliantOrgCodeList = getOrgNameCompliantOrgCodeList(reqUserInfoListPO.getOrgName()); + if (orgNameCompliantOrgCodeList != null && orgNameCompliantOrgCodeList.size() == 0) { + return pageVo; + } LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) .eq(DingEmployeeInfo::getMainJob, "true") .eq(StringUtils.isNotBlank(orgCode), DingEmployeeInfo::getOrganizationCode, orgCode) .like(StringUtils.isNotBlank(phoneNo), DingEmployeeInfo::getBindUserMobile, phoneNo) .like(StringUtils.isNotBlank(name), DingEmployeeInfo::getEmployeeName, name) - .in(Objects.nonNull(roleCompliantEmployeeCodeList),DingEmployeeInfo::getEmployeeCode,roleCompliantEmployeeCodeList); + .in(Objects.nonNull(roleCompliantEmployeeCodeList), DingEmployeeInfo::getEmployeeCode, roleCompliantEmployeeCodeList) + .in(Objects.nonNull(orgNameCompliantOrgCodeList), DingEmployeeInfo::getOrganizationCode, orgNameCompliantOrgCodeList); Page page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper); List records = page.getRecords(); @@ -109,12 +120,24 @@ public class UserInfoManage { }).collect(Collectors.toList()); } - PageVo pageVo = new PageVo<>(); pageVo.setTotal(total); pageVo.setRecords(resUserInfoListVOList); return pageVo; } + private List getOrgNameCompliantOrgCodeList(String orgName) { + if (StringUtils.isBlank(orgName)) { + return null; + } + List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .like(DingOrganization::getOrganizationName, orgName)); + + List orgCodeList = dingOrganizationList.stream() + .map(DingOrganization::getOrganizationCode) + .collect(Collectors.toList()); + return orgCodeList; + } + /** * 获取符合查询条件的 用户 employeeCode *