Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e7f935bd
authored
Oct 13, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:组织树支持多个
1 parent
61fdd5fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrganizationServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrganizationServiceImpl.java
View file @
e7f935b
...
...
@@ -43,12 +43,22 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
public
Result
<?>
getOrganizationTree
(
String
levelType
,
String
levelValue
)
{
// 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容
List
<
OrganizationTreeDTO
.
Result
>
rs
=
new
ArrayList
<>();
for
(
String
value
:
levelValue
.
split
(
","
))
{
rs
.
add
(
getOrganizationTreeByOrgId
(
levelType
,
value
));
}
return
Result
.
success
(
rs
);
}
public
OrganizationTreeDTO
.
Result
getOrganizationTreeByOrgId
(
String
levelType
,
String
levelValue
)
{
// 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容
OrganizationTreeDTO
.
Result
rs
=
new
OrganizationTreeDTO
.
Result
();
rs
.
setLevelType
(
levelType
).
setLevelValue
(
levelValue
);
if
(
"group"
.
equals
(
levelType
))
{
OrgGroupEntity
orgGroupEntity
=
orgGroupDao
.
getByGroupId
(
levelValue
);
if
(
orgGroupEntity
==
null
)
{
return
Result
.
failed
(
"groupId对应的信息不存在"
)
;
return
null
;
}
List
<?>
groups
=
new
ArrayList
<>(
Collections
.
singletonList
(
groupEntity2Dto
(
orgGroupEntity
)));
OrgBranchEntity
orgBranchEntity
=
orgBranchDao
.
getByBranchId
(
orgGroupEntity
.
getBranchId
());
...
...
@@ -59,7 +69,7 @@ public class OrganizationServiceImpl implements OrganizationService {
}
else
if
(
"branch"
.
equals
(
levelType
))
{
OrgBranchEntity
orgBranchEntity
=
orgBranchDao
.
getByBranchId
(
levelValue
);
if
(
orgBranchEntity
==
null
)
{
return
Result
.
failed
(
"分站信息不存在"
)
;
return
null
;
}
OrgClusterEntity
orgClusterEntity
=
orgClusterDao
.
getByClusterId
(
orgBranchEntity
.
getClusterId
());
List
<?>
groups
=
getChildByBranch
(
levelValue
);
...
...
@@ -69,7 +79,7 @@ public class OrganizationServiceImpl implements OrganizationService {
}
else
if
(
"cluster"
.
equals
(
levelType
))
{
OrgClusterEntity
orgClusterEntity
=
orgClusterDao
.
getByClusterId
(
levelValue
);
if
(
orgClusterEntity
==
null
)
{
return
Result
.
failed
(
"大区信息不存在"
)
;
return
null
;
}
List
<?>
branchs
=
getChildByCluster
(
levelValue
);
List
<?>
clusters
=
new
ArrayList
<>(
Collections
.
singletonList
(
clusterEntity2Dto
(
orgClusterEntity
).
setChildren
(
branchs
)));
...
...
@@ -77,7 +87,7 @@ public class OrganizationServiceImpl implements OrganizationService {
}
else
{
rs
.
setClusters
(
getTreeByRoot
());
}
return
Result
.
success
(
rs
)
;
return
rs
;
}
@Override
...
...
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