From 5a128d1a147d22c29884cc5fd273235edfcd27d6 Mon Sep 17 00:00:00 2001 From: wenjy Date: Tue, 3 May 2022 10:51:15 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E5=BC=82=E5=B8=B8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=AE=B0=E5=BD=95=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BC=A0?= =?UTF-8?q?=E6=84=9F=E5=99=A8=E6=A0=91=E5=BD=A2=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/BaseSensorInfoController.java | 7 ++ .../record/recordAlarm/recordAlarm.html | 97 +++++++++++++++---- .../system/mapper/BaseSensorInfoMapper.java | 10 ++ .../service/IBaseSensorInfoService.java | 11 +++ .../impl/BaseSensorInfoServiceImpl.java | 27 +++++- .../mapper/system/BaseSensorInfoMapper.xml | 14 +++ 6 files changed, 148 insertions(+), 18 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSensorInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSensorInfoController.java index 07bbfd6..42a1153 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSensorInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSensorInfoController.java @@ -8,6 +8,7 @@ import java.util.stream.Collectors; import com.alibaba.fastjson.JSONArray; import com.mysql.cj.xdevapi.JsonArray; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.system.domain.BaseAlarmInfo; import com.ruoyi.system.domain.BaseAlarmType; @@ -240,6 +241,12 @@ public class BaseSensorInfoController extends BaseController { ajax.put("value",json); return ajax; } + + @GetMapping("/getSensorInfoTree") + @ResponseBody + public List getSensorInfoTree(){ + return baseSensorInfoService.selectSensorInfoTree(); + } } /** diff --git a/ruoyi-admin/src/main/resources/templates/record/recordAlarm/recordAlarm.html b/ruoyi-admin/src/main/resources/templates/record/recordAlarm/recordAlarm.html index e8bd462..999aa3d 100644 --- a/ruoyi-admin/src/main/resources/templates/record/recordAlarm/recordAlarm.html +++ b/ruoyi-admin/src/main/resources/templates/record/recordAlarm/recordAlarm.html @@ -2,18 +2,39 @@ + + +
+
+
+
+ 传感器 +
+
+ + + +
+
+
+
+
+
+
+ +
+
    -
  • - - -
  • @@ -53,13 +74,34 @@
+
+ + diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseSensorInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseSensorInfoMapper.java index 025de90..e5a7e7f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseSensorInfoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseSensorInfoMapper.java @@ -1,6 +1,8 @@ package com.ruoyi.system.mapper; import java.util.List; + +import com.ruoyi.system.domain.BaseMonitorunitInfo; import com.ruoyi.system.domain.BaseSensorInfo; import com.ruoyi.system.domain.dto.BaseSensorInfoDto; @@ -68,4 +70,12 @@ public interface BaseSensorInfoMapper * @return java.util.List */ public List selectSensorDataListBySensorType(String sensorType); + + /** + * 传感器信息与监控单元树结合 + * @author WenJY + * @date 2022/5/3 10:20 + * @return java.util.List + */ + public List selectSensorInfoTree(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseSensorInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseSensorInfoService.java index 4f5757e..a9f2f3d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseSensorInfoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseSensorInfoService.java @@ -1,6 +1,9 @@ package com.ruoyi.system.service; import java.util.List; + +import com.ruoyi.common.core.domain.Ztree; +import com.ruoyi.system.domain.BaseMonitorunitInfo; import com.ruoyi.system.domain.BaseSensorInfo; import com.ruoyi.system.domain.dto.BaseSensorInfoDto; @@ -78,4 +81,12 @@ public interface IBaseSensorInfoService * @return java.util.List */ public List selectSensorDataListBySensorType(String sensorType); + + /** + * 传感器信息与监控单元树结合 + * @author WenJY + * @date 2022/5/3 10:20 + * @return java.util.List + */ + public List selectSensorInfoTree(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseSensorInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseSensorInfoServiceImpl.java index e2403c8..6645355 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseSensorInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseSensorInfoServiceImpl.java @@ -1,12 +1,15 @@ package com.ruoyi.system.service.impl; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.BaseMonitorunitInfo; import com.ruoyi.system.domain.dto.BaseSensorInfoDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,7 +25,7 @@ import com.ruoyi.common.core.text.Convert; * @date 2022-02-07 */ @Service -public class BaseSensorInfoServiceImpl implements IBaseSensorInfoService +public class BaseSensorInfoServiceImpl implements IBaseSensorInfoService { @Autowired private BaseSensorInfoMapper baseSensorInfoMapper; @@ -169,4 +172,26 @@ public class BaseSensorInfoServiceImpl implements IBaseSensorInfoService public List selectSensorDataListBySensorType(String sensorType) { return baseSensorInfoMapper.selectSensorDataListBySensorType(sensorType); } + + /** + * 传感器信息与监控单元树结合 + * @author WenJY + * @date 2022/5/3 10:20 + * @return java.util.List + */ + @Override + public List selectSensorInfoTree() { + List baseMonitorunitInfos = baseSensorInfoMapper.selectSensorInfoTree(); + List ztrees = new ArrayList(); + for (BaseMonitorunitInfo baseMonitorunitInfo : baseMonitorunitInfos) { + Ztree ztree = new Ztree(); + ztree.setId(baseMonitorunitInfo.getMonitorunitId()); + ztree.setpId(baseMonitorunitInfo.getParentId()); + ztree.setName(baseMonitorunitInfo.getMonitorunitName()); + ztree.setTitle(baseMonitorunitInfo.getMonitorunitName()); + ztree.setOpen(false); + ztrees.add(ztree); + } + return ztrees; + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/BaseSensorInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BaseSensorInfoMapper.xml index f6ee4a3..a92a3c0 100644 --- a/ruoyi-system/src/main/resources/mapper/system/BaseSensorInfoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/BaseSensorInfoMapper.xml @@ -43,6 +43,12 @@ + + + + + + select ObjId, EdgeId, @@ -129,6 +135,14 @@ and t2.CollectTime between DATE_FORMAT(now(), '%Y-%m-%d 00:00:00') and DATE_FORMAT(now(), '%Y-%m-%d 23:59:59'); + + insert into base_sensor_info