| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- package com.zksy.gas.domain;
- 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 java.io.Serializable;
- import java.math.BigDecimal;
- import java.time.LocalDateTime;
- import java.util.HashMap;
- import java.util.Map;
- import com.fasterxml.jackson.annotation.JsonFormat;
- import lombok.Data;
- /**
- * 可燃气体监测仪数据表
- * @TableName gas_monitor_data
- */
- @TableName(value = "gas_monitor_data", schema = "public")
- @Data
- public class GasMonitorData implements Serializable {
- /**
- * 主键ID
- */
- @TableId(value = "id", type = IdType.ASSIGN_UUID)
- private String id;
- /**
- * 帧类型
- */
- @TableField(value = "frame_type")
- private Integer frameType;
- /**
- * MAC地址
- */
- @TableField(value = "mac_address")
- private String macAddress;
- /**
- * 16位短地址
- */
- @TableField(value = "short_address")
- private String shortAddress;
- /**
- * 自动应答选项
- */
- @TableField(value = "auto_reply_option")
- private Integer autoReplyOption;
- /**
- * 数据帧序号
- */
- @TableField(value = "sequence_no")
- private Integer sequenceNo;
- /**
- * 命令字
- */
- @TableField(value = "command")
- private Integer command;
- /**
- * 设备属性
- */
- @TableField(value = "device_attr")
- private Integer deviceAttr;
- /**
- * 协议版本
- */
- @TableField(value = "protocol_version")
- private String protocolVersion;
- /**
- * 报警信息(解析后二进制)
- */
- @TableField(value = "alarm_info")
- private Integer alarmInfo;
- /**
- * 设备上报时间戳
- */
- @TableField(value = "report_time")
- private LocalDateTime reportTime;
- /**
- * 气体浓度(如%LEL)
- */
- @TableField(value = "gas_concentration")
- private BigDecimal gasConcentration;
- /**
- * 气体类型(如CH4)
- */
- @TableField(value = "gas_type")
- private String gasType;
- /**
- * 气体单位
- */
- @TableField(value = "gas_unit")
- private String gasUnit;
- /**
- * 电池电量
- */
- @TableField(value = "battery")
- private BigDecimal battery;
- /**
- * 信号强度
- */
- @TableField(value = "signal_strength")
- private Float signalStrength;
- /**
- * 温度
- */
- @TableField(value = "temperature")
- private Float temperature;
- /**
- * 湿度
- */
- @TableField(value = "humidity")
- private Float humidity;
- /**
- * 经度
- */
- @TableField(value = "longitude")
- private BigDecimal longitude;
- /**
- * 纬度
- */
- @TableField(value = "latitude")
- private BigDecimal latitude;
- /**
- * 入库时间
- */
- @TableField(value = "create_time")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- private LocalDateTime createTime;
- @TableField(exist = false)
- private static final long serialVersionUID = 1L;
- public Map<String, Boolean> parseAlarmBits() {
- Map<String, Boolean> alarmBits = new HashMap<>();
- if (alarmInfo == null) {
- alarmInfo = 0;
- }
- alarmBits.put("unknownAlarm", (alarmInfo & (1 << 0)) != 0); // Bit0:未知报警
- alarmBits.put("highAlarm", (alarmInfo & (1 << 1)) != 0); // Bit1:高报警
- alarmBits.put("overRange", (alarmInfo & (1 << 2)) != 0); // Bit2:超量程
- alarmBits.put("calibrationCycle", (alarmInfo & (1 << 3)) != 0); // Bit3:标定周期
- alarmBits.put("overLife", (alarmInfo & (1 << 4)) != 0); // Bit4:超寿命
- alarmBits.put("fallAlarm", (alarmInfo & (1 << 5)) != 0); // Bit5:跌倒报警
- alarmBits.put("undervoltage", (alarmInfo & (1 << 6)) != 0); // Bit6:欠压报警
- alarmBits.put("rangeAlarm", (alarmInfo & (1 << 7)) != 0); // Bit7:区间报警
- alarmBits.put("keyAlarm", (alarmInfo & (1 << 8)) != 0); // Bit8:按键报警
- alarmBits.put("vibrationAlarm", (alarmInfo & (1 << 9)) != 0); // Bit9:震动报警
- alarmBits.put("waterLevelAlarm", (alarmInfo & (1 << 10)) != 0); // Bit10:水位报警
- alarmBits.put("powerOffAlarm", (alarmInfo & (1 << 11)) != 0); // Bit11:断电报警
- alarmBits.put("sensorFault", (alarmInfo & (1 << 12)) != 0); // Bit12:传感器故障
- alarmBits.put("overHumidity", (alarmInfo & (1 << 13)) != 0); // Bit13:超湿报警
- alarmBits.put("overTemperature", (alarmInfo & (1 << 14)) != 0); // Bit14:超温报警
- alarmBits.put("systemFault", (alarmInfo & (1 << 15)) != 0); // Bit15:系统故障
- return alarmBits;
- }
- }
|