|
|
@@ -52,9 +52,15 @@ public class UserInfoManage { |
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
|
|
|
|
|
public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { |
|
|
|
|
|
|
|
String phoneNo = reqUserInfoListPO.getPhoneNo(); |
|
|
|
String orgCode = reqUserInfoListPO.getOrgCode(); |
|
|
|
String name = reqUserInfoListPO.getName(); |
|
|
|
LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) |
|
|
|
.eq(DingEmployeeInfo::getMainJob, "true") |
|
|
|
.eq(StringUtils.isNotBlank(reqUserInfoListPO.getOrgCode()), DingEmployeeInfo::getOrganizationCode, reqUserInfoListPO.getOrgCode()); |
|
|
|
.eq(StringUtils.isNotBlank(orgCode), DingEmployeeInfo::getOrganizationCode, orgCode) |
|
|
|
.like(StringUtils.isNotBlank(phoneNo), DingEmployeeInfo::getBindUserMobile, phoneNo) |
|
|
|
.like(StringUtils.isNotBlank(name), DingEmployeeInfo::getEmployeeName, name); |
|
|
|
|
|
|
|
Page<DingEmployeeInfo> page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper); |
|
|
|
List<DingEmployeeInfo> records = page.getRecords(); |
|
|
@@ -70,32 +76,28 @@ public class UserInfoManage { |
|
|
|
.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() |
|
|
|
.collect(Collectors.toList()); |
|
|
|
Map<String, String> orgCodeAndNameMap = iDingOrganizationService.getOrgCodeAndNameMap(orgCodeList); |
|
|
|
|
|
|
|
Map<String, UserInfo> finalEmployeeCodeAvailableMap = employeeCodeAvailableMap; |
|
|
|
resUserInfoListVOList = records.stream() |
|
|
|
.map(r -> { |
|
|
|
ResUserInfoListVO resListVO = new ResUserInfoListVO(); |
|
|
|
resListVO.setName(r.getEmployeeName()); |
|
|
|
resListVO.setOrgName(r.getOrganizationCode()); |
|
|
|
resListVO.setOrgCode(r.getOrganizationCode()); |
|
|
|
String organizationCode = r.getOrganizationCode(); |
|
|
|
if (StringUtils.isNotBlank(organizationCode)) { |
|
|
|
resListVO.setOrgName(orgCodeAndNameMap.get(organizationCode)); |
|
|
|
resListVO.setOrgCode(organizationCode); |
|
|
|
} |
|
|
|
// TODO 从用户信息中获取 |
|
|
|
// 从所属组织中获取 |
|
|
|
// resListVO.setRegionId(); |
|
|
|
|
|
|
|
UserInfo userInfo = finalEmployeeCodeAvailableMap.get(r.getEmployeeCode()); |
|
|
|
if (Objects.nonNull(userInfo)) { |
|
|
|
resListVO.setPhoneNo(userInfo.getMobile()); |
|
|
|
if (StringUtils.isNotBlank(userInfo.getAvailable()) |
|
|
|
&& UserAvailableEnum.ENABLE.name().equals(userInfo.getAvailable())) { |
|
|
|
resListVO.setStatus(UserAvailableEnum.ENABLE.name()); |
|
|
|
} else { |
|
|
|
resListVO.setStatus(UserAvailableEnum.DISABLE.name()); |
|
|
|
} |
|
|
|
resListVO.setUserId(userInfo.getId()); |
|
|
|
} else { |
|
|
|
resListVO.setStatus(UserAvailableEnum.DISABLE.name()); |
|
|
|
} |
|
|
|
// 装配用户状态 及 userId |
|
|
|
userStatusAssembler(resListVO, userInfo); |
|
|
|
resListVO.setUpdateTime(r.getUpdateOn()); |
|
|
|
// 从用户信息中获取 |
|
|
|
resListVO.setEmployeeCode(r.getEmployeeCode()); |
|
|
@@ -110,6 +112,27 @@ public class UserInfoManage { |
|
|
|
return pageVo; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 装配用户状态 及 userId |
|
|
|
* |
|
|
|
* @param resListVO |
|
|
|
* @param userInfo |
|
|
|
*/ |
|
|
|
private void userStatusAssembler(ResUserInfoListVO resListVO, UserInfo userInfo) { |
|
|
|
if (Objects.nonNull(userInfo)) { |
|
|
|
resListVO.setPhoneNo(userInfo.getMobile()); |
|
|
|
if (StringUtils.isNotBlank(userInfo.getAvailable()) |
|
|
|
&& UserAvailableEnum.ENABLE.name().equals(userInfo.getAvailable())) { |
|
|
|
resListVO.setStatus(UserAvailableEnum.ENABLE.name()); |
|
|
|
} else { |
|
|
|
resListVO.setStatus(UserAvailableEnum.DISABLE.name()); |
|
|
|
} |
|
|
|
resListVO.setUserId(userInfo.getId()); |
|
|
|
} else { |
|
|
|
resListVO.setStatus(UserAvailableEnum.DISABLE.name()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<UserRoleVO> getUserRoleVOList(Long userId) { |
|
|
|
List<UserRoleVO> userRoleInfoList = new ArrayList<>(); |
|
|
|