Sfoglia il codice sorgente

查询设备预警阈值

xiang13487 1 settimana fa
parent
commit
0e773f1b91

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

@@ -5,6 +5,8 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.base.alarm.domain.WarningThreshold;
+import com.zksy.base.alarm.service.WarningThresholdService;
 import com.zksy.base.domain.EquipmentBase;
 import com.zksy.base.domain.EquipmentStatus;
 import com.zksy.base.domain.EquipmentType;
@@ -23,6 +25,7 @@ import com.zksy.manhole.dto.in.ManholeDevicePageInDTO;
 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.springframework.beans.factory.annotation.Autowired;
@@ -53,6 +56,9 @@ public class ManholeDeviceController extends BaseController
     @Autowired
     private ManholeDataService manholeDataService;
 
+    @Autowired
+    private WarningThresholdService warningThresholdService;
+
     /**
      * 分页查询监测设备台账列表
      */
@@ -110,6 +116,14 @@ public class ManholeDeviceController extends BaseController
             ManholeDataOutDTO manholeDataOutDTO = BeanUtil.copyProperties(manholeData, ManholeDataOutDTO.class);
             outDTO.setManholeData(manholeDataOutDTO);
         }
+        // 查询设备预警阈值
+        List<WarningThreshold> warningThresholdList = warningThresholdService.list(new LambdaQueryWrapper<WarningThreshold>()
+                .eq(WarningThreshold::getDeviceCode, outDTO.getEquipmentCode())
+                .orderByDesc(WarningThreshold::getCreateTime));
+        if(CollUtil.isNotEmpty(warningThresholdList)){
+            List<WarningThresholdOutDTO> warningThresholdOutDTOList = BeanUtil.copyToList(warningThresholdList, WarningThresholdOutDTO.class);
+            outDTO.setWarningThresholdList(warningThresholdOutDTOList);
+        }
         return AjaxResult2.success(outDTO);
     }
 

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

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * 获取监测设备台账详情-出参
@@ -25,4 +26,7 @@ public class EquipmentBaseOutDTO extends EquipmentBase implements Serializable {
 
     @ApiModelProperty(value = "井盖实时监测数据")
     private ManholeDataOutDTO manholeData;
+
+    @ApiModelProperty(value = "设备预警阈值列表")
+    private List<WarningThresholdOutDTO> warningThresholdList;
 }

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

@@ -0,0 +1,30 @@
+package com.zksy.manhole.dto.out;
+
+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 WarningThresholdOutDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "预警类型")
+    private String warningType;
+
+    @ApiModelProperty(value = "预警编码")
+    private String warningCode;
+
+    @ApiModelProperty(value = "预警值")
+    private Double warningValue;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+}