Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
dd1401f4
Commit
dd1401f4
authored
Dec 31, 2021
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化区域
parent
22759691
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
19 deletions
+28
-19
AreaServiceImpl.java
...com/yeejoin/equipmanage/service/impl/AreaServiceImpl.java
+28
-19
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/AreaServiceImpl.java
View file @
dd1401f4
...
...
@@ -26,6 +26,7 @@ import com.yeejoin.equipmanage.operation.AreaSynRiskOperator;
import
com.yeejoin.equipmanage.service.IAreaService
;
import
com.yeejoin.equipmanage.service.IEqSourceFileService
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce
;
import
liquibase.pro.packaged.o
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -33,9 +34,11 @@ import org.springframework.context.annotation.Lazy;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -128,17 +131,6 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
return
areaTreeVos
;
}
private
List
<
UnitAreaTreeVo
>
getAreaChildren
(
UnitAreaTreeVo
root
,
List
<
UnitAreaTreeVo
>
all
)
{
return
all
.
stream
().
filter
(
d
->
StringUtil
.
isNotEmpty
(
d
.
getParentId
())
&&
d
.
getParentId
().
equals
(
root
.
getId
())
||
(
StringUtil
.
isNotEmpty
(
d
.
getBizOrgCode
())
&&
d
.
getBizOrgCode
().
equals
(
root
.
getBizOrgCode
())
&&
!
"area"
.
equals
(
root
.
getType
())
&&
!
d
.
getId
().
equals
(
root
.
getId
()))
)
.
peek
(
m
->
m
.
setChildren
(
getAreaChildren
(
m
,
all
)))
.
collect
(
Collectors
.
toList
());
}
/**
* 根据父节点查询子节点赋值
*
...
...
@@ -180,16 +172,15 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
List
<
UnitAreaTreeVo
>
list
=
new
ArrayList
<>();
list
=
treeMenuList
(
getAreaTreeListVo
(),
id
);
List
<
Long
>
parentIdSet
=
list
.
stream
().
map
(
vo
->
vo
.
getId
()).
collect
(
Collectors
.
toList
());
parentIdSet
.
add
(
id
);
if
(
StringUtil
.
isNotEmpty
(
area
.
getBizOrgCode
()))
{
queryWrapper
.
like
(
Area:
:
getBizOrgCode
,
area
.
getBizOrgCode
());
}
queryWrapper
.
eq
(
Area:
:
getIsDelete
,
false
);
if
(
parentIdSet
.
size
()
>
0
)
{
queryWrapper
.
in
(
Area:
:
getParentId
,
parentIdSet
);
queryWrapper
.
or
().
eq
(
Area:
:
getId
,
id
);
}
else
{
queryWrapper
.
eq
(
Area:
:
getId
,
id
);
if
(
0
!=
area
.
getParentId
())
{
queryWrapper
.
or
().
eq
(
Area:
:
getId
,
id
);
}
}
IPage
pageArea
=
this
.
baseMapper
.
selectMapsPage
(
page
,
queryWrapper
);
...
...
@@ -228,7 +219,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
List
<
UnitAreaTreeVo
>
voList
=
new
ArrayList
<>();
for
(
UnitAreaTreeVo
vo
:
list
)
{
//遍历出父id等于参数的id,add进子节点集合
if
(
Long
.
valueOf
(
vo
.
getParentId
())
==
pid
)
{
if
(
!
ObjectUtils
.
isEmpty
(
vo
.
getParentId
())
&&
0
!=
vo
.
getParentId
()
&&
Long
.
valueOf
(
vo
.
getParentId
())
==
pid
)
{
//递归遍历下一级
treeMenuList
(
list
,
Long
.
valueOf
(
vo
.
getId
()));
voList
.
add
(
vo
);
...
...
@@ -241,6 +232,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
public
List
<
UnitAreaTreeVo
>
getAreaTreeListVo
()
{
// 获取公司部门list
List
<
OrgUsrDto
>
orgCompanyLists
=
jcsRemoteService
.
getCompanyDeptListWithAuth
(
authKey
,
"COMPANY"
);
AtomicReference
<
Boolean
>
flag
=
new
AtomicReference
<
Boolean
>();
List
<
UnitAreaTreeVo
>
areaTreeList
=
orgCompanyLists
.
stream
()
.
map
(
key
->
{
UnitAreaTreeVo
vo
=
new
UnitAreaTreeVo
();
...
...
@@ -250,6 +242,9 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
vo
.
setBizOrgCode
(
key
.
getBizOrgCode
());
vo
.
setBizOrgName
(
key
.
getBizOrgName
());
vo
.
setParentId
(
StringUtil
.
isNotEmpty
(
key
.
getParentId
())
?
Long
.
valueOf
(
key
.
getParentId
())
:
null
);
if
(
""
.
equals
(
vo
.
getParentId
())
||
"-1"
.
equals
(
vo
.
getParentId
())
||
null
==
vo
.
getParentId
())
{
flag
.
set
(
true
);
}
return
vo
;
}).
collect
(
Collectors
.
toList
());
...
...
@@ -259,7 +254,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
wrapper
.
eq
(
Area:
:
getIsDelete
,
false
);
wrapper
.
in
(
Area:
:
getBizOrgCode
,
bizOrgCodes
);
List
<
Area
>
areaEntityList
=
this
.
baseMapper
.
selectList
(
wrapper
);
List
<
UnitAreaTreeVo
>
system
List
=
areaEntityList
.
stream
()
List
<
UnitAreaTreeVo
>
tree
List
=
areaEntityList
.
stream
()
.
map
(
key
->
{
UnitAreaTreeVo
vo
=
new
UnitAreaTreeVo
();
vo
.
setId
(
key
.
getId
());
...
...
@@ -271,13 +266,27 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
return
vo
;
}).
collect
(
Collectors
.
toList
());
areaTreeList
.
addAll
(
system
List
);
areaTreeList
.
addAll
(
tree
List
);
return
areaTreeList
.
stream
()
.
filter
(
d
->
!
"area"
.
equals
(
d
.
getType
()))
.
filter
(
d
->
flag
.
get
()
?
!
"area"
.
equals
(
d
.
getType
())
&&
d
.
getBizOrgCode
()
!=
null
&&
(
""
.
equals
(
d
.
getParentId
())
||
"-1"
.
equals
(
d
.
getParentId
())
||
null
==
d
.
getParentId
())
:
"area"
.
equals
(
d
.
getType
())
&&
null
!=
d
.
getBizOrgCode
())
.
peek
((
m
)
->
m
.
setChildren
(
getAreaChildren
(
m
,
areaTreeList
)))
.
collect
(
Collectors
.
toList
());
}
private
List
<
UnitAreaTreeVo
>
getAreaChildren
(
UnitAreaTreeVo
root
,
List
<
UnitAreaTreeVo
>
all
)
{
return
all
.
stream
().
filter
(
d
->
StringUtil
.
isNotEmpty
(
d
.
getParentId
())
&&
d
.
getParentId
().
equals
(
root
.
getId
())
||
(
StringUtil
.
isNotEmpty
(
d
.
getBizOrgCode
())
&&
d
.
getBizOrgCode
().
equals
(
root
.
getBizOrgCode
())
&&
!
"area"
.
equals
(
root
.
getType
())
&&
!
d
.
getId
().
equals
(
root
.
getId
()))
)
.
peek
(
m
->
m
.
setChildren
(
getAreaChildren
(
m
,
all
)))
.
collect
(
Collectors
.
toList
());
}
@Override
public
List
<
OrgMenuDto
>
companyDeptTree
()
{
return
jcsRemoteService
.
getCompanyDeptTreeWithAuth
(
authKey
,
"COMPANY"
);
...
...
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