From ef3c2b19b2465ede9549c81017e79cc54e780d9a Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Mon, 1 Aug 2022 10:20:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E7=82=B9=E5=8C=BA=E5=9F=9F=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E5=92=8C=E6=96=87=E6=98=8E=E5=88=9B=E5=9F=8E=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E5=88=86=E7=A6=BB=20=E9=83=A8=E5=88=86=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0swagger=E6=B3=A8=E9=87=8A=20=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BuildingController.java | 14 +- .../controller/EventController.java | 11 +- .../controller/FileController.java | 2 + .../controller/KeyAreaController.java | 193 ++++++++++++++++++ .../controller/PeopleRecognizeController.java | 3 - src/main/resources/mapper/EventMapper.xml | 8 +- 6 files changed, 222 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java index c00da7b..3cbdf9f 100644 --- a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java +++ b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java @@ -89,7 +89,8 @@ public class BuildingController { * @return */ @GetMapping("selectWeekPmAndNoice") - @ApiOperation("查询近7天工地噪声和扬尘的信息") + @ApiOperation("根据建筑编号查询近7天工地噪声和扬尘的信息") + @ApiImplicitParam(name = "buildLicense", value = "建筑许可编号", required = true, dataType = "String") public Result selectWeekPmAndNoice(String buildLicense){ List records = buildingRecordsMapper.selectWeekPmAndNoice(buildLicense); records.forEach(record ->{ @@ -107,7 +108,8 @@ public class BuildingController { * @return */ @GetMapping("selectMonthPmAndNoice") - @ApiOperation("查询近30天工地噪声和扬尘的信息") + @ApiOperation("根据建筑编号查询近30天工地噪声和扬尘的信息") + @ApiImplicitParam(name = "buildLicense", value = "建筑许可编号", required = true, dataType = "String") public Result selectMonthPmAndNoice(String buildLicense){ List records = buildingRecordsMapper.selectMonthPmAndNoice(buildLicense); records.forEach(record ->{ @@ -126,6 +128,10 @@ public class BuildingController { */ @GetMapping("selectRaise") @ApiOperation("查询工地扬尘事件") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer") + }) public Result selectRaise(Integer page,Integer pageSize){ List records = buildingRecordsMapper.selectRaise(page,pageSize); Integer integer = buildingRecordsMapper.selectCountRaise(); @@ -142,6 +148,10 @@ public class BuildingController { */ @GetMapping("selectNoiceEvent") @ApiOperation("查询工地噪声事件") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer") + }) public Result selectNoiceEvent(Integer page,Integer pageSize){ List records = buildingRecordsMapper.selectNoiceEvent(page,pageSize); Integer integer = buildingRecordsMapper.selectCountNoice(); diff --git a/src/main/java/com/hisense/monitormanage/controller/EventController.java b/src/main/java/com/hisense/monitormanage/controller/EventController.java index 7fbb5f8..f57c7ec 100644 --- a/src/main/java/com/hisense/monitormanage/controller/EventController.java +++ b/src/main/java/com/hisense/monitormanage/controller/EventController.java @@ -8,6 +8,7 @@ import com.hisense.monitormanage.mapper.EventMapper; import com.hisense.monitormanage.service.EventService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; @@ -137,6 +138,10 @@ public class EventController { */ @GetMapping("selectEvent") @ApiOperation("查询所有事件") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer") + }) public Result selectEvent(Integer page,Integer pageSize){ List events = eventMapper.selectEvent(page,pageSize); for (EventDto event: events) { @@ -201,7 +206,11 @@ public class EventController { */ @GetMapping("selectByName") @ApiOperation("根据事件名称查询事件") - @ApiImplicitParam(name = "eventNewName",value = "事件名称",required = true,dataType = "String") + @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 selectByName(String eventNewName,Integer page,Integer pageSize){ if (eventNewName.equals("环境卫生")){ List lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize); diff --git a/src/main/java/com/hisense/monitormanage/controller/FileController.java b/src/main/java/com/hisense/monitormanage/controller/FileController.java index ea68df4..fa06bca 100644 --- a/src/main/java/com/hisense/monitormanage/controller/FileController.java +++ b/src/main/java/com/hisense/monitormanage/controller/FileController.java @@ -3,6 +3,7 @@ package com.hisense.monitormanage.controller; import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.service.MonitorService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -27,6 +28,7 @@ public class FileController { */ @GetMapping("file") @ApiOperation("根据摄像头标识获取视频流") + @ApiImplicitParam(name = "channelCode", value = "摄像头标识", required = true, dataType = "String") public Result File(String channelCode)throws IOException { String s = monitorService.fileCode(channelCode); Result success = Result.success(s); diff --git a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java index d38e695..b2c8b7b 100644 --- a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java +++ b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java @@ -1,19 +1,25 @@ package com.hisense.monitormanage.controller; +import com.hisense.monitormanage.dto.EventDto; import com.hisense.monitormanage.dto.KeyAreaDto; import com.hisense.monitormanage.entity.KeyAreaLocation; import com.hisense.monitormanage.entity.PassengerFlow; import com.hisense.monitormanage.entity.Result; +import com.hisense.monitormanage.mapper.EventMapper; import com.hisense.monitormanage.mapper.KeyAreaMapper; import com.hisense.monitormanage.mapper.PassengerFlowMapper; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.HashMap; import java.util.List; +import java.util.Map; @RestController @RequestMapping("api/project/keyArea") @@ -26,6 +32,9 @@ public class KeyAreaController { @Autowired private PassengerFlowMapper passengerFlowMapper; + @Autowired + private EventMapper eventMapper; + /** * 根据区域类型查询区域的最新时间的人数 * @param type @@ -57,4 +66,188 @@ public class KeyAreaController { return success; } + /** + * 查询所有事件 + * @return + */ + @GetMapping("selectEvent") + @ApiOperation("查询所有事件") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer") + }) + public Result selectEvent(Integer page,Integer pageSize){ + List events = eventMapper.selectEvent(page,pageSize); + for (EventDto event: events) { + if (event.getEventCnName().equals("街头伞篷") || event.getEventCnName().equals("水果和食品摊") + || event.getEventCnName().equals("地摊")|| event.getEventCnName().equals("户外桌椅")){ + event.setEventNewName("占道经营"); + }else if (event.getEventCnName().equals("纸箱")|| event.getEventCnName().equals("街头散落垃圾") + ||event.getEventCnName().equals("塑料篮子")){ + event.setEventNewName("环境卫生"); + }else if (event.getEventCnName().equals("沿街晾晒衣物被单")){ + event.setEventNewName("沿街晾晒"); + }else if (event.getEventCnName().equals("机动车违停")){ + event.setEventNewName("违章停车"); + }else { + event.setEventNewName(event.getEventCnName()); + } + } + Integer integer = eventMapper.selectCountEvent(); + page = integer/pageSize + 1; + Map map = new HashMap<>(); + map.put("page",page); + map.put("events",events); + Result success = Result.success(map); + + return success; + } + + /** + * 查询当天事件 + * @return + */ + @GetMapping("selectByTime") + @ApiOperation("查询当天事件") + public Result selectByTime(){ + List events = eventMapper.selectByTime(); + for (EventDto event: events) { + if (event.getEventCnName().equals("街头伞篷") || event.getEventCnName().equals("水果和食品摊") + || event.getEventCnName().equals("地摊")|| event.getEventCnName().equals("户外桌椅")){ + event.setEventNewName("占道经营"); + }else if (event.getEventCnName().equals("纸箱")|| event.getEventCnName().equals("街头散落垃圾") + ||event.getEventCnName().equals("塑料篮子")){ + event.setEventNewName("环境卫生"); + }else if (event.getEventCnName().equals("沿街晾晒衣物被单")){ + event.setEventNewName("沿街晾晒"); + }else if (event.getEventCnName().equals("机动车违停")){ + event.setEventNewName("违章停车"); + }else { + event.setEventNewName(event.getEventCnName()); + } + } + + Result success = Result.success(events); + + return success; + + } + + /** + * 重点区域场景根据事件名称查询事件 + * @param eventNewName + * @return + */ + @GetMapping("selectByName") + @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 selectAreaByEventName(String eventNewName,Integer page,Integer pageSize){ + if (eventNewName.equals("环境卫生")){ + List lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize); + for (EventDto list: lists) { + 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); + for (EventDto list: lists) { + 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); + for (EventDto list: lists) { + 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); + for (EventDto list: lists) { + 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); + for (EventDto list : lists) { + 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); + for (EventDto list : lists) { + 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); + for (EventDto list : lists) { + 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); + for (EventDto list : lists) { + 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); + for (EventDto list : lists) { + 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; + } + return Result.error("请输入正确的事件类型"); + } + + } diff --git a/src/main/java/com/hisense/monitormanage/controller/PeopleRecognizeController.java b/src/main/java/com/hisense/monitormanage/controller/PeopleRecognizeController.java index b5ef131..c758061 100644 --- a/src/main/java/com/hisense/monitormanage/controller/PeopleRecognizeController.java +++ b/src/main/java/com/hisense/monitormanage/controller/PeopleRecognizeController.java @@ -1,9 +1,6 @@ package com.hisense.monitormanage.controller; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.hisense.monitormanage.dto.ChannelLabelDto; import com.hisense.monitormanage.dto.PeopleRecognizeDto; -import com.hisense.monitormanage.entity.PeopleRecognize; import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.mapper.PeopleRecognizeMapper; import com.hisense.monitormanage.service.MonitorService; diff --git a/src/main/resources/mapper/EventMapper.xml b/src/main/resources/mapper/EventMapper.xml index 2ab07a4..72c58ff 100644 --- a/src/main/resources/mapper/EventMapper.xml +++ b/src/main/resources/mapper/EventMapper.xml @@ -3,12 +3,14 @@