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
f8abe650
Commit
f8abe650
authored
Feb 10, 2022
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1。视频点增加建筑父级冗余,树形查询用
parent
20abe15f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
89 additions
and
23 deletions
+89
-23
VideoSource.java
...va/com/yeejoin/equipmanage/common/entity/VideoSource.java
+3
-0
VideoMapper.java
...main/java/com/yeejoin/equipmanage/mapper/VideoMapper.java
+2
-0
BuildingServiceImpl.java
...yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
+25
-15
VideoServiceImpl.java
...om/yeejoin/equipmanage/service/impl/VideoServiceImpl.java
+10
-4
wl-3.0.1.xml
...ot-system-equip/src/main/resources/changelog/wl-3.0.1.xml
+43
-0
VideoMapper.xml
...ot-system-equip/src/main/resources/mapper/VideoMapper.xml
+6
-2
jcs-1.0.0.0.xml
...ystem-jcs/src/main/resources/db/changelog/jcs-1.0.0.0.xml
+0
-2
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/VideoSource.java
View file @
f8abe650
...
@@ -34,4 +34,7 @@ public class VideoSource {
...
@@ -34,4 +34,7 @@ public class VideoSource {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
Date
createDate
;
private
Date
createDate
;
@ApiModelProperty
(
value
=
"本级及父级建筑ids,冗余树形搜索"
)
private
String
parentSourceIds
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/VideoMapper.java
View file @
f8abe650
...
@@ -87,4 +87,6 @@ public interface VideoMapper extends BaseMapper<Video> {
...
@@ -87,4 +87,6 @@ public interface VideoMapper extends BaseMapper<Video> {
List
<
Video
>
listByCode
(
@Param
(
"code"
)
String
code
);
List
<
Video
>
listByCode
(
@Param
(
"code"
)
String
code
);
List
<
Video
>
selectListBySourceId
(
Long
floorId
);
List
<
Video
>
selectListBySourceId
(
Long
floorId
);
String
getParentSourceIds
(
String
childrenId
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
View file @
f8abe650
...
@@ -157,6 +157,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
...
@@ -157,6 +157,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Value
(
"${firefightingsystem.equip.alarms.url}"
)
@Value
(
"${firefightingsystem.equip.alarms.url}"
)
private
String
ffsEquipAlarmsUrl
;
private
String
ffsEquipAlarmsUrl
;
final
String
ALL_BUILDING
=
"allBuilding"
;
/**
/**
* @param groupCode
* @param groupCode
* @Description 根据groupCode查询allowOperation对应的操作菜单
* @Description 根据groupCode查询allowOperation对应的操作菜单
...
@@ -768,19 +770,17 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
...
@@ -768,19 +770,17 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
@Override
public
Page
<
BuildingVideoVO
>
buildingVideoList
(
Page
page
,
BuildingVideoListVO
dto
)
{
public
Page
<
BuildingVideoVO
>
buildingVideoList
(
Page
page
,
BuildingVideoListVO
dto
)
{
Page
<
BuildingVideoVO
>
pages
=
videoService
.
pageBuildingVideo
(
page
,
dto
);
Page
<
BuildingVideoVO
>
pages
=
videoService
.
pageBuildingVideo
(
page
,
dto
);
if
(
0
<
pages
.
getRecords
().
size
())
{
pages
.
getRecords
().
forEach
(
x
->
{
pages
.
getRecords
().
forEach
(
x
->
{
if
(
StringUtil
.
isNotEmpty
(
x
.
getLocation
())
&&
StringUtil
.
isNotEmpty
(
x
.
getAddress
()))
{
if
(
StringUtil
.
isNotEmpty
(
x
.
getLocation
())
&&
StringUtil
.
isNotEmpty
(
x
.
getAddress
()))
{
x
.
setLocation
(
x
.
getLocation
()
+
'-'
+
x
.
getAddress
());
x
.
setLocation
(
x
.
getLocation
()
+
'-'
+
x
.
getAddress
());
}
else
{
}
else
{
if
(!
StringUtil
.
isNotEmpty
(
x
.
getLocation
()))
{
if
(!
StringUtil
.
isNotEmpty
(
x
.
getLocation
()))
{
x
.
setLocation
(
x
.
getAddress
());
x
.
setLocation
(
x
.
getAddress
());
}
}
}
x
.
setVedioFormat
(
vedioFormat
);
}
x
.
setUrl
(
videoService
.
getVideoUrl
(
x
.
getName
(),
x
.
getPresetPosition
(),
x
.
getUrl
(),
x
.
getCode
())
);
x
.
setVedioFormat
(
vedioFormat
);
}
);
x
.
setUrl
(
videoService
.
getVideoUrl
(
x
.
getName
(),
x
.
getPresetPosition
(),
x
.
getUrl
(),
x
.
getCode
())
);
}
}
);
return
pages
;
return
pages
;
}
}
...
@@ -1160,6 +1160,14 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
...
@@ -1160,6 +1160,14 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
List
<
BuildingTreeVo
>
companyBuildingList
=
buildBuildingAndCompanyListVos
(
buildVideoAuthKey
);
List
<
BuildingTreeVo
>
companyBuildingList
=
buildBuildingAndCompanyListVos
(
buildVideoAuthKey
);
List
<
Map
<
String
,
Long
>>
countList
=
iFormInstanceService
.
getBuildVideoCount
();
List
<
Map
<
String
,
Long
>>
countList
=
iFormInstanceService
.
getBuildVideoCount
();
Map
<
Long
,
Long
>
countMap
=
countList
.
stream
().
collect
(
Collectors
.
toMap
(
p
->
p
.
get
(
"buildId"
),
p
->
p
.
get
(
"total"
)));
Map
<
Long
,
Long
>
countMap
=
countList
.
stream
().
collect
(
Collectors
.
toMap
(
p
->
p
.
get
(
"buildId"
),
p
->
p
.
get
(
"total"
)));
companyBuildingList
.
forEach
(
c
->
{
if
(!
ALL_BUILDING
.
equals
(
c
.
getGroupType
())){
c
.
setTotal
(
countMap
.
get
(
c
.
getInstanceId
())
==
null
?
0L
:
countMap
.
get
(
c
.
getInstanceId
()));
}
else
{
// 方法 复用,覆盖掉不需要的数据
c
.
setTotal
(
0L
);
}
});
//2.list to tree
//2.list to tree
return
companyBuildingList
.
stream
()
return
companyBuildingList
.
stream
()
.
filter
(
a
->
companyBuildingList
.
stream
().
noneMatch
(
c
->
c
.
getId
().
toString
().
equals
(
a
.
getParentId
())))
.
filter
(
a
->
companyBuildingList
.
stream
().
noneMatch
(
c
->
c
.
getId
().
toString
().
equals
(
a
.
getParentId
())))
...
@@ -1169,11 +1177,13 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
...
@@ -1169,11 +1177,13 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
private
List
<
BuildingTreeVo
>
getCompanyBuildingChildrenWithCount
(
String
private
List
<
BuildingTreeVo
>
getCompanyBuildingChildrenWithCount
(
String
parentId
,
List
<
BuildingTreeVo
>
companyBuildingList
)
{
parentId
,
List
<
BuildingTreeVo
>
companyBuildingList
)
{
return
companyBuildingList
.
stream
().
filter
(
a
->
parentId
.
equals
(
a
.
getParentId
())).
peek
(
a
->
{
return
companyBuildingList
.
stream
().
filter
(
a
->
parentId
.
equals
(
a
.
getParentId
())).
peek
(
a
->
{
a
.
setChildren
(
getCompanyBuildingChildrenWithCount
(
a
.
getId
().
toString
(),
companyBuildingList
));
a
.
setChildren
(
getCompanyBuildingChildrenWithCount
(
a
.
getId
().
toString
(),
companyBuildingList
));
a
.
setTotal
(
a
.
getChildren
().
stream
().
filter
(
c
->
c
.
getTotal
()
!=
null
).
mapToLong
(
BuildingTreeVo:
:
getTotal
).
sum
());
//单位类型节点才需要设置摄像头总数,建筑的下摄像头总数已经在sql计算出来
if
(
ALL_BUILDING
.
equals
(
a
.
getGroupType
())){
a
.
setTotal
(
a
.
getChildren
().
stream
().
filter
(
c
->
c
.
getTotal
()
!=
null
).
mapToLong
(
BuildingTreeVo:
:
getTotal
).
sum
());
}
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/VideoServiceImpl.java
View file @
f8abe650
...
@@ -100,15 +100,16 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
...
@@ -100,15 +100,16 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
List
<
VideoSource
>
videoSources
=
new
ArrayList
<>();
List
<
VideoSource
>
videoSources
=
new
ArrayList
<>();
if
(
videoSave
.
getIds
()
!=
null
&&
videoSave
.
getIds
().
size
()
>
0
)
{
if
(
videoSave
.
getIds
()
!=
null
&&
videoSave
.
getIds
().
size
()
>
0
)
{
videoSave
.
getIds
().
forEach
(
x
->
{
videoSave
.
getIds
().
forEach
(
x
->
{
if
(
x
!=
null
&&
x
.
indexOf
(
"equip"
)
!=
-
1
)
{
if
(
x
!=
null
&&
x
.
contains
(
"equip"
)
)
{
VideoEquipmentSpecific
videoEquipmentSpecific
=
new
VideoEquipmentSpecific
();
VideoEquipmentSpecific
videoEquipmentSpecific
=
new
VideoEquipmentSpecific
();
videoEquipmentSpecific
.
setEquipmentSpecificId
(
Long
.
valueOf
(
x
.
substring
(
5
)));
videoEquipmentSpecific
.
setEquipmentSpecificId
(
Long
.
valueOf
(
x
.
substring
(
5
)));
videoEquipmentSpecific
.
setVideoId
(
videoSave
.
getVideo
().
getId
());
videoEquipmentSpecific
.
setVideoId
(
videoSave
.
getVideo
().
getId
());
videoEquipmentSpecifics
.
add
(
videoEquipmentSpecific
);
videoEquipmentSpecifics
.
add
(
videoEquipmentSpecific
);
}
else
if
(
x
!=
null
&&
x
.
indexOf
(
"region"
)
!=
-
1
)
{
}
else
if
(
x
!=
null
&&
x
.
contains
(
"region"
)
)
{
VideoSource
videoSource
=
new
VideoSource
();
VideoSource
videoSource
=
new
VideoSource
();
videoSource
.
setVideoId
(
videoSave
.
getVideo
().
getId
());
videoSource
.
setVideoId
(
videoSave
.
getVideo
().
getId
());
videoSource
.
setSourceId
(
Long
.
valueOf
(
x
.
substring
(
6
)));
videoSource
.
setSourceId
(
Long
.
valueOf
(
x
.
substring
(
6
)));
videoSource
.
setParentSourceIds
(
getParentSourceIds
(
videoSource
.
getSourceId
().
toString
()));
videoSources
.
add
(
videoSource
);
videoSources
.
add
(
videoSource
);
}
}
});
});
...
@@ -130,6 +131,10 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
...
@@ -130,6 +131,10 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
return
videoSave
.
getVideo
();
return
videoSave
.
getVideo
();
}
}
private
String
getParentSourceIds
(
String
childrenId
){
return
this
.
videoMapper
.
getParentSourceIds
(
childrenId
);
}
@Transactional
@Transactional
@Override
@Override
public
Boolean
delVideo
(
List
<
Long
>
ids
)
{
public
Boolean
delVideo
(
List
<
Long
>
ids
)
{
...
@@ -173,15 +178,16 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
...
@@ -173,15 +178,16 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
List
<
VideoSource
>
videoSources
=
new
ArrayList
<>();
List
<
VideoSource
>
videoSources
=
new
ArrayList
<>();
if
(
videoSave
.
getIds
()
!=
null
&&
videoSave
.
getIds
().
size
()
>
0
)
{
if
(
videoSave
.
getIds
()
!=
null
&&
videoSave
.
getIds
().
size
()
>
0
)
{
videoSave
.
getIds
().
forEach
(
x
->
{
videoSave
.
getIds
().
forEach
(
x
->
{
if
(
x
!=
null
&&
x
.
indexOf
(
"equip"
)
!=
-
1
)
{
if
(
x
!=
null
&&
x
.
contains
(
"equip"
)
)
{
VideoEquipmentSpecific
videoEquipmentSpecific
=
new
VideoEquipmentSpecific
();
VideoEquipmentSpecific
videoEquipmentSpecific
=
new
VideoEquipmentSpecific
();
videoEquipmentSpecific
.
setEquipmentSpecificId
(
Long
.
valueOf
(
x
.
substring
(
5
)));
videoEquipmentSpecific
.
setEquipmentSpecificId
(
Long
.
valueOf
(
x
.
substring
(
5
)));
videoEquipmentSpecific
.
setVideoId
(
videoSave
.
getVideo
().
getId
());
videoEquipmentSpecific
.
setVideoId
(
videoSave
.
getVideo
().
getId
());
videoEquipmentSpecifics
.
add
(
videoEquipmentSpecific
);
videoEquipmentSpecifics
.
add
(
videoEquipmentSpecific
);
}
else
if
(
x
!=
null
&&
x
.
indexOf
(
"region"
)
!=
-
1
)
{
}
else
if
(
x
!=
null
&&
x
.
contains
(
"region"
)
)
{
VideoSource
videoSource
=
new
VideoSource
();
VideoSource
videoSource
=
new
VideoSource
();
videoSource
.
setVideoId
(
videoSave
.
getVideo
().
getId
());
videoSource
.
setVideoId
(
videoSave
.
getVideo
().
getId
());
videoSource
.
setSourceId
(
Long
.
valueOf
(
x
.
substring
(
6
)));
videoSource
.
setSourceId
(
Long
.
valueOf
(
x
.
substring
(
6
)));
videoSource
.
setParentSourceIds
(
getParentSourceIds
(
videoSource
.
getSourceId
().
toString
()));
videoSources
.
add
(
videoSource
);
videoSources
.
add
(
videoSource
);
}
}
});
});
...
...
amos-boot-system-equip/src/main/resources/changelog/wl-3.0.1.xml
View file @
f8abe650
...
@@ -2385,4 +2385,46 @@
...
@@ -2385,4 +2385,46 @@
alter table `wl_equipment_specific` modify column `team_id` varchar(32) DEFAULT NULL COMMENT '所属队伍id(来源于平台)';
alter table `wl_equipment_specific` modify column `team_id` varchar(32) DEFAULT NULL COMMENT '所属队伍id(来源于平台)';
</sql>
</sql>
</changeSet>
</changeSet>
<changeSet
author=
"shg"
id=
"1644459872903-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"wl_video_source"
columnName=
"parent_source_ids"
/>
</not>
</preConditions>
<comment>
wl_video_source add column parent_source_ids 本级及父级建筑ids,冗余树形搜索
</comment>
<sql>
alter table `wl_video_source` add column `parent_source_ids` text COMMENT '本级及父级建筑ids,冗余树形搜索';
</sql>
</changeSet>
<changeSet
author=
"shg"
id=
"1644459872903-1"
runAlways=
"true"
>
<comment>
`getBuildingParentIds` 存在前后顺序依赖关系所以放在这里
</comment>
<sql
endDelimiter=
"#"
>
DROP FUNCTION IF EXISTS `getBuildingParentIds`#
CREATE DEFINER=`root`@`%` FUNCTION `getBuildingParentIds`(`childrenId` VARCHAR(32)) RETURNS varchar(1000) CHARSET utf8
BEGIN
DECLARE ptemp VARCHAR(1000);
DECLARE ctemp VARCHAR(1000);
DECLARE ctempName VARCHAR(1000);
SET ptemp ='';
SET ctemp = childrenId;
WHILE ctemp != '0' DO
SET ptemp = concat(ptemp,',',ctemp);
SELECT IFNULL((SELECT parentId
FROM get_building_tree
WHERE instanceId = ctemp),'0') INTO ctemp;
END WHILE;
SET ptemp = SUBSTR(ptemp,2);
RETURN ptemp;
END#
</sql>
</changeSet>
<changeSet
author=
"shg"
id=
"1644459872903-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"wl_video_source"
columnName=
"parent_source_ids"
/>
</preConditions>
<comment>
wl_video_source 存量数据修改parent_source_ids
</comment>
<sql>
update wl_video_source s set s.parent_source_ids = (SELECT getBuildingParentIds(s.source_id)) ;
</sql>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
\ No newline at end of file
amos-boot-system-equip/src/main/resources/mapper/VideoMapper.xml
View file @
f8abe650
...
@@ -61,14 +61,15 @@
...
@@ -61,14 +61,15 @@
v.token AS token,
v.token AS token,
v.url AS url,
v.url AS url,
v.code AS code,
v.code AS code,
getBuildingNames(vc.source_id)
as location,
ws.full_name
as location,
v.address,
v.address,
v.preset_position as presetPosition
v.preset_position as presetPosition
FROM wl_video v
FROM wl_video v
JOIN wl_video_source vc ON vc.video_id = v.id
JOIN wl_video_source vc ON vc.video_id = v.id
left join wl_warehouse_structure ws on ws.id = vc.source_id
<where>
<where>
<if
test=
"dto.buildingId!=null and dto.buildingId!=''"
>
<if
test=
"dto.buildingId!=null and dto.buildingId!=''"
>
FIND_IN_SET(
vc.source_id, getBuildChildIdsByRootId(#{dto.buildingId})
)
FIND_IN_SET(
#{dto.buildingId}, vc.parent_source_ids
)
</if>
</if>
<if
test=
"dto.bizOrgCode!=null and dto.bizOrgCode!=''"
>
<if
test=
"dto.bizOrgCode!=null and dto.bizOrgCode!=''"
>
and v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
and v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
...
@@ -377,4 +378,7 @@
...
@@ -377,4 +378,7 @@
where vs.source_id = #{floorId}
where vs.source_id = #{floorId}
and vs.video_id = v.id
and vs.video_id = v.id
</select>
</select>
<select
id=
"getParentSourceIds"
resultType=
"java.lang.String"
>
select getBuildingParentIds(#{childrenId})
</select>
</mapper>
</mapper>
amos-boot-system-jcs/src/main/resources/db/changelog/jcs-1.0.0.0.xml
View file @
f8abe650
...
@@ -2770,7 +2770,5 @@
...
@@ -2770,7 +2770,5 @@
END#
END#
</sql>
</sql>
</changeSet>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
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