xiang13487 1 dienu atpakaļ
vecāks
revīzija
9f385153f3

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

@@ -22,15 +22,18 @@ import com.zksy.common.core.domain.AjaxResult2;
 import com.zksy.manhole.dto.in.EquipmentStatusInDTO;
 import com.zksy.manhole.dto.in.ManholeDeviceListInDTO;
 import com.zksy.manhole.dto.in.ManholeDevicePageInDTO;
+import com.zksy.manhole.dto.in.WarningThresholdInDTO;
 import com.zksy.manhole.dto.out.EquipmentBaseOutDTO;
 import com.zksy.manhole.dto.out.EquipmentStatusOutDTO;
 import com.zksy.manhole.dto.out.ManholeDataOutDTO;
 import com.zksy.manhole.dto.out.WarningThresholdOutDTO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -140,4 +143,22 @@ public class ManholeDeviceController extends BaseController
         return updated ? AjaxResult.success("修改成功",updated)
                 : AjaxResult.error("修改失败",updated);
     }
+
+    /**
+     * 保存设备预警阈值
+     * @param inDTO
+     * @return
+     */
+    @Anonymous
+    @PostMapping("/saveWarningThreshold")
+    @ApiOperation(value = "保存设备预警阈值")
+    public AjaxResult saveWarningThreshold(@RequestBody WarningThresholdInDTO inDTO) {
+        WarningThreshold warningThreshold = BeanUtil.copyProperties(inDTO, WarningThreshold.class);
+        if(StringUtils.isNotEmpty(warningThreshold.getId())){
+            warningThreshold.setUpdateTime(LocalDateTime.now());
+        }
+        boolean result = warningThresholdService.saveOrUpdate(warningThreshold);
+        return result ? AjaxResult.success("保存成功",result)
+                : AjaxResult.error("保存失败",result);
+    }
 }

+ 39 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/manhole/dto/in/WarningThresholdInDTO.java

@@ -0,0 +1,39 @@
+package com.zksy.manhole.dto.in;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 保存设备预警阈值-入参
+ *
+ * @author xianggx
+ */
+@Data
+@ApiModel(value = "保存设备预警阈值-入参", description = "保存设备预警阈值-入参")
+public class WarningThresholdInDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "预警阈值ID:修改时必填")
+    private String id;
+
+    @ApiModelProperty(value = "设备编码,支持多个设备编号,用逗号分隔", required = true)
+    private String deviceCode;
+
+    @ApiModelProperty(value = "预警类型", required = true)
+    private String warningType;
+
+    @ApiModelProperty(value = "预警编码", required = true)
+    private String warningCode;
+
+    @ApiModelProperty(value = "预警最小值,小于等于该值视为报警", required = true)
+    private Double minValue;
+
+    @ApiModelProperty(value = "预警最大值,大于等于该值视为报警", required = true)
+    private Double maxValue;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+}

+ 6 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/manhole/dto/out/WarningThresholdOutDTO.java

@@ -16,6 +16,12 @@ import java.io.Serializable;
 public class WarningThresholdOutDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    @ApiModelProperty(value = "预警阈值ID")
+    private String id;
+
+    @ApiModelProperty(value = "设备编码,支持多个设备编号,用逗号分隔")
+    private String deviceCode;
+
     @ApiModelProperty(value = "预警类型")
     private String warningType;