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
8a0760ed
Commit
8a0760ed
authored
Sep 27, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开票回调函数代码
parent
ea6b17e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
9 deletions
+91
-9
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+6
-0
RoleController.java
...main/java/com/gic/auth/web/controller/RoleController.java
+67
-1
RoleDetailVO.java
...h-web/src/main/java/com/gic/auth/web/vo/RoleDetailVO.java
+18
-8
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
8a0760ed
...
...
@@ -54,6 +54,12 @@ public class MenuApiServiceImpl implements MenuApiService {
private
AppTokenApiService
appTokenApiService
;
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
listByMenuIdList
(
List
<
Integer
>
menuIdList
)
{
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
MenuDTO
.
class
,
menuService
.
selectByIds
(
menuIdList
)));
}
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
listUserMenu
(
Integer
userId
)
{
TabSysUser
tabSysUser
=
userService
.
getUserById
(
userId
);
if
(
tabSysUser
==
null
)
{
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/RoleController.java
View file @
8a0760ed
...
...
@@ -6,7 +6,9 @@ import java.util.List;
import
java.util.Map
;
import
com.gic.auth.constant.MenuTypeEnum
;
import
com.gic.auth.constant.SignConstants
;
import
com.gic.auth.web.vo.AppMenuVO
;
import
com.gic.commons.util.EntityUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -41,7 +43,42 @@ public class RoleController {
@RequestMapping
(
"/get-detail"
)
public
RestResponse
getDetail
(
Integer
id
)
{
return
ResultControllerUtils
.
commonResultOne
(
roleApiService
.
getById
(
id
),
RoleDetailVO
.
class
);
ServiceResponse
<
RoleDTO
>
roleResult
=
roleApiService
.
getById
(
id
);
if
(
roleResult
.
isSuccess
())
{
RoleDTO
roleDTO
=
roleResult
.
getResult
();
RoleDetailVO
vo
=
EntityUtil
.
changeEntityNew
(
RoleDetailVO
.
class
,
roleDTO
);
String
menuIds
=
roleDTO
.
getMenuIds
();
String
[]
menuIdArr
=
menuIds
.
split
(
SignConstants
.
COMMA
);
List
<
Integer
>
menuIdList
=
new
ArrayList
<>(
menuIdArr
.
length
);
for
(
String
menuId
:
menuIdArr
)
{
menuIdList
.
add
(
Integer
.
parseInt
(
menuId
));
}
ServiceResponse
<
List
<
MenuDTO
>>
menuListResult
=
menuApiService
.
listByMenuIdList
(
menuIdList
);
ServiceResponse
<
List
<
MenuDTO
>>
gicResult
=
menuApiService
.
listMenuTreeForRole
(
MenuProjectConstants
.
DEFAULT_PROJECT
);
Map
<
Integer
,
Object
>
gicMap
=
new
HashMap
<>(
16
);
if
(
gicResult
.
isSuccess
())
{
List
<
MenuDTO
>
gicMenuList
=
gicResult
.
getResult
();
for
(
MenuDTO
menuDTO
:
gicMenuList
)
{
gicMap
.
put
(
menuDTO
.
getMenuId
(),
1
);
}
}
vo
.
setGicMap
(
changeListToSelectTree
(
MenuLevelConstants
.
FIRST_LEVEL_PARENT_ID
,
menuListResult
.
getResult
(),
gicMap
));
//app已购买应用
ServiceResponse
<
List
<
MenuDTO
>>
appResult
=
menuApiService
.
listAppPageOfHasBuy
();
Map
<
Integer
,
Object
>
appMap
=
new
HashMap
<>(
16
);
if
(
gicResult
.
isSuccess
())
{
List
<
MenuDTO
>
appMenuList
=
appResult
.
getResult
();
for
(
MenuDTO
menuDTO
:
appMenuList
)
{
appMap
.
put
(
menuDTO
.
getMenuId
(),
1
);
}
}
vo
.
setAppMap
(
changeListToSelectTree
(
MenuLevelConstants
.
FIRST_LEVEL_PARENT_ID
,
menuListResult
.
getResult
(),
appMap
));
return
RestResponse
.
success
(
vo
);
}
return
EnterpriseRestResponse
.
failure
(
roleResult
);
}
@RequestMapping
(
"/save"
)
...
...
@@ -138,4 +175,33 @@ public class RoleController {
}
return
result
;
}
public
static
List
<
Map
<
String
,
Object
>>
changeListToSelectTree
(
int
storeGroupId
,
List
<
MenuDTO
>
list
,
Map
<
Integer
,
Object
>
menuIdMap
)
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
if
(
list
!=
null
)
{
for
(
MenuDTO
menuDTO
:
list
)
{
if
(
storeGroupId
==
menuDTO
.
getParentId
()
&&
menuDTO
.
getIsShow
().
intValue
()
==
1
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
16
);
data
.
put
(
"menuId"
,
menuDTO
.
getMenuId
());
data
.
put
(
"menuName"
,
menuDTO
.
getMenuName
());
data
.
put
(
"project"
,
menuDTO
.
getProject
());
data
.
put
(
"menuType"
,
menuDTO
.
getMenuType
());
if
(
menuIdMap
.
containsKey
(
menuDTO
.
getMenuId
()))
{
//如果存在,则说明钩上了
data
.
put
(
"isSelect"
,
true
);
}
else
{
data
.
put
(
"isSelect"
,
false
);
}
List
<
Map
<
String
,
Object
>>
children
=
changeListToTree
(
menuDTO
.
getMenuId
(),
list
);
if
(
children
==
null
||
children
.
size
()
<
1
)
{
data
.
put
(
"children"
,
null
);
}
else
{
data
.
put
(
"children"
,
children
);
}
result
.
add
(
data
);
}
}
}
return
result
;
}
}
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/RoleDetailVO.java
View file @
8a0760ed
package
com
.
gic
.
auth
.
web
.
vo
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
/**
* 角色详情
* @ClassName: RoleDetailVO
...
...
@@ -21,10 +24,9 @@ public class RoleDetailVO implements Serializable{
*/
private
String
roleName
;
/**
* 菜单ID,多个时,用英文逗号隔开
*/
private
String
menuIds
;
List
<
Map
<
String
,
Object
>>
gicMap
;
List
<
Map
<
String
,
Object
>>
appMap
;
public
Integer
getRoleId
()
{
...
...
@@ -43,11 +45,19 @@ public class RoleDetailVO implements Serializable{
this
.
roleName
=
roleName
;
}
public
String
getMenuIds
()
{
return
menuIds
;
public
List
<
Map
<
String
,
Object
>>
getGicMap
()
{
return
gicMap
;
}
public
void
setGicMap
(
List
<
Map
<
String
,
Object
>>
gicMap
)
{
this
.
gicMap
=
gicMap
;
}
public
List
<
Map
<
String
,
Object
>>
getAppMap
()
{
return
appMap
;
}
public
void
set
MenuIds
(
String
menuIds
)
{
this
.
menuIds
=
menuIds
;
public
void
set
AppMap
(
List
<
Map
<
String
,
Object
>>
appMap
)
{
this
.
appMap
=
appMap
;
}
}
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