瀏覽代碼

fix 成员管理页面用户角色查询无效

tags/24080901
niohe·erbao 1 年之前
父節點
當前提交
2f31a06047
共有 1 個檔案被更改,包括 31 行新增1 行删除
  1. +31
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java

+ 31
- 1
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<String> roleCompliantEmployeeCodeList = getRoleCompliantEmployeeCodeList(reqUserInfoListPO.getUserRoleList());

LambdaQueryWrapper<DingEmployeeInfo> 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<DingEmployeeInfo> page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper);
List<DingEmployeeInfo> records = page.getRecords();
@@ -112,6 +116,32 @@ public class UserInfoManage {
}

/**
* 获取符合查询条件的 用户 employeeCode
*
* @param userRoleList
*/
private List<String> getRoleCompliantEmployeeCodeList(List<UserRoleVO> userRoleList) {
if (CollUtil.isEmpty(userRoleList)) {
return null;
}
List<Long> roleIdList = iUserRoleService.list()
.stream().map(UserRole::getRoleId).collect(Collectors.toList());

List<Long> 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


Loading…
取消
儲存