Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-usercenter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 42beab18
authored
Mar 23, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
bug修复
1 parent
958ab538
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
37 deletions
src/main/java/cn/com/glsx/shield/modules/service/permissionStrategy/AllStrategy.java
src/main/java/cn/com/glsx/shield/modules/service/permissionStrategy/AssignTenantStrategy.java
src/main/java/cn/com/glsx/shield/modules/service/permissionStrategy/SelfDepartmentStrategy.java
src/main/java/cn/com/glsx/shield/modules/service/permissionStrategy/SubDepartmentStrategy.java
src/main/java/cn/com/glsx/shield/modules/service/permissionStrategy/AllStrategy.java
View file @
42beab1
...
@@ -124,17 +124,11 @@ public class AllStrategy extends PermissionStrategy {
...
@@ -124,17 +124,11 @@ public class AllStrategy extends PermissionStrategy {
if
(
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
()))
{
Map
<
Long
,
Set
<
Long
>>
subOrgIdListMap
=
getSubIdsMap
(
search
.
getSubOrgIds
());
Map
<
Long
,
Set
<
Long
>>
subOrgIdListMap
=
getSubIdsMap
(
search
.
getSubOrgIds
());
Collection
<
Long
>
finalOrgIds
=
orgIds
;
//选中的节点及下级节点
//选中的节点及下级节点
Set
<
Long
>
selectSubOrgIds
=
Sets
.
newHashSet
();
Set
<
Long
>
selectSubOrgIds
=
Sets
.
newHashSet
();
for
(
Map
.
Entry
<
Long
,
Set
<
Long
>>
entry
:
subOrgIdListMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Long
,
Set
<
Long
>>
entry
:
subOrgIdListMap
.
entrySet
())
{
Set
<
Long
>
subOrgIds
=
entry
.
getValue
().
stream
().
filter
(
finalOrgIds:
:
contains
).
collect
(
Collectors
.
toSet
());
selectSubOrgIds
.
addAll
(
entry
.
getValue
());
if
(
orgIds
.
contains
(
entry
.
getKey
()))
{
subOrgIds
.
add
(
entry
.
getKey
());
}
selectSubOrgIds
.
addAll
(
subOrgIds
);
}
}
orgIds
=
selectSubOrgIds
;
orgIds
=
selectSubOrgIds
;
...
@@ -145,6 +139,15 @@ public class AllStrategy extends PermissionStrategy {
...
@@ -145,6 +139,15 @@ public class AllStrategy extends PermissionStrategy {
orgIds
=
this
.
getUserOrgSuperiorIds
(
search
.
getUserIds
());
orgIds
=
this
.
getUserOrgSuperiorIds
(
search
.
getUserIds
());
}
}
//如果有查询条件,如果没有过滤到需要查询的组织链,返回空数据
if
((
StringUtils
.
isNotEmpty
(
search
.
getOrgName
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getSupOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getUserIds
()))
&&
CollectionUtils
.
isEmpty
(
orgIds
))
{
return
Lists
.
newArrayList
();
}
search
.
setOrgIds
(
orgIds
);
search
.
setOrgIds
(
orgIds
);
List
<
OrgModel
>
modelList
=
organizationMapper
.
selectOrgList
(
search
);
List
<
OrgModel
>
modelList
=
organizationMapper
.
selectOrgList
(
search
);
...
...
src/main/java/cn/com/glsx/shield/modules/service/permissionStrategy/AssignTenantStrategy.java
View file @
42beab1
...
@@ -127,17 +127,11 @@ public class AssignTenantStrategy extends PermissionStrategy {
...
@@ -127,17 +127,11 @@ public class AssignTenantStrategy extends PermissionStrategy {
if
(
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
()))
{
Map
<
Long
,
Set
<
Long
>>
subOrgIdListMap
=
getSubIdsMap
(
search
.
getSubOrgIds
());
Map
<
Long
,
Set
<
Long
>>
subOrgIdListMap
=
getSubIdsMap
(
search
.
getSubOrgIds
());
Collection
<
Long
>
finalOrgIds
=
orgIds
;
//选中的节点及下级节点
//选中的节点及下级节点
Set
<
Long
>
selectSubOrgIds
=
Sets
.
newHashSet
();
Set
<
Long
>
selectSubOrgIds
=
Sets
.
newHashSet
();
for
(
Map
.
Entry
<
Long
,
Set
<
Long
>>
entry
:
subOrgIdListMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Long
,
Set
<
Long
>>
entry
:
subOrgIdListMap
.
entrySet
())
{
Set
<
Long
>
subOrgIds
=
entry
.
getValue
().
stream
().
filter
(
finalOrgIds:
:
contains
).
collect
(
Collectors
.
toSet
());
selectSubOrgIds
.
addAll
(
entry
.
getValue
());
if
(
orgIds
.
contains
(
entry
.
getKey
()))
{
subOrgIds
.
add
(
entry
.
getKey
());
}
selectSubOrgIds
.
addAll
(
subOrgIds
);
}
}
orgIds
=
selectSubOrgIds
;
orgIds
=
selectSubOrgIds
;
...
@@ -152,16 +146,26 @@ public class AssignTenantStrategy extends PermissionStrategy {
...
@@ -152,16 +146,26 @@ public class AssignTenantStrategy extends PermissionStrategy {
List
<
Tenant
>
tenantList
=
departmentService
.
getRolePermissionTenants
();
List
<
Tenant
>
tenantList
=
departmentService
.
getRolePermissionTenants
();
Set
<
Long
>
tenantIds
=
tenantList
.
stream
().
map
(
Tenant:
:
getId
).
collect
(
Collectors
.
toSet
());
Set
<
Long
>
tenantIds
=
tenantList
.
stream
().
map
(
Tenant:
:
getId
).
collect
(
Collectors
.
toSet
());
//如果指定租户没有,返回空数据
if
(
CollectionUtils
.
isEmpty
(
tenantIds
))
{
return
Lists
.
newArrayList
();
}
//如果有查询条件,如果没有过滤到需要查询的组织链,返回空数据
if
((
StringUtils
.
isNotEmpty
(
search
.
getOrgName
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getSupOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getUserIds
()))
&&
CollectionUtils
.
isEmpty
(
orgIds
))
{
return
Lists
.
newArrayList
();
}
//指定数据权限租户
//指定数据权限租户
search
.
setTenantIds
(
tenantIds
);
search
.
setTenantIds
(
tenantIds
);
//过滤出的组织
//过滤出的组织
search
.
setOrgIds
(
orgIds
);
search
.
setOrgIds
(
orgIds
);
//如果没有过滤到需要查询的组织链,返回空数据
if
(
CollectionUtils
.
isEmpty
(
orgIds
)
&&
CollectionUtils
.
isEmpty
(
tenantIds
))
{
return
Lists
.
newArrayList
();
}
List
<
OrgModel
>
modelList
=
organizationMapper
.
selectOrgList
(
search
);
List
<
OrgModel
>
modelList
=
organizationMapper
.
selectOrgList
(
search
);
List
<
Long
>
departmentIdList
=
modelList
.
stream
().
map
(
OrgModel:
:
getOrgId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
departmentIdList
=
modelList
.
stream
().
map
(
OrgModel:
:
getOrgId
).
collect
(
Collectors
.
toList
());
...
...
src/main/java/cn/com/glsx/shield/modules/service/permissionStrategy/SelfDepartmentStrategy.java
View file @
42beab1
...
@@ -136,17 +136,11 @@ public class SelfDepartmentStrategy extends PermissionStrategy {
...
@@ -136,17 +136,11 @@ public class SelfDepartmentStrategy extends PermissionStrategy {
if
(
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
()))
{
Map
<
Long
,
Set
<
Long
>>
subOrgIdListMap
=
getSubIdsMap
(
search
.
getSubOrgIds
());
Map
<
Long
,
Set
<
Long
>>
subOrgIdListMap
=
getSubIdsMap
(
search
.
getSubOrgIds
());
Collection
<
Long
>
finalOrgIds
=
orgIds
;
//选中的节点及下级节点
//选中的节点及下级节点
Set
<
Long
>
selectSubOrgIds
=
Sets
.
newHashSet
();
Set
<
Long
>
selectSubOrgIds
=
Sets
.
newHashSet
();
for
(
Map
.
Entry
<
Long
,
Set
<
Long
>>
entry
:
subOrgIdListMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Long
,
Set
<
Long
>>
entry
:
subOrgIdListMap
.
entrySet
())
{
Set
<
Long
>
subOrgIds
=
entry
.
getValue
().
stream
().
filter
(
finalOrgIds:
:
contains
).
collect
(
Collectors
.
toSet
());
selectSubOrgIds
.
addAll
(
entry
.
getValue
());
if
(
orgIds
.
contains
(
entry
.
getKey
()))
{
subOrgIds
.
add
(
entry
.
getKey
());
}
selectSubOrgIds
.
addAll
(
subOrgIds
);
}
}
orgIds
=
selectSubOrgIds
;
orgIds
=
selectSubOrgIds
;
...
@@ -157,8 +151,12 @@ public class SelfDepartmentStrategy extends PermissionStrategy {
...
@@ -157,8 +151,12 @@ public class SelfDepartmentStrategy extends PermissionStrategy {
orgIds
=
this
.
getUserOrgSuperiorIds
(
search
.
getUserIds
());
orgIds
=
this
.
getUserOrgSuperiorIds
(
search
.
getUserIds
());
}
}
//如果没有过滤到需要查询的组织链,返回空数据
//如果有查询条件,如果没有过滤到需要查询的组织链,返回空数据
if
(
CollectionUtils
.
isEmpty
(
orgIds
))
{
if
((
StringUtils
.
isNotEmpty
(
search
.
getOrgName
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getSupOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getUserIds
()))
&&
CollectionUtils
.
isEmpty
(
orgIds
))
{
return
Lists
.
newArrayList
();
return
Lists
.
newArrayList
();
}
}
...
...
src/main/java/cn/com/glsx/shield/modules/service/permissionStrategy/SubDepartmentStrategy.java
View file @
42beab1
...
@@ -192,17 +192,11 @@ public class SubDepartmentStrategy extends PermissionStrategy {
...
@@ -192,17 +192,11 @@ public class SubDepartmentStrategy extends PermissionStrategy {
if
(
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
()))
{
Map
<
Long
,
Set
<
Long
>>
subOrgIdListMap
=
getSubIdsMap
(
search
.
getSubOrgIds
());
Map
<
Long
,
Set
<
Long
>>
subOrgIdListMap
=
getSubIdsMap
(
search
.
getSubOrgIds
());
Collection
<
Long
>
finalOrgIds
=
orgIds
;
//选中的节点及下级节点
//选中的节点及下级节点
Set
<
Long
>
selectSubOrgIds
=
Sets
.
newHashSet
();
Set
<
Long
>
selectSubOrgIds
=
Sets
.
newHashSet
();
for
(
Map
.
Entry
<
Long
,
Set
<
Long
>>
entry
:
subOrgIdListMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Long
,
Set
<
Long
>>
entry
:
subOrgIdListMap
.
entrySet
())
{
Set
<
Long
>
subOrgIds
=
entry
.
getValue
().
stream
().
filter
(
finalOrgIds:
:
contains
).
collect
(
Collectors
.
toSet
());
selectSubOrgIds
.
addAll
(
entry
.
getValue
());
if
(
orgIds
.
contains
(
entry
.
getKey
()))
{
subOrgIds
.
add
(
entry
.
getKey
());
}
selectSubOrgIds
.
addAll
(
subOrgIds
);
}
}
orgIds
=
selectSubOrgIds
;
orgIds
=
selectSubOrgIds
;
...
@@ -213,8 +207,12 @@ public class SubDepartmentStrategy extends PermissionStrategy {
...
@@ -213,8 +207,12 @@ public class SubDepartmentStrategy extends PermissionStrategy {
orgIds
=
this
.
getUserOrgSuperiorIds
(
search
.
getUserIds
());
orgIds
=
this
.
getUserOrgSuperiorIds
(
search
.
getUserIds
());
}
}
//如果没有过滤到需要查询的组织链,返回空数据
//如果有查询条件,如果没有过滤到需要查询的组织链,返回空数据
if
(
CollectionUtils
.
isEmpty
(
orgIds
))
{
if
((
StringUtils
.
isNotEmpty
(
search
.
getOrgName
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getSupOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getSubOrgIds
())
||
CollectionUtils
.
isNotEmpty
(
search
.
getUserIds
()))
&&
CollectionUtils
.
isEmpty
(
orgIds
))
{
return
Lists
.
newArrayList
();
return
Lists
.
newArrayList
();
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment