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 9bc2021..bf1d439 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 @@ -2,7 +2,7 @@ package com.ningdatech.pmapi.todocenter.utils; import cn.hutool.core.collection.CollUtil; import com.google.common.collect.Sets; -import com.ningdatech.pmapi.user.service.IUserInfoService; +import com.ningdatech.pmapi.user.manage.UserInfoManage; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import com.wflow.workflow.bean.process.ProgressNode; import lombok.RequiredArgsConstructor; @@ -24,7 +24,7 @@ import java.util.Set; @Component public class BuildUserUtils { - private final IUserInfoService userInfoService; + private final UserInfoManage userInfoManage; public void buildUserByProcessInfo(List progressInfo) { Set userSet = Sets.newHashSet(); @@ -37,7 +37,7 @@ public class BuildUserUtils { userSet.add(node.getUserId()); } }); - Map userMap = userInfoService.getUserMapByEmployeeCode(userSet); + Map userMap = userInfoManage.getUserMapByEmployeeCode(userSet); buildUser(progressInfo,userMap); } private void buildUser(List progressInfo, Map userMap) { 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 5a7ac45..2556ea8 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 @@ -30,15 +30,13 @@ import com.ningdatech.pmapi.user.model.vo.UserRoleVO; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; +import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import lombok.RequiredArgsConstructor; 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.Map; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -427,4 +425,57 @@ public class UserInfoManage { } return resUserDetailVO; } + + public Map getUserMapByIds(Set staterUsers) { + List userInfos = iUserInfoService.listByIds(staterUsers); + return userInfos.stream().map(u -> { + ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); + userInfo.setUserId(u.getEmployeeCode()); + userInfo.setUserName(u.getRealName()); + // 根据 单位code获取单位名称 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); + if(Objects.nonNull(userFullInfo)){ + userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); + userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); + } + return userInfo; + }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); + } + + public Map getUserMapByEmployeeCode(Set staterUsers) { + if(CollUtil.isEmpty(staterUsers)){ + return Collections.emptyMap(); + } + List userInfos = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getEmployeeCode,staterUsers)); + if(CollUtil.isEmpty(userInfos)){ + return Collections.emptyMap(); + } + return userInfos.stream().map(u -> { + ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); + userInfo.setUserId(u.getEmployeeCode()); + userInfo.setUserName(u.getRealName()); + // 根据 单位code获取单位名称 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); + if(Objects.nonNull(userFullInfo)){ + userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); + userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); + } + return userInfo; + }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); + } + + public ProcessInstanceUserDto getUserInfo(String userId) { + UserInfo userInfo = iUserInfoService.getById(userId); + ProcessInstanceUserDto processInstanceUserDto = new ProcessInstanceUserDto(); + processInstanceUserDto.setUserId(String.valueOf(userInfo.getId())); + processInstanceUserDto.setUserName(userInfo.getRealName()); + // 根据 单位code获取单位名称 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userInfo.getId()); + if(Objects.nonNull(userFullInfo)){ + processInstanceUserDto.setOrgCode(userFullInfo.getEmpPosUnitCode()); + processInstanceUserDto.setOrgName(userFullInfo.getEmpPosUnitName()); + } + return processInstanceUserDto; + } } 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 78088d8..a5ef005 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 @@ -2,10 +2,6 @@ package com.ningdatech.pmapi.user.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ningdatech.pmapi.user.entity.UserInfo; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; - -import java.util.Map; -import java.util.Set; /** *

@@ -16,11 +12,6 @@ import java.util.Set; * @since 2023-02-01 */ 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 4baf766..929cf3c 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 @@ -1,26 +1,14 @@ package com.ningdatech.pmapi.user.service.impl; -import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.common.helper.UserInfoHelper; -import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; -import com.ningdatech.pmapi.organization.model.entity.DingOrganization; -import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; -import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper; -import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.service.IUserInfoService; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; -import java.util.*; -import java.util.stream.Collectors; - /** *

* 服务实现类 @@ -33,63 +21,6 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class UserInfoServiceImpl extends ServiceImpl implements IUserInfoService { private final NdUserInfoMapper userInfoMapper; - private final UserInfoHelper userInfoHelper; - - @Override - public Map getUserMapByIds(Set staterUsers) { - List userInfos = userInfoMapper.selectBatchIds(staterUsers); - return userInfos.stream().map(u -> { - ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); - userInfo.setUserId(u.getEmployeeCode()); - userInfo.setUserName(u.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); - if(Objects.nonNull(userFullInfo)){ - userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); - userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); - } - return userInfo; - }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); - } - - @Override - public Map getUserMapByEmployeeCode(Set staterUsers) { - if(CollUtil.isEmpty(staterUsers)){ - return Collections.emptyMap(); - } - List userInfos = userInfoMapper.selectList(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getEmployeeCode,staterUsers)); - if(CollUtil.isEmpty(userInfos)){ - return Collections.emptyMap(); - } - return userInfos.stream().map(u -> { - ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); - userInfo.setUserId(u.getEmployeeCode()); - userInfo.setUserName(u.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); - if(Objects.nonNull(userFullInfo)){ - userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); - userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); - } - 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(); - processInstanceUserDto.setUserId(String.valueOf(userInfo.getId())); - processInstanceUserDto.setUserName(userInfo.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userInfo.getId()); - if(Objects.nonNull(userFullInfo)){ - processInstanceUserDto.setOrgCode(userFullInfo.getEmpPosUnitCode()); - processInstanceUserDto.setOrgName(userFullInfo.getEmpPosUnitName()); - } - return processInstanceUserDto; - } @Override public UserInfo getUserInfoByPhoneNo(String phoneNo) {