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