liuxinxin hace 1 año
padre
commit
7ae6a1c7ce
Se han modificado 2 ficheros con 27 adiciones y 6 borrados
  1. +26
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java

+ 26
- 5
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java Ver fichero

@@ -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<ResUserInfoListVO> resUserInfoListVOList = 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<>();
if (CollUtil.isNotEmpty(employeeCodeList)) {
employeeCodeAvailableMap = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class)
.in(UserInfo::getEmployeeCode,employeeCodeList))
.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, Function.identity()));
}


Map<String, UserInfo> 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);


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java Ver fichero

@@ -41,7 +41,7 @@ public class ResUserInfoListVO {
private List<Role> userRoleList;

@ApiModelProperty("状态")
private Boolean status;
private String status;

@ApiModelProperty("更新时间")
private LocalDateTime updateTime;


Cargando…
Cancelar
Guardar