新增组织架构同步相关
This commit is contained in:
@@ -39,6 +39,9 @@ public class EnterpriseUserDAO {
|
||||
* @param excludeUserIds
|
||||
*/
|
||||
public void deleteUser(List<String> excludeUserIds){
|
||||
if(CollectionUtils.isEmpty(excludeUserIds)){
|
||||
return;
|
||||
}
|
||||
enterpriseUserMapper.deleteUser(excludeUserIds);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class EnterpriseUserRoleDAO {
|
||||
}
|
||||
|
||||
public Integer deleteRoleInUser(String roleId, DataSourceEnum dataSourceEnum, List<String> excludeUserIds){
|
||||
if(StringUtils.isBlank(roleId) || Objects.isNull(dataSourceEnum)){
|
||||
if(StringUtils.isBlank(roleId) || Objects.isNull(dataSourceEnum) || CollectionUtils.isEmpty(excludeUserIds)){
|
||||
return null;
|
||||
}
|
||||
return enterpriseUserRoleMapper.deleteRoleInUser(roleId, dataSourceEnum.getCode(), excludeUserIds);
|
||||
|
||||
@@ -89,6 +89,6 @@
|
||||
</update>
|
||||
|
||||
<update id="deleteUserInRole">
|
||||
update enterprise_user_role set deleted = 1 where role_id != #{roleId} and user_id = #{userId} and type = #{type}
|
||||
update enterprise_user_role set deleted = 1 where role_id != #{excludeRoleId} and user_id = #{userId} and type = #{type}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -37,6 +37,11 @@ public class RegionBaseInfoVO {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换成树
|
||||
* @param regionList
|
||||
* @return
|
||||
*/
|
||||
public static RegionBaseInfoVO convertTree(List<RegionDO> regionList){
|
||||
Map<String, List<RegionDO>> parentMap = regionList.stream().collect(Collectors.groupingBy(k -> k.getParentId()));
|
||||
RegionDO rootRegion = regionList.stream().filter(o -> CommonConstants.ZERO_STR.equals(o.getParentId())).findFirst().get();
|
||||
@@ -45,6 +50,12 @@ public class RegionBaseInfoVO {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子区域
|
||||
* @param regionId
|
||||
* @param parentMap
|
||||
* @return
|
||||
*/
|
||||
public static List<RegionBaseInfoVO> getSubRegion(String regionId, Map<String, List<RegionDO>> parentMap){
|
||||
List<RegionBaseInfoVO> resultList = new ArrayList<>();
|
||||
if(Objects.isNull(parentMap) || StringUtils.isBlank(regionId)){
|
||||
|
||||
@@ -169,8 +169,8 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
|
||||
if(CollectionUtils.isNotEmpty(departmentLists)){
|
||||
List<RegionDO> regionList = regionDAO.getRegionByRegionIds(departmentLists);
|
||||
List<String> regionIds = ListUtils.emptyIfNull(regionList).stream().map(RegionDO::getRegionId).collect(Collectors.toList());
|
||||
//判断两个集合是否都是包含关系
|
||||
if(!(regionIds.containsAll(departmentLists) && departmentLists.containsAll(regionList))){
|
||||
//判断两个集合是否都是包含关系,不包含的情况下 说明组织架构数据不全 重新同步
|
||||
if(!(regionIds.containsAll(departmentLists) && departmentLists.containsAll(regionIds))){
|
||||
Pair<List<RegionDO>, Multimap<String, String>> regionPair = syncRegion();
|
||||
regionList = regionPair.getKey();
|
||||
leaderDeptMap = regionPair.getValue();
|
||||
@@ -194,6 +194,7 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
|
||||
enterpriseUserDAO.batchInsertOrUpdate(new ArrayList<>(Arrays.asList(enterpriseUser)));
|
||||
break;
|
||||
case USER_DELETED:
|
||||
//人员职位删除状态,角色职位删除状态,人员从部门去除
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user