重点区域场景和文明创城场景分离

部分添加swagger注释
事件接口优化
This commit is contained in:
wuweida 2022-08-01 10:20:56 +08:00
parent 8d8b2e516a
commit ef3c2b19b2
6 changed files with 222 additions and 9 deletions

View File

@ -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<BuildingRecordsDtos> 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<BuildingRecordsDtos> 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<BuildingRecordsDto> 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<BuildingRecordsDto> records = buildingRecordsMapper.selectNoiceEvent(page,pageSize);
Integer integer = buildingRecordsMapper.selectCountNoice();

View File

@ -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<EventDto> 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<EventDto> lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize);

View File

@ -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);

View File

@ -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<EventDto> 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<String,Object> 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<EventDto> 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<EventDto> lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize);
for (EventDto list: lists) {
list.setEventNewName("环境卫生");
}
Integer integer = eventMapper.selectCountByName("'塑料篮子','纸箱','街头散落垃圾'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}else if (eventNewName.equals("占道经营")){
List<EventDto> lists = eventMapper.selectByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'",page,pageSize);
for (EventDto list: lists) {
list.setEventNewName("占道经营");
}
Integer integer = eventMapper.selectCountByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}else if (eventNewName.equals("沿街晾晒")){
List<EventDto> lists = eventMapper.selectByName("'沿街晾晒衣物被单'",page,pageSize);
for (EventDto list: lists) {
list.setEventNewName("沿街晾晒");
}
Integer integer = eventMapper.selectCountByName("'沿街晾晒衣物被单'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}else if (eventNewName.equals("违章停车")){
List<EventDto> lists = eventMapper.selectByName("'机动车违停'",page,pageSize);
for (EventDto list: lists) {
list.setEventNewName("违章停车");
}
Integer integer = eventMapper.selectCountByName("'机动车违停'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}else if (eventNewName.equals("渣土车发现")) {
List<EventDto> lists = eventMapper.selectByName("'渣土车发现'",page,pageSize);
for (EventDto list : lists) {
list.setEventNewName("渣土车发现");
}
Integer integer = eventMapper.selectCountByName("'渣土车发现'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}else if (eventNewName.equals("安保区域人员滞留")) {
List<EventDto> lists = eventMapper.selectByName("'安保区域人员滞留'",page,pageSize);
for (EventDto list : lists) {
list.setEventNewName("安保区域人员滞留");
}
Integer integer = eventMapper.selectCountByName("'安保区域人员滞留'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}else if (eventNewName.equals("安保区域人员徘徊")) {
List<EventDto> lists = eventMapper.selectByName("'安保区域人员徘徊'",page,pageSize);
for (EventDto list : lists) {
list.setEventNewName("安保区域人员徘徊");
}
Integer integer = eventMapper.selectCountByName("'安保区域人员徘徊'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}else if (eventNewName.equals("渣土车未密闭")) {
List<EventDto> lists = eventMapper.selectByName("'渣土车未密闭'",page,pageSize);
for (EventDto list : lists) {
list.setEventNewName("渣土车未密闭");
}
Integer integer = eventMapper.selectCountByName("'渣土车未密闭'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}else if (eventNewName.equals("道路积水事件")) {
List<EventDto> lists = eventMapper.selectByName("'道路积水事件'",page,pageSize);
for (EventDto list : lists) {
list.setEventNewName("道路积水事件");
}
Integer integer = eventMapper.selectCountByName("'道路积水事件'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success;
}
return Result.error("请输入正确的事件类型");
}
}

View File

@ -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;

View File

@ -3,12 +3,14 @@
<mapper namespace="com.hisense.monitormanage.mapper.EventMapper">
<select id="selectEvent" resultType="com.hisense.monitormanage.dto.EventDto">
SELECT * FROM t_event where track_event = 'START' ORDER BY capture_time DESC
<if test="page!=null and '' != page and pageSize != null and '' != pageSize">
<bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize}
</if>
</select>
<select id="selectByName" resultType="com.hisense.monitormanage.dto.EventDto">
select * from t_event where track_event = 'START' and event_cn_name in (${eventNewName})
select * from t_event where track_event = 'START' and event_cn_name in (${eventNewName}) ORDER BY capture_time DESC
<if test="page!=null and '' != page and pageSize != null and '' != pageSize">
<bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize}