From 03a02d46440db7c181f70e4092f7bd73b9b43cb3 Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Tue, 19 Jul 2022 17:44:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9D=8E=E6=9D=91=E5=95=86?= =?UTF-8?q?=E5=9C=88=E6=8E=A5=E5=8F=A3=20=E4=BF=AE=E6=94=B9=E5=B7=A5?= =?UTF-8?q?=E5=9C=B0=E8=BF=917=E5=A4=A9=E8=BF=9130=E5=A4=A9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BuildingController.java | 12 +++ .../controller/KeyAreaController.java | 15 +++ .../monitormanage/entity/KeyAreaLocation.java | 12 +++ .../mapper/BuildingRecordsMapper.java | 6 +- .../mapper/CameraChannelMapper.java | 2 +- .../monitormanage/mapper/KeyAreaMapper.java | 4 + .../mapper/BuildingRecordsMapper.xml | 96 +++++++++++++++++++ 7 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/hisense/monitormanage/entity/KeyAreaLocation.java diff --git a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java index 96e7347..f1ecdfb 100644 --- a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java +++ b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java @@ -86,6 +86,12 @@ public class BuildingController { @ApiOperation("查询近7天工地噪声和扬尘的信息") public Result selectWeekPmAndNoice(String buildLicense){ List recordsDtos = buildingRecordsMapper.selectWeekPmAndNoice(buildLicense); + recordsDtos.forEach(record ->{ + if (record.getPm10() == null && record.getNoice() == null){ + record.setPm10(0); + record.setNoice(0); + } + }); Result success = Result.success(recordsDtos); return success; } @@ -98,6 +104,12 @@ public class BuildingController { @ApiOperation("查询近30天工地噪声和扬尘的信息") public Result selectMonthPmAndNoice(String buildLicense){ List recordsDtos = buildingRecordsMapper.selectMonthPmAndNoice(buildLicense); + recordsDtos.forEach(record ->{ + if (record.getPm10() == null && record.getNoice() == null){ + record.setPm10(0); + record.setNoice(0); + } + }); Result success = Result.success(recordsDtos); return success; } diff --git a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java index cf84b80..d38e695 100644 --- a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java +++ b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java @@ -1,6 +1,7 @@ package com.hisense.monitormanage.controller; 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.KeyAreaMapper; @@ -42,4 +43,18 @@ public class KeyAreaController { Result success = Result.success(keyAreaDtos); return success; } + + /** + * 根据名称查询商圈范围 + * @param areaName + * @return + */ + @GetMapping("selectByAreaName") + @ApiOperation("根据名称查询商圈范围") + public Result selectByAreaName(String areaName){ + List keyAreaLocations = keyAreaMapper.selectByAreaName(areaName); + Result success = Result.success(keyAreaLocations); + return success; + } + } diff --git a/src/main/java/com/hisense/monitormanage/entity/KeyAreaLocation.java b/src/main/java/com/hisense/monitormanage/entity/KeyAreaLocation.java new file mode 100644 index 0000000..ff66349 --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/entity/KeyAreaLocation.java @@ -0,0 +1,12 @@ +package com.hisense.monitormanage.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("t_key_area_location") +public class KeyAreaLocation { + private Integer areaId; + private Double longitude; + private Double latitude; +} diff --git a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java index fa1e86b..d236b72 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java @@ -28,11 +28,9 @@ public interface BuildingRecordsMapper extends BaseMapper { "ON br.project_name = bns.gdmc ORDER BY br.push_time DESC LIMIT 93) bs LEFT JOIN t_channel_picture cp ON bs.channel_code = cp.channel_code") List selectAllBuilding(); - @Select("select DATE_FORMAT(br.push_time,'%Y%-%m-%d') pushTime,ROUND(AVG(br.pm10)) pm10,ROUND(AVG(br.noice)) noice from t_building_records br JOIN t_building_new_site bns ON br.project_name = bns.gdmc WHERE br.build_license = #{buildLicense} AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < date(br.push_time) group by pushTime") - List selectWeekPmAndNoice(String buildLicense); + List selectWeekPmAndNoice(@Param("buildLicense") String buildLicense); - @Select("select DATE_FORMAT(br.push_time,'%Y%-%m-%d') pushTime,ROUND(AVG(br.pm10)) pm10,ROUND(AVG(br.noice)) noice from t_building_records br JOIN t_building_new_site bns ON br.project_name = bns.gdmc WHERE br.build_license = #{buildLicense} AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < date(br.push_time) group by pushTime") - List selectMonthPmAndNoice(String buildLicense); + List selectMonthPmAndNoice(@Param("buildLicense") String buildLicense); List selectRaise(@Param("page") Integer page,@Param("pageSize") Integer pageSize); diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index 51fab9e..307c61c 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 < '404_37020300001310016759' AND channel_code > '183_37028352001328635450' ORDER BY channel_code DESC" ) + @Select("SELECT * FROM t_camera_channel WHERE channel_code < '183_37028301831321234380' AND channel_code > '183_37028301831321232834' ORDER BY channel_code DESC\n" ) List selectCameraChannel(); } diff --git a/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java b/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java index ee6d297..18c5194 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java @@ -3,6 +3,7 @@ package com.hisense.monitormanage.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hisense.monitormanage.dto.KeyAreaDto; import com.hisense.monitormanage.entity.KeyArea; +import com.hisense.monitormanage.entity.KeyAreaLocation; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; @@ -15,4 +16,7 @@ public interface KeyAreaMapper extends BaseMapper { @Select("select ka.type,ka.area_name,ka.location,ss.allNums from t_key_area ka LEFT JOIN (select pt.area_name,SUM(pf.all_nums) as allNums 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 = #{type} GROUP BY pt.area_name) ss ON ka.area_name = ss.area_name WHERE ka.type = #{type}") List selectKeyAreaList(@Param("type") String type,@Param("timeId") String timeId); + @Select("SELECT * FROM t_key_area_location kal JOIN t_key_area ka ON kal.area_id = ka.area_id WHERE ka.area_name = #{areaName}") + List selectByAreaName(String areaName); + } diff --git a/src/main/resources/mapper/BuildingRecordsMapper.xml b/src/main/resources/mapper/BuildingRecordsMapper.xml index d6adeb4..05b23e1 100644 --- a/src/main/resources/mapper/BuildingRecordsMapper.xml +++ b/src/main/resources/mapper/BuildingRecordsMapper.xml @@ -50,4 +50,100 @@ limit #{page},#{pageSize} + + + + \ No newline at end of file