From 63c1ff4a7cd1b7135ab3e18aa94f4da334e36d0b Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 15 Apr 2024 14:50:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=BA=8B=E5=8F=91=E5=9C=B0?= =?UTF-8?q?=E4=B8=8A=E6=B8=B810=E5=85=AC=E9=87=8C=E5=86=85=E7=9A=84?= =?UTF-8?q?=E6=83=85=E6=8A=A5=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcDeviceController.java | 18 +++++++++++++ .../zc/business/mapper/DcDeviceMapper.java | 2 ++ .../zc/business/service/IDcDeviceService.java | 6 +++++ .../service/impl/DcDeviceServiceImpl.java | 27 +++++++++++++++++++ .../mapper/business/DcDeviceMapper.xml | 10 +++++++ .../mapper/business/DcEventMapper.xml | 7 ++--- 6 files changed, 67 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index 9a4b4312..475c8e84 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -19,6 +19,7 @@ import com.zc.common.core.httpclient.exception.HttpException; import com.zc.common.core.httpclient.request.RequestParams; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Parameter; import okhttp3.Response; import org.springframework.beans.factory.annotation.Value; @@ -575,4 +576,21 @@ public class DcDeviceController extends BaseController { return JSON.parseObject(response.body().string(), AjaxResult.class); } + + + /** + * @Description 查询上游10公里内的情报板 + * + * @author liuwenge + * @date 2024/4/15 14:22 + * @param stakeMark + * @param direction + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("查询上游10公里内的情报板") + @PostMapping("/selectNearBoard") + public AjaxResult selectNearBoard(@ApiParam(value="桩号", name="stakeMark", required=true) @RequestParam ("stakeMark") String stakeMark, + @ApiParam(value="方向", name="direction", required=true) @RequestParam ("direction") String direction){ + return dcDeviceService.selectNearBoard(stakeMark,direction); + } } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java index 3caf756f..83ec034d 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java @@ -21,4 +21,6 @@ public interface DcDeviceMapper extends BaseMapper { List numberOfDevicesByType(); List selectNearCamPile(@Param("direction") String direction,@Param("startMileage") String startMileage,@Param("endMileage") String endMileage); + + List selectNearBoard(@Param("direction") String direction,@Param("startMileage") Integer startMileage,@Param("endMileage") Integer endMileage); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java index b3eb5f00..26644f00 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java @@ -2,6 +2,7 @@ package com.zc.business.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; import com.zc.business.domain.DcDevice; import com.zc.business.domain.DcStakeMark; @@ -83,4 +84,9 @@ public interface IDcDeviceService extends IService { List numberOfDevicesByType(); List selectNearCamPile(String direction,String startMileage,String endMileage); + + /** + * 查询上游10公里内的情报板 + */ + AjaxResult selectNearBoard(String stakeMark, String direction); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java index f6e446e3..c70a0fac 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java @@ -3,9 +3,11 @@ package com.zc.business.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StakeMarkUtils; import com.zc.business.constant.RedisKeyConstants; import com.zc.business.domain.DcDevice; import com.zc.business.domain.DcProduct; @@ -472,5 +474,30 @@ public class DcDeviceServiceImpl extends ServiceImpl i public List selectNearCamPile(String direction,String startMileage,String endMileage){ return dcDeviceMapper.selectNearCamPile(direction,startMileage,endMileage); } + + /** + * @Description 获取事发地上游10公里内的情报板 + * + * @author liuwenge + * @date 2024/4/15 14:18 + * @param stakeMark 桩号 + * @param direction 方向 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult selectNearBoard(String stakeMark, String direction){ + + Integer mileage = Integer.valueOf(StakeMarkUtils.formatMetre(stakeMark)); + + List boardList = new ArrayList<>(); + if ("1".equals(direction)){ + Integer start = mileage - 10000; + boardList = dcDeviceMapper.selectNearBoard(direction,start,mileage); + } else if ("3".equals(direction)){ + Integer end = mileage + 10000; + boardList = dcDeviceMapper.selectNearBoard(direction,mileage,end); + } + return AjaxResult.success(boardList); + } } diff --git a/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml b/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml index 28b3fc01..fe6f24c5 100644 --- a/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml @@ -128,5 +128,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where !ISNULL(t1.iot_device_id) and t1.device_type = '1' and t1.direction = #{direction} and t2.mileage >= #{startMileage} and t2.mileage <= #{endMileage} + diff --git a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml index 97fb7fe1..10718b22 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml @@ -667,7 +667,8 @@ where id = #{id} - + + update dc_event dept_id = #{deptId}, @@ -747,11 +748,11 @@