Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
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
platform
hg-smart
Commits
42bd5ace
Commit
42bd5ace
authored
Aug 22, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修复查询用户厂区和公司BUG
parent
e1bb9ffa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
15 deletions
+47
-15
UserSessionUtils.java
...ava/com/baosight/hggp/core/security/UserSessionUtils.java
+18
-12
HGXSTools.java
src/main/java/com/baosight/hggp/hg/xs/tools/HGXSTools.java
+29
-3
No files found.
src/main/java/com/baosight/hggp/core/security/UserSessionUtils.java
View file @
42bd5ace
...
@@ -125,13 +125,15 @@ public class UserSessionUtils extends UserSession {
...
@@ -125,13 +125,15 @@ public class UserSessionUtils extends UserSession {
if
(
CollectionUtils
.
isEmpty
(
orgs
))
{
if
(
CollectionUtils
.
isEmpty
(
orgs
))
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
List
<
String
>
orgIds
=
new
ArrayList
<>();
List
<
String
>
orgIds
=
orgs
.
stream
().
map
(
Org:
:
getOrgId
).
collect
(
Collectors
.
toList
());
for
(
Org
org
:
orgs
)
{
List
<
Org
>
parentOrgs
=
HGXSTools
.
XsOrg
.
queryParent
(
orgIds
);
List
<
String
>
results
=
new
ArrayList
<>();
for
(
Org
org
:
parentOrgs
)
{
if
(
OrgTypeEnum
.
COMPANY
.
getCode
().
equals
(
org
.
getOrgType
()))
{
if
(
OrgTypeEnum
.
COMPANY
.
getCode
().
equals
(
org
.
getOrgType
()))
{
orgId
s
.
add
(
org
.
getOrgId
());
result
s
.
add
(
org
.
getOrgId
());
}
}
}
}
return
orgIds
;
return
results
.
stream
().
distinct
().
collect
(
Collectors
.
toList
())
;
}
}
/**
/**
...
@@ -144,13 +146,15 @@ public class UserSessionUtils extends UserSession {
...
@@ -144,13 +146,15 @@ public class UserSessionUtils extends UserSession {
if
(
CollectionUtils
.
isEmpty
(
orgs
))
{
if
(
CollectionUtils
.
isEmpty
(
orgs
))
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
List
<
String
>
factoryCodes
=
new
ArrayList
<>();
List
<
String
>
orgIds
=
orgs
.
stream
().
map
(
Org:
:
getOrgId
).
collect
(
Collectors
.
toList
());
for
(
Org
org
:
orgs
)
{
List
<
Org
>
parentOrgs
=
HGXSTools
.
XsOrg
.
queryParent
(
orgIds
);
List
<
String
>
results
=
new
ArrayList
<>();
for
(
Org
org
:
parentOrgs
)
{
if
(
OrgTypeEnum
.
FACTORY
.
getCode
().
equals
(
org
.
getOrgType
()))
{
if
(
OrgTypeEnum
.
FACTORY
.
getCode
().
equals
(
org
.
getOrgType
()))
{
factoryCode
s
.
add
(
org
.
getOrgId
());
result
s
.
add
(
org
.
getOrgId
());
}
}
}
}
return
factoryCodes
;
return
results
.
stream
().
distinct
().
collect
(
Collectors
.
toList
())
;
}
}
/**
/**
...
@@ -163,13 +167,15 @@ public class UserSessionUtils extends UserSession {
...
@@ -163,13 +167,15 @@ public class UserSessionUtils extends UserSession {
if
(
CollectionUtils
.
isEmpty
(
orgs
))
{
if
(
CollectionUtils
.
isEmpty
(
orgs
))
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
List
<
String
>
factoryNames
=
new
ArrayList
<>();
List
<
String
>
orgIds
=
orgs
.
stream
().
map
(
Org:
:
getOrgId
).
collect
(
Collectors
.
toList
());
for
(
Org
org
:
orgs
)
{
List
<
Org
>
parentOrgs
=
HGXSTools
.
XsOrg
.
queryParent
(
orgIds
);
List
<
String
>
results
=
new
ArrayList
<>();
for
(
Org
org
:
parentOrgs
)
{
if
(
OrgTypeEnum
.
FACTORY
.
getCode
().
equals
(
org
.
getOrgType
()))
{
if
(
OrgTypeEnum
.
FACTORY
.
getCode
().
equals
(
org
.
getOrgType
()))
{
factoryNames
.
add
(
org
.
getOrgCn
ame
());
results
.
add
(
org
.
getFactoryN
ame
());
}
}
}
}
return
factoryNames
;
return
results
.
stream
().
distinct
().
collect
(
Collectors
.
toList
())
;
}
}
/**
/**
...
...
src/main/java/com/baosight/hggp/hg/xs/tools/HGXSTools.java
View file @
42bd5ace
...
@@ -295,9 +295,7 @@ public class HGXSTools {
...
@@ -295,9 +295,7 @@ public class HGXSTools {
AssertUtils
.
isNull
(
orgId
,
"组织ID不能为空"
);
AssertUtils
.
isNull
(
orgId
,
"组织ID不能为空"
);
Map
queryMap
=
new
HashMap
();
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"orgId"
,
orgId
);
queryMap
.
put
(
"orgId"
,
orgId
);
List
<
Org
>
results
=
DaoBase
.
getInstance
().
query
(
HGSqlConstant
.
HgXsOrg
.
QUERY_PARENT
,
queryMap
);
return
DaoBase
.
getInstance
().
query
(
HGSqlConstant
.
HgXsOrg
.
QUERY_PARENT
,
queryMap
);
AssertUtils
.
isEmpty
(
results
,
String
.
format
(
"组织[%s]不存在父级信息"
,
orgId
));
return
results
;
}
}
/**
/**
...
@@ -440,6 +438,34 @@ public class HGXSTools {
...
@@ -440,6 +438,34 @@ public class HGXSTools {
// 去除重复组织机构
// 去除重复组织机构
return
childOrgIds
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
return
childOrgIds
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
}
/**
* 查询父级(包含自身)
*
* @param orgIds
* @return
*/
public
static
List
<
Org
>
queryParent
(
List
<
String
>
orgIds
)
{
List
<
Org
>
results
=
new
ArrayList
<>();
List
<
String
>
resultIds
=
new
ArrayList
<>();
for
(
String
orgId
:
orgIds
)
{
// 已经存在不在重复查询
if
(
resultIds
.
contains
(
orgId
))
{
continue
;
}
// 查询组织子集
List
<
Org
>
dbOrgs
=
XsOrg
.
queryParent
(
orgId
);
for
(
Org
dbOrg
:
dbOrgs
)
{
if
(!
resultIds
.
contains
(
dbOrg
.
getOrgId
()))
{
resultIds
.
add
(
dbOrg
.
getOrgId
());
results
.
add
(
dbOrg
);
}
}
}
// 去除重复组织机构
return
results
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
}
}
}
}
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