mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 13:22:07 +08:00
1、生产单导入日志标签修改;
2、系统加载菜单增加组织管理员和普通人的判断; 3、角色菜单授权增加organid和角色的organid统一的处理,解决前端没有传organid导致rolemenu本机构人看不到的情况;
This commit is contained in:
+1
-1
@@ -237,7 +237,7 @@ public class OrderController {
|
|||||||
@Parameter(name = "type", description = "文件类型", required = true)
|
@Parameter(name = "type", description = "文件类型", required = true)
|
||||||
})
|
})
|
||||||
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = IMPORT)
|
||||||
public void exportTest(@RequestPart("file") MultipartFile file,
|
public void exportTest(@RequestPart("file") MultipartFile file,
|
||||||
@RequestParam(value = "type", required = false, defaultValue = "true") Integer type,
|
@RequestParam(value = "type", required = false, defaultValue = "true") Integer type,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
|
|||||||
+1
-2
@@ -73,9 +73,8 @@ public class PermissionController {
|
|||||||
reqVO.getMenuIds().removeIf(menuId -> !CollUtil.contains(menuIds, menuId));
|
reqVO.getMenuIds().removeIf(menuId -> !CollUtil.contains(menuIds, menuId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Long organId = reqVO.getOrganId() == null? OrganContextHolder.getOrganId(): reqVO.getOrganId();
|
|
||||||
// 执行菜单的分配
|
// 执行菜单的分配
|
||||||
permissionService.assignRoleMenu(reqVO.getRoleId(), reqVO.getMenuIds(), organId);
|
permissionService.assignRoleMenu(reqVO.getRoleId(), reqVO.getMenuIds(), reqVO.getOrganId());
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-6
@@ -166,6 +166,15 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
}else {
|
}else {
|
||||||
dbMenuIds = convertSet(roleMenuMapper.selectListByRoleId(roleId), RoleMenuDO::getMenuId);
|
dbMenuIds = convertSet(roleMenuMapper.selectListByRoleId(roleId), RoleMenuDO::getMenuId);
|
||||||
}
|
}
|
||||||
|
// 查询角色获取角色的组织id,如果没有传入组织id就跟角色的组织统一
|
||||||
|
RoleDO role = roleService.getRole(roleId);
|
||||||
|
if (Objects.isNull(role)) {
|
||||||
|
throw new ServiceException(ErrorCodeConstants.ROLE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
if (Objects.isNull(organId)) {
|
||||||
|
organId = role.getOrganId();
|
||||||
|
}
|
||||||
|
final Long finalOrganId = organId;
|
||||||
|
|
||||||
// 计算新增和删除的菜单编号
|
// 计算新增和删除的菜单编号
|
||||||
Set<Long> menuIdList = CollUtil.emptyIfNull(menuIds);
|
Set<Long> menuIdList = CollUtil.emptyIfNull(menuIds);
|
||||||
@@ -180,7 +189,7 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
if (isOrganRole) {
|
if (isOrganRole) {
|
||||||
entity.setOrganId(InternalRoleConstants.INTERNAL_ROLE_ORGAN_ID);
|
entity.setOrganId(InternalRoleConstants.INTERNAL_ROLE_ORGAN_ID);
|
||||||
}else {
|
}else {
|
||||||
entity.setOrganId(organId);
|
entity.setOrganId(finalOrganId);
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
};
|
};
|
||||||
@@ -195,11 +204,11 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
if (CollectionUtil.isNotEmpty(createMenuIds) || CollectionUtil.isNotEmpty(deleteMenuIds)) {
|
if (CollectionUtil.isNotEmpty(createMenuIds) || CollectionUtil.isNotEmpty(deleteMenuIds)) {
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
// 当前操作人和所操作的目标菜单机构不同时,清空MENU_ROLE_ID_LIST:目标机构id:菜单id的缓存
|
// 当前操作人和所操作的目标菜单机构不同时,清空MENU_ROLE_ID_LIST:目标机构id:菜单id的缓存
|
||||||
if (ObjectUtil.notEqual(organId, currentOrganId)) {
|
if (ObjectUtil.notEqual(finalOrganId, currentOrganId)) {
|
||||||
// 获取新增和删除菜单id的并集
|
// 获取新增和删除菜单id的并集
|
||||||
Collection<Long> delMenuIds = CollUtil.union(createMenuIds, deleteMenuIds);
|
Collection<Long> delMenuIds = CollUtil.union(createMenuIds, deleteMenuIds);
|
||||||
// 构建批量删除的key集合
|
// 构建批量删除的key集合
|
||||||
Set<String> delKeys = delMenuIds.stream().map(menuId -> String.format(String.valueOf(new StringBuffer(RedisKeyConstants.MENU_ROLE_ID_LIST).append(":%s:%s")), organId, menuId)).collect(Collectors.toSet());
|
Set<String> delKeys = delMenuIds.stream().map(menuId -> String.format(String.valueOf(new StringBuffer(RedisKeyConstants.MENU_ROLE_ID_LIST).append(":%s:%s")), finalOrganId, menuId)).collect(Collectors.toSet());
|
||||||
Long batchDelNum = redisTemplate.delete(delKeys);
|
Long batchDelNum = redisTemplate.delete(delKeys);
|
||||||
log.info("[assignRoleMenu] 批量删除redis[MENU_ROLE_ID_LIST]数量:{}", batchDelNum);
|
log.info("[assignRoleMenu] 批量删除redis[MENU_ROLE_ID_LIST]数量:{}", batchDelNum);
|
||||||
}
|
}
|
||||||
@@ -264,9 +273,13 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
if (roleService.hasAnySuperAdmin(roleIds)) {
|
if (roleService.hasAnySuperAdmin(roleIds)) {
|
||||||
return convertSet(menuService.getMenuList(), MenuDO::getId);
|
return convertSet(menuService.getMenuList(), MenuDO::getId);
|
||||||
}
|
}
|
||||||
// 如果是非管理员的情况下,获得拥有的菜单编号
|
if (roleIds.contains(InternalRoleConstants.ORGAN_ADMIN_ROLE_ID)) {
|
||||||
List<RoleMenuDO> from = roleMenuMapper.selectListByRoleIdsAndOrganId(roleIds, OrganContextHolder.getOrganId());
|
// 组织管理员不限制组织id
|
||||||
return convertSet(from, RoleMenuDO::getMenuId);
|
return convertSet(roleMenuMapper.selectListByRoleId(roleIds), RoleMenuDO::getMenuId);
|
||||||
|
} else {
|
||||||
|
// 普通成员只能看组织id下的菜单
|
||||||
|
return convertSet(roleMenuMapper.selectListByRoleIdsAndOrganId(roleIds, OrganContextHolder.getOrganId()), RoleMenuDO::getMenuId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user