From 6d63adfe587b296ef7b112297a39ad27f1d0531f Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Wed, 24 Aug 2022 17:38:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E7=82=B9=E5=8C=BA=E5=9F=9F=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8E=A5=E5=8F=A3=20=E5=B7=A5=E5=9C=B0=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E5=AE=9E=E4=BD=93=E7=B1=BB=E6=B7=BB=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/KeyAreaController.java | 63 +++++++++ .../hisense/monitormanage/dto/KeyAreaDto.java | 2 + .../monitormanage/dto/KeyAreaDtos.java | 9 ++ .../monitormanage/entity/KeyAreaLocation.java | 2 + .../monitormanage/mapper/KeyAreaMapper.java | 5 + .../mapper/BuildingRecordsMapper.xml | 4 +- src/main/resources/mapper/KeyAreaMapper.xml | 126 ++++++++++++++++-- 7 files changed, 197 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java index fe47b67..6534fda 100644 --- a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java +++ b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java @@ -238,5 +238,68 @@ public class KeyAreaController { return success; } + /** + * 统计事件类型 + * @return + */ + @GetMapping("selectEventType") + @ApiOperation("统计事件类型") + public Result selectEventType(){ + List keyAreaDtos = keyAreaMapper.selectEventType(); + keyAreaDtos.forEach(keyAreaDtos1 -> { + if (keyAreaDtos1.getEventCnName().equals("街头伞篷") || keyAreaDtos1.getEventCnName().equals("水果和食品摊") + || keyAreaDtos1.getEventCnName().equals("地摊")|| keyAreaDtos1.getEventCnName().equals("户外桌椅")){ + keyAreaDtos1.setEventNewName("占道经营"); + }else if (keyAreaDtos1.getEventCnName().equals("纸箱")|| keyAreaDtos1.getEventCnName().equals("街头散落垃圾") + ||keyAreaDtos1.getEventCnName().equals("塑料篮子")){ + keyAreaDtos1.setEventNewName("环境卫生"); + }else if (keyAreaDtos1.getEventCnName().equals("沿街晾晒衣物被单")){ + keyAreaDtos1.setEventNewName("沿街晾晒"); + }else if (keyAreaDtos1.getEventCnName().equals("机动车违停")){ + keyAreaDtos1.setEventNewName("违章停车"); + }else { + keyAreaDtos1.setEventNewName(keyAreaDtos1.getEventCnName()); + } + }); + Result success = Result.success(keyAreaDtos); + return success; + } + + /** + * 查询近7天重点区域本地外地人流峰值按每一天输出 + * @return + */ + @GetMapping("selectLocalWeekArea") + @ApiOperation("查询近7天重点区域本地外地人流峰值按每一天输出") + public Result selectLocalWeekArea(String areaName){ + List keyAreaDtos = keyAreaMapper.selectLocalWeekArea(areaName); + keyAreaDtos.forEach(keyAreaDtos1 -> { + if (keyAreaDtos1.getLocalNums() == null && keyAreaDtos1.getNonlocalNums() == null){ + keyAreaDtos1.setLocalNums(0); + keyAreaDtos1.setNonlocalNums(0); + } + }); + Result success = Result.success(keyAreaDtos); + return success; + } + + /** + * 查询近30天重点区域本地外地人流峰值按每一天输出 + * @return + */ + @GetMapping("selectLocalMonthArea") + @ApiOperation("查询近30天重点区域本地外地人流峰值按每一天输出") + public Result selectLocalMonthArea(String areaName){ + List keyAreaDtos = keyAreaMapper.selectLocalMonthArea(areaName); + keyAreaDtos.forEach(keyAreaDtos1 -> { + if (keyAreaDtos1.getLocalNums() == null && keyAreaDtos1.getNonlocalNums() == null){ + keyAreaDtos1.setLocalNums(0); + keyAreaDtos1.setNonlocalNums(0); + } + }); + Result success = Result.success(keyAreaDtos); + return success; + } + } diff --git a/src/main/java/com/hisense/monitormanage/dto/KeyAreaDto.java b/src/main/java/com/hisense/monitormanage/dto/KeyAreaDto.java index 1204c81..40a4def 100644 --- a/src/main/java/com/hisense/monitormanage/dto/KeyAreaDto.java +++ b/src/main/java/com/hisense/monitormanage/dto/KeyAreaDto.java @@ -31,4 +31,6 @@ public class KeyAreaDto { private Double latitude; + private String point; + } diff --git a/src/main/java/com/hisense/monitormanage/dto/KeyAreaDtos.java b/src/main/java/com/hisense/monitormanage/dto/KeyAreaDtos.java index 2e8a165..05d8ee0 100644 --- a/src/main/java/com/hisense/monitormanage/dto/KeyAreaDtos.java +++ b/src/main/java/com/hisense/monitormanage/dto/KeyAreaDtos.java @@ -8,4 +8,13 @@ public class KeyAreaDtos { private String pushTime; private Integer number; + + private String eventCnName; + + private String eventNewName; + + private Integer localNums; + + private Integer nonlocalNums; + } diff --git a/src/main/java/com/hisense/monitormanage/entity/KeyAreaLocation.java b/src/main/java/com/hisense/monitormanage/entity/KeyAreaLocation.java index e2bf394..37f1203 100644 --- a/src/main/java/com/hisense/monitormanage/entity/KeyAreaLocation.java +++ b/src/main/java/com/hisense/monitormanage/entity/KeyAreaLocation.java @@ -13,4 +13,6 @@ public class KeyAreaLocation { private Double latitude; + private String point; + } diff --git a/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java b/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java index a03cf96..1f33564 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java @@ -40,6 +40,11 @@ public interface KeyAreaMapper extends BaseMapper { List selectMonthAreaEvent(); + @Select("SELECT te.event_cn_name,COUNT(*) AS number 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 GROUP BY te.event_cn_name") + List selectEventType(); + List selectLocalWeekArea(@Param("areaName") String areaName); + + List selectLocalMonthArea(@Param("areaName") String areaName); } diff --git a/src/main/resources/mapper/BuildingRecordsMapper.xml b/src/main/resources/mapper/BuildingRecordsMapper.xml index 11b6149..db7a37c 100644 --- a/src/main/resources/mapper/BuildingRecordsMapper.xml +++ b/src/main/resources/mapper/BuildingRecordsMapper.xml @@ -47,11 +47,11 @@ SELECT * FROM - (SELECT ka.type,ka.location,ka.service_time,ka.management,ka.scenic_level, - ka.about,ka.area_id,ka.area_name,ss.allNums,ss.localNums,ss.nonlocalNums - FROM t_key_area ka LEFT JOIN - (SELECT pt.area_name,SUM(pf.all_nums) AS allNums,SUM(pf.local_nums) AS localNums, - SUM(pf.nonlocal_nums) AS nonlocalNums - FROM t_passenger_flow pf JOIN t_passenger_test pt - ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude - WHERE pf.time_id = #{timeId} AND pt.type IN (${type1}) GROUP BY pt.area_name) - ss ON ka.area_name = ss.area_name WHERE ka.type IN (${type1})) a - LEFT JOIN t_key_area_location kal ON kal.area_id = a.area_id + (SELECT ka.type,ka.location,ka.service_time,ka.management,ka.scenic_level, + ka.about,ka.area_id,ka.area_name,ss.allNums,ss.localNums,ss.nonlocalNums + FROM t_key_area ka LEFT JOIN + (SELECT pt.area_name,SUM(pf.all_nums) AS allNums,SUM(pf.local_nums) AS localNums, + SUM(pf.nonlocal_nums) AS nonlocalNums + FROM t_passenger_flow pf JOIN t_passenger_test pt + ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude + WHERE pf.time_id = #{timeId} AND pt.type IN (${type1}) GROUP BY pt.area_name) + ss ON ka.area_name = ss.area_name WHERE ka.type IN (${type1})) a + LEFT JOIN t_key_area_location kal ON kal.area_id = a.area_id UNION SELECT * FROM (SELECT ka.type,ka.location,ka.service_time,ka.management,ka.scenic_level, @@ -24,7 +24,7 @@ ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude WHERE pf.time_id = #{timeId} AND pt.type IN (${type2}) GROUP BY pt.area_name) ss ON ka.area_name = ss.area_name WHERE ka.type IN (${type2})) a - LEFT JOIN t_key_area_location kal ON kal.area_id = a.area_id + LEFT JOIN t_key_area_location kal ON kal.area_id = a.area_id UNION SELECT * FROM (SELECT ka.type,ka.location,ka.service_time,ka.management,ka.scenic_level, @@ -36,7 +36,7 @@ ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude WHERE pf.time_id = #{timeId} AND pt.type IN (${type3}) GROUP BY pt.area_name) ss ON ka.area_name = ss.area_name WHERE ka.type IN (${type3})) a - LEFT JOIN t_key_area_location1 kal1 ON kal1.area_id = a.area_id + LEFT JOIN t_key_area_location kal ON kal.area_id = a.area_id + + + + \ No newline at end of file