@@ -2,7 +2,7 @@ package com.ningdatech.pmapi.todocenter.utils; | |||||
import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||
import com.google.common.collect.Sets; | 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.dto.ProcessInstanceUserDto; | ||||
import com.wflow.workflow.bean.process.ProgressNode; | import com.wflow.workflow.bean.process.ProgressNode; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -24,7 +24,7 @@ import java.util.Set; | |||||
@Component | @Component | ||||
public class BuildUserUtils { | public class BuildUserUtils { | ||||
private final IUserInfoService userInfoService; | |||||
private final UserInfoManage userInfoManage; | |||||
public void buildUserByProcessInfo(List<ProgressNode> progressInfo) { | public void buildUserByProcessInfo(List<ProgressNode> progressInfo) { | ||||
Set<String> userSet = Sets.newHashSet(); | Set<String> userSet = Sets.newHashSet(); | ||||
@@ -37,7 +37,7 @@ public class BuildUserUtils { | |||||
userSet.add(node.getUserId()); | userSet.add(node.getUserId()); | ||||
} | } | ||||
}); | }); | ||||
Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByEmployeeCode(userSet); | |||||
Map<String, ProcessInstanceUserDto> userMap = userInfoManage.getUserMapByEmployeeCode(userSet); | |||||
buildUser(progressInfo,userMap); | buildUser(progressInfo,userMap); | ||||
} | } | ||||
private void buildUser(List<ProgressNode> progressInfo, Map<String, ProcessInstanceUserDto> userMap) { | private void buildUser(List<ProgressNode> progressInfo, Map<String, ProcessInstanceUserDto> userMap) { | ||||
@@ -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.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | import com.ningdatech.pmapi.user.service.IUserInfoService; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
import java.time.LocalDateTime; | 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; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
@@ -427,4 +425,57 @@ public class UserInfoManage { | |||||
} | } | ||||
return resUserDetailVO; | return resUserDetailVO; | ||||
} | } | ||||
public Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers) { | |||||
List<UserInfo> 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<String, ProcessInstanceUserDto> getUserMapByEmployeeCode(Set<String> staterUsers) { | |||||
if(CollUtil.isEmpty(staterUsers)){ | |||||
return Collections.emptyMap(); | |||||
} | |||||
List<UserInfo> 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; | |||||
} | |||||
} | } |
@@ -2,10 +2,6 @@ package com.ningdatech.pmapi.user.service; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import com.ningdatech.pmapi.user.entity.UserInfo; | import com.ningdatech.pmapi.user.entity.UserInfo; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||||
import java.util.Map; | |||||
import java.util.Set; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -16,11 +12,6 @@ import java.util.Set; | |||||
* @since 2023-02-01 | * @since 2023-02-01 | ||||
*/ | */ | ||||
public interface IUserInfoService extends IService<UserInfo> { | public interface IUserInfoService extends IService<UserInfo> { | ||||
Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers); | |||||
Map<String, ProcessInstanceUserDto> getUserMapByEmployeeCode(Set<String> staterUsers); | |||||
ProcessInstanceUserDto getUserInfo(String userId); | |||||
UserInfo getUserInfoByPhoneNo(String phoneNo); | UserInfo getUserInfoByPhoneNo(String phoneNo); | ||||
@@ -1,26 +1,14 @@ | |||||
package com.ningdatech.pmapi.user.service.impl; | package com.ningdatech.pmapi.user.service.impl; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 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.entity.UserInfo; | ||||
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper; | 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.ningdatech.pmapi.user.service.IUserInfoService; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.*; | |||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 服务实现类 | * 服务实现类 | ||||
@@ -33,63 +21,6 @@ import java.util.stream.Collectors; | |||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo> implements IUserInfoService { | public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo> implements IUserInfoService { | ||||
private final NdUserInfoMapper userInfoMapper; | private final NdUserInfoMapper userInfoMapper; | ||||
private final UserInfoHelper userInfoHelper; | |||||
@Override | |||||
public Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers) { | |||||
List<UserInfo> 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<String, ProcessInstanceUserDto> getUserMapByEmployeeCode(Set<String> staterUsers) { | |||||
if(CollUtil.isEmpty(staterUsers)){ | |||||
return Collections.emptyMap(); | |||||
} | |||||
List<UserInfo> 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 | @Override | ||||
public UserInfo getUserInfoByPhoneNo(String phoneNo) { | public UserInfo getUserInfoByPhoneNo(String phoneNo) { | ||||