From 5e3db658b04beed1ae8c08a76d332c2ffd0467cb Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Fri, 12 Aug 2022 15:49:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E6=B0=B4=E7=82=B9=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=B9=E6=8D=AE=E7=BB=8F=E7=BA=AC=E5=BA=A6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=A7=AF=E6=B0=B4=E7=82=B9=E5=91=A8=E8=BE=B9?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=20=E5=9C=A8=E5=BB=BA=E5=B7=A5=E5=9C=B0?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WaterPointController.java | 25 +++++++++++++++++++ .../mapper/BuildingRecordsMapper.java | 4 +-- .../mapper/WaterPointMapper.java | 8 ++++++ .../mapper/BuildingRecordsMapper.xml | 6 ++--- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/controller/WaterPointController.java b/src/main/java/com/hisense/monitormanage/controller/WaterPointController.java index 997b8be..1c8df92 100644 --- a/src/main/java/com/hisense/monitormanage/controller/WaterPointController.java +++ b/src/main/java/com/hisense/monitormanage/controller/WaterPointController.java @@ -3,11 +3,14 @@ package com.hisense.monitormanage.controller; import com.hisense.monitormanage.dto.WaterCameraDto; import com.hisense.monitormanage.dto.WaterPointDto; import com.hisense.monitormanage.dto.WaterPointDtos; +import com.hisense.monitormanage.entity.CameraChannel; import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.entity.WaterPoint; import com.hisense.monitormanage.mapper.WaterPointMapper; +import com.hisense.monitormanage.utils.LongLatUtil; 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; @@ -98,4 +101,26 @@ public class WaterPointController { Result success = Result.success(waterCameras); return success; } + + /** + * 根据经纬度查询积水点周边监控 + * @param longitude + * @param latitude + * @param radius + * @return + */ + @GetMapping ("selectByLongAndLiti") + @ApiOperation("根据经纬度查询积水点周边监控") + @ApiImplicitParams({ + @ApiImplicitParam(name = "longitude", value = "经度",required = true,dataType ="Double"), + @ApiImplicitParam(name = "latitude", value = "纬度",required = true,dataType ="Double"), + @ApiImplicitParam(name = "radius", value = "半径,米",required = true,dataType ="Integer"),} + ) + public Result selectByLongAndLiti(Double longitude,Double latitude,Integer radius){ + double[] around = LongLatUtil.getAround(longitude, latitude, radius); + List c = waterPointMapper.selectByLongAndLiti(around[0], around[2], around[1], around[3]); + Result success = Result.success(c); + 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 c96e5ac..49c79ea 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java @@ -42,7 +42,7 @@ public interface BuildingRecordsMapper extends BaseMapper { List selectByAllEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize); - @Select("select COUNT(*) from t_event WHERE camera_name IN ('博海建设南昌路127号现场','青城建设蚌埠路以北宁乡路以西门') AND track_event = 'START'") + @Select("select COUNT(*) from t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name where te.track_event = 'START'") Integer selectCountEvent(); @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 ") @@ -71,7 +71,7 @@ public interface BuildingRecordsMapper extends BaseMapper { @Select("select * from t_road_data where pm10 > 150 AND dt = #{dt}") List selectByDayRoadData(String dt); - @Select("select * from t_event WHERE camera_name IN ('博海建设南昌路127号现场','青城建设蚌埠路以北宁乡路以西门') AND track_event = 'START' AND TO_DAYS(capture_time) = TO_DAYS(NOW())") + @Select("select * from t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name where te.track_event = 'START' AND TO_DAYS(te.capture_time) = TO_DAYS(NOW())") List selectByEvent(); } diff --git a/src/main/java/com/hisense/monitormanage/mapper/WaterPointMapper.java b/src/main/java/com/hisense/monitormanage/mapper/WaterPointMapper.java index 08abbc3..5852150 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/WaterPointMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/WaterPointMapper.java @@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hisense.monitormanage.dto.WaterCameraDto; import com.hisense.monitormanage.dto.WaterPointDto; import com.hisense.monitormanage.dto.WaterPointDtos; +import com.hisense.monitormanage.entity.CameraChannel; import com.hisense.monitormanage.entity.WaterPoint; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; @@ -31,5 +33,11 @@ public interface WaterPointMapper extends BaseMapper { @Select("select wpr.point_level,COUNT(*) as count from water_point wp LEFT JOIN water_point_report wpr ON wp.water_point_id = wpr.water_point_id WHERE wp.audit_flag = '2' and wp.disp_flag in (0,1) GROUP BY wpr.point_level") List selectCountLevel(); + @Select("select * from water_point where (longitude between #{longitude1} and #{longitude2}) and (latitude between #{latitude1} and #{latitude2} ) and audit_flag = '2' and disp_flag in (0,1)") + List selectByLongAndLiti(@Param("longitude1") Double longitude1, + @Param("longitude2") Double longitude2, + @Param("latitude1") Double latitude1, + @Param("latitude2") Double latitude2); + } diff --git a/src/main/resources/mapper/BuildingRecordsMapper.xml b/src/main/resources/mapper/BuildingRecordsMapper.xml index 89e4e4f..5f0c787 100644 --- a/src/main/resources/mapper/BuildingRecordsMapper.xml +++ b/src/main/resources/mapper/BuildingRecordsMapper.xml @@ -51,9 +51,9 @@