Commit a9862370 authored by chenzhao's avatar chenzhao

视频匹配规则代码修改

parent f35cd88c
...@@ -449,7 +449,7 @@ public class CommandController extends BaseController { ...@@ -449,7 +449,7 @@ public class CommandController extends BaseController {
} }
ResponseModel<Page<Map<String, Object>>> data = null; ResponseModel<Page<Map<String, Object>>> data = null;
if (ValidationUtil.isEmpty(par.getLatitudeTwo()) ){ if (ValidationUtil.isEmpty(par.getLatitudeTwo()) ){
data = equipFeignClient.getVideopag( String.valueOf((pageNum - 1) * pageSize), pageSize.toString(),par.getBuildingId(),par.getCode(),null,par.getBizOrgCode(),par.getType()); data = equipFeignClient.getVideopagList( String.valueOf((pageNum - 1) * pageSize), pageSize.toString(),par.getBuildingId(),par.getCode(),par.getEquipmentName(),par.getBizOrgCode(),par.getType());
}else { }else {
data = equipFeignClient.pageVideoByAlertType( pageNum, pageSize, par); data = equipFeignClient.pageVideoByAlertType( pageNum, pageSize, par);
} }
......
...@@ -99,4 +99,17 @@ public class BuildingVideoController extends AbstractBaseController { ...@@ -99,4 +99,17 @@ public class BuildingVideoController extends AbstractBaseController {
return buildService.getSecurityEquipment(id); return buildService.getSecurityEquipment(id);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑视屏监控分页列表-----灾情信息")
@PostMapping(value = "/pageList")
public Page<BuildingVideoVO> pageBuildingVideoList( Page page, BuildingVideoListVO dto) {
List<BuildingVideoVO> buildingVideoVOS = buildService.pageBuildingVideoList(page, dto);
int num = buildService.pageBuildingVideoCount(dto);
Page<BuildingVideoVO> pageBean = new Page<>(page.getCurrent(), page.getSize());
pageBean.setRecords(buildingVideoVOS);
pageBean.setTotal(num);
return pageBean;
}
} }
...@@ -88,9 +88,13 @@ public interface VideoMapper extends BaseMapper<Video> { ...@@ -88,9 +88,13 @@ public interface VideoMapper extends BaseMapper<Video> {
List<VideoListVo> pageVideoListByAlert(@Param("pageNum") Integer pageNum, List<VideoListVo> pageVideoListByAlert(@Param("pageNum") Integer pageNum,
@Param("pageSize") Integer pageSize, @Param("pageSize") Integer pageSize,
@Param("par") RequestData par); @Param("par") RequestData par,@Param("deptId")String deptId);
int VideoListByAlertCount( @Param("par") RequestData par); int VideoListByAlertCount( @Param("par") RequestData par,@Param("deptId")String deptId);
List<BuildingVideoVO> pageBuildingVideoList(@Param("current") long current, @Param("size") long size,@Param("dto") BuildingVideoListVO dto,@Param("deptId") String deptId);
int pageBuildingVideoCount( @Param("dto") BuildingVideoListVO dto,@Param("deptId") String deptId);
int pageVideoCount(@Param("longitude") Double longitude, int pageVideoCount(@Param("longitude") Double longitude,
@Param("latitude") Double latitude, @Param("latitude") Double latitude,
......
...@@ -206,6 +206,10 @@ public interface IBuilldService extends IService<Building> { ...@@ -206,6 +206,10 @@ public interface IBuilldService extends IService<Building> {
*/ */
Map<String ,Object> getEveryCount( Long id, String groupType, String bizOrgCode); Map<String ,Object> getEveryCount( Long id, String groupType, String bizOrgCode);
List<BuildingVideoVO> pageBuildingVideoList(Page page, BuildingVideoListVO dto);
int pageBuildingVideoCount( BuildingVideoListVO dto);
/** /**
* 消防建筑视屏监控统计树 * 消防建筑视屏监控统计树
* @return * @return
......
...@@ -66,6 +66,9 @@ public interface IVideoService extends IService<Video> { ...@@ -66,6 +66,9 @@ public interface IVideoService extends IService<Video> {
List<VideoListVo> pageVideoListByAlert(Integer pageNum, Integer pageSize, RequestData par); List<VideoListVo> pageVideoListByAlert(Integer pageNum, Integer pageSize, RequestData par);
List<BuildingVideoVO> pageBuildingVideoList(Page page, BuildingVideoListVO dto);
int pageBuildingVideoCount(BuildingVideoListVO dto);
int VideoListByAlertCount(RequestData par); int VideoListByAlertCount(RequestData par);
......
...@@ -702,6 +702,29 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -702,6 +702,29 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
@Override @Override
public int pageBuildingVideoCount(BuildingVideoListVO dto) {
return videoService.pageBuildingVideoCount(dto);
}
@Override
public List<BuildingVideoVO> pageBuildingVideoList(Page page, BuildingVideoListVO dto) {
List<BuildingVideoVO> pages = videoService.pageBuildingVideoList(page, dto);
pages.forEach(x -> {
if (StringUtil.isNotEmpty(x.getLocation()) && StringUtil.isNotEmpty(x.getAddress())) {
x.setLocation(x.getLocation() + '-' + x.getAddress());
} else {
if (!StringUtil.isNotEmpty(x.getLocation())) {
x.setLocation(x.getAddress());
}
}
x.setVedioFormat(vedioFormat);
x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode()));
});
return pages;
}
@Override
public Map<String, Object> getEveryCount(Long id, String groupType, String bizOrgCode) { public Map<String, Object> getEveryCount(Long id, String groupType, String bizOrgCode) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if ("".equals(groupType) || "allBuilding".equals(groupType)) { if ("".equals(groupType) || "allBuilding".equals(groupType)) {
......
...@@ -79,6 +79,9 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -79,6 +79,9 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Autowired @Autowired
VideoMapper videoMapper; VideoMapper videoMapper;
@Value("${fxkgtId}")
private String deptId;
@Autowired @Autowired
VideoFeignClient videoFeignClient; VideoFeignClient videoFeignClient;
...@@ -532,13 +535,24 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -532,13 +535,24 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Override @Override
public List<VideoListVo> pageVideoListByAlert(Integer pageNum, Integer pageSize,RequestData par) { public List<VideoListVo> pageVideoListByAlert(Integer pageNum, Integer pageSize,RequestData par) {
return videoMapper.pageVideoListByAlert(pageNum, pageSize, par); return videoMapper.pageVideoListByAlert(pageNum, pageSize, par,deptId);
}
@Override
public List<BuildingVideoVO> pageBuildingVideoList(Page page, BuildingVideoListVO dto) {
return this.baseMapper.pageBuildingVideoList(page.getCurrent(),page.getSize(), dto,deptId);
}
@Override
public int pageBuildingVideoCount( BuildingVideoListVO dto) {
return this.baseMapper.pageBuildingVideoCount( dto,deptId);
} }
@Override @Override
public int VideoListByAlertCount(RequestData par) { public int VideoListByAlertCount(RequestData par) {
return videoMapper.VideoListByAlertCount( par); return videoMapper.VideoListByAlertCount( par,deptId);
} }
......
...@@ -56,7 +56,7 @@ public class ESCarService implements IESCarService { ...@@ -56,7 +56,7 @@ public class ESCarService implements IESCarService {
MatchQueryBuilder matchQueryBuilder= QueryBuilders.matchQuery("sequenceNbr", id); MatchQueryBuilder matchQueryBuilder= QueryBuilders.matchQuery("sequenceNbr", id);
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder() NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
.withQuery(matchQueryBuilder) .withQuery(matchQueryBuilder)
.withPageable(PageRequest.of(1, 1)) .withPageable(PageRequest.of(0, 1))
.withSort(SortBuilders.fieldSort("Time").order(SortOrder.DESC)); .withSort(SortBuilders.fieldSort("Time").order(SortOrder.DESC));
List<ESCar> list = new LinkedList<>(); List<ESCar> list = new LinkedList<>();
long totle = 0; long totle = 0;
......
...@@ -117,4 +117,6 @@ redis_equip_type_count = equipTypeAndCount ...@@ -117,4 +117,6 @@ redis_equip_type_count = equipTypeAndCount
auth-key-fire-iot-equip=fire_iot-equip_info auth-key-fire-iot-equip=fire_iot-equip_info
# app离线同步装备数据开关 # app离线同步装备数据开关
auth-open-fire-equip=false auth-open-fire-equip=false
\ No newline at end of file
fxkgtId=1522051112935387138
\ No newline at end of file
...@@ -357,6 +357,174 @@ ...@@ -357,6 +357,174 @@
limit #{pageNum},#{pageSize} limit #{pageNum},#{pageSize}
</select> </select>
<select id="pageBuildingVideoList" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO">
select a.* from (
<if test="dto.buildingId!=null and dto.buildingId!=''">
SELECT
v.id AS id,
v.name AS name,
v.token AS token,
v.url AS url,
v.code AS code,
v.address,
v.preset_position as presetPosition
FROM wl_video v
<choose>
<when test="dto.buildingId!=null and dto.buildingId!=''">
JOIN wl_video_source vc ON vc.video_id = v.id
join wl_form_instance wfl on wfl.instance_id = vc.source_id
WHERE
FIND_IN_SET(#{dto.buildingId}, vc.parent_source_ids)
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type = #{dto.type}
</if>
GROUP BY id
</when>
<when test='dto.buildingId == null || dto.buildingId ==""'>
<where>
<if test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
</if>
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type =#{dto.type}
</if>
</where>
GROUP BY id
</when>
</choose>
UNION
</if>
SELECT
v.id AS id,
v.name AS name,
v.token AS token,
v.url AS url,
v.code AS code,
v.address,
v.preset_position as presetPosition
FROM wl_video v
JOIN wl_video_source vc ON vc.video_id = v.id
join wl_form_instance wfl on wfl.instance_id = vc.source_id
WHERE
FIND_IN_SET(#{deptId}, vc.parent_source_ids)
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type =#{dto.type}
</if>
GROUP BY id
) AS a limit #{current},#{size}
</select>
<select id="pageBuildingVideoCount" resultType="int">
select count(a.id) from (
<if test="dto.buildingId!=null and dto.buildingId!=''">
SELECT
v.id AS id,
v.name AS name,
v.token AS token,
v.url AS url,
v.code AS code,
v.address,
v.preset_position as presetPosition
FROM wl_video v
<choose>
<when test="dto.buildingId!=null and dto.buildingId!=''">
JOIN wl_video_source vc ON vc.video_id = v.id
join wl_form_instance wfl on wfl.instance_id = vc.source_id
WHERE
FIND_IN_SET(#{dto.buildingId}, vc.parent_source_ids)
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type = #{dto.type}
</if>
GROUP BY id
</when>
<when test='dto.buildingId == null || dto.buildingId ==""'>
<where>
<if test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
</if>
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type =#{dto.type}
</if>
</where>
GROUP BY id
</when>
</choose>
UNION
</if>
SELECT
v.id AS id,
v.name AS name,
v.token AS token,
v.url AS url,
v.code AS code,
v.address,
v.preset_position as presetPosition
FROM wl_video v
JOIN wl_video_source vc ON vc.video_id = v.id
join wl_form_instance wfl on wfl.instance_id = vc.source_id
WHERE
FIND_IN_SET(#{deptId}, vc.parent_source_ids)
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type =#{dto.type}
</if>
GROUP BY id
) AS a
</select>
<select id="pageVideoListByAlert" resultType="com.yeejoin.equipmanage.common.entity.vo.VideoListVo"> <select id="pageVideoListByAlert" resultType="com.yeejoin.equipmanage.common.entity.vo.VideoListVo">
SELECT SELECT
a.* a.*
...@@ -367,17 +535,17 @@ ...@@ -367,17 +535,17 @@
wle.id , wle.id ,
wle.`code` , wle.`code` ,
wle.url, wle.url,
wle.position3d,
wle.token, wle.token,
wle.`name` , wle.`name` ,
wle.address , wle.address ,
wle.longitude, wle.longitude,
Round(st_distance(point(wle.longitude,wle.latitude),point(#{longitude},#{latitude}))*111195,1) AS distance, Round(st_distance(point(wle.longitude,wle.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance,
wle.latitude wle.latitude
FROM wl_video wle FROM wl_video wle
where wle.longitude is not null and wle.latitude is not null where wle.longitude is not null and wle.latitude is not null
<if test='par.longitude!=null and par.latitude!=null and distance!=null'> <if test='par.longitude!=null and par.latitude!=null'>
and distance &lt;= #{distance} and Round(st_distance(point(wle.longitude,wle.latitude),point(#{par.longitude},#{par.latitude}))*111195,1)
&lt;= #{par.distance}
</if> </if>
<if test='par.type!=null and par.type!="" '> <if test='par.type!=null and par.type!="" '>
wle.type = #{type} wle.type = #{type}
...@@ -397,7 +565,6 @@ ...@@ -397,7 +565,6 @@
wle.id, wle.id,
wle.`code`, wle.`code`,
wle.url, wle.url,
wle.position3d,
wle.token, wle.token,
wle.`name`, wle.`name`,
wle.address, wle.address,
...@@ -406,15 +573,15 @@ ...@@ -406,15 +573,15 @@
st_distance ( st_distance (
point ( wle.longitude, wle.latitude ), point ( wle.longitude, wle.latitude ),
point (#{par.longitudeTwo},#{par.latitudeTwo} ) ) * 111195, 1 ) AS distance, point (#{par.longitudeTwo},#{par.latitudeTwo} ) ) * 111195, 1 ) AS distance,
wle.latitude wle.latitude
FROM FROM
wl_video wle wl_video wle
WHERE WHERE
wle.longitude IS NOT NULL wle.longitude IS NOT NULL
AND wle.latitude IS NOT NULL AND wle.latitude IS NOT NULL
<if test='par.longitudeTwo!=null and par.latitude!=null and distance!=null'> <if test='par.longitudeTwo!=null and par.latitude!=null '>
AND distance &lt;= #{distance} AND Round(st_distance(point(wle.longitude,wle.latitude),point(#{par.longitude},#{par.latitude}))*111195,1)
&lt;= #{par.distance}
</if> </if>
<if test='par.type!=null and par.type!="" '> <if test='par.type!=null and par.type!="" '>
wle.type = #{par.type} wle.type = #{par.type}
...@@ -425,13 +592,25 @@ ...@@ -425,13 +592,25 @@
<if test='par.code!=null and par.code!="" '> <if test='par.code!=null and par.code!="" '>
wle.code like concat ('%',#{par.code},'%') wle.code like concat ('%',#{par.code},'%')
</if> </if>
<if test='par.longitudeTwo !=null and par.latitudeTwo!=null '>
ORDER BY
distance
</if>
</if> </if>
) AS a union
limit #{pageNum},#{pageSize} SELECT
v.id AS id,
v.NAME AS NAME,
v.token AS token,
v.url AS url,
v.CODE AS CODE,
v.address,
v.longitude,
'' as distance,
v.latitude
FROM wl_video v
JOIN wl_video_source vc ON vc.video_id = v.id
join wl_form_instance wfl on wfl.instance_id = vc.source_id
WHERE
FIND_IN_SET(#{deptId}, vc.parent_source_ids)
GROUP BY id
) AS a ORDER BY a.distance desc limit #{pageNum},#{pageSize}
</select> </select>
...@@ -445,17 +624,17 @@ ...@@ -445,17 +624,17 @@
wle.id , wle.id ,
wle.`code` , wle.`code` ,
wle.url, wle.url,
wle.position3d,
wle.token, wle.token,
wle.`name` , wle.`name` ,
wle.address , wle.address ,
wle.longitude, wle.longitude,
Round(st_distance(point(wle.longitude,wle.latitude),point(#{longitude},#{latitude}))*111195,1) AS distance, Round(st_distance(point(wle.longitude,wle.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance,
wle.latitude wle.latitude
FROM wl_video wle FROM wl_video wle
where wle.longitude is not null and wle.latitude is not null where wle.longitude is not null and wle.latitude is not null
<if test='par.longitude!=null and par.latitude!=null and distance!=null'> <if test='par.longitude!=null and par.latitude!=null'>
and distance &lt;= #{distance} and Round(st_distance(point(wle.longitude,wle.latitude),point(#{par.longitude},#{par.latitude}))*111195,1)
&lt;= #{par.distance}
</if> </if>
<if test='par.type!=null and par.type!="" '> <if test='par.type!=null and par.type!="" '>
wle.type = #{type} wle.type = #{type}
...@@ -475,7 +654,6 @@ ...@@ -475,7 +654,6 @@
wle.id, wle.id,
wle.`code`, wle.`code`,
wle.url, wle.url,
wle.position3d,
wle.token, wle.token,
wle.`name`, wle.`name`,
wle.address, wle.address,
...@@ -491,8 +669,9 @@ ...@@ -491,8 +669,9 @@
WHERE WHERE
wle.longitude IS NOT NULL wle.longitude IS NOT NULL
AND wle.latitude IS NOT NULL AND wle.latitude IS NOT NULL
<if test='par.longitudeTwo!=null and par.latitude!=null and distance!=null'> <if test='par.longitudeTwo!=null and par.latitude!=null'>
AND distance &lt;= #{distance} AND Round(st_distance(point(wle.longitude,wle.latitude),point(#{par.longitude},#{par.latitude}))*111195,1)
&lt;= #{par.distance}
</if> </if>
<if test='par.type!=null and par.type!="" '> <if test='par.type!=null and par.type!="" '>
wle.type = #{par.type} wle.type = #{par.type}
...@@ -503,11 +682,24 @@ ...@@ -503,11 +682,24 @@
<if test='par.code!=null and par.code!="" '> <if test='par.code!=null and par.code!="" '>
wle.code like concat ('%',#{par.code},'%') wle.code like concat ('%',#{par.code},'%')
</if> </if>
<if test='par.longitudeTwo !=null and par.latitudeTwo!=null '>
ORDER BY
distance
</if>
</if> </if>
union
SELECT
v.id AS id,
v.NAME AS NAME,
v.token AS token,
v.url AS url,
v.CODE AS CODE,
v.address,
v.longitude,
'' as distance,
v.latitude
FROM wl_video v
JOIN wl_video_source vc ON vc.video_id = v.id
join wl_form_instance wfl on wfl.instance_id = vc.source_id
WHERE
FIND_IN_SET(#{deptId}, vc.parent_source_ids)
GROUP BY id
) AS a ) AS a
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment