|
|
@@ -103,11 +103,11 @@ public class DataPermissionAspect implements InnerInterceptor {
|
|
|
} else if (DataPermissionEnum.DATA_SCOPE_DEPT.getType() == scope) {
|
|
|
//log.info("【数据权限】 部门权限,查本部门数据");
|
|
|
SysDeptUser deptUser = getDeptUser(loginUser.getDeptId());
|
|
|
- userIds.addAll(getPermissionUserIds(deptUser,Boolean.FALSE));
|
|
|
+ userIds.addAll(getPermissionUserIds(deptUser, Boolean.FALSE));
|
|
|
} else if (DataPermissionEnum.DATA_SCOPE_DEPT_AND_CHILD.getType() == scope) {
|
|
|
//log.info("【数据权限】 部门及子部门权限,查本部门及下属部门数据");
|
|
|
SysDeptUser deptUser = getDeptUser(loginUser.getDeptId());
|
|
|
- userIds.addAll(getPermissionUserIds(deptUser,Boolean.TRUE));
|
|
|
+ userIds.addAll(getPermissionUserIds(deptUser, Boolean.TRUE));
|
|
|
} else if (DataPermissionEnum.DATA_SCOPE_SELF.getType() == scope) {
|
|
|
//log.info("【数据权限】 个人权限,只可查个人创建的数据");
|
|
|
userIds.add(loginUser.getUserId());
|
|
|
@@ -115,7 +115,7 @@ public class DataPermissionAspect implements InnerInterceptor {
|
|
|
//log.info("【数据权限】 自定义,查自定义指定的部分数据");
|
|
|
List<LoginRole> roles = loginUser.getRoles().stream().filter(r -> r.getDataScope().equals(DataPermissionEnum.DATA_SCOPE_CUSTOM.getType())).collect(Collectors.toList());
|
|
|
if (roles != null && !roles.isEmpty()) {
|
|
|
- List<Long> ids = getCustomRoleUserIds(loginUser.getRoleId(),roles.get(0).getDataScopeDept());
|
|
|
+ List<Long> ids = getCustomRoleUserIds(roleId, roles.get(0).getDataScopeDept());
|
|
|
userIds.addAll(ids);
|
|
|
}
|
|
|
}
|
|
|
@@ -139,17 +139,18 @@ public class DataPermissionAspect implements InnerInterceptor {
|
|
|
|
|
|
/**
|
|
|
* 获取权限用户
|
|
|
+ *
|
|
|
* @param deptId
|
|
|
* @return
|
|
|
*/
|
|
|
private SysDeptUser getDeptUser(Long deptId) {
|
|
|
- SysDeptUser deptUser = redisService.getCacheObject(CacheConstants.PERMISSION_DEPT_USER+deptId);
|
|
|
+ SysDeptUser deptUser = redisService.getCacheObject(CacheConstants.PERMISSION_DEPT_USER + deptId);
|
|
|
if (deptUser == null) {
|
|
|
//遠程調用
|
|
|
ResultData<SysDeptUser> result = remoteUserService.getSysDeptUser(deptId);
|
|
|
if (HttpStatus.SUCCESS == result.getCode()) {
|
|
|
deptUser = result.getData();
|
|
|
- redisService.setCacheObject(CacheConstants.PERMISSION_DEPT_USER+deptId, deptUser, BaseConstants.TOKEN_EXPIRE, TimeUnit.MINUTES);
|
|
|
+ redisService.setCacheObject(CacheConstants.PERMISSION_DEPT_USER + deptId, deptUser, BaseConstants.TOKEN_EXPIRE, TimeUnit.MINUTES);
|
|
|
}
|
|
|
}
|
|
|
return deptUser;
|
|
|
@@ -170,6 +171,7 @@ public class DataPermissionAspect implements InnerInterceptor {
|
|
|
|
|
|
/**
|
|
|
* 拼装本部门/本部门及以下 对应用户id
|
|
|
+ *
|
|
|
* @param deptUser
|
|
|
* @param needChildDept
|
|
|
* @return
|