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
670345b5
Commit
670345b5
authored
Sep 20, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增操作项:同步生成权限项
parent
cdf87bff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
8 deletions
+55
-8
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+28
-8
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+27
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
670345b5
...
...
@@ -2,6 +2,7 @@ package com.gic.auth.service.outer.impl;
import
java.util.*
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.Page
;
import
com.gic.auth.constant.*
;
import
com.gic.auth.dto.MenuItemDTO
;
...
...
@@ -13,6 +14,8 @@ import com.gic.open.api.dto.ApplicationDTO;
import
com.gic.open.api.dto.ServePropDTO
;
import
com.gic.open.api.service.ApplicationApiService
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -31,6 +34,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
@Service
(
"menuApiService"
)
public
class
MenuApiServiceImpl
implements
MenuApiService
{
private
final
static
Logger
LOGGER
=
LogManager
.
getLogger
(
MenuApiServiceImpl
.
class
);
@Autowired
private
MenuService
menuService
;
@Autowired
...
...
@@ -62,7 +66,11 @@ public class MenuApiServiceImpl implements MenuApiService {
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
listMenuTree
(
MenuListQO
params
)
{
if
(
params
.
isNeedUpdateAppMenu
())
{
if
(
params
.
getIsGIC
()
==
null
)
{
params
.
setIsGIC
(
1
);
}
//应用菜单类型
if
(
params
.
getIsGIC
()
==
2
&&
params
.
isNeedUpdateAppMenu
())
{
saveAppMenu
();
}
params
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
...
...
@@ -105,7 +113,7 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public
ServiceResponse
<
Void
>
saveGICChildPage
(
MenuDTO
menuDTO
)
{
public
ServiceResponse
<
Integer
>
saveGICChildPage
(
MenuDTO
menuDTO
)
{
menuDTO
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
return
saveChildPage
(
menuDTO
,
MenuDTO
.
SaveGICChildPageValid
.
class
);
}
...
...
@@ -138,7 +146,7 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public
ServiceResponse
<
Void
>
saveAppChildPage
(
MenuDTO
menuDTO
)
{
public
ServiceResponse
<
Integer
>
saveAppChildPage
(
MenuDTO
menuDTO
)
{
menuDTO
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
return
saveChildPage
(
menuDTO
,
MenuDTO
.
SaveAppChildPageValid
.
class
);
}
...
...
@@ -162,9 +170,21 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public
ServiceResponse
<
Void
>
saveOperationItem
(
MenuDTO
menuDTO
)
{
public
ServiceResponse
<
Integer
>
saveOperationItem
(
MenuDTO
menuDTO
)
{
menuDTO
.
setMenuType
(
MenuTypeEnum
.
OPERATION
.
getCode
());
return
saveChildPage
(
menuDTO
,
MenuDTO
.
SaveOperationItemValid
.
class
);
ServiceResponse
<
Integer
>
saveOperationItemResult
=
saveChildPage
(
menuDTO
,
MenuDTO
.
SaveOperationItemValid
.
class
);
if
(
saveOperationItemResult
.
isSuccess
())
{
if
(
menuDTO
.
isNeedCreateAuthItem
())
{
//同步生成权限项
AuthItemSaveQO
authItemSaveQO
=
new
AuthItemSaveQO
();
authItemSaveQO
.
setMenuName
(
menuDTO
.
getMenuName
());
authItemSaveQO
.
setOperationItemIds
(
saveOperationItemResult
.
getResult
().
toString
());
authItemSaveQO
.
setParentId
(
menuDTO
.
getParentId
());
ServiceResponse
saveAuthItemResult
=
saveAuthItem
(
authItemSaveQO
);
LOGGER
.
info
(
"同步生成权限项结果:{}"
,
JSON
.
toJSONString
(
saveAuthItemResult
));
}
}
return
saveOperationItemResult
;
}
@Override
...
...
@@ -302,7 +322,7 @@ public class MenuApiServiceImpl implements MenuApiService {
return
ServiceResponse
.
success
();
}
private
ServiceResponse
<
Void
>
saveChildPage
(
MenuDTO
menuDTO
,
Class
clazz
)
{
private
ServiceResponse
<
Integer
>
saveChildPage
(
MenuDTO
menuDTO
,
Class
clazz
)
{
TabSysMenu
record
=
menuService
.
getMenuById
(
menuDTO
.
getParentId
());
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"父级页面不存在"
);
...
...
@@ -314,8 +334,8 @@ public class MenuApiServiceImpl implements MenuApiService {
setNormalFieldValue
(
menuDTO
,
record
);
setMenuVersion
(
menuDTO
);
menuService
.
savePage
(
menuDTO
);
return
ServiceResponse
.
success
();
Integer
menuId
=
menuService
.
savePage
(
menuDTO
);
return
ServiceResponse
.
success
(
menuId
);
}
private
ServiceResponse
<
Void
>
updatePage
(
MenuDTO
menuDTO
,
MenuTypeEnum
menuTypeEnum
,
Class
clazz
)
{
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
670345b5
...
...
@@ -154,12 +154,39 @@ public class MenuController {
return
EnterpriseRestResponse
.
failure
(
result
);
}
/**
* 新增页面的时候,应用版本下拉数据
* @Title: getMenuVersionByParentId
* @Description:
* @author guojuxing
* @param parentId
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/get-menu-version-by-parent-id"
)
public
RestResponse
getMenuVersionByParentId
(
Integer
parentId
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>(
16
);
if
(
parentId
==
null
)
{
//如果为空,则是gic新增页面
for
(
GicVersionEnum
versionEnum
:
GicVersionEnum
.
values
())
{
map
.
put
(
String
.
valueOf
(
versionEnum
.
getCode
()),
versionEnum
.
getMessage
());
}
return
RestResponse
.
success
(
map
);
}
ServiceResponse
<
MenuDTO
>
result
=
menuApiService
.
getDetailById
(
parentId
);
if
(
result
.
isSuccess
())
{
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
);
String
menuVersion
=
dto
.
getMenuVersion
().
substring
(
1
,
dto
.
getMenuVersion
().
length
()
-
1
);
vo
.
setMenuVersion
(
menuVersion
.
replaceAll
(
SignConstants
.
UNDERLINE
,
SignConstants
.
COMMA
));
vo
.
setMap
(
getMenuVersionMap
(
result
.
getResult
()));
return
RestResponse
.
success
(
vo
);
}
...
...
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