添加工地视频感知 物联感知 走航监测 30天事件时间趋势

添加 全部 近7天 近30天 走航监测道路污染事件top5
This commit is contained in:
wuweida 2022-08-18 11:13:42 +08:00
parent 3a0da0fd4d
commit 17c3663174
6 changed files with 358 additions and 3 deletions

View File

@ -3,6 +3,7 @@ package com.hisense.monitormanage.controller;
import com.hisense.monitormanage.dto.BuildingRecordsDto; import com.hisense.monitormanage.dto.BuildingRecordsDto;
import com.hisense.monitormanage.dto.BuildingRecordsDtos; import com.hisense.monitormanage.dto.BuildingRecordsDtos;
import com.hisense.monitormanage.dto.EventDto; import com.hisense.monitormanage.dto.EventDto;
import com.hisense.monitormanage.dto.RoadDataDto;
import com.hisense.monitormanage.entity.BuildingRecords; import com.hisense.monitormanage.entity.BuildingRecords;
import com.hisense.monitormanage.entity.Event; import com.hisense.monitormanage.entity.Event;
import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.entity.Result;
@ -81,6 +82,9 @@ public class BuildingController {
@ApiOperation("查询所有工地") @ApiOperation("查询所有工地")
public Result selectAllBuilding(){ public Result selectAllBuilding(){
List<BuildingRecordsDto> records = buildingRecordsMapper.selectAllBuilding(); List<BuildingRecordsDto> records = buildingRecordsMapper.selectAllBuilding();
records.forEach(record ->{
});
Result success = Result.success(records); Result success = Result.success(records);
return success; return success;
} }
@ -387,6 +391,102 @@ public class BuildingController {
return success; return success;
} }
/**
* 查询近30天物联感知事件时间趋势
* @return
*/
@GetMapping("selectMonthCurrentByBuilding")
@ApiOperation("查询近30天物联感知事件时间趋势")
public Result selectMonthCurrentByBuilding(){
List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByBuilding();
buildingRecordsDtos.forEach(buildingRecordsDto -> {
if (buildingRecordsDto.getNumber() == null){
buildingRecordsDto.setNumber(0);
}
});
Result success = Result.success(buildingRecordsDtos);
return success;
}
/**
* 查询近30天视频感知事件时间趋势
* @return
*/
@GetMapping("selectMonthCurrentByEvent")
@ApiOperation("查询近30天视频感知事件时间趋势")
public Result selectMonthCurrentByEvent(){
List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByEvent();
buildingRecordsDtos.forEach(buildingRecordsDto -> {
if (buildingRecordsDto.getNumber() == null){
buildingRecordsDto.setNumber(0);
}
});
Result success = Result.success(buildingRecordsDtos);
return success;
}
/**
* 查询走航监测top5全部道路污染事件
* @return
*/
@GetMapping("selectRoadDataCountEvent")
@ApiOperation("查询走航监测top5全部道路污染事件")
public Result selectRoadDataCountEvent(){
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataCountEvent();
Result success = Result.success(roadDataDtos);
return success;
}
/**
* 查询走航监测top5近7天道路污染事件
* @return
*/
@GetMapping("selectRoadDataWeekEvent")
@ApiOperation("查询走航监测top5近7天道路污染事件")
public Result selectRoadDataWeekEvent(){
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataWeekEvent();
Result success = Result.success(roadDataDtos);
return success;
}
/**
* 查询走航监测top5近30天道路污染事件
* @return
*/
@GetMapping("selectRoadDataMonthEvent")
@ApiOperation("查询走航监测top5近30天道路污染事件")
public Result selectRoadDataMonthEvent(){
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataMonthEvent();
Result success = Result.success(roadDataDtos);
return success;
}
/**
* 查询近30天走航监测事件时间趋势
* @return
*/
@GetMapping("selectMonthCurrentByRoadData")
@ApiOperation("查询近30天走航监测事件时间趋势")
public Result selectMonthCurrentByRoadData(){
List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByRoadData();
buildingRecordsDtos.forEach(buildingRecordsDto -> {
if (buildingRecordsDto.getNumber() == null){
buildingRecordsDto.setNumber(0);
}
});
Result success = Result.success(buildingRecordsDtos);
return success;
}
} }

View File

@ -11,4 +11,6 @@ public class BuildingRecordsDtos {
private Integer noice; private Integer noice;
private Integer number;
} }

View File

@ -0,0 +1,15 @@
package com.hisense.monitormanage.dto;
import lombok.Data;
@Data
public class RoadDataDto {
private String roadName;
private String start;
private String end;
private Integer number;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.dto.BuildingRecordsDto; import com.hisense.monitormanage.dto.BuildingRecordsDto;
import com.hisense.monitormanage.dto.BuildingRecordsDtos; import com.hisense.monitormanage.dto.BuildingRecordsDtos;
import com.hisense.monitormanage.dto.EventDto; import com.hisense.monitormanage.dto.EventDto;
import com.hisense.monitormanage.dto.RoadDataDto;
import com.hisense.monitormanage.entity.BuildingRecords; import com.hisense.monitormanage.entity.BuildingRecords;
import com.hisense.monitormanage.entity.Event; import com.hisense.monitormanage.entity.Event;
import com.hisense.monitormanage.entity.RoadData; import com.hisense.monitormanage.entity.RoadData;
@ -71,7 +72,7 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
@Select("select * from t_road_data where pm10 > 150 AND dt = #{dt}") @Select("select * from t_road_data where pm10 > 150 AND dt = #{dt}")
List<RoadData> selectByDayRoadData(String dt); List<RoadData> selectByDayRoadData(String dt);
@Select("select * from t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name where te.track_event = 'START' AND TO_DAYS(te.capture_time) = TO_DAYS(NOW())") @Select("select * from t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name where te.track_event = 'START' AND tse.scene_id = 1 AND TO_DAYS(te.capture_time) = TO_DAYS(NOW())")
List<EventDto> selectByEvent(); List<EventDto> selectByEvent();
List<BuildingRecordsDto> selectByWeekNoice(); List<BuildingRecordsDto> selectByWeekNoice();
@ -86,4 +87,19 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
List<EventDto> selectByMonthEvent(); List<EventDto> selectByMonthEvent();
List<BuildingRecordsDtos> selectMonthCurrentByBuilding();
List<BuildingRecordsDtos> selectMonthCurrentByEvent();
@Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC limit 5")
List<RoadDataDto> selectRoadDataCountEvent();
@Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(rd.dt) GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC limit 5")
List<RoadDataDto> selectRoadDataWeekEvent();
@Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(rd.dt) GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC limit 5")
List<RoadDataDto> selectRoadDataMonthEvent();
List<BuildingRecordsDtos> selectMonthCurrentByRoadData();
} }

View File

@ -306,7 +306,7 @@ public class MonitorService{
} }
} }
@Scheduled(cron = "0 30 8 * * ?") //@Scheduled(cron = "0 30 8 * * ?")
public void buildingImage() { public void buildingImage() {
try { try {
List<BuildingSite> buildingSites = buildingSiteMapper.selectByList(); List<BuildingSite> buildingSites = buildingSiteMapper.selectByList();
@ -337,7 +337,7 @@ public class MonitorService{
/** /**
* 所有摄像头抓图 sql持续更新 * 所有摄像头抓图 sql持续更新
*/ */
@Scheduled(cron = "0 0 6 * * ?") @Scheduled(cron = "0 15 9 * * ?")
public void CameraScreenshot() { public void CameraScreenshot() {
try { try {
log.info("[monitor-capture]: start capture"); log.info("[monitor-capture]: start capture");

View File

@ -215,6 +215,228 @@
AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt; DATE(te.capture_time) AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt; DATE(te.capture_time)
</select> </select>
<select id="selectMonthCurrentByBuilding" resultType="com.hisense.monitormanage.dto.BuildingRecordsDtos">
SELECT b.pushTime,c.number FROM (
SELECT date_sub(curdate(), INTERVAL 1 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 2 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 3 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 4 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 5 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 6 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 7 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 8 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 9 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 10 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 11 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 12 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 13 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 14 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 15 day) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 16 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 17 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 18 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 19 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 20 DAY) as pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 21 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 22 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 23 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 24 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 25 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 26 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 27 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 28 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 29 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 30 DAY) AS pushTime
) b
LEFT JOIN (
SELECT DATE_FORMAT(a.push_time,'%Y%-%m-%d') AS pushTime,COUNT(*) AS number FROM(
SELECT br.noice,br.push_time,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq
FROM t_building_records br JOIN t_building_new_site bs
ON br.project_name = bs.gdmc
WHERE br.pm10 > 80 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= DATE(br.push_time)
UNION
SELECT br.noice,br.push_time,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq
FROM t_building_records br JOIN t_building_new_site bs
ON br.project_name = bs.gdmc
WHERE (HOUR(br.push_time)>=22 OR 6 > HOUR(br.push_time)) AND br.noice > 55
AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= DATE(br.push_time)
UNION
SELECT br.noice,br.push_time,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq
FROM t_building_records br JOIN t_building_new_site bs
ON br.project_name = bs.gdmc
WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H') &lt; 22
AND br.noice > 70 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= DATE(br.push_time)
) a GROUP BY pushTime
) c ON b.pushTime = c.pushTime ORDER BY b.pushTime
</select>
<select id="selectMonthCurrentByEvent" resultType="com.hisense.monitormanage.dto.BuildingRecordsDtos">
SELECT b.pushTime,a.number FROM (
SELECT date_sub(curdate(), INTERVAL 1 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 2 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 3 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 4 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 5 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 6 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 7 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 8 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 9 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 10 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 11 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 12 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 13 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 14 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 15 day) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 16 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 17 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 18 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 19 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 20 DAY) as pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 21 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 22 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 23 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 24 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 25 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 26 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 27 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 28 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 29 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 30 DAY) AS pushTime
) b LEFT JOIN (
SELECT DATE_FORMAT(te.capture_time,'%Y%-%m-%d') AS pushTime,COUNT(1) AS number
FROM t_event te
JOIN t_scene_event tse ON te.camera_name = tse.channel_name
WHERE te.track_event = 'START' AND tse.scene_id = 1
AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= DATE(te.capture_time)
GROUP BY pushTime) a
ON b.pushTime = a.pushTime ORDER BY b.pushTime
</select>
<select id="selectMonthCurrentByRoadData" resultType="com.hisense.monitormanage.dto.BuildingRecordsDtos">
SELECT b.pushTime,a.number FROM (
SELECT date_sub(curdate(), INTERVAL 1 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 2 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 3 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 4 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 5 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 6 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 7 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 8 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 9 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 10 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 11 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 12 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 13 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 14 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 15 day) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 16 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 17 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 18 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 19 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 20 DAY) as pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 21 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 22 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 23 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 24 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 25 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 26 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 27 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 28 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 29 DAY) AS pushTime
UNION ALL
SELECT date_sub(curdate(), INTERVAL 30 DAY) AS pushTime
) b LEFT JOIN (
SELECT DATE_FORMAT(rd.dt,'%Y%-%m-%d') AS pushTime,COUNT(1) AS number
from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= DATE(rd.dt) GROUP BY pushTime) a
ON a.pushTime = b.pushTime ORDER BY b.pushTime
</select>