diff --git a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java index a3cb4ae..45a04a7 100644 --- a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java +++ b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java @@ -3,6 +3,7 @@ package com.hisense.monitormanage.controller; import com.hisense.monitormanage.dto.BuildingRecordsDto; import com.hisense.monitormanage.dto.BuildingRecordsDtos; import com.hisense.monitormanage.dto.EventDto; +import com.hisense.monitormanage.dto.RoadDataDto; import com.hisense.monitormanage.entity.BuildingRecords; import com.hisense.monitormanage.entity.Event; import com.hisense.monitormanage.entity.Result; @@ -81,6 +82,9 @@ public class BuildingController { @ApiOperation("查询所有工地") public Result selectAllBuilding(){ List records = buildingRecordsMapper.selectAllBuilding(); + records.forEach(record ->{ + + }); Result success = Result.success(records); return success; } @@ -387,6 +391,102 @@ public class BuildingController { return success; } + /** + * 查询近30天物联感知事件时间趋势 + * @return + */ + @GetMapping("selectMonthCurrentByBuilding") + @ApiOperation("查询近30天物联感知事件时间趋势") + public Result selectMonthCurrentByBuilding(){ + List 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 = 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 roadDataDtos = buildingRecordsMapper.selectRoadDataCountEvent(); + + Result success = Result.success(roadDataDtos); + + return success; + } + + /** + * 查询走航监测top5近7天道路污染事件 + * @return + */ + @GetMapping("selectRoadDataWeekEvent") + @ApiOperation("查询走航监测top5近7天道路污染事件") + public Result selectRoadDataWeekEvent(){ + + List roadDataDtos = buildingRecordsMapper.selectRoadDataWeekEvent(); + + Result success = Result.success(roadDataDtos); + + return success; + } + + /** + * 查询走航监测top5近30天道路污染事件 + * @return + */ + @GetMapping("selectRoadDataMonthEvent") + @ApiOperation("查询走航监测top5近30天道路污染事件") + public Result selectRoadDataMonthEvent(){ + + List roadDataDtos = buildingRecordsMapper.selectRoadDataMonthEvent(); + + Result success = Result.success(roadDataDtos); + + return success; + } + + /** + * 查询近30天走航监测事件时间趋势 + * @return + */ + @GetMapping("selectMonthCurrentByRoadData") + @ApiOperation("查询近30天走航监测事件时间趋势") + public Result selectMonthCurrentByRoadData(){ + List buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByRoadData(); + buildingRecordsDtos.forEach(buildingRecordsDto -> { + if (buildingRecordsDto.getNumber() == null){ + buildingRecordsDto.setNumber(0); + } + }); + Result success = Result.success(buildingRecordsDtos); + return success; + } + } diff --git a/src/main/java/com/hisense/monitormanage/dto/BuildingRecordsDtos.java b/src/main/java/com/hisense/monitormanage/dto/BuildingRecordsDtos.java index 61f2e6d..9a04dcc 100644 --- a/src/main/java/com/hisense/monitormanage/dto/BuildingRecordsDtos.java +++ b/src/main/java/com/hisense/monitormanage/dto/BuildingRecordsDtos.java @@ -11,4 +11,6 @@ public class BuildingRecordsDtos { private Integer noice; + private Integer number; + } diff --git a/src/main/java/com/hisense/monitormanage/dto/RoadDataDto.java b/src/main/java/com/hisense/monitormanage/dto/RoadDataDto.java new file mode 100644 index 0000000..a15f115 --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/dto/RoadDataDto.java @@ -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; +} diff --git a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java index a0f55af..b2a3a73 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hisense.monitormanage.dto.BuildingRecordsDto; import com.hisense.monitormanage.dto.BuildingRecordsDtos; import com.hisense.monitormanage.dto.EventDto; +import com.hisense.monitormanage.dto.RoadDataDto; import com.hisense.monitormanage.entity.BuildingRecords; import com.hisense.monitormanage.entity.Event; import com.hisense.monitormanage.entity.RoadData; @@ -71,7 +72,7 @@ public interface BuildingRecordsMapper extends BaseMapper { @Select("select * from t_road_data where pm10 > 150 AND dt = #{dt}") List 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 selectByEvent(); List selectByWeekNoice(); @@ -86,4 +87,19 @@ public interface BuildingRecordsMapper extends BaseMapper { List selectByMonthEvent(); + List selectMonthCurrentByBuilding(); + + List 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 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 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 selectRoadDataMonthEvent(); + + List selectMonthCurrentByRoadData(); + } diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index cf275e6..b603386 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -306,7 +306,7 @@ public class MonitorService{ } } - @Scheduled(cron = "0 30 8 * * ?") + //@Scheduled(cron = "0 30 8 * * ?") public void buildingImage() { try { List buildingSites = buildingSiteMapper.selectByList(); @@ -337,7 +337,7 @@ public class MonitorService{ /** * 所有摄像头抓图 sql持续更新 */ - @Scheduled(cron = "0 0 6 * * ?") + @Scheduled(cron = "0 15 9 * * ?") public void CameraScreenshot() { try { log.info("[monitor-capture]: start capture"); diff --git a/src/main/resources/mapper/BuildingRecordsMapper.xml b/src/main/resources/mapper/BuildingRecordsMapper.xml index dc6e899..2a1ed80 100644 --- a/src/main/resources/mapper/BuildingRecordsMapper.xml +++ b/src/main/resources/mapper/BuildingRecordsMapper.xml @@ -215,6 +215,228 @@ AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(te.capture_time) + + + + + +