Browse Source

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

tags/24080901
niohe·erbao 1 year ago
parent
commit
2f31a06047
1 changed files with 31 additions and 1 deletions
  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 View File

@@ -55,11 +55,15 @@ public class UserInfoManage {
String phoneNo = reqUserInfoListPO.getPhoneNo(); String phoneNo = reqUserInfoListPO.getPhoneNo();
String orgCode = reqUserInfoListPO.getOrgCode(); String orgCode = reqUserInfoListPO.getOrgCode();
String name = reqUserInfoListPO.getName(); String name = reqUserInfoListPO.getName();

List<String> roleCompliantEmployeeCodeList = getRoleCompliantEmployeeCodeList(reqUserInfoListPO.getUserRoleList());

LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getMainJob, "true") .eq(DingEmployeeInfo::getMainJob, "true")
.eq(StringUtils.isNotBlank(orgCode), DingEmployeeInfo::getOrganizationCode, orgCode) .eq(StringUtils.isNotBlank(orgCode), DingEmployeeInfo::getOrganizationCode, orgCode)
.like(StringUtils.isNotBlank(phoneNo), DingEmployeeInfo::getBindUserMobile, phoneNo) .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); Page<DingEmployeeInfo> page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper);
List<DingEmployeeInfo> records = page.getRecords(); 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 * 装配用户状态 及 userId
* *
* @param resListVO * @param resListVO


Loading…
Cancel
Save