|
|
@@ -83,59 +83,63 @@ public class UserInfoManage { |
|
|
|
Page<DingEmployeeInfo> page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper); |
|
|
|
List<DingEmployeeInfo> records = page.getRecords(); |
|
|
|
long total = page.getTotal(); |
|
|
|
List<ResUserInfoListVO> resUserInfoListVOList = new ArrayList<>(); |
|
|
|
List<ResUserInfoListVO> result = new ArrayList<>(); |
|
|
|
if (records != null && records.size() > 0) { |
|
|
|
List<String> employeeCodeList = records.stream().map(DingEmployeeInfo::getEmployeeCode) |
|
|
|
.distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
Map<String, UserInfo> employeeCodeAvailableMap = new HashMap<>(); |
|
|
|
Map<String, UserInfo> employeeCodeAvailableMap = new HashMap<>(16); |
|
|
|
if (CollUtil.isNotEmpty(employeeCodeList)) { |
|
|
|
employeeCodeAvailableMap = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) |
|
|
|
.in(UserInfo::getEmployeeCode, employeeCodeList)) |
|
|
|
.in(UserInfo::getEmployeeCode, employeeCodeList)) |
|
|
|
.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, Function.identity())); |
|
|
|
} |
|
|
|
List<String> orgCodeList = records.stream() |
|
|
|
.filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) |
|
|
|
.map(DingEmployeeInfo::getOrganizationCode).distinct() |
|
|
|
.map(DingEmployeeInfo::getOrganizationCode) |
|
|
|
.filter(StringUtils::isNotBlank).distinct() |
|
|
|
.collect(Collectors.toList()); |
|
|
|
Map<String, DingOrganization> orgMap = iDingOrganizationService.getOrgMap(orgCodeList); |
|
|
|
|
|
|
|
Map<String, UserInfo> finalEmployeeCodeAvailableMap = employeeCodeAvailableMap; |
|
|
|
resUserInfoListVOList = records.stream() |
|
|
|
.map(r -> { |
|
|
|
ResUserInfoListVO resListVO = new ResUserInfoListVO(); |
|
|
|
resListVO.setName(r.getEmployeeName()); |
|
|
|
String organizationCode = r.getOrganizationCode(); |
|
|
|
if (StringUtils.isNotBlank(organizationCode) && orgMap.containsKey(organizationCode)) { |
|
|
|
resListVO.setOrgName(orgMap.get(organizationCode).getOrganizationName()); |
|
|
|
resListVO.setOrgCode(organizationCode); |
|
|
|
String regionCode = orgMap.get(organizationCode).getDivisionCode(); |
|
|
|
resListVO.setRegionCode(regionCode); |
|
|
|
if (Objects.nonNull(regionCode)) { |
|
|
|
resListVO.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY)); |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO 从用户信息中获取 |
|
|
|
// 从所属组织中获取 |
|
|
|
// resListVO.setRegionId(); |
|
|
|
UserInfo userInfo = finalEmployeeCodeAvailableMap.get(r.getEmployeeCode()); |
|
|
|
// 装配用户状态 及 userId |
|
|
|
userStatusAssembler(resListVO, userInfo); |
|
|
|
|
|
|
|
if (Objects.isNull(userInfo)) { |
|
|
|
resListVO.setUpdateTime(r.getUpdateOn()); |
|
|
|
} else { |
|
|
|
resListVO.setUpdateTime(userInfo.getUpdateOn()); |
|
|
|
} |
|
|
|
// 从用户信息中获取 |
|
|
|
resListVO.setEmployeeCode(r.getEmployeeCode()); |
|
|
|
resListVO.setUserRoleList(getUserRoleVOList(resListVO.getUserId())); |
|
|
|
return resListVO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
records.forEach(r -> { |
|
|
|
ResUserInfoListVO resListVO = new ResUserInfoListVO(); |
|
|
|
resListVO.setName(r.getEmployeeName()); |
|
|
|
String organizationCode = r.getOrganizationCode(); |
|
|
|
if (StringUtils.isNotBlank(organizationCode) && orgMap.containsKey(organizationCode)) { |
|
|
|
resListVO.setOrgName(orgMap.get(organizationCode).getOrganizationName()); |
|
|
|
resListVO.setOrgCode(organizationCode); |
|
|
|
String regionCode = orgMap.get(organizationCode).getDivisionCode(); |
|
|
|
resListVO.setRegionCode(regionCode); |
|
|
|
if (Objects.nonNull(regionCode)) { |
|
|
|
resListVO.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY)); |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO 从用户信息中获取 |
|
|
|
// 从所属组织中获取 |
|
|
|
// resListVO.setRegionId(); |
|
|
|
UserInfo userInfo = finalEmployeeCodeAvailableMap.get(r.getEmployeeCode()); |
|
|
|
// 装配用户状态 及 userId |
|
|
|
userStatusAssembler(resListVO, userInfo); |
|
|
|
|
|
|
|
if (Objects.isNull(userInfo)) { |
|
|
|
resListVO.setUpdateTime(r.getUpdateOn()); |
|
|
|
} else { |
|
|
|
resListVO.setUpdateTime(userInfo.getUpdateOn()); |
|
|
|
} |
|
|
|
// 从用户信息中获取 |
|
|
|
resListVO.setEmployeeCode(r.getEmployeeCode()); |
|
|
|
List<UserRoleVO> userRoles = getUserRoleVOList(resListVO.getUserId()); |
|
|
|
resListVO.setUserRoleList(userRoles); |
|
|
|
LocalDateTime roleModifyTime; |
|
|
|
if ((roleModifyTime = userRoles.get(userRoles.size() - 1).getCreateOn()).isAfter(resListVO.getUpdateTime()) |
|
|
|
&& CollUtil.isNotEmpty(userRoles)) { |
|
|
|
resListVO.setUpdateTime(roleModifyTime); |
|
|
|
} |
|
|
|
result.add(resListVO); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
pageVo.setTotal(total); |
|
|
|
pageVo.setRecords(resUserInfoListVOList); |
|
|
|
pageVo.setRecords(result); |
|
|
|
return pageVo; |
|
|
|
} |
|
|
|
|
|
|
@@ -172,7 +176,7 @@ public class UserInfoManage { |
|
|
|
|
|
|
|
// TODO 这里过滤的非浙政钉用户的专家 后续需要增加补充逻辑 |
|
|
|
return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) |
|
|
|
.in(UserInfo::getId, compliantUserIdList)) |
|
|
|
.in(UserInfo::getId, compliantUserIdList)) |
|
|
|
.stream().filter(r -> StringUtils.isNotBlank(r.getEmployeeCode())) |
|
|
|
.map(UserInfo::getEmployeeCode).collect(Collectors.toList()); |
|
|
|
|
|
|
@@ -214,6 +218,7 @@ public class UserInfoManage { |
|
|
|
UserRoleVO userRoleVO = new UserRoleVO(); |
|
|
|
userRoleVO.setId(r.getId()); |
|
|
|
userRoleVO.setName(r.getName()); |
|
|
|
userRoleVO.setCreateOn(r.getCreateOn()); |
|
|
|
return userRoleVO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|