From 9996dbc912a1d7ed2ea3d97a15437dc26d9ac858 Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Thu, 9 Jun 2022 18:03:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=85=A8=E9=83=A8=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EventController.java | 44 ++++++++++++++++--- .../hisense/monitormanage/dto/EventDto.java | 23 ++++++++++ .../monitormanage/mapper/EventMapper.java | 9 ++-- src/main/resources/mapper/EventMapper.xml | 6 ++- 4 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/hisense/monitormanage/dto/EventDto.java diff --git a/src/main/java/com/hisense/monitormanage/controller/EventController.java b/src/main/java/com/hisense/monitormanage/controller/EventController.java index 9a6d38a..f1c79b1 100644 --- a/src/main/java/com/hisense/monitormanage/controller/EventController.java +++ b/src/main/java/com/hisense/monitormanage/controller/EventController.java @@ -1,6 +1,7 @@ package com.hisense.monitormanage.controller; import com.alibaba.fastjson.JSONObject; +import com.hisense.monitormanage.dto.EventDto; import com.hisense.monitormanage.entity.Event; import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.mapper.EventMapper; @@ -141,10 +142,23 @@ public class EventController { */ @GetMapping("selectEvent") @ApiOperation("查询所有事件") - public Result selectEvent(){ - - List events = eventMapper.selectEvent(); - + 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()); + } + } Result success = Result.success(events); return success; @@ -157,9 +171,24 @@ public class EventController { @GetMapping("selectByTime") @ApiOperation("查询当天事件") public Result selectByTime(){ - List byTime = eventMapper.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(byTime); + Result success = Result.success(events); return success; @@ -174,7 +203,8 @@ public class EventController { @ApiOperation("根据事件名称查询事件") @ApiImplicitParam(name = "eventCnName",value = "事件名称",required = true,dataType = "String") public Result selectByName(String eventCnName){ - List byName = eventMapper.selectByName(eventCnName); + + List byName = eventMapper.selectByName(eventCnName); Result success = Result.success(byName); diff --git a/src/main/java/com/hisense/monitormanage/dto/EventDto.java b/src/main/java/com/hisense/monitormanage/dto/EventDto.java new file mode 100644 index 0000000..2a8763b --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/dto/EventDto.java @@ -0,0 +1,23 @@ +package com.hisense.monitormanage.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class EventDto { + private String eventCnName; + private String eventNewName; + private String eventSerial; + private String color; + private String vehicle; + private String classes; + private String cameraName; + private String district; + private BigDecimal latitude; + private BigDecimal longitude; + private String imageUrl; + private String taskId; + private String captureTime; + private String trackEvent; +} diff --git a/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java b/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java index 3e75034..8b6163b 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java @@ -1,6 +1,7 @@ package com.hisense.monitormanage.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hisense.monitormanage.dto.EventDto; import com.hisense.monitormanage.entity.Event; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -8,14 +9,14 @@ import org.apache.ibatis.annotations.Select; import java.util.List; public interface EventMapper extends BaseMapper { - @Select("SELECT * FROM t_event where track_event = 'START'") - List selectEvent(); + + List selectEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize); @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND track_event = 'START'") - List selectByTime(); + List selectByTime(); @Select("select * from t_event where event_cn_name = #{eventCnName} and track_event = 'START'") - List selectByName(@Param("eventCnName") String eventCnName); + List selectByName(@Param("eventCnName") String eventCnName); @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND event_cn_name = #{eventCnName} AND track_event = 'START'") List selectByTimeAndName(@Param("eventCnName") String eventCnName); diff --git a/src/main/resources/mapper/EventMapper.xml b/src/main/resources/mapper/EventMapper.xml index 4ad23b8..c45a9cb 100644 --- a/src/main/resources/mapper/EventMapper.xml +++ b/src/main/resources/mapper/EventMapper.xml @@ -1,5 +1,9 @@ - + \ No newline at end of file