diff --git a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java index 4665521..c00da7b 100644 --- a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java +++ b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java @@ -128,8 +128,9 @@ public class BuildingController { @ApiOperation("查询工地扬尘事件") public Result selectRaise(Integer page,Integer pageSize){ List records = buildingRecordsMapper.selectRaise(page,pageSize); + Integer integer = buildingRecordsMapper.selectCountRaise(); Map map = new HashMap<>(); - map.put("sum",records.size()); + map.put("sum",integer); map.put("data",records); Result success = Result.success(map); return success; @@ -143,8 +144,9 @@ public class BuildingController { @ApiOperation("查询工地噪声事件") public Result selectNoiceEvent(Integer page,Integer pageSize){ List records = buildingRecordsMapper.selectNoiceEvent(page,pageSize); + Integer integer = buildingRecordsMapper.selectCountNoice(); Map map = new HashMap<>(); - map.put("sum",records.size()); + map.put("sum",integer); map.put("data",records); Result success = Result.success(map); return success; diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index d67ca0b..ea8a051 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -252,6 +252,7 @@ public class Controller { return success; } + /** * 根据标签名字模糊查询标签 * @param labelName diff --git a/src/main/java/com/hisense/monitormanage/controller/EventController.java b/src/main/java/com/hisense/monitormanage/controller/EventController.java index 410ccf7..7fbb5f8 100644 --- a/src/main/java/com/hisense/monitormanage/controller/EventController.java +++ b/src/main/java/com/hisense/monitormanage/controller/EventController.java @@ -208,8 +208,9 @@ public class EventController { for (EventDto list: lists) { list.setEventNewName("环境卫生"); } + Integer integer = eventMapper.selectCountByName("'塑料篮子','纸箱','街头散落垃圾'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; @@ -218,8 +219,9 @@ public class EventController { for (EventDto list: lists) { list.setEventNewName("占道经营"); } + Integer integer = eventMapper.selectCountByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; @@ -228,8 +230,9 @@ public class EventController { for (EventDto list: lists) { list.setEventNewName("沿街晾晒"); } + Integer integer = eventMapper.selectCountByName("'沿街晾晒衣物被单'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; @@ -238,8 +241,9 @@ public class EventController { for (EventDto list: lists) { list.setEventNewName("违章停车"); } + Integer integer = eventMapper.selectCountByName("'机动车违停'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; @@ -248,8 +252,9 @@ public class EventController { for (EventDto list : lists) { list.setEventNewName("渣土车发现"); } + Integer integer = eventMapper.selectCountByName("'渣土车发现'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; @@ -258,8 +263,9 @@ public class EventController { for (EventDto list : lists) { list.setEventNewName("安保区域人员滞留"); } + Integer integer = eventMapper.selectCountByName("'安保区域人员滞留'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; @@ -268,8 +274,9 @@ public class EventController { for (EventDto list : lists) { list.setEventNewName("安保区域人员徘徊"); } + Integer integer = eventMapper.selectCountByName("'安保区域人员徘徊'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; @@ -278,8 +285,9 @@ public class EventController { for (EventDto list : lists) { list.setEventNewName("渣土车未密闭"); } + Integer integer = eventMapper.selectCountByName("'渣土车未密闭'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; @@ -288,8 +296,9 @@ public class EventController { for (EventDto list : lists) { list.setEventNewName("道路积水事件"); } + Integer integer = eventMapper.selectCountByName("'道路积水事件'"); Map map = new HashMap<>(); - map.put("sum",lists.size()); + map.put("sum",integer); map.put("events",lists); Result success = Result.success(map); return success; diff --git a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java index 11736d1..b147624 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java @@ -38,6 +38,13 @@ public interface BuildingRecordsMapper extends BaseMapper { List selectNoiceEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize); + @Select("select COUNT(*) from (select br.pm10 from t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc where br.pm10 > 80) a ") + Integer selectCountRaise(); + + @Select("SELECT COUNT(*) FROM (SELECT br.noice,br.push_time FROM t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc WHERE (hour(br.push_time)>=22 or 6 > hour(br.push_time)) AND br.noice > 55 " + + "UNION SELECT br.noice,br.push_time FROM t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H')<=22 AND br.noice > 70) a") + Integer selectCountNoice(); + @Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq,bs.yjsg from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" + " where br.project_name like concat('%',#{projectName},'%')") List selectByProjectName(String projectName); diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index 284090a..2a7e710 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java @@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper { List selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); - @Select("SELECT * FROM t_camera_channel WHERE channel_code < '183_37028301831321231117' AND channel_code > '183_37028301001328630804' ORDER BY channel_code DESC") + @Select("SELECT * FROM t_camera_channel WHERE channel_code < '183_37028301831315320208' AND channel_code > '183_37028301001328630804' ORDER BY channel_code DESC") List selectCameraChannel(); } diff --git a/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java b/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java index ee9e09d..9c5bb67 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java @@ -22,6 +22,9 @@ public interface EventMapper extends BaseMapper { List selectByName(@Param("eventNewName") String eventNewName,@Param("page") Integer page,@Param("pageSize") Integer pageSize); + @Select("select count(*) from t_event where track_event = 'START' and event_cn_name in (${eventNewName})") + Integer selectCountByName(@Param("eventNewName")String eventNewName); + @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND event_cn_name in (${eventNewName}) AND track_event = 'START'") List selectByTimeAndName(@Param("eventNewName") String eventNewName); } diff --git a/src/test/java/com/hisense/monitormanage/MonitorManageApplicationTests.java b/src/test/java/com/hisense/monitormanage/MonitorManageApplicationTests.java index bed34ea..b9a9e13 100644 --- a/src/test/java/com/hisense/monitormanage/MonitorManageApplicationTests.java +++ b/src/test/java/com/hisense/monitormanage/MonitorManageApplicationTests.java @@ -1,29 +1,49 @@ package com.hisense.monitormanage; +import cn.hutool.crypto.SecureUtil; import com.alibaba.fastjson.JSONObject; -import com.hisense.monitormanage.service.MonitorService; +import com.hisense.monitormanage.entity.PassengerFlow; +import com.hisense.monitormanage.entity.RoadData; +import com.hisense.monitormanage.service.*; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; @SpringBootTest class MonitorManageApplicationTests { + + @Autowired + private RoadDataService roadDataService; @Autowired private MonitorService monitorService; + @Autowired + private QidiService qidiService; + + @Autowired + private BuildingRecordsService buildingRecordsService; + @Test void contextLoads() { - + qidiService.resCatalogApplyHJWSZY(); } @Test - void start1() { - monitorService.start1(); + void start1(){ + buildingRecordsService.getAndSaveRecords(); + } + + @Test + void start2(){ + roadDataService.saveRoadData(); + }