Kaynağa Gözat

fix:bug修改

null 5 gün önce
ebeveyn
işleme
d36cd158b1

+ 10 - 1
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/manhole/ManholeDeviceController.java

@@ -172,9 +172,11 @@ public class ManholeDeviceController extends BaseController
             ManholeDataOutDTO manholeDataOutDTO = BeanUtil.copyProperties(manholeData, ManholeDataOutDTO.class);
             outDTO.setManholeData(manholeDataOutDTO);
         }
-        // 查询设备预警阈值(支持多个设备编号,用逗号分隔)
+        // 窨井设备仅支持倾斜角度阈值,支持多个设备编号,用逗号分隔
         List<WarningThreshold> warningThresholdList = warningThresholdService.list(new LambdaQueryWrapper<WarningThreshold>()
                 .apply("CONCAT(',', device_code, ',') LIKE CONCAT('%,', {0}, ',%')", outDTO.getEquipmentCode())
+                .eq(WarningThreshold::getWarningCode, "WARN-TILT")
+                .eq(WarningThreshold::getWarningType, "倾斜预警")
                 .orderByDesc(WarningThreshold::getCreateTime));
         if(CollUtil.isNotEmpty(warningThresholdList)){
             List<WarningThresholdOutDTO> warningThresholdOutDTOList = BeanUtil.copyToList(warningThresholdList, WarningThresholdOutDTO.class);
@@ -206,6 +208,13 @@ public class ManholeDeviceController extends BaseController
     @PostMapping("/saveWarningThreshold")
     @ApiOperation(value = "保存设备预警阈值")
     public AjaxResult saveWarningThreshold(@RequestBody WarningThresholdInDTO inDTO) {
+        if (inDTO == null || !StringUtils.equals("WARN-TILT", inDTO.getWarningCode())
+                || !StringUtils.equals("倾斜预警", inDTO.getWarningType())) {
+            return AjaxResult.error("窨井设备仅支持倾斜角度阈值");
+        }
+        if (StringUtils.isBlank(inDTO.getDeviceCode())) {
+            return AjaxResult.error("设备编码不能为空");
+        }
         WarningThreshold warningThreshold = BeanUtil.copyProperties(inDTO, WarningThreshold.class);
         if(StringUtils.isNotEmpty(warningThreshold.getId())){
             warningThreshold.setUpdateTime(LocalDateTime.now());