From f0c412f73b667b40aef3a30f1469e9f8358e1f0e Mon Sep 17 00:00:00 2001 From: yang chen Date: Tue, 2 Dec 2025 22:07:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(biz):=20=E5=8A=A8=E7=8E=AF=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=9B=91=E6=8E=A7=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将monitorData字段从String类型改为DeviceMetric对象 - 新增DeviceMetric内部类用于映射JSON监控数据 - 添加各类动环设备指标字段及视图字段 - 包含UPS、精密空调、温湿度检测等相关指标 - 使用JacksonTypeHandler处理JSON序列化 - 更新测试用例中monitorData字段赋值逻辑 --- .../mapper/LcPowerEnvDeviceMapperTest.java | 4 - .../biz/entity/LcPowerEnvDeviceEntity.java | 435 +++++++++++++++++- 2 files changed, 433 insertions(+), 6 deletions(-) diff --git a/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapperTest.java b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapperTest.java index 97d64df..e11e983 100644 --- a/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapperTest.java +++ b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapperTest.java @@ -33,7 +33,6 @@ public class LcPowerEnvDeviceMapperTest extends BaseDbUnitTest { entity.setBuildingName("测试楼宇"); entity.setCampusId("CAMPUS_001"); entity.setCampusName("测试园区"); - entity.setMonitorData("{\"temperature\": 25.6}"); entity.setTenantId(1L); entity.setCreateUser(1L); entity.setCreateTime(LocalDateTime.now()); @@ -66,7 +65,6 @@ public class LcPowerEnvDeviceMapperTest extends BaseDbUnitTest { entity.setBuildingName("测试楼宇"); entity.setCampusId("CAMPUS_001"); entity.setCampusName("测试园区"); - entity.setMonitorData("{\"temperature\": 25.6}"); entity.setTenantId(1L); entity.setCreateUser(1L); entity.setCreateTime(LocalDateTime.now()); @@ -99,7 +97,6 @@ public class LcPowerEnvDeviceMapperTest extends BaseDbUnitTest { entity.setBuildingName("测试楼宇"); entity.setCampusId("CAMPUS_001"); entity.setCampusName("测试园区"); - entity.setMonitorData("{\"temperature\": 25.6}"); entity.setTenantId(1L); entity.setCreateUser(1L); entity.setCreateTime(LocalDateTime.now()); @@ -132,7 +129,6 @@ public class LcPowerEnvDeviceMapperTest extends BaseDbUnitTest { entity.setBuildingName("测试楼宇"); entity.setCampusId("CAMPUS_001"); entity.setCampusName("测试园区"); - entity.setMonitorData("{\"temperature\": 25.6}"); entity.setTenantId(1L); entity.setCreateUser(1L); entity.setCreateTime(LocalDateTime.now()); diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvDeviceEntity.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvDeviceEntity.java index b80673b..d42a0be 100644 --- a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvDeviceEntity.java +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvDeviceEntity.java @@ -1,14 +1,19 @@ package com.jeelowcode.module.biz.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.jeelowcode.framework.utils.model.global.BaseTenantEntity; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigDecimal; + /** * 动环设备信息表 * @@ -67,8 +72,434 @@ public class LcPowerEnvDeviceEntity extends BaseTenantEntity { private String campusName; /** - * 最新监控数据 + * 最新监控数据 映射成DeviceMetric,数据库是Json */ - private String monitorData; + @TableField(typeHandler = JacksonTypeHandler.class) + private DeviceMetric monitorData; + /** + * 动环设备监控指标信息 + */ + @Data + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class DeviceMetric { + + /** + * 是否告警 + */ + private Boolean alarm; + + /** + * 电池组电流 + */ + private BigDecimal BatI; + + /** + * 电池组电流视图 + */ + private String BatIView; + + // UPS相关指标 + /** + * 电池备用时间 + */ + private BigDecimal BatteryPowerTime; + + /** + * 电池备用时间视图 + */ + private String BatteryPowerTimeView; + + /** + * 电池组电压 + */ + private BigDecimal BatU; + + /** + * 电池组电压视图 + */ + private String BatUView; + + /** + * 频率 + */ + private BigDecimal electricFr; + + /** + * 频率视图 + */ + private String electricFrView; + + /** + * A相有功功率 + */ + private BigDecimal electricPa; + + /** + * A相有功功率视图 + */ + private String electricPaView; + + /** + * B相有功功率 + */ + private BigDecimal electricPb; + + /** + * B相有功功率视图 + */ + private String electricPbView; + + /** + * C相有功功率 + */ + private BigDecimal electricPc; + + /** + * C相有功功率视图 + */ + private String electricPcView; + + /** + * 紧急停止状态 + */ + private Boolean EmerOutage; + + /** + * 紧急停止状态视图 + */ + private String EmerOutageView; + + /** + * UPS保险丝故障状态 + */ + private Boolean FuFaultAlarm; + + /** + * UPS保险丝故障状态视图 + */ + private String FuFaultAlarmView; + + /** + * 逆变器主要故障状态 + */ + private Boolean InverterFaultAlarm; + + /** + * 逆变器主要故障状态视图 + */ + private String InverterFaultAlarmView; + + /** + * 负载百分比 + */ + private BigDecimal LoadPercentage; + + /** + * 负载百分比视图 + */ + private String LoadPercentageView; + + /** + * 电池电量低警告状态 + */ + private Boolean LowBatteryAlarm; + + /** + * 电池电量低警告状态视图 + */ + private String LowBatteryAlarmView; + + /** + * A相电压 + */ + private BigDecimal nUa; + + /** + * A相电压视图 + */ + private String nUaView; + + /** + * B相电压 + */ + private BigDecimal nUb; + + /** + * B相电压视图 + */ + private String nUbView; + + /** + * C相电压 + */ + private BigDecimal nUc; + + /** + * C相电压视图 + */ + private String nUcView; + + /** + * UPS过载状态 + */ + private Boolean OverLoadAlarm; + + /** + * UPS过载状态视图 + */ + private String OverLoadAlarmView; + + /** + * 开关状态 + */ + private Boolean switchStatus; + + /** + * 开关状态视图 + */ + private String switchStatusView; + + /** + * AB线电压 + */ + private BigDecimal Uab1; + + /** + * AB线电压视图 + */ + private String Uab1View; + + /** + * BC线电压 + */ + private BigDecimal Ubc1; + + /** + * BC线电压视图 + */ + private String Ubc1View; + + /** + * CA线电压 + */ + private BigDecimal Uca1; + + /** + * CA线电压视图 + */ + private String Uca1View; + + // 精密空调相关指标 + /** + * 风机或气流丢失故障 + */ + private Boolean FlowLose; + + /** + * 风机或气流丢失故障视图 + */ + private String FlowLoseView; + + /** + * 回风高湿报警 + */ + private Boolean HumidityHighAlarm; + + /** + * 回风高湿报警视图 + */ + private String HumidityHighAlarmView; + + /** + * 回风低湿报警 + */ + private Boolean HumidityLowAlarm; + + /** + * 回风低湿报警视图 + */ + private String HumidityLowAlarmView; + + /** + * 水浸报警 + */ + private Boolean LeakAlarm; + + /** + * 水浸报警视图 + */ + private String LeakAlarmView; + + /** + * 回风湿度 + */ + private BigDecimal nRetAirHum; + + /** + * 回风湿度视图 + */ + private String nRetAirHumView; + + /** + * 回风温度 + */ + private BigDecimal nRetAirTemp; + + /** + * 回风温度视图 + */ + private String nRetAirTempView; + + /** + * 相序错误(逆相) + */ + private Boolean PhaseSequenceError; + + /** + * 相序错误(逆相)视图 + */ + private String PhaseSequenceErrorView; + + /** + * 回风高温报警 + */ + private Boolean TemperatureHighAlarm; + + /** + * 回风高温报警视图 + */ + private String TemperatureHighAlarmView; + + /** + * 回风低温报警 + */ + private Boolean TemperatureLowAlarm; + + /** + * 回风低温报警视图 + */ + private String TemperatureLowAlarmView; + + // 温湿度检测相关指标 + /** + * 环境湿度 + */ + private BigDecimal humidity; + + /** + * 环境湿度视图 + */ + private String humidityView; + + /** + * 环境温度 + */ + private BigDecimal temperature; + + /** + * 环境温度视图 + */ + private String temperatureView; + + // 氢气检测相关指标 + /** + * 氢气浓度 + */ + private BigDecimal Concentrate; + + /** + * 氢气浓度视图 + */ + private String ConcentrateView; + + // 粉尘检测相关指标 + /** + * 粉尘检测 + */ + private BigDecimal DustDetection; + + /** + * 粉尘检测视图 + */ + private String DustDetectionView; + + // 加湿器相关指标 + /** + * 盘管故障 + */ + private Boolean CoilFault; + + /** + * 盘管故障视图 + */ + private String CoilFaultView; + + /** + * 水满告警 + */ + private Boolean FullWaterAlarm; + + /** + * 水满告警视图 + */ + private String FullWaterAlarmView; + + /** + * 缺水告警 + */ + private Boolean LockWaterAlarm; + + /** + * 缺水告警视图 + */ + private String LockWaterAlarmView; + + /** + * 温湿度传感器故障 + */ + private Boolean SensorFault; + + /** + * 温湿度传感器故障视图 + */ + private String SensorFaultView; + + // 加湿除湿一体相关指标 + // humidity 和 temperature 字段已在上面定义 + + // 电量仪相关指标 + /** + * A相电流 + */ + private BigDecimal nIa; + + /** + * A相电流视图 + */ + private String nIaView; + + /** + * B相电流 + */ + private BigDecimal nIb; + + /** + * B相电流视图 + */ + private String nIbView; + + /** + * C相电流 + */ + private BigDecimal nIc; + + /** + * C相电流视图 + */ + private String nIcView; + + // nUa, nUb, nUc 字段已在上面定义 + } + } \ No newline at end of file