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
8ec2deca
Commit
8ec2deca
authored
Jan 06, 2022
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:解决单位建筑视频树统计单位无数据问题
parent
b79105e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
39 deletions
+110
-39
BuildingServiceImpl.java
...yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
+110
-39
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
View file @
8ec2deca
...
...
@@ -640,7 +640,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
*/
@Override
public
Long
equipmentTotal
(
Long
instanceId
,
String
groupType
)
{
Map
<
String
,
Object
>
map
=
getEveryCount
(
instanceId
,
groupType
,
null
);
Map
<
String
,
Object
>
map
=
getEveryCount
(
instanceId
,
groupType
,
null
);
return
Long
.
parseLong
(
String
.
valueOf
(
map
.
get
(
"equipCount"
)));
}
...
...
@@ -1130,7 +1130,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
List
<
BuildingTreeVo
>
allListVo
=
getBuildingTreeVos
();
// 获取公司部门list
List
<
OrgUsrDto
>
orgUsrLists
=
jcsRemoteService
.
getCompanyDeptListWithAuth
(
authKey
,
"COMPANY"
);
List
<
OrgUsrDto
>
orgUsrLists
=
jcsRemoteService
.
getCompanyDeptListWithAuth
(
authKey
,
"COMPANY"
);
AtomicReference
<
Boolean
>
flag
=
new
AtomicReference
<>(
false
);
List
<
BuildingTreeVo
>
collect
=
orgUsrLists
.
stream
().
map
(
orgUsrDto
->
{
BuildingTreeVo
vo
=
new
BuildingTreeVo
();
...
...
@@ -1151,54 +1151,125 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
allListVo
.
addAll
(
collect
);
return
allListVo
.
stream
().
filter
(
s
->
flag
.
get
()
?
"allBuilding"
.
equals
(
s
.
getGroupType
())
&&
s
.
getBizOrgCode
()
!=
null
&&
(
""
.
equals
(
s
.
getParentId
())
||
"-1"
.
equals
(
s
.
getParentId
())
||
null
==
s
.
getParentId
())
:
"allBuilding"
.
equals
(
s
.
getGroupType
())
&&
s
.
getBizOrgCode
()
!=
null
)
:
"allBuilding"
.
equals
(
s
.
getGroupType
())
&&
s
.
getBizOrgCode
()
!=
null
)
.
peek
(
m
->
m
.
setChildren
(
this
.
getCompanyBuildingChildrenTree
(
m
,
allListVo
)))
.
collect
(
Collectors
.
toList
());
}
@Override
public
List
<
BuildingTreeVo
>
getBuildingVideoTreeNew
()
{
List
<
BuildingTreeVo
>
list
=
getCompanyBuildingTree
(
buildVideoAuthKey
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
List
<
Map
<
String
,
Long
>>
countList
=
iFormInstanceService
.
getBuildVideoCount
();
if
(!
CollectionUtils
.
isEmpty
(
countList
))
{
Map
<
Long
,
Long
>
map
=
countList
.
stream
().
collect
(
Collectors
.
toMap
(
p
->
p
.
get
(
"buildId"
),
p
->
p
.
get
(
"total"
)));
for
(
BuildingTreeVo
treeVo
:
list
)
{
List
<
BuildingTreeVo
>
children
=
treeVo
.
getChildren
();
if
(!
CollectionUtils
.
isEmpty
(
children
))
{
List
<
BuildingTreeVo
>
treeVoList
=
getBuildingVideoTotal
(
children
,
map
);
treeVo
.
setChildren
(
treeVoList
);
}
treeVo
.
setTotal
(
map
.
get
(
treeVo
.
getInstanceId
()));
}
List
<
BuildingTreeVo
>
allListVo
=
getBuildingTreeVos
();
// 获取公司部门list
List
<
OrgUsrDto
>
orgUsrLists
=
jcsRemoteService
.
getCompanyDeptListWithAuth
(
buildVideoAuthKey
,
"COMPANY"
);
List
<
Map
<
String
,
Long
>>
countList
=
iFormInstanceService
.
getBuildVideoCount
();
Map
<
Long
,
Long
>
map
=
countList
.
stream
().
collect
(
Collectors
.
toMap
(
p
->
p
.
get
(
"buildId"
),
p
->
p
.
get
(
"total"
)));
AtomicReference
<
Boolean
>
flag
=
new
AtomicReference
<>(
false
);
List
<
BuildingTreeVo
>
collect
=
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
(
""
.
equals
(
orgUsrDto
.
getParentId
())
||
"-1"
.
equals
(
orgUsrDto
.
getParentId
())
||
null
==
orgUsrDto
.
getParentId
())
{
flag
.
set
(
true
);
}
return
list
;
}
return
Lists
.
newArrayList
();
return
vo
;
}).
collect
(
Collectors
.
toList
());
allListVo
.
addAll
(
collect
);
return
allListVo
.
stream
().
filter
(
s
->
flag
.
get
()
?
"allBuilding"
.
equals
(
s
.
getGroupType
())
&&
s
.
getBizOrgCode
()
!=
null
&&
(
""
.
equals
(
s
.
getParentId
())
||
"-1"
.
equals
(
s
.
getParentId
())
||
null
==
s
.
getParentId
())
:
"allBuilding"
.
equals
(
s
.
getGroupType
())
&&
s
.
getBizOrgCode
()
!=
null
)
.
peek
(
m
->
{
List
<
BuildingTreeVo
>
treeVos
=
this
.
getCompanyBuildingChildrenTreeNew
(
m
,
allListVo
,
map
);
m
.
setChildren
(
treeVos
);
Long
total
=
0L
;
for
(
BuildingTreeVo
vo
:
treeVos
)
{
Long
aLong
=
vo
.
getTotal
();
total
+=
aLong
==
null
?
0
:
aLong
;
}
m
.
setTotal
(
total
);
})
.
collect
(
Collectors
.
toList
());
}
public
List
<
BuildingTreeVo
>
getBuildingVideoTotal
(
List
<
BuildingTreeVo
>
children
,
Map
<
Long
,
Long
>
map
)
{
for
(
BuildingTreeVo
treeVo
:
children
)
{
List
<
BuildingTreeVo
>
childrenList
=
treeVo
.
getChildren
();
if
(!
CollectionUtils
.
isEmpty
(
childrenList
))
{
getBuildingVideoTotal
(
childrenList
,
map
);
}
treeVo
.
setTotal
(
map
.
get
(
treeVo
.
getInstanceId
()));
}
return
children
;
// @Override
// public List<BuildingTreeVo> getBuildingVideoTreeNew() {
// List<BuildingTreeVo> list = getCompanyBuildingTree(buildVideoAuthKey);
// if (!CollectionUtils.isEmpty(list)) {
// List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount();
// if (!CollectionUtils.isEmpty(countList)) {
// Map<Long, Long> map = countList.stream().collect(Collectors.toMap(p->p.get("buildId"), p->p.get("total")));
// for (BuildingTreeVo treeVo : list) {
// List<BuildingTreeVo> children = treeVo.getChildren();
// if (!CollectionUtils.isEmpty(children)) {
// List<BuildingTreeVo> treeVoList = getBuildingVideoTotal(children, map);
// treeVo.setChildren(treeVoList);
// }
// treeVo.setTotal(map.get(treeVo.getInstanceId()));
// }
// }
// return list;
// }
// return Lists.newArrayList();
// }
//
// public List<BuildingTreeVo> getBuildingVideoTotal(List<BuildingTreeVo> children, Map<Long, Long> map) {
// for (BuildingTreeVo treeVo : children) {
// List<BuildingTreeVo> childrenList = treeVo.getChildren();
// if (!CollectionUtils.isEmpty(childrenList)) {
// getBuildingVideoTotal (childrenList, map);
// }
// treeVo.setTotal(map.get(treeVo.getInstanceId()));
// }
// return children;
// }
private
List
<
BuildingTreeVo
>
getCompanyBuildingChildrenTree
(
BuildingTreeVo
root
,
List
<
BuildingTreeVo
>
all
)
{
return
all
.
stream
().
filter
(
b
->
(
root
.
getId
()
!=
null
&&
StringUtil
.
isNotEmpty
(
b
.
getParentId
())
&&
b
.
getParentId
().
equals
(
root
.
getId
().
toString
()))
||
(
"allBuilding"
.
equals
(
root
.
getGroupType
())
&&
"building"
.
equals
(
b
.
getGroupType
())
&&
StringUtil
.
isNotEmpty
(
root
.
getBizOrgCode
())
&&
root
.
getBizOrgCode
().
equals
(
b
.
getBizOrgCode
())
&&
!
b
.
getId
().
equals
(
root
.
getId
())))
.
peek
(
m
->
{
m
.
setChildren
(
getCompanyBuildingChildrenTree
(
m
,
all
));
m
.
setDetailPaneApi
(
address
);
m
.
setApiUrl
(
apiUrl
);
})
.
collect
(
Collectors
.
toList
());
}
private
List
<
BuildingTreeVo
>
getCompanyBuildingChildrenTree
(
BuildingTreeVo
root
,
List
<
BuildingTreeVo
>
all
)
{
return
all
.
stream
().
filter
(
b
->
(
root
.
getId
()
!=
null
&&
StringUtil
.
isNotEmpty
(
b
.
getParentId
())
&&
b
.
getParentId
().
equals
(
root
.
getId
().
toString
()))
||
private
List
<
BuildingTreeVo
>
getCompanyBuildingChildrenTree
New
(
BuildingTreeVo
root
,
List
<
BuildingTreeVo
>
all
,
Map
<
Long
,
Long
>
map
)
{
return
all
.
stream
().
filter
(
b
->
(
root
.
getId
()
!=
null
&&
StringUtil
.
isNotEmpty
(
b
.
getParentId
())
&&
b
.
getParentId
().
equals
(
root
.
getId
().
toString
()))
||
(
"allBuilding"
.
equals
(
root
.
getGroupType
())
&&
"building"
.
equals
(
b
.
getGroupType
())
&&
StringUtil
.
isNotEmpty
(
root
.
getBizOrgCode
())
&&
root
.
getBizOrgCode
().
equals
(
b
.
getBizOrgCode
())
&&
!
b
.
getId
().
equals
(
root
.
getId
())))
.
peek
(
m
->
{
m
.
setChildren
(
getCompanyBuildingChildrenTree
(
m
,
all
));
m
.
setDetailPaneApi
(
address
);
m
.
setApiUrl
(
apiUrl
);})
.
collect
(
Collectors
.
toList
());
&&
"building"
.
equals
(
b
.
getGroupType
())
&&
StringUtil
.
isNotEmpty
(
root
.
getBizOrgCode
())
&&
root
.
getBizOrgCode
().
equals
(
b
.
getBizOrgCode
())
&&
!
b
.
getId
().
equals
(
root
.
getId
())))
.
peek
(
m
->
{
List
<
BuildingTreeVo
>
treeVos
=
getCompanyBuildingChildrenTreeNew
(
m
,
all
,
map
);
m
.
setChildren
(
treeVos
);
Long
aLong1
=
map
.
get
(
m
.
getInstanceId
());
if
(
aLong1
==
null
)
{
Long
total
=
0L
;
for
(
BuildingTreeVo
vo
:
treeVos
)
{
Long
aLong
=
vo
.
getTotal
();
total
+=
aLong
==
null
?
0
:
aLong
;
}
m
.
setTotal
(
total
);
}
else
{
m
.
setTotal
(
map
.
get
(
m
.
getInstanceId
()));
}
m
.
setDetailPaneApi
(
address
);
m
.
setApiUrl
(
apiUrl
);
})
.
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