Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-platform-auth
Commits
06bfb93b
Commit
06bfb93b
authored
Aug 31, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询没有权限的操作项列表接口修复
parent
b7455f32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
3 deletions
+53
-3
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+53
-3
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
06bfb93b
...
@@ -1430,12 +1430,62 @@ public class MenuApiServiceImpl implements MenuApiService {
...
@@ -1430,12 +1430,62 @@ public class MenuApiServiceImpl implements MenuApiService {
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户不存在"
);
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户不存在"
);
}
}
//添加逻辑:如果是超级管理员,
直接全部有效,不存在
没有权限的操作项
//添加逻辑:如果是超级管理员,
过滤部门权限,给出
没有权限的操作项
if
(
tabSysUser
.
getSuperAdmin
().
intValue
()
==
1
)
{
if
(
tabSysUser
.
getSuperAdmin
().
intValue
()
==
1
)
{
//
//
MenuListQO
params
=
new
MenuListQO
();
MenuListQO
params
=
new
MenuListQO
();
List
<
TabSysMenu
>
adminMenuList
=
filterOperationUserDepartAuth
(
menuService
.
listMenu
(
params
),
tabSysUser
);
//操作项
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
MenuDTO
.
class
,
adminMenuList
));
params
.
setMenuType
(
2
);
List
<
TabSysMenu
>
allOper
=
menuService
.
listMenu
(
params
);
if
(
tabSysUser
!=
null
&&
tabSysUser
.
getLoginType
().
intValue
()
!=
0
)
{
//运营人员的部门职位;根据手机号查询运维人员的部门职位信息
GicUserDTO
gicUserDTO
=
gicUserService
.
getUserByMobile
(
tabSysUser
.
getPhoneNumber
());
LOGGER
.
info
(
"运维人员的部门职位数据:{}"
,
JSON
.
toJSONString
(
gicUserDTO
));
//如果是运营人员
Set
<
String
>
departPosition
=
new
HashSet
<>(
2
);
String
departmentCode
=
gicUserDTO
.
getDepartmentCode
();
if
(
StringUtils
.
isNotBlank
(
departmentCode
))
{
if
(
StringUtils
.
isBlank
(
gicUserDTO
.
getPositionCode
()))
{
//如果职位code是空,则取下面全部的职位code
List
<
GicDepartmentDTO
>
gicDepartmentDTOList
=
gicDepartmentService
.
listAllGicDepartment
();
if
(
CollectionUtils
.
isNotEmpty
(
gicDepartmentDTOList
))
{
Map
<
String
,
List
<
GicPositionDTO
>>
departMap
=
gicDepartmentDTOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
e
->
e
.
getDepartmentCode
(),
e
->
e
.
getPositionList
()));
List
<
GicPositionDTO
>
positionList
=
departMap
.
get
(
departmentCode
);
if
(
CollectionUtils
.
isNotEmpty
(
positionList
))
{
positionList
.
forEach
(
e
->
{
departPosition
.
add
(
departmentCode
+
"-"
+
e
.
getPositionCode
());
});
}
}
}
else
{
departPosition
.
add
(
departmentCode
+
"-"
+
gicUserDTO
.
getPositionCode
());
}
}
//过滤运营人员的部门职位权限
Map
<
String
,
List
<
TabSysMenuAuthDepart
>>
departMap
=
getAuthDepartMap
(
null
);
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
MenuDTO
.
class
,
allOper
.
stream
().
filter
(
e
->
{
if
(
e
.
getAuthType
().
intValue
()
==
1
)
{
//普通管理员的都有效,不需要判断部门职位
return
false
;
}
List
<
TabSysMenuAuthDepart
>
authList
=
departMap
.
get
(
e
.
getMenuCode
());
if
(
authList
==
null
)
{
//如果是空的,说明是全部权限
return
false
;
}
//验证departPosition是否存在一个于authList中
if
(
authList
.
stream
().
anyMatch
(
auth
->
departPosition
.
contains
(
auth
.
getDepartCode
()
+
"-"
+
auth
.
getPositionCode
())))
{
return
false
;
}
return
true
;
}).
collect
(
Collectors
.
toList
())));
}
else
if
(
tabSysUser
!=
null
&&
tabSysUser
.
getSuperAdmin
().
intValue
()
==
1
)
{
//超级管理员
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
MenuDTO
.
class
,
allOper
.
stream
().
filter
(
e
->
e
.
getAuthType
().
intValue
()
==
3
).
collect
(
Collectors
.
toList
())));
}
}
}
//用户拥有的菜单权限
//用户拥有的菜单权限
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment