update
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.60" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tika:tika-core:1.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
||||
@@ -32,8 +31,6 @@
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
||||
@@ -51,8 +48,6 @@
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||
@@ -64,9 +59,6 @@
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||
@@ -120,5 +112,12 @@
|
||||
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -45,6 +45,20 @@
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>ons20190214</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>5.3.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -7,10 +7,10 @@ import com.aliyun.openservices.ons.api.Message;
|
||||
import com.aliyun.openservices.ons.api.MessageListener;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dto.enterprise.EnterpriseInitDTO;
|
||||
import com.cool.store.enums.AppTypeEnum;
|
||||
import com.cool.store.enums.EnterpriseStatusEnum;
|
||||
import com.cool.store.service.EnterpriseInitService;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.coolstore.base.enums.AppTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.aliyun.openservices.ons.api.ConsumeContext;
|
||||
import com.aliyun.openservices.ons.api.Message;
|
||||
import com.aliyun.openservices.ons.api.MessageListener;
|
||||
import com.cool.store.dto.enterprise.EnterpriseOpenMsg;
|
||||
import com.cool.store.enums.RocketMqTagEnum;
|
||||
import com.cool.store.service.EnterpriseInitService;
|
||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.cool.store.dto.enterprise.AuthScopeDTO;
|
||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||
import com.cool.store.dto.enterprise.SysDepartmentDTO;
|
||||
import com.cool.store.dto.login.UserIdInfoDTO;
|
||||
import com.cool.store.dto.response.ResultDTO;
|
||||
import com.cool.store.utils.RestTemplateUtil;
|
||||
import com.coolstore.base.dto.ResultDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.cool.store.http;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||
import com.cool.store.dto.wx.CodeSessionDTO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.utils.RestTemplateUtil;
|
||||
import com.coolstore.base.dto.ResultDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.crypto.hash.Hash;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cool.store.mq;
|
||||
|
||||
import com.aliyun.openservices.ons.api.SendResult;
|
||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||
import com.cool.store.enums.RocketMqTagEnum;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cool.store.mq;
|
||||
|
||||
import com.aliyun.openservices.ons.api.SendCallback;
|
||||
import com.aliyun.openservices.ons.api.SendResult;
|
||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||
import com.cool.store.enums.RocketMqTagEnum;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
|
||||
@@ -4,10 +4,10 @@ import com.aliyun.openservices.ons.api.Message;
|
||||
import com.aliyun.openservices.ons.api.SendResult;
|
||||
import com.aliyun.openservices.ons.api.bean.OrderProducerBean;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.enums.RocketMqTagEnum;
|
||||
import com.cool.store.mq.OrderMessageService;
|
||||
import com.cool.store.mq.RocketMqConfig;
|
||||
import com.cool.store.utils.UUIDUtils;
|
||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
@@ -6,10 +6,10 @@ import com.aliyun.openservices.ons.api.SendCallback;
|
||||
import com.aliyun.openservices.ons.api.SendResult;
|
||||
import com.aliyun.openservices.ons.api.bean.ProducerBean;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.enums.RocketMqTagEnum;
|
||||
import com.cool.store.mq.RocketMqConfig;
|
||||
import com.cool.store.mq.SimpleMessageService;
|
||||
import com.cool.store.utils.UUIDUtils;
|
||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.aliyun.ons20190214.*;
|
||||
import com.aliyun.ons20190214.models.*;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.coolstore.base.enums.RocketMqGroupEnum;
|
||||
import com.cool.store.enums.RocketMqGroupEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.auth.AuthRegionStoreDTO;
|
||||
import com.cool.store.dto.auth.AuthRegionStoreUserDTO;
|
||||
import com.cool.store.dto.auth.AuthStoreCountDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* describe:可视化权限服务
|
||||
*
|
||||
* @author zhouyiping
|
||||
* @date 2020/10/14
|
||||
*/
|
||||
public interface AuthVisualService {
|
||||
|
||||
/**
|
||||
* do
|
||||
* 查询权限区域/门店(配置区域使用)
|
||||
* @param eid
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<AuthRegionStoreUserDTO> authRegionStore(String eid, String userId);
|
||||
|
||||
|
||||
/**
|
||||
* do
|
||||
* 查询权限区域/门店(配置区域使用)
|
||||
* @param eid
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
List<AuthRegionStoreDTO> authRegionStoreByUserList(String eid, List<String> userIdList);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* do
|
||||
* 获取人员拥有的门店总数
|
||||
* @param eid
|
||||
* @param userId
|
||||
* @param isReturnList 是否返回门店列表
|
||||
* @return
|
||||
*/
|
||||
List<AuthStoreCountDTO> authStoreCount(String eid, List<String> userId, Boolean isReturnList);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.enterprise.EnterpriseOpenMsg;
|
||||
import com.coolstore.base.enums.AppTypeEnum;
|
||||
import com.cool.store.enums.AppTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.context.CurrentUser;
|
||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||
import com.cool.store.dto.usergroup.UserGroupAddRequest;
|
||||
import com.cool.store.dto.usergroup.UserGroupDTO;
|
||||
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||
import com.cool.store.vo.usergroup.UserGroupVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author wxp
|
||||
* @Date 2022/12/29 11:18
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface EnterpriseUserGroupService {
|
||||
|
||||
/**
|
||||
* 增加用户分组
|
||||
* @param enterpriseId
|
||||
* @param userGroupAddRequest
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
Boolean saveOrUpdateUserGroup(String enterpriseId, UserGroupAddRequest userGroupAddRequest, CurrentUser user);
|
||||
|
||||
Boolean updateUserGroup(String enterpriseId,Long userGroupId,List<String> userIdList);
|
||||
|
||||
void batchDeleteGroup(String enterpriseId, String groupId, List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 获取用户分组列表
|
||||
* @param enterpriseId
|
||||
* @param groupName 分组名,模糊查询用
|
||||
* @return
|
||||
*/
|
||||
List<UserGroupVO> listUserGroup(String enterpriseId, String groupName, CurrentUser user);
|
||||
|
||||
UserGroupVO getGroupInfo(String enterpriseId, String groupId, CurrentUser user);
|
||||
|
||||
PageInfo<EnterpriseUserPageVO> listUserByGroupId(String enterpriseId, String groupId, String userName, Integer pageNum, Integer pageSize, CurrentUser currentUser);
|
||||
|
||||
void updateUserGroup(String enterpriseId, List<String> groupIdList, String userId, CurrentUser currentUser);
|
||||
|
||||
Boolean configUser(String enterpriseId, UserGroupAddRequest userGroupAddRequest, CurrentUser user);
|
||||
|
||||
Map<String, List<UserGroupDTO>> getUserGroupMap(String enterpriseId, List<String> userIdList);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,12 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.buser.SubordinateUserRangeDTO;
|
||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
@@ -12,4 +18,20 @@ public interface EnterpriseUserService {
|
||||
|
||||
void updateUserRegionPathList(String enterpriseId, List<String> userIds);
|
||||
|
||||
List<EnterpriseUserPageVO> listUser(String enterpriseId, String userName, String deptId,
|
||||
String orderBy, String orderRule,
|
||||
Long roleId, Integer userStatus, Integer pageNum, Integer pageSize, String jobNumber, String regionId, Boolean hasPage);
|
||||
|
||||
List<String> initUserRole(String enterpriseId, List<EnterpriseUserPageVO> enterpriseUserList);
|
||||
|
||||
Map<String, SubordinateUserRangeDTO> fillUserSubordinateNames(String enterpriseId, List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 获取人员所属部门
|
||||
* @param enterpriseId
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
Map<String, String> getUserRegion(String enterpriseId, List<String> userIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SubordinateMappingService {
|
||||
|
||||
|
||||
/**
|
||||
* 判断用户是否管辖全部用户
|
||||
* @param enterpriseId
|
||||
* @param currentUserId
|
||||
* @return
|
||||
*/
|
||||
Boolean checkHaveAllSubordinateUser(String enterpriseId, String currentUserId);
|
||||
|
||||
/**
|
||||
* 获取管辖用户
|
||||
* @param enterpriseId
|
||||
* @param currentUserId
|
||||
* @return
|
||||
*/
|
||||
List<String> getSubordinateUserIdList(String enterpriseId, String currentUserId,Boolean addCurrentFlag);
|
||||
|
||||
/**
|
||||
* 保留管辖用户
|
||||
* @param enterpriseId
|
||||
* @param currentUserId
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
List<String> retainSubordinateUserIdList(String enterpriseId, String currentUserId, List<String> userIdList,Boolean addCurrentFlag);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.auth.AuthRegionStoreDTO;
|
||||
import com.cool.store.dto.auth.AuthRegionStoreUserDTO;
|
||||
import com.cool.store.dto.auth.AuthStoreCountDTO;
|
||||
import com.cool.store.dto.buser.UserRoleDTO;
|
||||
import com.cool.store.dto.store.StoreAreaDTO;
|
||||
import com.cool.store.entity.RegionDO;
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.entity.UserAuthMappingDO;
|
||||
import com.cool.store.enums.*;
|
||||
import com.cool.store.service.AuthVisualService;
|
||||
import com.cool.store.utils.CommonNodeUtils;
|
||||
import com.cool.store.utils.RedisConstantUtil;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* describe:
|
||||
*
|
||||
* @author zhouyiping
|
||||
* @date 2020/10/14
|
||||
*/
|
||||
@Service
|
||||
public class AuthVisualServiceImpl implements AuthVisualService {
|
||||
|
||||
@Resource
|
||||
private UserAuthMappingDAO userAuthMappingDAO;
|
||||
@Resource
|
||||
private RegionDAO regionDAO;
|
||||
@Autowired
|
||||
private RedisUtilPool redisUtilPool;
|
||||
@Autowired
|
||||
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||
@Resource
|
||||
private UserRegionMappingDAO userRegionMappingDAO;
|
||||
@Resource
|
||||
private RedisConstantUtil redisConstantUtil;
|
||||
@Resource
|
||||
private StoreDAO storeDAO;
|
||||
|
||||
|
||||
@Override
|
||||
public List<AuthRegionStoreUserDTO> authRegionStore(String eid, String userId) {
|
||||
|
||||
List<UserAuthMappingDO> userAuthMappingList = userAuthMappingDAO.listUserAuthMappingByUserId(eid, userId);
|
||||
return getAuthRegionStoreUserDTO(eid, userAuthMappingList);
|
||||
}
|
||||
|
||||
public List<AuthRegionStoreUserDTO> getAuthRegionStoreUserDTO(String eid, List<UserAuthMappingDO> userAuthMappingList) {
|
||||
List<AuthRegionStoreUserDTO> authRegionStoreDTOList = new ArrayList<>();
|
||||
Pair<List<String>, List<String>> listListTwoResultTuple = splitUserAuthMapping(userAuthMappingList);
|
||||
List<String> storeIdList = listListTwoResultTuple.getKey();
|
||||
List<String> regionIdList = listListTwoResultTuple.getValue();
|
||||
//将组织架构权限中的区域转换
|
||||
if (CollectionUtils.isNotEmpty(regionIdList)) {
|
||||
List<RegionDO> regionByRegionIds = regionDAO.getRegionByRegionIds(eid, regionIdList);
|
||||
List<AuthRegionStoreUserDTO> regionAuthRegionStoreList = ListUtils.emptyIfNull(regionByRegionIds).stream()
|
||||
.map(data -> mapAuthRegionStoreByRegion(data.getName(), data.getRegionId(), false, data.getStoreId()))
|
||||
.collect(Collectors.toList());
|
||||
List<String> regionStoreIdList = ListUtils.emptyIfNull(regionByRegionIds).stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getStoreId()) && RegionTypeEnum.STORE.getType().equals(e.getRegionType()))
|
||||
.map(RegionDO::getStoreId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(regionAuthRegionStoreList)) {
|
||||
authRegionStoreDTOList.addAll(regionAuthRegionStoreList);
|
||||
}
|
||||
// 是否需要展示区域对应门店权限数据
|
||||
if (storeIdList != null && CollectionUtils.isNotEmpty(regionStoreIdList)
|
||||
&& StringUtils.isNotBlank(redisUtilPool.getString(redisConstantUtil.getShowStoreAuthKey()))) {
|
||||
storeIdList.addAll(regionStoreIdList);
|
||||
}
|
||||
}
|
||||
//将组织架构权限中的门店转换
|
||||
if (CollectionUtils.isNotEmpty(storeIdList) && StringUtils.isNotBlank(redisUtilPool.getString(redisConstantUtil.getShowStoreAuthKey()))) {
|
||||
List<StoreDO> storeListByStoreIds = storeDAO.getStoreListByStoreIds(eid, storeIdList);
|
||||
List<AuthRegionStoreUserDTO> storeAuthRegionStoreList = ListUtils.emptyIfNull(storeListByStoreIds).stream()
|
||||
.map(data -> mapAuthRegionStoreByRegion(data.getStoreName(), data.getStoreId(), true, data.getStoreId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(storeAuthRegionStoreList)) {
|
||||
authRegionStoreDTOList.addAll(storeAuthRegionStoreList);
|
||||
}
|
||||
}
|
||||
return authRegionStoreDTOList;
|
||||
}
|
||||
|
||||
public Pair<List<String>, List<String>> splitUserAuthMapping(List<UserAuthMappingDO> userAuthMappingList) {
|
||||
|
||||
List<UserAuthMappingDO> store = new ArrayList<>();
|
||||
List<UserAuthMappingDO> region = new ArrayList<>();
|
||||
ListUtils.emptyIfNull(userAuthMappingList)
|
||||
.forEach(data -> {
|
||||
if (data.getType().equals(UserAuthMappingTypeEnum.STORE.getCode())) {
|
||||
store.add(data);
|
||||
} else {
|
||||
region.add(data);
|
||||
}
|
||||
});
|
||||
List<String> storeIdList = ListUtils.emptyIfNull(store).stream()
|
||||
.map(UserAuthMappingDO::getMappingId).distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
List<String> regionIdList = ListUtils.emptyIfNull(region).stream()
|
||||
.map(UserAuthMappingDO::getMappingId).distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
return new Pair(storeIdList, regionIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuthRegionStoreDTO> authRegionStoreByUserList(String eid, List<String> userIdList) {
|
||||
|
||||
List<UserAuthMappingDO> userAuthMappingList = userAuthMappingDAO.listUserAuthMappingByUserIds(eid, userIdList);
|
||||
List<AuthRegionStoreUserDTO> authRegionStoreUserDTO = getAuthRegionStoreUserDTO(eid, userAuthMappingList);
|
||||
Map<String, AuthRegionStoreUserDTO> regionStoreUserMap = ListUtils.emptyIfNull(authRegionStoreUserDTO)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(AuthRegionStoreUserDTO::getId, data -> data, (a, b) -> a));
|
||||
Map<String, List<UserAuthMappingDO>> userAuthGroup = ListUtils.emptyIfNull(userAuthMappingList)
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(UserAuthMappingDO::getUserId));
|
||||
return userIdList.stream()
|
||||
.map(data -> mapAuthRegionStoreDTO(regionStoreUserMap, userAuthGroup, data))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuthStoreCountDTO> authStoreCount(String eid, List<String> userIdList, Boolean isReturnList) {
|
||||
/**
|
||||
* 1.查询出所有关于用户的权限门店
|
||||
* 1.权限区域角色权限
|
||||
* 2.权限门店
|
||||
* 2.分组聚合
|
||||
* 3.去重统计门店数
|
||||
*/
|
||||
//用户配置的区域权限
|
||||
List<UserAuthMappingDO> userAuthMappingDOList = userAuthMappingDAO.listUserAuthMappingByUserIds(eid, userIdList);
|
||||
|
||||
List<String> allAuthRegionList = ListUtils.emptyIfNull(userAuthMappingDOList)
|
||||
.stream()
|
||||
.filter(data -> StringUtils.equals(UserAuthMappingTypeEnum.REGION.getCode(), data.getType()))
|
||||
.map(UserAuthMappingDO::getMappingId)
|
||||
.distinct()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<StoreAreaDTO> storeAreaDTOS = storeDAO.listStoreByRegionIdList(eid, allAuthRegionList);
|
||||
Map<String, List<String>> storeAreaMap = ListUtils.emptyIfNull(storeAreaDTOS)
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(StoreAreaDTO::getAreaId,
|
||||
Collectors.mapping(StoreAreaDTO::getStoreId, Collectors.toList())));
|
||||
Map<String, List<UserAuthMappingDO>> authMappingMap = ListUtils.emptyIfNull(userAuthMappingDOList)
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(UserAuthMappingDO::getUserId));
|
||||
//用户角色可视化范围
|
||||
List<UserRoleDTO> userRoleList = enterpriseUserRoleDAO.getUserAndRolesByUserId(eid, userIdList);
|
||||
//取优先级最大角色去查询权限
|
||||
//todo role
|
||||
Map<String, UserRoleDTO> userRoleMap = ListUtils.emptyIfNull(userRoleList)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(UserRoleDTO::getUserId, data -> data, (a, b) -> {
|
||||
if (a.getPriority() == null || b.getPriority() == null) {
|
||||
return a;
|
||||
}
|
||||
return a.getPriority() > b.getPriority() ? b : a;
|
||||
}));
|
||||
List<UserRoleDTO> minUserRoleList = new ArrayList<UserRoleDTO>(userRoleMap.values());
|
||||
List<String> allStoreList = storeDAO.getAllStoreList(eid, isReturnList);
|
||||
Integer allStoreCount = storeDAO.getStoreCount(eid);
|
||||
|
||||
//子区域计算
|
||||
List<Long> all = null;
|
||||
Map<Long, List<Long>> regionParentGroupMap = null;
|
||||
Map<String, String> regionIdStoreIdMap = null;
|
||||
if (CollectionUtils.isNotEmpty(allAuthRegionList)) {
|
||||
List<RegionDO> allRegion = regionDAO.getAllRegion(eid);
|
||||
ListUtils.emptyIfNull(allRegion).forEach(this::initRoot);
|
||||
all = ListUtils.emptyIfNull(allRegion)
|
||||
.stream()
|
||||
.map(RegionDO::getId)
|
||||
.collect(Collectors.toList());
|
||||
regionParentGroupMap = ListUtils.emptyIfNull(allRegion)
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(data -> Long.valueOf(data.getParentId()),
|
||||
Collectors.mapping(RegionDO::getId, Collectors.toList())));
|
||||
|
||||
List<Long> storeRegionIdList = allAuthRegionList.stream()
|
||||
.map(e -> Long.valueOf(e)).collect(Collectors.toList());
|
||||
List<RegionDO> storeRegionList = regionDAO.listStoreRegionByIds(eid, storeRegionIdList);
|
||||
regionIdStoreIdMap = ListUtils.emptyIfNull(storeRegionList).stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getStoreId()) && !e.getDeleted() && RegionTypeEnum.STORE.getType().equals(e.getRegionType()))
|
||||
.collect(Collectors.toMap(data->String.valueOf(data.getId()), RegionDO::getStoreId, (a, b) -> a));
|
||||
}
|
||||
|
||||
List<Long> finalAll = all;
|
||||
Map<Long, List<Long>> finalRegionParentGroupMap = regionParentGroupMap;
|
||||
Map<String, String> finalRegionIdStoreIdMap = regionIdStoreIdMap;
|
||||
return ListUtils.emptyIfNull(minUserRoleList).stream()
|
||||
.map(data -> mapAuStoreCountDTO(data, authMappingMap, storeAreaMap, allStoreList, allStoreCount, finalAll, finalRegionParentGroupMap, finalRegionIdStoreIdMap))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private AuthRegionStoreDTO mapAuthRegionStoreDTO(Map<String, AuthRegionStoreUserDTO> regionStoreUserMap, Map<String, List<UserAuthMappingDO>> userAuthGroup, String data) {
|
||||
if (MapUtils.isNotEmpty(userAuthGroup) && CollectionUtils.isNotEmpty(userAuthGroup.get(data)) && MapUtils.isNotEmpty(regionStoreUserMap)) {
|
||||
List<AuthRegionStoreUserDTO> authRegionStoreUserDTOList = ListUtils.emptyIfNull(userAuthGroup.get(data))
|
||||
.stream()
|
||||
.map(userAuthMappingDO -> regionStoreUserMap.get(userAuthMappingDO.getMappingId()))
|
||||
.distinct()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
AuthRegionStoreDTO authRegionStoreDTO = new AuthRegionStoreDTO();
|
||||
authRegionStoreDTO.setUserId(data);
|
||||
authRegionStoreDTO.setAuthRegionStoreUserList(authRegionStoreUserDTOList);
|
||||
return authRegionStoreDTO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void initRoot(RegionDO regionDO) {
|
||||
if (regionDO.getParentId() == null) {
|
||||
regionDO.setParentId("0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取区域下的门店(不包含子节点)
|
||||
* @param storeIdList
|
||||
* @param areaStoreList
|
||||
* @return
|
||||
*/
|
||||
private List<String> authStoreId(List<String> storeIdList,
|
||||
List<String> areaStoreList) {
|
||||
|
||||
List<String> allStoreIdList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(storeIdList)) {
|
||||
allStoreIdList.addAll(storeIdList);
|
||||
}
|
||||
//聚合区域下的门店信息
|
||||
|
||||
if (CollectionUtils.isNotEmpty(areaStoreList)) {
|
||||
allStoreIdList.addAll(areaStoreList);
|
||||
}
|
||||
|
||||
|
||||
//去除重复的StoreId
|
||||
return ListUtils.emptyIfNull(allStoreIdList).stream()
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private AuthStoreCountDTO mapAuStoreCountDTO(UserRoleDTO userRoleDTO,
|
||||
Map<String, List<UserAuthMappingDO>> authMappingMap,
|
||||
Map<String, List<String>> storeAreaMap,
|
||||
List<String> invalidStores,
|
||||
Integer allStoreCount,
|
||||
List<Long> all,
|
||||
Map<Long, List<Long>> regionParentGroupMap, Map<String, String> regionIdStoreIdMap) {
|
||||
AuthStoreCountDTO authStoreCountDTO = new AuthStoreCountDTO();
|
||||
if (userRoleDTO == null || userRoleDTO.getRoleAuth() == null) {
|
||||
return authStoreCountDTO;
|
||||
}
|
||||
String userId = userRoleDTO.getUserId();
|
||||
authStoreCountDTO.setUserId(userId);
|
||||
//全企业数据或者管理员 直接返回企业下所有的门店总数
|
||||
if (StringUtils.equals(userRoleDTO.getRoleEnum(), (RoleEnum.MASTER.getRoleEnum()))) {
|
||||
authStoreCountDTO.setStoreList(invalidStores);
|
||||
authStoreCountDTO.setStoreCount(allStoreCount);
|
||||
return authStoreCountDTO;
|
||||
}
|
||||
List<String> storeIdList = new ArrayList<>();
|
||||
List<String> regionIdList = new ArrayList<>();
|
||||
List<String> areaStoreList;
|
||||
|
||||
if (MapUtils.isNotEmpty(authMappingMap)) {
|
||||
List<UserAuthMappingDO> userAuthMappingDOList = authMappingMap.get(userId);
|
||||
Pair<List<String>, List<String>> listListTwoResultTuple = splitUserAuthMapping(userAuthMappingDOList);
|
||||
storeIdList = listListTwoResultTuple.getKey();
|
||||
regionIdList = listListTwoResultTuple.getValue();
|
||||
if(CollectionUtils.isNotEmpty(regionIdList) && regionIdStoreIdMap != null){
|
||||
List<String> finalStoreIdList = storeIdList;
|
||||
regionIdList.forEach(regionId -> {
|
||||
String regionStoreId = regionIdStoreIdMap.get(regionId);
|
||||
if (StringUtils.isNotBlank(regionStoreId)) {
|
||||
finalStoreIdList.add(regionStoreId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
switch (AuthRoleEnum.getByCode(userRoleDTO.getRoleAuth())) {
|
||||
case ALL:
|
||||
authStoreCountDTO.setStoreList(invalidStores);
|
||||
authStoreCountDTO.setStoreCount(allStoreCount);
|
||||
break;
|
||||
case INCLUDE_SUBORDINATE:
|
||||
|
||||
areaStoreList = ListUtils.emptyIfNull(regionIdList)
|
||||
.stream()
|
||||
.map(data -> CommonNodeUtils.getAllChildListContainSelf(0L,
|
||||
Long.valueOf(data), all, regionParentGroupMap))
|
||||
.flatMap(Collection::stream)
|
||||
.map(data -> data.toString())
|
||||
.map(data -> {
|
||||
if (MapUtils.isNotEmpty(storeAreaMap)) {
|
||||
return storeAreaMap.get(data);
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
List<String> includeSubordinateStoreIdList = authStoreId(storeIdList, areaStoreList);
|
||||
if (CollectionUtils.isNotEmpty(includeSubordinateStoreIdList)) {
|
||||
authStoreCountDTO.setStoreList(includeSubordinateStoreIdList);
|
||||
authStoreCountDTO.setStoreCount(ListUtils.emptyIfNull(includeSubordinateStoreIdList).size());
|
||||
|
||||
}
|
||||
break;
|
||||
case PERSONAL:
|
||||
areaStoreList = ListUtils.emptyIfNull(regionIdList)
|
||||
.stream()
|
||||
.map(data -> CommonNodeUtils.getAllChildListContainSelf(0L,
|
||||
Long.valueOf(data), all, regionParentGroupMap))
|
||||
.flatMap(Collection::stream)
|
||||
.map(data -> data.toString())
|
||||
.map(data -> {
|
||||
if (MapUtils.isNotEmpty(storeAreaMap)) {
|
||||
return storeAreaMap.get(data);
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
List<String> personalStoreIdList = authStoreId(storeIdList, areaStoreList);
|
||||
if (CollectionUtils.isNotEmpty(personalStoreIdList)) {
|
||||
authStoreCountDTO.setStoreList(personalStoreIdList);
|
||||
authStoreCountDTO.setStoreCount(ListUtils.emptyIfNull(personalStoreIdList).size());
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return authStoreCountDTO;
|
||||
}
|
||||
|
||||
private AuthRegionStoreUserDTO mapAuthRegionStoreByRegion(String name, String regionId, boolean b, String storeId) {
|
||||
AuthRegionStoreUserDTO authRegionStoreDTO = new AuthRegionStoreUserDTO();
|
||||
authRegionStoreDTO.setName(name);
|
||||
authRegionStoreDTO.setId(regionId);
|
||||
authRegionStoreDTO.setStoreFlag(b);
|
||||
authRegionStoreDTO.setStoreId(storeId);
|
||||
return authRegionStoreDTO;
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,7 @@ import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.RegionDO;
|
||||
import com.cool.store.entity.SysDepartmentDO;
|
||||
import com.cool.store.entity.UserRegionMappingDO;
|
||||
import com.cool.store.enums.AIEnum;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.RegionTypeEnum;
|
||||
import com.cool.store.enums.RoleEnum;
|
||||
import com.cool.store.enums.*;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.http.ISVHttpRequest;
|
||||
import com.cool.store.mq.SimpleMessageService;
|
||||
@@ -22,8 +19,6 @@ import com.cool.store.utils.DataSourceHelper;
|
||||
import com.cool.store.utils.ListOptUtils;
|
||||
import com.cool.store.utils.ScriptUtil;
|
||||
import com.cool.store.utils.UUIDUtils;
|
||||
import com.coolstore.base.enums.AppTypeEnum;
|
||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
@@ -0,0 +1,389 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.context.CurrentUser;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.EnterpriseUserGroupDAO;
|
||||
import com.cool.store.dao.EnterpriseUserGroupMappingDAO;
|
||||
import com.cool.store.dao.EnterpriseUserRoleDAO;
|
||||
import com.cool.store.dto.auth.AuthRegionStoreDTO;
|
||||
import com.cool.store.dto.buser.SubordinateUserRangeDTO;
|
||||
import com.cool.store.dto.usergroup.UserGroupAddRequest;
|
||||
import com.cool.store.dto.usergroup.UserGroupDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.EnterpriseUserGroupDO;
|
||||
import com.cool.store.entity.EnterpriseUserGroupMappingDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.service.AuthVisualService;
|
||||
import com.cool.store.service.EnterpriseUserGroupService;
|
||||
import com.cool.store.service.EnterpriseUserService;
|
||||
import com.cool.store.service.SubordinateMappingService;
|
||||
import com.cool.store.utils.UUIDUtils;
|
||||
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||
import com.cool.store.vo.usergroup.UserGroupVO;
|
||||
import com.cool.store.vo.usergroup.UserSimpleDTO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Author wxp
|
||||
* @Date 2022/12/29 11:18
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class EnterpriseUserGroupServiceImpl implements EnterpriseUserGroupService {
|
||||
|
||||
@Resource
|
||||
private EnterpriseUserGroupDAO enterpriseUserGroupDAO;
|
||||
@Resource
|
||||
private EnterpriseUserGroupMappingDAO enterpriseUserGroupMappingDAO;
|
||||
@Autowired
|
||||
public EnterpriseUserService enterpriseUserService;
|
||||
@Resource
|
||||
private EnterpriseUserDAO enterpriseUserDAO;
|
||||
@Resource
|
||||
private AuthVisualService visualService;
|
||||
@Resource
|
||||
private SubordinateMappingService subordinateMappingService;
|
||||
@Resource
|
||||
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||
|
||||
@Override
|
||||
public Boolean saveOrUpdateUserGroup(String enterpriseId, UserGroupAddRequest userGroupAddRequest, CurrentUser currentUser) {
|
||||
int count = enterpriseUserGroupDAO.countByGroupName(enterpriseId, userGroupAddRequest.getGroupName(), userGroupAddRequest.getGroupId());
|
||||
if (count > 0) {
|
||||
throw new ServiceException(ErrorCodeEnum.USER_GROUP_NAME_EXIST);
|
||||
}
|
||||
EnterpriseUserGroupDO userGroupDO = translateToUserGroupDO(userGroupAddRequest, currentUser);
|
||||
if(StringUtils.isBlank(userGroupAddRequest.getGroupId())){
|
||||
enterpriseUserGroupDAO.insertSelective(userGroupDO, enterpriseId);
|
||||
}else {
|
||||
enterpriseUserGroupDAO.updateByGroupId(userGroupDO, enterpriseId);
|
||||
}
|
||||
List<String> userIdList = userGroupAddRequest.getUserIdList();
|
||||
if(CollectionUtils.isEmpty(userIdList)){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
enterpriseUserGroupMappingDAO.deleteUserGroupMappingByGroupId(enterpriseId, userGroupDO.getGroupId());
|
||||
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = new ArrayList<>();
|
||||
for (String userId: userIdList) {
|
||||
EnterpriseUserGroupMappingDO userGroupMappingDO = new EnterpriseUserGroupMappingDO();
|
||||
userGroupMappingDO.setUserId(userId);
|
||||
userGroupMappingDO.setGroupId(userGroupDO.getGroupId());
|
||||
userGroupMappingDO.setCreateUserId(currentUser.getUserId());
|
||||
userGroupMappingDO.setUpdateUserId(currentUser.getUserId());
|
||||
userGroupMappingDOList.add(userGroupMappingDO);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)) {
|
||||
enterpriseUserGroupMappingDAO.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateUserGroup(String enterpriseId, Long userGroupId, List<String> userIdList){
|
||||
enterpriseUserGroupMappingDAO.deleteUserGroupMappingByGroupId(enterpriseId, String.valueOf(userGroupId));
|
||||
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = new ArrayList<>();
|
||||
for (String userId: userIdList) {
|
||||
EnterpriseUserGroupMappingDO userGroupMappingDO = new EnterpriseUserGroupMappingDO();
|
||||
userGroupMappingDO.setUserId(userId);
|
||||
userGroupMappingDO.setGroupId(String.valueOf(userGroupId));
|
||||
userGroupMappingDO.setCreateUserId("");
|
||||
userGroupMappingDO.setUpdateUserId("");
|
||||
userGroupMappingDOList.add(userGroupMappingDO);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)) {
|
||||
enterpriseUserGroupMappingDAO.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDeleteGroup(String enterpriseId, String groupId, List<String> userIdList) {
|
||||
enterpriseUserGroupMappingDAO.deleteMappingByGroupIdList(enterpriseId, groupId, userIdList);
|
||||
if(CollectionUtils.isEmpty(userIdList)){
|
||||
enterpriseUserGroupDAO.deleteByGroupIdList(enterpriseId, Collections.singletonList(groupId));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserGroupVO> listUserGroup(String enterpriseId, String groupName, CurrentUser user) {
|
||||
List<EnterpriseUserGroupDO> userGroupDOList = enterpriseUserGroupDAO.listUserGroup(enterpriseId,groupName);
|
||||
List<UserGroupVO> resultList = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(userGroupDOList)) {
|
||||
return resultList;
|
||||
}
|
||||
List<String> groupIdList = userGroupDOList.stream().map(EnterpriseUserGroupDO::getGroupId).collect(Collectors.toList());
|
||||
Set<String> userIdSet = userGroupDOList.stream()
|
||||
.flatMap(c->Stream.of(c.getCreateUserId(),c.getUpdateUserId()))
|
||||
.collect(Collectors.toSet());
|
||||
List<EnterpriseUserDO> userDOList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, new ArrayList<>(userIdSet));
|
||||
Map<String, EnterpriseUserDO> userMap = userDOList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, Function.identity()));
|
||||
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = enterpriseUserGroupMappingDAO.listByGroupIdList(enterpriseId, groupIdList);
|
||||
Map<String, List<EnterpriseUserGroupMappingDO>> userGroupMappingMap = userGroupMappingDOList.stream()
|
||||
.collect(Collectors.groupingBy(EnterpriseUserGroupMappingDO::getGroupId));
|
||||
for (EnterpriseUserGroupDO enterpriseUserGroupDO : userGroupDOList) {
|
||||
UserGroupVO userGroupVO = new UserGroupVO();
|
||||
userGroupVO.setCreateUserId(enterpriseUserGroupDO.getCreateUserId());
|
||||
userGroupVO.setGroupId(enterpriseUserGroupDO.getGroupId());
|
||||
userGroupVO.setGroupName(enterpriseUserGroupDO.getGroupName());
|
||||
userGroupVO.setCreateTime(enterpriseUserGroupDO.getCreateTime());
|
||||
userGroupVO.setUpdateTime(enterpriseUserGroupDO.getUpdateTime());
|
||||
EnterpriseUserDO createUser = userMap.get(enterpriseUserGroupDO.getCreateUserId());
|
||||
if (createUser != null) {
|
||||
userGroupVO.setCreateUserName(createUser.getName());
|
||||
}
|
||||
EnterpriseUserDO updateUser = userMap.get(enterpriseUserGroupDO.getUpdateUserId());
|
||||
if (updateUser != null) {
|
||||
userGroupVO.setUpdateUserName(updateUser.getName());
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(userGroupMappingMap.get(enterpriseUserGroupDO.getGroupId()))){
|
||||
userGroupVO.setUserCount(userGroupMappingMap.get(enterpriseUserGroupDO.getGroupId()).size());
|
||||
}
|
||||
userGroupVO.setEditFlag(checkUserEditFlag(enterpriseId, enterpriseUserGroupDO, user.getUserId()));
|
||||
resultList.add(userGroupVO);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserGroupVO getGroupInfo(String enterpriseId, String groupId, CurrentUser user) {
|
||||
EnterpriseUserGroupDO userGroupDO = enterpriseUserGroupDAO.getByGroupId(enterpriseId, groupId);
|
||||
if (userGroupDO == null) {
|
||||
throw new ServiceException(ErrorCodeEnum.USER_GROUP_NOT_EXIST);
|
||||
}
|
||||
UserGroupVO userGroupVO = new UserGroupVO();
|
||||
BeanUtils.copyProperties(userGroupDO, userGroupVO);
|
||||
fillUserGroupVO(enterpriseId, userGroupDO, userGroupVO);
|
||||
userGroupVO.setEditFlag(checkUserEditFlag(enterpriseId, userGroupDO, user.getUserId()));
|
||||
return userGroupVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<EnterpriseUserPageVO> listUserByGroupId(String enterpriseId, String groupId, String userName, Integer pageNum, Integer pageSize, CurrentUser currentUser) {
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
List<EnterpriseUserDO> enterpriseUserList = enterpriseUserDAO.listUserByGroupId(enterpriseId, groupId, userName, null);
|
||||
PageInfo pageInfo = new PageInfo<>();
|
||||
if (CollectionUtils.isEmpty(enterpriseUserList)) {
|
||||
return pageInfo;
|
||||
}
|
||||
List<EnterpriseUserPageVO> resultList = new ArrayList<>();
|
||||
resultList = EnterpriseUserPageVO.transUserDOToVO(enterpriseUserList);
|
||||
pageInfo = new PageInfo<>(resultList);
|
||||
//填充角色信息如果存在角色信息
|
||||
List<String> userIdList = enterpriseUserService.initUserRole(enterpriseId, resultList);
|
||||
List<AuthRegionStoreDTO> authRegionStoreDTOList = visualService.authRegionStoreByUserList(enterpriseId, userIdList);
|
||||
Map<String, AuthRegionStoreDTO> authRegionStoreMap = ListUtils.emptyIfNull(authRegionStoreDTOList)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(AuthRegionStoreDTO::getUserId, data -> data, (a, b) -> a));
|
||||
Map<String, SubordinateUserRangeDTO> subordinateUserRangeMap = enterpriseUserService.fillUserSubordinateNames(enterpriseId, userIdList);
|
||||
Map<String, String> userRegionMap = enterpriseUserService.getUserRegion(enterpriseId, userIdList);
|
||||
|
||||
Boolean haveAllSubordinateUser = subordinateMappingService.checkHaveAllSubordinateUser(enterpriseId, currentUser.getUserId());
|
||||
List<String> userSubordinateList = Lists.newArrayList();
|
||||
if(!haveAllSubordinateUser){
|
||||
userSubordinateList = subordinateMappingService.getSubordinateUserIdList(enterpriseId, currentUser.getUserId(),Boolean.TRUE);
|
||||
}
|
||||
List<String> finalUserSubordinateList = userSubordinateList;
|
||||
resultList.stream()
|
||||
.forEach(data->{
|
||||
if(MapUtils.isNotEmpty(authRegionStoreMap)&&authRegionStoreMap.get(data.getUserId())!=null){
|
||||
AuthRegionStoreDTO authRegionStoreDTO = authRegionStoreMap.get(data.getUserId());
|
||||
data.setAuthRegionStoreList(authRegionStoreDTO.getAuthRegionStoreUserList());
|
||||
}
|
||||
// 填充下属用户
|
||||
if (subordinateUserRangeMap.get(data.getUserId()) != null){
|
||||
data.setSubordinateUserRange(subordinateUserRangeMap.get(data.getUserId()).getSubordinateUserRange());
|
||||
data.setSourceList(subordinateUserRangeMap.get(data.getUserId()).getSourceList());
|
||||
data.setMySubordinates(subordinateUserRangeMap.get(data.getUserId()).getMySubordinates());
|
||||
}
|
||||
data.setDepartment(userRegionMap.get(data.getUserId()));
|
||||
if(haveAllSubordinateUser){
|
||||
data.setSelectFlag(true);
|
||||
}else {
|
||||
data.setSelectFlag(finalUserSubordinateList.contains(data.getUserId()));
|
||||
}
|
||||
});
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserGroup(String enterpriseId, List<String> groupIdList, String userId, CurrentUser currentUser) {
|
||||
if(CollectionUtils.isEmpty(groupIdList)){
|
||||
return;
|
||||
}
|
||||
enterpriseUserGroupMappingDAO.deleteMappingByUserIdList(enterpriseId, Collections.singletonList(userId));
|
||||
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = new ArrayList<>();
|
||||
for (String groupId: groupIdList) {
|
||||
EnterpriseUserGroupMappingDO userGroupMappingDO = new EnterpriseUserGroupMappingDO();
|
||||
userGroupMappingDO.setUserId(userId);
|
||||
userGroupMappingDO.setGroupId(groupId);
|
||||
userGroupMappingDO.setCreateUserId(currentUser.getUserId());
|
||||
userGroupMappingDO.setUpdateUserId(currentUser.getUserId());
|
||||
userGroupMappingDOList.add(userGroupMappingDO);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)) {
|
||||
enterpriseUserGroupMappingDAO.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean configUser(String enterpriseId, UserGroupAddRequest userGroupAddRequest, CurrentUser currentUser) {
|
||||
EnterpriseUserGroupDO userGroupDO = enterpriseUserGroupDAO.getByGroupId(enterpriseId, userGroupAddRequest.getGroupId());
|
||||
if (userGroupDO == null) {
|
||||
throw new ServiceException(ErrorCodeEnum.USER_GROUP_NOT_EXIST);
|
||||
}
|
||||
List<String> userIdList = userGroupAddRequest.getUserIdList();
|
||||
if(CollectionUtils.isEmpty(userIdList)){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = new ArrayList<>();
|
||||
for (String userId: userIdList) {
|
||||
EnterpriseUserGroupMappingDO userGroupMappingDO = new EnterpriseUserGroupMappingDO();
|
||||
userGroupMappingDO.setUserId(userId);
|
||||
userGroupMappingDO.setGroupId(userGroupDO.getGroupId());
|
||||
userGroupMappingDO.setCreateUserId(currentUser.getUserId());
|
||||
userGroupMappingDO.setUpdateUserId(currentUser.getUserId());
|
||||
userGroupMappingDOList.add(userGroupMappingDO);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)) {
|
||||
enterpriseUserGroupMappingDAO.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<UserGroupDTO>> getUserGroupMap(String enterpriseId, List<String> userIdList) {
|
||||
Map<String, List<UserGroupDTO>> resultMap = Maps.newHashMap();
|
||||
if(CollectionUtils.isEmpty(userIdList)){
|
||||
return resultMap;
|
||||
}
|
||||
List<EnterpriseUserGroupMappingDO> enterpriseUserGroupMappingDOList = enterpriseUserGroupMappingDAO.listByUserIdList(enterpriseId, userIdList);
|
||||
List<String> allGroupIdList = ListUtils.emptyIfNull(enterpriseUserGroupMappingDOList)
|
||||
.stream().map(EnterpriseUserGroupMappingDO::getGroupId)
|
||||
.collect(Collectors.toList());
|
||||
List<EnterpriseUserGroupDO> userGroupDOList = enterpriseUserGroupDAO.listByGroupIdList(enterpriseId, allGroupIdList);
|
||||
//封装 userId-userGroup map,以表示一个用户对应几个分组
|
||||
Map<String, Set<String>> userGroupMap = ListUtils.emptyIfNull(enterpriseUserGroupMappingDOList)
|
||||
.stream().collect(Collectors.groupingBy(EnterpriseUserGroupMappingDO::getUserId,
|
||||
Collectors.mapping(EnterpriseUserGroupMappingDO::getGroupId, Collectors.toSet())));
|
||||
//获得分组id -分组名称的map
|
||||
Map<String, String> groupNameMap = ListUtils.emptyIfNull(userGroupDOList)
|
||||
.stream()
|
||||
.filter(data -> StringUtils.isNotBlank(data.getGroupName()))
|
||||
.collect(Collectors.toMap(EnterpriseUserGroupDO::getGroupId, EnterpriseUserGroupDO::getGroupName, (a, b) -> a));
|
||||
userIdList.forEach(userId -> {
|
||||
Set<String> groupIdList = userGroupMap.get(userId);
|
||||
if (CollectionUtils.isNotEmpty(groupIdList)) {
|
||||
List<UserGroupDTO> userGroupDTOList = resultMap.get(userId);
|
||||
if (CollectionUtils.isEmpty(userGroupDTOList)) {
|
||||
userGroupDTOList = Lists.newArrayList();
|
||||
resultMap.put(userId, userGroupDTOList);
|
||||
}
|
||||
for (String groupId: groupIdList) {
|
||||
UserGroupDTO userGroupDTO = new UserGroupDTO();
|
||||
userGroupDTO.setGroupId(groupId);
|
||||
userGroupDTO.setGroupName(groupNameMap.get(groupId));
|
||||
userGroupDTOList.add(userGroupDTO);
|
||||
}
|
||||
}
|
||||
});
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private void fillUserGroupVO(String enterpriseId, EnterpriseUserGroupDO userGroupDO, UserGroupVO userGroupVO) {
|
||||
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = enterpriseUserGroupMappingDAO.listByGroupIdList(enterpriseId, Collections.singletonList(userGroupDO.getGroupId()));
|
||||
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)){
|
||||
List<String> configUserIdList = userGroupMappingDOList.stream().map(EnterpriseUserGroupMappingDO::getUserId).collect(Collectors.toList());
|
||||
List<EnterpriseUserDO> enterpriseUserDOList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, configUserIdList);
|
||||
List<UserSimpleDTO> configUserList = ListUtils.emptyIfNull(enterpriseUserDOList).stream()
|
||||
.map(this::translateToUserSimpleDTO)
|
||||
.collect(Collectors.toList());
|
||||
userGroupVO.setConfigUserList(configUserList);
|
||||
}
|
||||
if(StringUtils.isNotBlank(userGroupDO.getCommonEditUserids())){
|
||||
List<String> commonEditUserIdList = StrUtil.splitTrim(userGroupDO.getCommonEditUserids(), ",");
|
||||
List<EnterpriseUserDO> enterpriseUserDOList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, commonEditUserIdList);
|
||||
List<UserSimpleDTO> commonEditUserList = ListUtils.emptyIfNull(enterpriseUserDOList).stream()
|
||||
.map(this::translateToUserSimpleDTO)
|
||||
.collect(Collectors.toList());
|
||||
userGroupVO.setCommonEditUserList(commonEditUserList);
|
||||
}
|
||||
|
||||
List<String> userIdList = Lists.newArrayList();
|
||||
userIdList.add(userGroupDO.getCreateUserId());
|
||||
userIdList.add(userGroupDO.getUpdateUserId());
|
||||
List<EnterpriseUserDO> userDOList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, userIdList);
|
||||
Map<String, EnterpriseUserDO> userMap = userDOList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, Function.identity()));
|
||||
EnterpriseUserDO createUser = userMap.get(userGroupDO.getCreateUserId());
|
||||
if (createUser != null) {
|
||||
userGroupVO.setCreateUserName(createUser.getName());
|
||||
}
|
||||
EnterpriseUserDO updateUser = userMap.get(userGroupDO.getUpdateUserId());
|
||||
if (updateUser != null) {
|
||||
userGroupVO.setUpdateUserName(updateUser.getName());
|
||||
}
|
||||
if (CommonConstants.SYSTEM_USER_ID.equals(userGroupDO.getCreateUserId())) {
|
||||
userGroupVO.setCreateUserName(CommonConstants.SYSTEM_USER_ID);
|
||||
}
|
||||
}
|
||||
|
||||
private UserSimpleDTO translateToUserSimpleDTO(EnterpriseUserDO enterpriseUserDO) {
|
||||
UserSimpleDTO userSimpleDTO = new UserSimpleDTO();
|
||||
userSimpleDTO.setUserId(enterpriseUserDO.getUserId());
|
||||
userSimpleDTO.setUserName(enterpriseUserDO.getName());
|
||||
return userSimpleDTO;
|
||||
}
|
||||
|
||||
public EnterpriseUserGroupDO translateToUserGroupDO(UserGroupAddRequest request, CurrentUser user) {
|
||||
EnterpriseUserGroupDO userGroupDO = new EnterpriseUserGroupDO();
|
||||
String groupId = StringUtils.isNotBlank(request.getGroupId()) ? request.getGroupId() : UUIDUtils.get32UUID();
|
||||
userGroupDO.setGroupId(groupId);
|
||||
userGroupDO.setGroupName(request.getGroupName());
|
||||
if(CollectionUtils.isNotEmpty(request.getCommonEditUserIdList())){
|
||||
userGroupDO.setCommonEditUserids(CommonConstants.COMMA + StringUtils.join(request.getCommonEditUserIdList(), CommonConstants.COMMA) + CommonConstants.COMMA);
|
||||
}else {
|
||||
userGroupDO.setCommonEditUserids("");
|
||||
}
|
||||
if(StringUtils.isNotBlank(request.getGroupId())){
|
||||
userGroupDO.setUpdateTime(new Date());
|
||||
userGroupDO.setUpdateUserId(user.getUserId());
|
||||
}else {
|
||||
userGroupDO.setCreateTime(new Date());
|
||||
userGroupDO.setCreateUserId(user.getUserId());
|
||||
}
|
||||
return userGroupDO;
|
||||
}
|
||||
|
||||
|
||||
// 校验用户是否有编辑权限
|
||||
public Boolean checkUserEditFlag(String eid, EnterpriseUserGroupDO enterpriseUserGroupDO, String userId){
|
||||
// 是否管理员
|
||||
boolean isAdmin = enterpriseUserRoleDAO.checkIsAdmin(eid, userId);
|
||||
if(isAdmin || userId.equals(enterpriseUserGroupDO.getCreateUserId()) || (StringUtils.isNotBlank(enterpriseUserGroupDO.getCommonEditUserids()) && enterpriseUserGroupDO.getCommonEditUserids().contains(userId))){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,17 +1,30 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.context.CurrentUser;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.RegionDAO;
|
||||
import com.cool.store.dao.UserRegionMappingDAO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.RegionDO;
|
||||
import com.cool.store.entity.UserRegionMappingDO;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.auth.AuthRegionStoreDTO;
|
||||
import com.cool.store.dto.auth.AuthStoreCountDTO;
|
||||
import com.cool.store.dto.buser.MySubordinatesDTO;
|
||||
import com.cool.store.dto.buser.SubordinateUserRangeDTO;
|
||||
import com.cool.store.dto.buser.UserRoleDTO;
|
||||
import com.cool.store.dto.region.RegionPathDTO;
|
||||
import com.cool.store.dto.usergroup.UserGroupDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.SubordinateSourceEnum;
|
||||
import com.cool.store.enums.UserSelectRangeEnum;
|
||||
import com.cool.store.service.AuthVisualService;
|
||||
import com.cool.store.service.EnterpriseUserGroupService;
|
||||
import com.cool.store.service.EnterpriseUserService;
|
||||
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.collections4.SetUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -35,6 +48,14 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
|
||||
private RegionDAO regionDAO;
|
||||
@Resource
|
||||
private EnterpriseUserDAO enterpriseUserDAO;
|
||||
@Resource
|
||||
private AuthVisualService authVisualService;
|
||||
@Resource
|
||||
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||
@Resource
|
||||
private EnterpriseUserGroupService enterpriseUserGroupService;
|
||||
@Resource
|
||||
private SubordinateMappingDAO subordinateMappingDAO;
|
||||
|
||||
@Override
|
||||
public void updateUserRegionPathList(String enterpriseId, List<String> userIds) {
|
||||
@@ -91,6 +112,100 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
|
||||
enterpriseUserDAO.batchUpdateDiffUserDiffRegionIds(enterpriseId, enterpriseUserList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnterpriseUserPageVO> listUser(String enterpriseId, String userName, String deptId,
|
||||
String orderBy, String orderRule,
|
||||
Long roleId, Integer userStatus, Integer pageNum, Integer pageSize, String jobNumber, String regionId, Boolean hasPage) {
|
||||
if (hasPage){
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
}
|
||||
List<EnterpriseUserDO> enterpriseUserList = new ArrayList<>();
|
||||
//企微用户 用户名在数据表中加密,需要再次请求企业端接口根据名称去筛选数据
|
||||
if(roleId!=null){
|
||||
enterpriseUserList = enterpriseUserDAO.fuzzyUsersByDepartment(enterpriseId, deptId, roleId, orderBy, orderRule, userName, jobNumber, userStatus, null,regionId);
|
||||
}else {
|
||||
enterpriseUserList= enterpriseUserDAO.fuzzyUsersByNotRole(enterpriseId, deptId, orderBy, orderRule, userName, jobNumber, userStatus, null,regionId);
|
||||
}
|
||||
List<EnterpriseUserPageVO> resultList = new ArrayList<>();
|
||||
if(CollectionUtils.isEmpty(enterpriseUserList)){
|
||||
return resultList;
|
||||
}
|
||||
resultList = EnterpriseUserPageVO.transUserDOToVO(enterpriseUserList);
|
||||
//填充角色信息如果存在角色信息
|
||||
List<String> userIdList = initUserRole(enterpriseId, resultList);
|
||||
//根据人员查询该人员所在部门集合
|
||||
List<UserRegionMappingDO> userRegionMappingDOS = userRegionMappingDAO.listUserRegionMappingByUserId(enterpriseId, userIdList);
|
||||
//regionids 集合
|
||||
List<String> regionIds = ListUtils.emptyIfNull(userRegionMappingDOS).stream().map(UserRegionMappingDO::getRegionId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<RegionDO> regionDOs = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(regionIds)){
|
||||
regionDOs = regionDAO.getRegionByRegionIds(enterpriseId, regionIds);
|
||||
}
|
||||
//部门map KV key-部门id value-部门名称
|
||||
Map<String, String> regionMap = ListUtils.emptyIfNull(regionDOs)
|
||||
.stream()
|
||||
.filter(a->a.getId()!=null&&a.getName()!=null)
|
||||
.collect(Collectors.toMap(data->data.getId().toString(), RegionDO::getName, (a, b) -> a));
|
||||
//人员所在部门map key-人员id value-部门set集合(set去重)
|
||||
Map<String, Set<String>> userRegionMap = ListUtils.emptyIfNull(userRegionMappingDOS)
|
||||
.stream().filter(a->a.getId()!=null&&a.getRegionId()!=null)
|
||||
.collect(Collectors.groupingBy(UserRegionMappingDO::getUserId,
|
||||
Collectors.mapping(UserRegionMappingDO::getRegionId, Collectors.toSet())));
|
||||
|
||||
//填充门店总数以及权限区域列表
|
||||
List<AuthRegionStoreDTO> authRegionStoreDTOList = authVisualService.authRegionStoreByUserList(enterpriseId, userIdList);
|
||||
List<AuthStoreCountDTO> authStoreCountDTOS = authVisualService.authStoreCount(enterpriseId, userIdList, false);
|
||||
Map<String, AuthStoreCountDTO> storeCountMap = ListUtils.emptyIfNull(authStoreCountDTOS)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(AuthStoreCountDTO::getUserId, data -> data, (a, b) -> a));
|
||||
Map<String, AuthRegionStoreDTO> authRegionStoreMap = ListUtils.emptyIfNull(authRegionStoreDTOList)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(AuthRegionStoreDTO::getUserId, data -> data, (a, b) -> a));
|
||||
|
||||
Map<String, List<UserGroupDTO>> userGroupMap = enterpriseUserGroupService.getUserGroupMap(enterpriseId, userIdList);
|
||||
Map<String, SubordinateUserRangeDTO> subordinateUserRangeMap = fillUserSubordinateNames(enterpriseId, userIdList);
|
||||
|
||||
resultList.stream()
|
||||
.forEach(data->{
|
||||
if(MapUtils.isNotEmpty(authRegionStoreMap)&&authRegionStoreMap.get(data.getUserId())!=null){
|
||||
AuthRegionStoreDTO authRegionStoreDTO = authRegionStoreMap.get(data.getUserId());
|
||||
data.setAuthRegionStoreList(authRegionStoreDTO.getAuthRegionStoreUserList());
|
||||
}
|
||||
if(MapUtils.isNotEmpty(storeCountMap)&&storeCountMap.get(data.getUserId())!=null){
|
||||
AuthStoreCountDTO authStoreCountDTO = storeCountMap.get(data.getUserId());
|
||||
if(authStoreCountDTO.getStoreCount()!=null){
|
||||
data.setStoreCount(authStoreCountDTO.getStoreCount());
|
||||
}else {
|
||||
data.setStoreCount(0);
|
||||
}
|
||||
}
|
||||
if(MapUtils.isNotEmpty(userRegionMap)&&MapUtils.isNotEmpty(regionMap)) {
|
||||
Set<String> regions = userRegionMap.get(data.getUserId());
|
||||
String deptNames = SetUtils.emptyIfNull(regions)
|
||||
.stream()
|
||||
.map(dept -> regionMap.get(dept.toString()))
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.joining(CommonConstants.COMMA));
|
||||
data.setDepartment(deptNames);
|
||||
}
|
||||
//填充用户分组
|
||||
data.setUserGroupList(userGroupMap.get(data.getUserId()));
|
||||
// 填充下属用户
|
||||
if (subordinateUserRangeMap.get(data.getUserId()) != null){
|
||||
data.setSubordinateUserRange(subordinateUserRangeMap.get(data.getUserId()).getSubordinateUserRange());
|
||||
data.setSourceList(subordinateUserRangeMap.get(data.getUserId()).getSourceList());
|
||||
data.setMySubordinates(subordinateUserRangeMap.get(data.getUserId()).getMySubordinates());
|
||||
}
|
||||
});
|
||||
// 添加至常用联系人
|
||||
if (StringUtils.isNotBlank(userName)) {
|
||||
List<String> userIds = enterpriseUserList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList());
|
||||
//lruService.putRecentUseUser(enterpriseId, UserHolder.getUser().getUserId(), userIds);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
private void addUserRegionMappingDO(String enterpriseId,String userId,String regionId,CurrentUser currentUser){
|
||||
UserRegionMappingDO userRegionMappingDO = new UserRegionMappingDO();
|
||||
userRegionMappingDO.setUserId(userId);
|
||||
@@ -102,4 +217,154 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
|
||||
//将用户添加到未分组
|
||||
userRegionMappingDAO.batchInsertRegionMapping(enterpriseId, Arrays.asList(userRegionMappingDO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, SubordinateUserRangeDTO> fillUserSubordinateNames(String enterpriseId, List<String> userIdList) {
|
||||
Map<String, SubordinateUserRangeDTO> subordinateUserRangeMap = Maps.newHashMap();
|
||||
if (CollectionUtils.isNotEmpty(userIdList)) {
|
||||
//查询该用户的下属
|
||||
List<SubordinateMappingDO> subordinateMappingDOS = subordinateMappingDAO.selectByUserIds(enterpriseId, userIdList);
|
||||
|
||||
List<EnterpriseUserDO> enterpriseUserDOS = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, userIdList);
|
||||
Map<String, String> subordinateRangeMap = ListUtils.emptyIfNull(enterpriseUserDOS).stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getSubordinateRange));
|
||||
|
||||
List<SubordinateMappingDO> defineSelectMappingLit = subordinateMappingDOS.stream().filter(x -> SubordinateSourceEnum.SELECT.getCode().equals(x.getSource())).collect(Collectors.toList());
|
||||
Map<String, List<SubordinateMappingDO>> defineSelectMappingMap = ListUtils.emptyIfNull(defineSelectMappingLit).stream()
|
||||
.collect(Collectors.groupingBy(SubordinateMappingDO::getUserId));
|
||||
userIdList.forEach(userId -> {
|
||||
SubordinateUserRangeDTO subordinateUserRangeDTO = new SubordinateUserRangeDTO();
|
||||
subordinateUserRangeMap.put(userId, subordinateUserRangeDTO);
|
||||
String subordinateUserRange = subordinateRangeMap.get(userId);
|
||||
if (StringUtils.isNotBlank(subordinateUserRange)) {
|
||||
subordinateUserRangeDTO.setSubordinateUserRange(subordinateUserRange);
|
||||
if (UserSelectRangeEnum.DEFINE.getCode().equals(subordinateUserRange)) {
|
||||
List<SubordinateMappingDO> myDefineSelectMappingLit = defineSelectMappingMap.get(userId);
|
||||
List<String> regionIds = ListUtils.emptyIfNull(myDefineSelectMappingLit).stream().filter(x -> StringUtils.isNotBlank(x.getRegionId()))
|
||||
.map(SubordinateMappingDO::getRegionId).collect(Collectors.toList());
|
||||
Map<String, String> regionMap = new HashMap<>();
|
||||
List<RegionPathDTO> regionPathByList = regionDAO.getRegionPathByList(enterpriseId, regionIds);
|
||||
regionMap = regionPathByList.stream().collect(Collectors.toMap(RegionPathDTO::getRegionId, RegionPathDTO::getRegionName));
|
||||
|
||||
List<String> personalIds = ListUtils.emptyIfNull(myDefineSelectMappingLit).stream().filter(x -> StringUtils.isNotBlank(x.getPersonalId()))
|
||||
.map(SubordinateMappingDO::getPersonalId).collect(Collectors.toList());
|
||||
|
||||
List<EnterpriseUserDO> personalList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(personalIds)) {
|
||||
personalList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, personalIds);
|
||||
}
|
||||
Map<String, String> personalMap = personalList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getName));
|
||||
|
||||
List<MySubordinatesDTO> nodeTypeList = new ArrayList<>();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(myDefineSelectMappingLit)) {
|
||||
for (SubordinateMappingDO item : myDefineSelectMappingLit) {
|
||||
MySubordinatesDTO nodeTypeDTO = new MySubordinatesDTO();
|
||||
if (StringUtils.isNotBlank(item.getRegionId())) {
|
||||
String regionName = regionMap.get(item.getRegionId());
|
||||
nodeTypeDTO.setNodeType("region");
|
||||
nodeTypeDTO.setRegionName(regionName);
|
||||
nodeTypeDTO.setRegionId(item.getRegionId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(item.getPersonalId())) {
|
||||
String personalName = personalMap.get(item.getPersonalId());
|
||||
nodeTypeDTO.setNodeType("personal");
|
||||
nodeTypeDTO.setPersonalName(personalName);
|
||||
nodeTypeDTO.setPersonalId(item.getPersonalId());
|
||||
}
|
||||
nodeTypeList.add(nodeTypeDTO);
|
||||
}
|
||||
}
|
||||
List<String> sourceList = subordinateMappingDOS.stream().filter(x -> StringUtils.isNotBlank(x.getSource()))
|
||||
.map(SubordinateMappingDO::getSource).distinct().collect(Collectors.toList());
|
||||
subordinateUserRangeDTO.setSourceList(sourceList);
|
||||
if (CollectionUtils.isEmpty(sourceList)) {
|
||||
subordinateUserRangeDTO.setSourceList(Collections.singletonList(SubordinateSourceEnum.AUTO.getCode()));
|
||||
}
|
||||
subordinateUserRangeDTO.setMySubordinates(nodeTypeList);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return subordinateUserRangeMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> initUserRole(String enterpriseId, List<EnterpriseUserPageVO> enterpriseUserList) {
|
||||
List<String> userIdList = ListUtils.emptyIfNull(enterpriseUserList)
|
||||
.stream()
|
||||
.map(EnterpriseUserPageVO::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if(CollectionUtils.isNotEmpty(userIdList)){
|
||||
List<UserRoleDTO> userRoleDTOS = enterpriseUserRoleDAO.getUserAndRolesByUserId(enterpriseId, userIdList);
|
||||
//封装 userId-userRole map,以表示一个用户对应几个角色
|
||||
Map<String, List<Long>> userRoleDtoMap = new HashMap<>();
|
||||
userRoleDTOS.forEach(roleDto -> {
|
||||
List<Long> check = userRoleDtoMap.get(roleDto.getUserId());
|
||||
if (check == null) {
|
||||
List<Long> roleDtoList = new ArrayList<>();
|
||||
roleDtoList.add(roleDto.getRoleId());
|
||||
userRoleDtoMap.put(roleDto.getUserId(), roleDtoList);
|
||||
} else {
|
||||
check.add(roleDto.getRoleId());
|
||||
userRoleDtoMap.put(roleDto.getUserId(), check);
|
||||
}
|
||||
});
|
||||
//获得角色id -角色名称的map
|
||||
Map<Long, String> roleNameMap = ListUtils.emptyIfNull(userRoleDTOS)
|
||||
.stream()
|
||||
.filter(data -> StringUtils.isNotBlank(data.getRoleName()))
|
||||
.collect(Collectors.toMap(UserRoleDTO::getRoleId, UserRoleDTO::getRoleName, (a, b) -> a));
|
||||
enterpriseUserList.forEach(user -> {
|
||||
List<Long> roleIdList = userRoleDtoMap.get(user.getUserId());
|
||||
if (roleIdList != null && roleIdList.size() != 0) {
|
||||
String roleName = roleIdList.stream()
|
||||
.filter(data -> roleNameMap.get(data) != null)
|
||||
.map(role -> roleNameMap.get(role))
|
||||
.collect(Collectors.joining(","));
|
||||
user.setRoleName(roleName);
|
||||
}
|
||||
});
|
||||
}
|
||||
return userIdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getUserRegion(String enterpriseId, List<String> userIdList) {
|
||||
Map<String, String> resultMap = Maps.newHashMap();
|
||||
//根据人员查询该人员所在部门集合
|
||||
List<UserRegionMappingDO> userRegionMappingDOS = userRegionMappingDAO.listUserRegionMappingByUserId(enterpriseId, userIdList);
|
||||
//regionids 集合
|
||||
List<String> regionIds = ListUtils.emptyIfNull(userRegionMappingDOS).stream()
|
||||
.map(UserRegionMappingDO::getRegionId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<RegionDO> regionDOs = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(regionIds)){
|
||||
regionDOs = regionDAO.getRegionByRegionIds(enterpriseId, regionIds);
|
||||
}
|
||||
//部门map KV key-部门id value-部门名称
|
||||
Map<String, String> regionMap = ListUtils.emptyIfNull(regionDOs)
|
||||
.stream()
|
||||
.filter(a->a.getId()!=null&&a.getName()!=null)
|
||||
.collect(Collectors.toMap(data->data.getId().toString(), RegionDO::getName, (a, b) -> a));
|
||||
//人员所在部门map key-人员id value-部门set集合(set去重)
|
||||
Map<String, Set<String>> userRegionMap = ListUtils.emptyIfNull(userRegionMappingDOS)
|
||||
.stream().filter(a->a.getId()!=null&&a.getRegionId()!=null)
|
||||
.collect(Collectors.groupingBy(UserRegionMappingDO::getUserId,
|
||||
Collectors.mapping(UserRegionMappingDO::getRegionId, Collectors.toSet())));
|
||||
userIdList.stream()
|
||||
.forEach(userId->{
|
||||
if(MapUtils.isNotEmpty(userRegionMap)&&MapUtils.isNotEmpty(regionMap)) {
|
||||
Set<String> regions = userRegionMap.get(userId);
|
||||
|
||||
String deptNames = SetUtils.emptyIfNull(regions)
|
||||
.stream()
|
||||
.map(dept -> regionMap.get(dept.toString()))
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.collect(Collectors.joining(CommonConstants.COMMA));
|
||||
resultMap.put(userId, deptNames);
|
||||
}
|
||||
});
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.EnterpriseUserRoleDAO;
|
||||
import com.cool.store.dao.SubordinateMappingDAO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.SubordinateMappingDO;
|
||||
import com.cool.store.entity.UserAuthMappingDO;
|
||||
import com.cool.store.enums.SubordinateSourceEnum;
|
||||
import com.cool.store.enums.UserSelectRangeEnum;
|
||||
import com.cool.store.mapper.EnterpriseUserMapper;
|
||||
import com.cool.store.mapper.UserAuthMappingMapper;
|
||||
import com.cool.store.service.EnterpriseUserService;
|
||||
import com.cool.store.service.SubordinateMappingService;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author wxp
|
||||
* @Date 2023/1/6 11:18
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SubordinateMappingServiceImpl implements SubordinateMappingService {
|
||||
|
||||
@Resource
|
||||
private SubordinateMappingDAO subordinateMappingDAO;
|
||||
@Autowired
|
||||
private EnterpriseUserService enterpriseUserService;
|
||||
@Resource
|
||||
private EnterpriseUserMapper enterpriseUserMapper;
|
||||
@Resource
|
||||
private EnterpriseUserDAO enterpriseUserDAO;
|
||||
@Resource
|
||||
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||
@Resource
|
||||
private UserAuthMappingMapper userAuthMappingMapper;
|
||||
|
||||
/**
|
||||
* 判断用户是否管辖全部用户
|
||||
* @param enterpriseId
|
||||
* @param currentUserId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean checkHaveAllSubordinateUser(String enterpriseId, String currentUserId) {
|
||||
if(CommonConstants.SYSTEM_USER_ID.equals(currentUserId)){
|
||||
return true;
|
||||
}
|
||||
// 判断是否是管理员
|
||||
boolean isAdmin = enterpriseUserRoleDAO.checkIsAdmin(enterpriseId, currentUserId);
|
||||
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(enterpriseId, currentUserId);
|
||||
//失效人员没有权限
|
||||
if(user == null){
|
||||
return false;
|
||||
}
|
||||
if(isAdmin || UserSelectRangeEnum.ALL.getCode().equals(user.getSubordinateRange())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管辖用户
|
||||
* @param enterpriseId
|
||||
* @param currentUserId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<String> getSubordinateUserIdList(String enterpriseId, String currentUserId,Boolean addCurrentFlag) {
|
||||
|
||||
List<String> allUserIdList = Lists.newArrayList();
|
||||
if (addCurrentFlag){
|
||||
allUserIdList.add(currentUserId);
|
||||
}
|
||||
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(enterpriseId, currentUserId);
|
||||
// 查询管辖用户
|
||||
List<SubordinateMappingDO> subordinateMappingList = subordinateMappingDAO.selectByUserIds(enterpriseId, Collections.singletonList(currentUserId));
|
||||
// 如果用户关联用户配置是自定义,但是没有具体数据,默认关联区域门店区域权限下的人
|
||||
if(user != null && UserSelectRangeEnum.DEFINE.getCode().equals(user.getSubordinateRange()) && CollectionUtils.isEmpty(subordinateMappingList)){
|
||||
subordinateMappingList = Lists.newArrayList();
|
||||
SubordinateMappingDO subordinateMappingDO = fillDefaultAutoSubordinate(currentUserId, UserSelectRangeEnum.DEFINE.getCode(), SubordinateSourceEnum.AUTO.getCode());
|
||||
subordinateMappingList.add(subordinateMappingDO);
|
||||
subordinateMappingDAO.batchInsertSubordinateMapping(enterpriseId, subordinateMappingList);
|
||||
}
|
||||
|
||||
List<String> sourceList = ListUtils.emptyIfNull(subordinateMappingList).stream().filter(x -> StringUtils.isNotBlank(x.getSource()))
|
||||
.map(SubordinateMappingDO::getSource).distinct().collect(Collectors.toList());
|
||||
|
||||
//自动关联单独查询 过滤自动关联
|
||||
subordinateMappingList = ListUtils.emptyIfNull(subordinateMappingList).stream().filter(o -> !SubordinateSourceEnum.AUTO.getCode().equals(o.getSource())).collect(Collectors.toList());
|
||||
|
||||
List<String> regionIds = ListUtils.emptyIfNull(subordinateMappingList).stream().filter(x -> StringUtils.isNotBlank(x.getRegionId()))
|
||||
.map(SubordinateMappingDO::getRegionId).collect(Collectors.toList());
|
||||
List<String> personalIds = ListUtils.emptyIfNull(subordinateMappingList).stream().filter(x -> StringUtils.isNotBlank(x.getPersonalId()))
|
||||
.map(SubordinateMappingDO::getPersonalId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(personalIds)) {
|
||||
allUserIdList.addAll(personalIds);
|
||||
}
|
||||
|
||||
if(CollectionUtils.isNotEmpty(sourceList) && sourceList.contains(SubordinateSourceEnum.AUTO.getCode())) {
|
||||
List<UserAuthMappingDO> userAuthList = userAuthMappingMapper.listUserAuthMappingByUserId(enterpriseId, currentUserId);
|
||||
List<String> authRegionIdList = ListUtils.emptyIfNull(userAuthList)
|
||||
.stream().map(UserAuthMappingDO::getMappingId)
|
||||
.collect(Collectors.toList());
|
||||
regionIds.addAll(authRegionIdList);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(regionIds)) {
|
||||
List<EnterpriseUserDO> enterpriseUserDOList = enterpriseUserMapper.listByRegionIdList(enterpriseId, regionIds);
|
||||
if (CollectionUtils.isNotEmpty(enterpriseUserDOList)) {
|
||||
List<String> enterpriseUserIds = enterpriseUserDOList.stream()
|
||||
.map(EnterpriseUserDO::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
allUserIdList.addAll(enterpriseUserIds);
|
||||
}
|
||||
}
|
||||
allUserIdList = allUserIdList.stream().distinct().collect(Collectors.toList());
|
||||
return allUserIdList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保留管辖用户 userId管辖用户范围
|
||||
* @param enterpriseId
|
||||
* @param currentUserId
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<String> retainSubordinateUserIdList(String enterpriseId, String currentUserId, List<String> userIdList,Boolean addCurrentFlag) {
|
||||
Boolean flag = this.checkHaveAllSubordinateUser(enterpriseId, currentUserId);
|
||||
if(flag){
|
||||
return userIdList;
|
||||
}
|
||||
List<String> subordinateUserIdList = getSubordinateUserIdList(enterpriseId, currentUserId,addCurrentFlag);
|
||||
userIdList.retainAll(subordinateUserIdList);
|
||||
return userIdList;
|
||||
}
|
||||
|
||||
|
||||
private SubordinateMappingDO fillDefaultAutoSubordinate(String userId, String userRange, String source) {
|
||||
SubordinateMappingDO subordinateMappingDO = new SubordinateMappingDO();
|
||||
subordinateMappingDO.setUserId(userId);
|
||||
subordinateMappingDO.setRegionId(CommonConstants.ZERO_STR);
|
||||
subordinateMappingDO.setCreateId(CommonConstants.SYSTEM_USER_ID);
|
||||
subordinateMappingDO.setUpdateId(CommonConstants.SYSTEM_USER_ID);
|
||||
subordinateMappingDO.setType(CommonConstants.ZERO);
|
||||
subordinateMappingDO.setUserRange(userRange);
|
||||
subordinateMappingDO.setSource(source);
|
||||
return subordinateMappingDO;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user