From e3264d71c5befecc7e81c22b3a73d28253aba77c Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Fri, 19 Aug 2022 16:20:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E7=82=B9=E5=8C=BA=E5=9F=9F=E4=BA=8B?= =?UTF-8?q?=E4=BB=B630=E5=A4=A9=E6=97=B6=E9=97=B4=E8=B6=8B=E5=8A=BF=20?= =?UTF-8?q?=E9=87=8D=E7=82=B9=E5=8C=BA=E5=9F=9F=E5=9C=BA=E6=99=AF=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=A0=B9=E6=8D=AE=E5=8C=BA=E5=9F=9F=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8C=BA=E5=9F=9F=E7=9A=84=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=9A=84=E4=BA=BA=E6=95=B0=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=87=8D=E7=82=B9=E5=8C=BA=E5=9F=9F=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=8E=A5=E5=8F=A3=20=E5=B7=A5=E5=9C=B0?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=B3=A8=E9=87=8A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BuildingController.java | 4 +- .../controller/KeyAreaController.java | 96 ++++++++------ .../monitormanage/dto/KeyAreaDtos.java | 11 ++ .../monitormanage/mapper/KeyAreaMapper.java | 15 ++- .../monitormanage/service/MonitorService.java | 2 +- src/main/resources/mapper/KeyAreaMapper.xml | 124 +++++++++++++++++- 6 files changed, 206 insertions(+), 46 deletions(-) create mode 100644 src/main/java/com/hisense/monitormanage/dto/KeyAreaDtos.java diff --git a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java index 320e1c1..1fcaa0e 100644 --- a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java +++ b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java @@ -412,11 +412,11 @@ public class BuildingController { } /** - * 查询近30天视频感知事件时间趋势 + * 查询近30天工地视频感知事件时间趋势 * @return */ @GetMapping("selectMonthCurrentByEvent") - @ApiOperation("查询近30天视频感知事件时间趋势") + @ApiOperation("查询近30天工地视频感知事件时间趋势") public Result selectMonthCurrentByEvent(){ List buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByEvent(); buildingRecordsDtos.forEach(buildingRecordsDto -> { diff --git a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java index 268226b..fe47b67 100644 --- a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java +++ b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java @@ -1,7 +1,9 @@ package com.hisense.monitormanage.controller; +import com.hisense.monitormanage.dto.BuildingRecordsDtos; import com.hisense.monitormanage.dto.EventDto; import com.hisense.monitormanage.dto.KeyAreaDto; +import com.hisense.monitormanage.dto.KeyAreaDtos; import com.hisense.monitormanage.entity.KeyArea; import com.hisense.monitormanage.entity.KeyAreaLocation; import com.hisense.monitormanage.entity.PassengerFlow; @@ -36,17 +38,37 @@ public class KeyAreaController { @Autowired private EventMapper eventMapper; + /** + * 根据区域类型查询全部区域列表的最新时间的人数 + * @param type1 + * @param type2 + * @param type3 + * @return + */ + @GetMapping("selectKeyAreaList") + @ApiOperation("根据区域类型查询全部区域列表的最新时间的人数") + public Result selectKeyAreaList(String type1,String type2,String type3){ + PassengerFlow maxId = passengerFlowMapper.getByMaxId(); + String timeId = maxId.getTimeId(); + List keyAreaDtos = keyAreaMapper.selectKeyAreaList(type1,type2,type3,timeId); + keyAreaDtos.forEach(keyAreaDto -> { + keyAreaDto.setTimeId(timeId); + }); + Result success = Result.success(keyAreaDtos); + return success; + } + /** * 根据区域类型查询区域的最新时间的人数 * @param type * @return */ - @GetMapping("selectKeyAreaList") + @GetMapping("selectKeyArea") @ApiOperation("根据区域类型查询区域的最新时间的人数") - public Result selectKeyAreaList(String type){ + public Result selectKeyArea(String type){ PassengerFlow maxId = passengerFlowMapper.getByMaxId(); String timeId = maxId.getTimeId(); - List keyAreaDtos = keyAreaMapper.selectKeyAreaList(type,timeId); + List keyAreaDtos = keyAreaMapper.selectKeyArea(type,timeId); keyAreaDtos.forEach(keyAreaDto -> { keyAreaDto.setTimeId(timeId); }); @@ -121,10 +143,10 @@ public class KeyAreaController { * 重点区域场景查询当天事件 * @return */ - @GetMapping("selectAreaByTime") + @GetMapping("selectByDayAreaEvent") @ApiOperation("重点区域场景查询当天事件") - public Result selectAreaByTime(){ - List events = eventMapper.selectByTime(); + public Result selectByDayAreaEvent(){ + List events = keyAreaMapper.selectByDayAreaEvent(); events.forEach(event -> { if (event.getEventCnName().equals("街头伞篷") || event.getEventCnName().equals("水果和食品摊") || event.getEventCnName().equals("地摊")|| event.getEventCnName().equals("户外桌椅")){ @@ -140,9 +162,10 @@ public class KeyAreaController { event.setEventNewName(event.getEventCnName()); } }); - - Result success = Result.success(events); - + Map map = new HashMap<>(); + map.put("sum",events.size()); + map.put("events",events); + Result success = Result.success(map); return success; } @@ -152,53 +175,31 @@ public class KeyAreaController { * @param eventNewName * @return */ - @GetMapping("selectAreaByName") + @GetMapping("selectByNameAreaEvent") @ApiOperation("重点区域场景根据事件名称查询事件") @ApiImplicitParams({ @ApiImplicitParam(name = "eventNewName",value = "事件名称",required = true,dataType = "String"), @ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer") }) - public Result selectAreaByName(String eventNewName,Integer page,Integer pageSize){ + public Result selectByNameAreaEvent(String eventNewName,Integer page,Integer pageSize){ if (eventNewName.equals("环境卫生")){ - List lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize); + List lists = keyAreaMapper.selectByNameAreaEvent("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize); lists.forEach(list ->{ list.setEventNewName("环境卫生"); }); - Integer integer = eventMapper.selectCountByName("'塑料篮子','纸箱','街头散落垃圾'"); + Integer integer = keyAreaMapper.selectCountByNameAreaEvent("'塑料篮子','纸箱','街头散落垃圾'"); Map map = new HashMap<>(); map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; }else if (eventNewName.equals("占道经营")){ - List lists = eventMapper.selectByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'",page,pageSize); + List lists = keyAreaMapper.selectByNameAreaEvent("'街头伞篷','水果和食品摊','地摊','户外桌椅'",page,pageSize); lists.forEach(list ->{ list.setEventNewName("占道经营"); }); - Integer integer = eventMapper.selectCountByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'"); - Map map = new HashMap<>(); - map.put("sum",integer); - map.put("events",lists); - Result success = Result.success(map); - return success; - }else if (eventNewName.equals("沿街晾晒")){ - List lists = eventMapper.selectByName("'沿街晾晒衣物被单'",page,pageSize); - lists.forEach(list ->{ - list.setEventNewName("沿街晾晒"); - }); - Integer integer = eventMapper.selectCountByName("'沿街晾晒衣物被单'"); - Map map = new HashMap<>(); - map.put("sum",integer); - map.put("events",lists); - Result success = Result.success(map); - return success; - }else if (eventNewName.equals("违章停车")){ - List lists = eventMapper.selectByName("'机动车违停'",page,pageSize); - lists.forEach(list ->{ - list.setEventNewName("违章停车"); - }); - Integer integer = eventMapper.selectCountByName("'机动车违停'"); + Integer integer = keyAreaMapper.selectCountByNameAreaEvent("'街头伞篷','水果和食品摊','地摊','户外桌椅'"); Map map = new HashMap<>(); map.put("sum",integer); map.put("events",lists); @@ -207,11 +208,11 @@ public class KeyAreaController { }else { StringBuilder str = new StringBuilder(eventNewName); String s = str.insert(0, "'").append("'").toString(); - List lists = eventMapper.selectByName(s, page, pageSize); + List lists = keyAreaMapper.selectByNameAreaEvent(s, page, pageSize); lists.forEach(list ->{ list.setEventNewName(list.getEventCnName()); }); - Integer integer = eventMapper.selectCountByName(s); + Integer integer = keyAreaMapper.selectCountByNameAreaEvent(s); Map map = new HashMap<>(); map.put("sum",integer); map.put("events",lists); @@ -220,5 +221,22 @@ public class KeyAreaController { } } + /** + * 查询近30天重点区域视频感知事件时间趋势 + * @return + */ + @GetMapping("selectMonthAreaEvent") + @ApiOperation("查询近30天重点区域视频感知事件时间趋势") + public Result selectMonthAreaEvent(){ + List keyAreaDtos = keyAreaMapper.selectMonthAreaEvent(); + keyAreaDtos.forEach(keyAreaDtos1 -> { + if (keyAreaDtos1.getNumber() == null){ + keyAreaDtos1.setNumber(0); + } + }); + Result success = Result.success(keyAreaDtos); + return success; + } + } diff --git a/src/main/java/com/hisense/monitormanage/dto/KeyAreaDtos.java b/src/main/java/com/hisense/monitormanage/dto/KeyAreaDtos.java new file mode 100644 index 0000000..2e8a165 --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/dto/KeyAreaDtos.java @@ -0,0 +1,11 @@ +package com.hisense.monitormanage.dto; + +import lombok.Data; + +@Data +public class KeyAreaDtos { + + private String pushTime; + + private Integer number; +} diff --git a/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java b/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java index df2a947..a03cf96 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java @@ -3,6 +3,7 @@ package com.hisense.monitormanage.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hisense.monitormanage.dto.EventDto; import com.hisense.monitormanage.dto.KeyAreaDto; +import com.hisense.monitormanage.dto.KeyAreaDtos; import com.hisense.monitormanage.entity.KeyArea; import com.hisense.monitormanage.entity.KeyAreaLocation; import org.apache.ibatis.annotations.Param; @@ -14,7 +15,9 @@ import java.util.List; @Repository public interface KeyAreaMapper extends BaseMapper { - List selectKeyAreaList(@Param("type") String type,@Param("timeId") String timeId); + List selectKeyAreaList(@Param("type1") String type1,@Param("type2") String type2,@Param("type3") String type3,@Param("timeId") String timeId); + + List selectKeyArea(@Param("type") String type,@Param("timeId") String timeId); @Select("SELECT * FROM t_key_area_location kal JOIN t_key_area ka ON kal.area_id = ka.area_id WHERE ka.area_name = #{areaName}") List selectByAreaName(String areaName); @@ -27,6 +30,16 @@ public interface KeyAreaMapper extends BaseMapper { @Select("SELECT COUNT(*) 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 = 2") Integer selectCountAreaEvent(); + @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 = 2 AND TO_DAYS(te.capture_time) = TO_DAYS(NOW())") + List selectByDayAreaEvent(); + + List selectByNameAreaEvent(@Param("eventNewName") String eventNewName,@Param("page") Integer page,@Param("pageSize") Integer pageSize); + + @Select("SELECT COUNT(*) 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 = 2 AND event_cn_name IN (${eventNewName})") + Integer selectCountByNameAreaEvent(@Param("eventNewName")String eventNewName); + + List selectMonthAreaEvent(); + } diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index b603386..4f1a2a6 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -337,7 +337,7 @@ public class MonitorService{ /** * 所有摄像头抓图 sql持续更新 */ - @Scheduled(cron = "0 15 9 * * ?") + @Scheduled(cron = "0 0 6 * * ?") public void CameraScreenshot() { try { log.info("[monitor-capture]: start capture"); diff --git a/src/main/resources/mapper/KeyAreaMapper.xml b/src/main/resources/mapper/KeyAreaMapper.xml index 8f36b35..520417a 100644 --- a/src/main/resources/mapper/KeyAreaMapper.xml +++ b/src/main/resources/mapper/KeyAreaMapper.xml @@ -4,23 +4,141 @@ + + + \ No newline at end of file