Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
fangxinjiang
yifu-mvp
Commits
5ae9e3f1
Commit
5ae9e3f1
authored
Jan 16, 2023
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
B端调优---人员菜单获取优化
parent
8dcd5202
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
13 deletions
+24
-13
Common.java
.../com/yifu/cloud/plus/v1/yifu/common/core/util/Common.java
+8
-0
BusinessUserController.java
...plus/v1/yifu/admin/controller/BusinessUserController.java
+16
-13
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/Common.java
View file @
5ae9e3f1
...
...
@@ -14,6 +14,9 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -652,4 +655,9 @@ public class Common {
}
return
errorMessageList
;
}
public
static
<
T
>
Predicate
<
T
>
distinctByKey
(
Function
<?
super
T
,
?>
keyExtractor
)
{
Set
<
Object
>
seen
=
ConcurrentHashMap
.
newKeySet
();
return
t
->
seen
.
add
(
keyExtractor
.
apply
(
t
));
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/BusinessUserController.java
View file @
5ae9e3f1
...
...
@@ -22,6 +22,7 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.ehcache.impl.internal.util.ServiceUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
...
...
@@ -235,19 +236,21 @@ public class BusinessUserController {
Set
<
SysMenu
>
all
=
new
HashSet
<>();
SecurityUtils
.
getRolesByClient
(
ClientNameConstants
.
CLIENT_B
)
.
forEach
(
roleId
->
all
.
addAll
(
sysMenuService
.
findMenuByRoleId
(
roleId
)));
List
<
MenuTreeForVue
>
menuTreeList
;
if
(
Common
.
isNotNull
(
type
))
{
menuTreeList
=
all
.
stream
()
.
filter
(
menuVo
->
type
.
equals
(
menuVo
.
getType
()))
.
map
(
MenuTreeForVue:
:
new
)
.
sorted
(
Comparator
.
comparingInt
(
MenuTreeForVue:
:
getSort
))
.
collect
(
Collectors
.
toList
());
}
else
{
menuTreeList
=
all
.
stream
()
.
map
(
MenuTreeForVue:
:
new
)
.
sorted
(
Comparator
.
comparingInt
(
MenuTreeForVue:
:
getSort
))
.
collect
(
Collectors
.
toList
());
}
List
<
MenuTreeForVue
>
menuTreeList
=
null
;
if
(
Common
.
isNotNull
(
all
)){
if
(
Common
.
isNotNull
(
type
))
{
menuTreeList
=
all
.
stream
().
filter
(
Common
.
distinctByKey
(
SysMenu:
:
getMenuId
))
.
filter
(
menuVo
->
type
.
equals
(
menuVo
.
getType
()))
.
map
(
MenuTreeForVue:
:
new
)
.
sorted
(
Comparator
.
comparingInt
(
MenuTreeForVue:
:
getSort
))
.
collect
(
Collectors
.
toList
());
}
else
{
menuTreeList
=
all
.
stream
().
filter
(
Common
.
distinctByKey
(
SysMenu:
:
getMenuId
))
.
map
(
MenuTreeForVue:
:
new
)
.
sorted
(
Comparator
.
comparingInt
(
MenuTreeForVue:
:
getSort
))
.
collect
(
Collectors
.
toList
());
}
}
return
new
R
<>(
TreeUtil
.
bulid
(
menuTreeList
,
-
1
));
}
/**
...
...
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