From bf10750ff5bd92d4a8660c37e8071963322ac364 Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Fri, 20 May 2022 16:25:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=E6=91=84?= =?UTF-8?q?=E5=83=8F=E5=A4=B4=E7=BB=8F=E7=BA=AC=E5=BA=A6=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8D=8A=E5=BE=84=E5=86=85=E6=89=80=E6=9C=89=E7=9A=84=E6=91=84?= =?UTF-8?q?=E5=83=8F=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitormanage/controller/Controller.java | 28 +++++++++---------- .../mapper/CameraChannelMapper.java | 10 +++---- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index f02a942..2284827 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -4,6 +4,7 @@ import com.hisense.monitormanage.dto.*; import com.hisense.monitormanage.entity.*; import com.hisense.monitormanage.mapper.*; import com.hisense.monitormanage.service.*; +import com.hisense.monitormanage.utils.LongLatUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -207,25 +208,24 @@ public class Controller { } /** - * 根据两个点查询范围内的摄像头 + * 根据经纬度查询半径内所有的摄像头 * @param gpsX - * @param gpsX1 * @param gpsY - * @param gpsY1 + * @param raidus * @return */ @GetMapping ("selectAllByGps") - public Result selectAllByGps(String gpsX,String gpsX1,String gpsY,String gpsY1){ - - List gps = cameraChannelMapper.selectAllByGps(gpsX, gpsX1, gpsY, gpsY1); - double gpsx = Double.parseDouble(gpsX); - double gpsx1 = Double.parseDouble(gpsX1); - double gpsy = Double.parseDouble(gpsY); - double gpsy1 = Double.parseDouble(gpsY1); - if (gpsx < gpsx1 || gpsy < gpsy1){ - return Result.success(gps); - } - return Result.error("请输入正确的精度范围"); + @ApiOperation("根据经纬度查询半径内所有的摄像头") + @ApiImplicitParams({ + @ApiImplicitParam(name = "gpsX", value = "经度", paramType = "query",required = true,dataType ="double"), + @ApiImplicitParam(name = "gpsY", value = "纬度", paramType = "query",required = true,dataType ="double"), + @ApiImplicitParam(name = "raidus", value = "半径,米", paramType = "query",required = true,dataType ="Integer"),} + ) + public Result selectAllByGps(Double gpsX,Double gpsY,Integer raidus){ + double[] around = LongLatUtil.getAround(gpsX, gpsY, raidus); + List c = cameraChannelMapper.selectAllByGps(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/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index edce4ee..3009d1a 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java @@ -44,12 +44,12 @@ public interface CameraChannelMapper extends BaseMapper { "ON a.label_code = b.label_code AND b.channel_code = c.channel_code where c.`status`!= 0) m where m.label_code in (${labelCode}) ") List selectLabelAndChannel(@Param("labelCode") String labelCode); - @Select("select cc.channel_code,cc.gps_x,cc.gps_y from t_camera_channel cc " + + @Select("select cc.* from t_camera_channel cc " + "where (gps_x between #{gpsX} and #{gpsX1}) and (gps_y between #{gpsY} and #{gpsY1} )") - List selectAllByGps(@Param("gpsX") String gpsX, - @Param("gpsX1") String gpsX1, - @Param("gpsY") String gpsY, - @Param("gpsY1") String gpsY1); + List selectAllByGps(@Param("gpsX") Double gpsX, + @Param("gpsX1") Double gpsX1, + @Param("gpsY") Double gpsY, + @Param("gpsY1") Double gpsY1); List selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize);