From fd4c5fd0d635d057f7adc7bbd7520741bf50a2c7 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 30 Mar 2023 14:24:46 +0800 Subject: [PATCH] =?UTF-8?q?debug=20=E7=94=A8=E6=88=B7id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/todocenter/utils/BuildUserUtils.java | 2 +- .../pmapi/user/service/IUserInfoService.java | 2 ++ .../user/service/impl/UserInfoServiceImpl.java | 28 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/BuildUserUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/BuildUserUtils.java index b7dd4a0..9bc2021 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/BuildUserUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/BuildUserUtils.java @@ -37,7 +37,7 @@ public class BuildUserUtils { userSet.add(node.getUserId()); } }); - Map userMap = userInfoService.getUserMapByIds(userSet); + Map userMap = userInfoService.getUserMapByEmployeeCode(userSet); buildUser(progressInfo,userMap); } private void buildUser(List progressInfo, Map userMap) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java index c87664f..78088d8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java @@ -18,6 +18,8 @@ import java.util.Set; public interface IUserInfoService extends IService { Map getUserMapByIds(Set staterUsers); + Map getUserMapByEmployeeCode(Set staterUsers); + ProcessInstanceUserDto getUserInfo(String userId); UserInfo getUserInfoByPhoneNo(String phoneNo); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java index bdf3546..3c7c873 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java @@ -66,6 +66,34 @@ public class UserInfoServiceImpl extends ServiceImpl } @Override + public Map getUserMapByEmployeeCode(Set staterUsers) { + List userInfos = userInfoMapper.selectList(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode,staterUsers)); + return userInfos.stream().map(u -> { + ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); + userInfo.setUserId(String.valueOf(u.getId())); + userInfo.setUserName(u.getRealName()); + Long accountId = u.getAccountId(); + if (Objects.isNull(accountId)) { + throw new BizException("该用户没有录入浙政钉用户信息!"); + } + // 根据浙政钉用户ID获取单位code + DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getAccountId, accountId) + .eq(DingEmployeeInfo::getMainJob, String.valueOf(Boolean.TRUE)) + .last("limit 1")); + String organizationCode = employeeInfo.getOrganizationCode(); + // 根据 单位code获取单位名称 + DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, organizationCode).last("limit 1")); + String organizationName = dingOrganization.getOrganizationName(); + userInfo.setOrgCode(organizationCode); + userInfo.setOrgName(organizationName); + return userInfo; + }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); + } + + @Override public ProcessInstanceUserDto getUserInfo(String userId) { UserInfo userInfo = userInfoMapper.selectById(Long.valueOf(userId)); ProcessInstanceUserDto processInstanceUserDto = new ProcessInstanceUserDto();