瀏覽代碼

修改循环依赖

tags/24080901
PoffyZhang 1 年之前
父節點
當前提交
491d838f66
共有 4 個文件被更改,包括 58 次插入85 次删除
  1. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/BuildUserUtils.java
  2. +55
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java
  3. +0
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java
  4. +0
    -69
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java

+ 3
- 3
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<ProgressNode> progressInfo) {
Set<String> userSet = Sets.newHashSet();
@@ -37,7 +37,7 @@ public class BuildUserUtils {
userSet.add(node.getUserId());
}
});
Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByEmployeeCode(userSet);
Map<String, ProcessInstanceUserDto> userMap = userInfoManage.getUserMapByEmployeeCode(userSet);
buildUser(progressInfo,userMap);
}
private void buildUser(List<ProgressNode> progressInfo, Map<String, ProcessInstanceUserDto> userMap) {


+ 55
- 4
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<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;
}
}

+ 0
- 9
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;

/**
* <p>
@@ -16,11 +12,6 @@ import java.util.Set;
* @since 2023-02-01
*/
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);



+ 0
- 69
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;

/**
* <p>
* 服务实现类
@@ -33,63 +21,6 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo> implements IUserInfoService {
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
public UserInfo getUserInfoByPhoneNo(String phoneNo) {


Loading…
取消
儲存