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
a6b025f4
Commit
a6b025f4
authored
Sep 09, 2024
by
张森
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
/equip/building/video/getBuildingVideoTreeVideoList
建筑 + 监控视频
parent
c1c49a24
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
2 deletions
+86
-2
BuildingVideoController.java
...ejoin/equipmanage/controller/BuildingVideoController.java
+28
-1
BuildingServiceImpl.java
...yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
+58
-1
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/BuildingVideoController.java
View file @
a6b025f4
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.equipmanage.common.entity.vo.BuildingListVO
;
import
com.yeejoin.equipmanage.common.entity.vo.BuildingVideoListVO
;
...
...
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
java.util.Iterator
;
import
java.util.List
;
/**
...
...
@@ -48,7 +50,32 @@ public class BuildingVideoController extends AbstractBaseController {
@ApiOperation
(
"物联监控->单位建筑树(节点上绑定视频集合数据)"
)
@GetMapping
(
value
=
"/getBuildingVideoTreeVideoList"
)
public
List
<
BuildingTreeVo
>
getBuildingVideoTreeVideoList
()
{
return
buildService
.
getBuildingVideoTreeVideoList
();
List
<
BuildingTreeVo
>
buildingVideoTreeVideoList
=
buildService
.
getBuildingVideoTreeVideoList
();
Iterator
<
BuildingTreeVo
>
iterator
=
buildingVideoTreeVideoList
.
iterator
();
while
(
iterator
.
hasNext
())
{
BuildingTreeVo
item
=
iterator
.
next
();
if
(
CollUtil
.
isEmpty
(
item
.
getVideoList
()))
{
iterator
.
remove
();
}
else
{
removeZeroTotalNodes
(
item
);
}
}
return
buildingVideoTreeVideoList
;
}
public
void
removeZeroTotalNodes
(
BuildingTreeVo
root
)
{
if
(
root
==
null
)
{
return
;
}
Iterator
<
BuildingTreeVo
>
iterator
=
root
.
getChildren
().
iterator
();
while
(
iterator
.
hasNext
())
{
BuildingTreeVo
child
=
iterator
.
next
();
if
(
CollUtil
.
isEmpty
(
child
.
getVideoList
()))
{
iterator
.
remove
();
}
else
{
removeZeroTotalNodes
(
child
);
}
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
View file @
a6b025f4
...
...
@@ -1485,6 +1485,63 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
private
List
<
BuildingTreeVo
>
buildBuildingAndCompanyListVosNew
(
String
authKey
,
String
type
,
String
ment
)
{
if
(
StringUtils
.
isEmpty
(
authKey
))
{
authKey
=
this
.
authKey
;
}
CompletableFuture
<
List
<
BuildingTreeVo
>>
companyListFuture
=
CompletableFuture
.
supplyAsync
(()
->
getBuildingTreeVos
(
false
,
null
));
String
finalAuthKey
=
authKey
;
String
appKey
=
RequestContext
.
getAppKey
();
String
product
=
RequestContext
.
getProduct
();
String
token
=
RequestContext
.
getToken
();
CompletableFuture
<
List
<
OrgUsrDto
>>
orgUsrListFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
token
);
return
jcsRemoteService
.
getCompanyDeptListWithAuth
(
finalAuthKey
,
"COMPANY"
,
type
);
});
CompletableFuture
.
allOf
(
companyListFuture
,
orgUsrListFuture
).
join
();
List
<
BuildingTreeVo
>
buildingTreeVos
=
companyListFuture
.
join
();
List
<
OrgUsrDto
>
orgUsrLists
=
orgUsrListFuture
.
join
();
if
(
orgUsrLists
.
isEmpty
()){
return
new
ArrayList
<>();
}
// 2.数据结构转换
List
<
BuildingTreeVo
>
companyList
=
orgUsrLists
.
stream
().
map
(
orgUsrDto
->
{
BuildingTreeVo
vo
=
new
BuildingTreeVo
();
vo
.
setGroupType
(
"allBuilding"
);
vo
.
setGroupCode
(
"allBuilding"
);
vo
.
setInstanceName
(
orgUsrDto
.
getBizOrgName
());
vo
.
setBizOrgCode
(
orgUsrDto
.
getBizOrgCode
());
vo
.
setInstanceId
(
orgUsrDto
.
getSequenceNbr
());
vo
.
setParentId
(
orgUsrDto
.
getParentId
());
vo
.
setName
(
orgUsrDto
.
getBizOrgName
());
vo
.
setId
(
orgUsrDto
.
getSequenceNbr
());
vo
.
setBizOrgName
(
orgUsrDto
.
getBizOrgName
());
//此处为公共接口 未区分导致消防建筑页面树统计错误
if
(
ment
.
equals
(
"video"
)){
vo
.
setTotal
(!
StringUtils
.
isEmpty
(
orgUsrDto
.
getBizOrgCode
())
?
formInstanceMapper
.
queryVideoCountByBizOrgCode
(
orgUsrDto
.
getBizOrgCode
())
:
0L
);
}
else
{
vo
.
setTotal
(
buildingTreeVos
.
stream
().
filter
(
b
->
!
ObjectUtils
.
isEmpty
(
b
.
getBizOrgCode
())
&&
b
.
getBizOrgCode
().
contains
(
ObjectUtils
.
isEmpty
(
vo
.
getBizOrgCode
())?
""
:
vo
.
getBizOrgCode
())
&&
"building"
.
equals
(
b
.
getGroupType
())).
count
());
}
return
vo
;
}).
collect
(
Collectors
.
toList
());
// 3.将建筑的bizOrgCode转换为parentId连接树 ,拼接数据准备
Map
<
String
,
Long
>
comMap
=
orgUsrLists
.
stream
().
collect
(
Collectors
.
toMap
(
OrgUsrDto:
:
getBizOrgCode
,
OrgUsrDto:
:
getSequenceNbr
));
//增加了一层对树的过滤,过滤掉指定公司外的其他建筑。
List
<
BuildingTreeVo
>
collect
=
buildingTreeVos
.
stream
().
filter
(
build
->
companyList
.
stream
().
map
(
m
->
{
String
bizOrgCode
=
m
.
getBizOrgCode
();
return
bizOrgCode
;
}).
collect
(
Collectors
.
toList
()).
contains
(
build
.
getBizOrgCode
())).
collect
(
Collectors
.
toList
());
collect
.
forEach
(
b
->
{
b
.
setParentId
(
"0"
.
equals
(
b
.
getParentId
())
?
String
.
valueOf
(
comMap
.
get
(
b
.
getBizOrgCode
()))
:
b
.
getParentId
());
b
.
setDetailPaneApi
(
address
);
b
.
setApiUrl
(
apiUrl
);
});
return
collect
;
}
private
List
<
BuildingTreeVo
>
buildBuildingAndCompanyListVos
(
String
authKey
,
String
type
,
String
ment
)
{
if
(
StringUtils
.
isEmpty
(
authKey
))
{
...
...
@@ -1582,7 +1639,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
public
List
<
BuildingTreeVo
>
getBuildingVideoTreeVideoList
()
{
//1.组装数据
List
<
BuildingTreeVo
>
companyBuildingList
=
buildBuildingAndCompanyListVos
(
buildVideoAuthKey
,
null
,
"video"
);
List
<
BuildingTreeVo
>
companyBuildingList
=
buildBuildingAndCompanyListVos
New
(
buildVideoAuthKey
,
null
,
"video"
);
List
<
Map
<
String
,
Long
>>
countList
=
iFormInstanceService
.
getBuildVideoCount
();
...
...
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