Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
base-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
base-platform
Commits
403f22a8
Commit
403f22a8
authored
Apr 07, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加事项同步数据
parent
0ee0af23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
23 deletions
+24
-23
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteBusinessServiceImpl.java
...xhx/module/site/service/impl/SiteBusinessServiceImpl.java
+24
-23
No files found.
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteBusinessServiceImpl.java
View file @
403f22a8
package
com.mortals.xhx.module.site.service.impl
;
import
com.mortals.xhx.module.business.model.BusinessEntity
;
import
com.mortals.xhx.module.business.model.BusinessQuery
;
import
org.springframework.stereotype.Service
;
...
...
@@ -12,28 +13,29 @@ import com.mortals.xhx.module.site.model.SiteBusinessQuery;
import
com.mortals.xhx.module.site.service.SiteBusinessService
;
import
com.mortals.xhx.module.site.model.SiteBusinessTreeSelect
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* SiteBusinessService
* 站点事项 service实现
*
* @author zxfei
* @date 2022-01-13
*/
* SiteBusinessService
* 站点事项 service实现
*
* @author zxfei
* @date 2022-01-13
*/
@Service
(
"siteBusinessService"
)
public
class
SiteBusinessServiceImpl
extends
AbstractCRUDServiceImpl
<
SiteBusinessDao
,
SiteBusinessEntity
,
Long
>
implements
SiteBusinessService
{
@Override
protected
void
findAfter
(
SiteBusinessEntity
params
,
Context
context
,
List
<
SiteBusinessEntity
>
list
)
throws
AppException
{
list
.
stream
().
peek
(
item
->
{
List
<
SiteBusinessEntity
>
childs
=
this
.
find
(
new
SiteBusinessQuery
().
parentId
(
item
.
getBusinessId
()));
if
(!
ObjectUtils
.
isEmpty
(
childs
)){
list
.
stream
().
peek
(
item
->
{
List
<
SiteBusinessEntity
>
childs
=
this
.
find
(
new
SiteBusinessQuery
().
parentId
(
item
.
getBusinessId
()));
item
.
setChildren
(
childs
);
}
else
{
item
.
setChildren
(
null
);
}
}).
count
();
super
.
findAfter
(
params
,
context
,
list
);
}
...
...
@@ -68,7 +70,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusines
}
@Override
public
boolean
hasChildBySiteBusinessId
(
Long
siteBusinessId
)
{
List
<
SiteBusinessEntity
>
list
=
this
.
find
(
new
SiteBusinessQuery
().
parentId
(
siteBusinessId
));
...
...
@@ -92,8 +93,8 @@ public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusines
recursionFn
(
list
,
siteBusinessEntity
);
returnList
.
add
(
siteBusinessEntity
);
}
}
if
(
returnList
.
isEmpty
())
{
}
if
(
returnList
.
isEmpty
())
{
returnList
=
list
;
}
...
...
@@ -102,8 +103,8 @@ public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusines
/**
* 递归列表
*/
* 递归列表
*/
private
void
recursionFn
(
List
<
SiteBusinessEntity
>
list
,
SiteBusinessEntity
t
)
{
// 得到子节点列表
List
<
SiteBusinessEntity
>
childList
=
getChildList
(
list
,
t
);
...
...
@@ -116,22 +117,22 @@ public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusines
}
/**
* 判断是否有子节点
*/
* 判断是否有子节点
*/
private
boolean
hasChild
(
List
<
SiteBusinessEntity
>
list
,
SiteBusinessEntity
t
)
{
return
getChildList
(
list
,
t
).
size
()
>
0
?
true
:
false
;
}
/**
* 得到子节点列表
*/
* 得到子节点列表
*/
private
List
<
SiteBusinessEntity
>
getChildList
(
List
<
SiteBusinessEntity
>
list
,
SiteBusinessEntity
t
)
{
return
list
.
stream
().
map
(
item
->
{
return
list
.
stream
().
map
(
item
->
{
if
(!
ObjectUtils
.
isEmpty
(
item
.
getParentId
())
&&
item
.
getParentId
()
==
t
.
getId
())
{
return
item
;
}
return
null
;
}).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
}).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
}
}
\ No newline at end of file
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