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
d84d1ed4
Commit
d84d1ed4
authored
Sep 18, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限管理:页面、子页面、操作项接口修改
parent
d339e5a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
200 additions
and
21 deletions
+200
-21
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+45
-21
MenuDetailVO.java
...h-web/src/main/java/com/gic/auth/web/vo/MenuDetailVO.java
+155
-0
No files found.
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
d84d1ed4
...
...
@@ -5,9 +5,6 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.auth.constant.GicVersionEnum
;
import
com.gic.auth.constant.MenuLevelConstants
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -15,14 +12,18 @@ import org.springframework.web.bind.annotation.RestController;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.constant.GicVersionEnum
;
import
com.gic.auth.constant.MenuLevelConstants
;
import
com.gic.auth.constant.MenuProjectConstants
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.qo.MenuListQO
;
import
com.gic.auth.service.MenuApiService
;
import
com.gic.auth.web.vo.MenuDetailVO
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.response.EnterpriseRestResponse
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
com.gic.store.dto.StoreGroupDTO
;
@RestController
public
class
MenuController
{
...
...
@@ -127,6 +128,45 @@ public class MenuController {
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
setSort
(
id
,
sort
));
}
@RequestMapping
(
"/get-menu-version-by-id"
)
public
RestResponse
getMenuVersionById
(
Integer
id
)
{
ServiceResponse
<
MenuDTO
>
result
=
menuApiService
.
getDetailById
(
id
);
if
(
result
.
isSuccess
())
{
return
RestResponse
.
success
(
getMenuVersionMap
(
result
.
getResult
()));
}
return
EnterpriseRestResponse
.
failure
(
result
);
}
@RequestMapping
(
"/get-menu-detail-by-id"
)
public
RestResponse
getMenuDetailById
(
Integer
id
)
{
ServiceResponse
<
MenuDTO
>
result
=
menuApiService
.
getDetailById
(
id
);
if
(
result
.
isSuccess
())
{
MenuDTO
dto
=
result
.
getResult
();
MenuDetailVO
vo
=
EntityUtil
.
changeEntityNew
(
MenuDetailVO
.
class
,
dto
);
vo
.
setMap
(
getMenuVersionMap
(
result
.
getResult
()));
return
RestResponse
.
success
(
vo
);
}
return
EnterpriseRestResponse
.
failure
(
result
);
}
private
static
Map
<
String
,
String
>
getMenuVersionMap
(
MenuDTO
dto
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>(
16
);
if
(
dto
.
getProject
().
equals
(
MenuProjectConstants
.
DEFAULT_PROJECT
)
&&
dto
.
getLevel
()
==
1
)
{
for
(
GicVersionEnum
versionEnum
:
GicVersionEnum
.
values
())
{
map
.
put
(
String
.
valueOf
(
versionEnum
.
getCode
()),
versionEnum
.
getMessage
());
}
}
else
{
String
menuVersion
=
dto
.
getMenuVersion
();
String
menuVersionName
=
dto
.
getMenuVersionName
();
String
[]
menuVersionArr
=
menuVersion
.
substring
(
1
,
menuVersion
.
length
()
-
1
).
split
(
"_"
);
String
[]
menuVersionNameArr
=
menuVersionName
.
split
(
"/"
);
for
(
int
i
=
0
,
len
=
menuVersionArr
.
length
;
i
<
len
;
i
++)
{
map
.
put
(
menuVersionArr
[
i
],
menuVersionNameArr
[
i
]);
}
}
return
map
;
}
public
static
List
<
Map
<
String
,
Object
>>
changeListToTree
(
int
storeGroupId
,
List
<
MenuDTO
>
list
)
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
if
(
list
!=
null
)
{
...
...
@@ -139,7 +179,7 @@ public class MenuController {
data
.
put
(
"sort"
,
menuDTO
.
getSort
());
data
.
put
(
"menuCode"
,
menuDTO
.
getMenuCode
());
data
.
put
(
"parentCode"
,
menuDTO
.
getParentCode
());
data
.
put
(
"menuVersion
"
,
getMenuVersionStr
(
menuDTO
.
getMenuVersion
()
));
data
.
put
(
"menuVersion
Name"
,
menuDTO
.
getMenuVersionName
(
));
List
<
Map
<
String
,
Object
>>
children
=
changeListToTree
(
menuDTO
.
getMenuId
(),
list
);
if
(
children
==
null
||
children
.
size
()
<
1
)
{
data
.
put
(
"children"
,
null
);
...
...
@@ -152,20 +192,4 @@ public class MenuController {
}
return
result
;
}
private
static
String
getMenuVersionStr
(
String
menuVersion
)
{
if
(
StringUtils
.
isBlank
(
menuVersion
))
{
return
null
;
}
String
[]
menuVersionArr
=
menuVersion
.
split
(
"_"
);
StringBuilder
result
=
new
StringBuilder
();
for
(
String
str
:
menuVersionArr
)
{
if
(
StringUtils
.
isBlank
(
str
))
{
continue
;
}
result
.
append
(
GicVersionEnum
.
getMessageByCode
(
Integer
.
parseInt
(
str
))).
append
(
"/"
);
}
String
menuVersionStr
=
result
.
toString
();
return
menuVersionStr
.
substring
(
0
,
menuVersionStr
.
length
()
-
1
);
}
}
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/MenuDetailVO.java
0 → 100644
View file @
d84d1ed4
package
com
.
gic
.
auth
.
web
.
vo
;
import
java.io.Serializable
;
import
java.util.Map
;
/**
* 页面、子页面、操作项等详情
* @ClassName: GicMenuDetailVO
* @Description:
* @author guojuxing
* @date 2019/9/18 4:47 PM
*/
public
class
MenuDetailVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
6360620959633903701L
;
/**
*
*/
private
Integer
menuId
;
/**
* 菜单名称
*/
private
String
menuName
;
/**
* 菜单路由
*/
private
String
menuUrl
;
/**
* 上级菜单id
*/
private
Integer
parentId
;
/**
* 0当前页1新开页
*/
private
Integer
target
;
/**
*
*/
private
String
iconUrl
;
/**
* 是否显示在菜单栏的菜单,0否1是
*/
private
Integer
isShow
;
/**
* 页面code
*/
private
String
menuCode
;
/**
* 父级code
*/
private
String
parentCode
;
/**
* 多选,例如_1_2_格式,如果是GIC菜单 1gic标准版 2gic集团版;如果是应用菜单 1:基础班 2:高级版
*/
private
String
menuVersion
;
private
Map
<
String
,
String
>
map
;
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
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
Integer
getTarget
()
{
return
target
;
}
public
void
setTarget
(
Integer
target
)
{
this
.
target
=
target
;
}
public
String
getIconUrl
()
{
return
iconUrl
;
}
public
void
setIconUrl
(
String
iconUrl
)
{
this
.
iconUrl
=
iconUrl
;
}
public
Integer
getIsShow
()
{
return
isShow
;
}
public
void
setIsShow
(
Integer
isShow
)
{
this
.
isShow
=
isShow
;
}
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
;
}
public
String
getMenuVersion
()
{
return
menuVersion
;
}
public
void
setMenuVersion
(
String
menuVersion
)
{
this
.
menuVersion
=
menuVersion
;
}
public
Map
<
String
,
String
>
getMap
()
{
return
map
;
}
public
void
setMap
(
Map
<
String
,
String
>
map
)
{
this
.
map
=
map
;
}
}
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