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 fcee3b0..f6dad91 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 @@ -29,9 +29,8 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -58,6 +57,18 @@ public class UserInfoManage { long total = page.getTotal(); List resUserInfoListVOList = new ArrayList<>(); if (records != null && records.size() > 0) { + List employeeCodeList = records.stream().map(DingEmployeeInfo::getEmployeeCode) + .distinct().collect(Collectors.toList()); + + Map employeeCodeAvailableMap = new HashMap<>(); + if (CollUtil.isNotEmpty(employeeCodeList)) { + employeeCodeAvailableMap = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getEmployeeCode,employeeCodeList)) + .stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, Function.identity())); + } + + + Map finalEmployeeCodeAvailableMap = employeeCodeAvailableMap; resUserInfoListVOList = records.stream() .map(r -> { ResUserInfoListVO resListVO = new ResUserInfoListVO(); @@ -65,10 +76,20 @@ public class UserInfoManage { resListVO.setOrgName(r.getOrganizationCode()); resListVO.setOrgCode(r.getOrganizationCode()); // TODO 从用户信息中获取 -// resListVO.setPhoneNo(); + // 从所属组织中获取 // resListVO.setRegionId(); - resListVO.setStatus(false); + + 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.setUpdateTime(r.getUpdateOn()); // 从用户信息中获取 resListVO.setUserId(1L); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java index a16ee03..8b189ca 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java @@ -41,7 +41,7 @@ public class ResUserInfoListVO { private List userRoleList; @ApiModelProperty("状态") - private Boolean status; + private String status; @ApiModelProperty("更新时间") private LocalDateTime updateTime;