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
275633ac
Commit
275633ac
authored
Mar 13, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限控制添加:应用菜单的查询和过滤
parent
73d3d25b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
62 deletions
+114
-62
MenuApiService.java
...pi/src/main/java/com/gic/auth/service/MenuApiService.java
+13
-3
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+19
-3
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+64
-0
UserOperationItemAuthVO.java
...ain/java/com/gic/auth/web/vo/UserOperationItemAuthVO.java
+18
-56
No files found.
gic-platform-auth-api/src/main/java/com/gic/auth/service/MenuApiService.java
View file @
275633ac
...
...
@@ -32,7 +32,7 @@ public interface MenuApiService {
ServiceResponse
<
List
<
MenuDTO
>>
listByParentMenuIdList
(
List
<
Integer
>
parentMenuIdList
);
/**
* 查询用户拥有的所有菜单路由权限
* 查询用户拥有的所有菜单路由权限
,用于登录用户session用
* @Title: listUserMenu
* @Description:
* @author guojuxing
...
...
@@ -68,7 +68,7 @@ public interface MenuApiService {
String
versionCode
);
/**
* 根据用户ID查询没拥有的gic操作项
* 根据用户ID查询没拥有的gic操作项
(gic)
* @Title: getNoAuthOperationItemOfGic
* @Description:
* @author guojuxing
...
...
@@ -77,6 +77,16 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.MenuDTO>>
*/
ServiceResponse
<
List
<
MenuDTO
>>
getNoAuthOperationItemOfGic
(
Integer
userId
,
String
versionCode
);
/**
* 根据用户ID查询没拥有的gic操作项(应用)
* @Title: getNoAuthOperationItemOfApp
* @Description:
* @author guojuxing
* @param userId
* @param versionCode
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.MenuDTO>>
*/
ServiceResponse
<
List
<
MenuDTO
>>
getNoAuthOperationItemOfApp
(
Integer
userId
,
String
versionCode
);
/**
* 获取超级管理员的Gic菜单
...
...
@@ -86,7 +96,7 @@ public interface MenuApiService {
ServiceResponse
<
List
<
MenuDTO
>>
getSuperAdminGicMenu
(
Integer
enterpriseId
);
/**
* 获取超级管理员的菜单 非树
* 获取超级管理员的菜单 非树
用于登录用户session用
* @Title: getSuperAdminGicMenuNotTree
* @Description:
* @author guojuxing
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
275633ac
...
...
@@ -89,9 +89,16 @@ public class MenuApiServiceImpl implements MenuApiService {
List
<
TabSysMenu
>
temp
=
new
ArrayList
<>();
//超级管理员
MenuListQO
params
=
new
MenuListQO
();
//查询gic的菜单
params
.
setIsGIC
(
MenuProjectConstants
.
DEFAULT_PROJECT_CODE
);
params
.
setVersionCode
(
versionCode
);
params
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
temp
.
addAll
(
this
.
menuService
.
listMenu
(
params
));
//查询应用的菜单
params
.
setVersionCode
(
""
);
params
.
setIsGIC
(
MenuProjectConstants
.
APP_PROJECT_CODE
);
params
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
temp
.
addAll
(
this
.
menuService
.
listMenu
(
params
));
result
=
EntityUtil
.
changeEntityListNew
(
MenuDTO
.
class
,
temp
);
}
else
{
...
...
@@ -122,6 +129,11 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
getNoAuthOperationItemOfApp
(
Integer
userId
,
String
versionCode
)
{
return
getNoAuthOperationItem
(
userId
,
MenuProjectConstants
.
APP_PROJECT_CODE
,
versionCode
);
}
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
getSuperAdminGicMenu
(
Integer
enterpriseId
)
{
//查询超级管理员
TabSysUser
tabSysUser
=
userService
.
getUserByEnterpriseId
(
enterpriseId
);
...
...
@@ -873,6 +885,7 @@ public class MenuApiServiceImpl implements MenuApiService {
* @param userId
* @param currentMenu
* @param isGic 是否是gic项目
* @param versionCode 如果是gic项目,则传的是基础服务版本,如果是应用,则传递的是应用ID
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.MenuDTO>>
*/
private
ServiceResponse
<
List
<
MenuDTO
>>
getUserLoginMenu
(
Integer
enterpriseId
,
Integer
userId
,
Integer
currentMenu
,
boolean
isGic
,
...
...
@@ -885,18 +898,21 @@ public class MenuApiServiceImpl implements MenuApiService {
//返回结果集定义声明
List
<
TabSysMenu
>
resultList
;
if
(
StringUtils
.
isBlank
(
versionCode
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户还没有订购基础服务"
);
if
(
isGic
)
{
if
(
StringUtils
.
isBlank
(
versionCode
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户还没有订购基础服务"
);
}
}
if
(
tabSysUser
.
getSuperAdmin
().
intValue
()
==
1
)
{
//超级用户
MenuListQO
params
=
new
MenuListQO
();
params
.
setVersionCode
(
versionCode
);
params
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
if
(
isGic
)
{
params
.
setVersionCode
(
versionCode
);
params
.
setIsGIC
(
MenuProjectConstants
.
DEFAULT_PROJECT_CODE
);
}
else
{
params
.
setProject
(
versionCode
);
params
.
setIsGIC
(
MenuProjectConstants
.
APP_PROJECT_CODE
);
}
resultList
=
this
.
menuService
.
listMenu
(
params
);
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
275633ac
...
...
@@ -4,6 +4,8 @@ import java.util.*;
import
com.gic.api.base.commons.Page
;
import
com.gic.auth.web.vo.LogListVO
;
import
com.gic.commons.util.EntityUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -32,6 +34,14 @@ public class MenuController {
@Autowired
private
MenuItemApiService
menuItemApiService
;
/**
* 查询登录用户的gic菜单
* @Title: loginUserMenu
* @Description:
* @author guojuxing
* @param currentMenu
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"login-user-menu"
)
public
RestResponse
loginUserMenu
(
Integer
currentMenu
)
{
Integer
userId
=
UserDetailUtils
.
getUserDetail
().
getUserId
();
...
...
@@ -44,6 +54,34 @@ public class MenuController {
return
EnterpriseRestResponse
.
failure
(
userMenu
);
}
/**
* 查询登录用户的应用的菜单
* @Title: loginUserMenu
* @Description:
* @author guojuxing
* @param currentMenu
* @param appId
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"login-user-menu-of-app"
)
public
RestResponse
loginUserMenu
(
Integer
currentMenu
,
String
appId
)
{
Integer
userId
=
UserDetailUtils
.
getUserDetail
().
getUserId
();
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
ServiceResponse
<
List
<
MenuDTO
>>
userMenu
=
this
.
menuApiService
.
getUserMenuOfApp
(
enterpriseId
,
userId
,
currentMenu
,
appId
);
if
(
userMenu
.
isSuccess
())
{
return
RestResponse
.
success
(
userMenu
.
getResult
());
}
return
EnterpriseRestResponse
.
failure
(
userMenu
);
}
/**
* 登陆用户没有权限的操作项列表数据(gic)
* @Title: loginUserOperationItem
* @Description:
* @author guojuxing
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"login-user-operation-item"
)
public
RestResponse
loginUserOperationItem
()
{
Integer
userId
=
UserDetailUtils
.
getUserDetail
().
getUserId
();
...
...
@@ -54,6 +92,32 @@ public class MenuController {
}
/**
* 登陆用户没有权限的操作项列表数据(app)
* @Title: loginUserOperationItemOfApp
* @Description:
* @author guojuxing
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"login-user-operation-item-of-app"
)
public
RestResponse
loginUserOperationItemOfApp
(
String
appId
)
{
Integer
userId
=
UserDetailUtils
.
getUserDetail
().
getUserId
();
ServiceResponse
<
List
<
MenuDTO
>>
menuList
=
this
.
menuApiService
.
getNoAuthOperationItemOfApp
(
userId
,
""
);
List
<
UserOperationItemAuthVO
>
resultList
=
new
ArrayList
<>();
if
(
menuList
.
isSuccess
())
{
List
<
MenuDTO
>
list
=
menuList
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
MenuDTO
menuDTO
:
list
)
{
if
(
menuDTO
.
getProject
().
equals
(
appId
))
{
resultList
.
add
(
EntityUtil
.
changeEntityNew
(
UserOperationItemAuthVO
.
class
,
menuDTO
));
}
}
}
}
return
RestResponse
.
success
(
resultList
);
}
/**
* 获取的页面树
* @Title: listMenuPageTree
* @Description:
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/UserOperationItemAuthVO.java
View file @
275633ac
package
com
.
gic
.
auth
.
web
.
vo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* 登陆用户拥有的所有操作项
...
...
@@ -8,79 +11,38 @@ import java.io.Serializable;
* @author guojuxing
* @date 2019/9/26 11:05 AM
*/
@Accessors
(
chain
=
true
)
@Data
public
class
UserOperationItemAuthVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4102202683416381220L
;
/**
*
*
操作项ID
*/
private
Integer
menuId
;
/**
* 名称
*/
private
String
menuName
;
/**
* 项目,应用ID
*/
private
String
project
;
/**
* 接口路径
*/
private
String
menuUrl
;
private
Integer
parentId
;
/**
* 菜单code,唯一
*/
private
String
menuCode
;
private
String
parentCode
;
public
Integer
getMenuId
()
{
return
menuId
;
}
public
void
setMenuId
(
Integer
menuId
)
{
this
.
menuId
=
menuId
;
}
public
String
getMenuName
()
{
return
menuName
;
}
public
void
setMenuName
(
String
menuName
)
{
this
.
menuName
=
menuName
;
}
public
String
getProject
()
{
return
project
;
}
public
void
setProject
(
String
project
)
{
this
.
project
=
project
;
}
public
String
getMenuUrl
()
{
return
menuUrl
;
}
public
void
setMenuUrl
(
String
menuUrl
)
{
this
.
menuUrl
=
menuUrl
;
}
public
Integer
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Integer
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getMenuCode
()
{
return
menuCode
;
}
public
void
setMenuCode
(
String
menuCode
)
{
this
.
menuCode
=
menuCode
;
}
public
String
getParentCode
()
{
return
parentCode
;
}
public
void
setParentCode
(
String
parentCode
)
{
this
.
parentCode
=
parentCode
;
}
}
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