From 2f31a0604742b211328f2d8e05e2036da8248e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Fri, 24 Mar 2023 11:09:38 +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=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2=E6=9F=A5?= =?UTF-8?q?=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 | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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 713cdfc..f22d462 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 @@ -55,11 +55,15 @@ public class UserInfoManage { String phoneNo = reqUserInfoListPO.getPhoneNo(); String orgCode = reqUserInfoListPO.getOrgCode(); String name = reqUserInfoListPO.getName(); + + List roleCompliantEmployeeCodeList = getRoleCompliantEmployeeCodeList(reqUserInfoListPO.getUserRoleList()); + 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); + .like(StringUtils.isNotBlank(name), DingEmployeeInfo::getEmployeeName, name) + .in(Objects.nonNull(roleCompliantEmployeeCodeList),DingEmployeeInfo::getEmployeeCode,roleCompliantEmployeeCodeList); Page page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper); List records = page.getRecords(); @@ -112,6 +116,32 @@ public class UserInfoManage { } /** + * 获取符合查询条件的 用户 employeeCode + * + * @param userRoleList + */ + private List getRoleCompliantEmployeeCodeList(List userRoleList) { + if (CollUtil.isEmpty(userRoleList)) { + return null; + } + List roleIdList = iUserRoleService.list() + .stream().map(UserRole::getRoleId).collect(Collectors.toList()); + + List compliantUserIdList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .in(UserRole::getRoleId, roleIdList)).stream().map(UserRole::getUserId).distinct().collect(Collectors.toList()); + if (CollUtil.isEmpty(compliantUserIdList)) { + return new ArrayList<>(); + } + + // TODO 这里过滤的非浙政钉用户的专家 后续需要增加补充逻辑 + return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getId, compliantUserIdList)) + .stream().filter(r -> StringUtils.isNotBlank(r.getEmployeeCode())) + .map(UserInfo::getEmployeeCode).collect(Collectors.toList()); + + } + + /** * 装配用户状态 及 userId * * @param resListVO