feat: 新功能开发,监测历史记录。微信和物联网平台,模块搭建。
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package com.intc.tdengine.domain;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
@NoArgsConstructor // 生成无参构造方法
|
||||
@@ -10,17 +14,64 @@ import java.time.LocalDateTime;
|
||||
public class DeviceSensorData {
|
||||
|
||||
// 测量字段(随时间变化的数值)
|
||||
private LocalDateTime time; // 时序主键时间戳
|
||||
private LocalDateTime createTime; // 数据创建时间
|
||||
private double dissolvedOxygen; // 溶解氧
|
||||
private double temperature; // 温度
|
||||
private double saturability; // 饱和度
|
||||
private double ph; // pH值
|
||||
private double salinity; // 盐度
|
||||
private double treference; // 参考值(具体含义需结合业务)
|
||||
private double tfluorescence; // 荧光值
|
||||
private double phaseDifference; // 相位差
|
||||
private double battery; // 电池电量
|
||||
private String time; // 时序主键时间戳
|
||||
private String createTime; // 数据创建时间
|
||||
private Double dissolvedOxygen; // 溶解氧
|
||||
private Double temperature; // 温度
|
||||
private Double saturability; // 饱和度
|
||||
private Double ph; // pH值
|
||||
private Double salinity; // 盐度
|
||||
private Double treference; // 参考值(具体含义需结合业务)
|
||||
private Double tfluorescence; // 荧光值
|
||||
private Double phaseDifference; // 相位差
|
||||
private Double battery; // 电池电量
|
||||
|
||||
// Getter 方法,返回保留两位小数的值
|
||||
public Double getDissolvedOxygen() {
|
||||
return roundToTwoDecimals(dissolvedOxygen);
|
||||
}
|
||||
|
||||
public Double getTemperature() {
|
||||
return roundToTwoDecimals(temperature);
|
||||
}
|
||||
|
||||
public Double getSaturability() {
|
||||
return roundToTwoDecimals(saturability);
|
||||
}
|
||||
|
||||
public Double getPh() {
|
||||
return roundToTwoDecimals(ph);
|
||||
}
|
||||
|
||||
public Double getSalinity() {
|
||||
return roundToTwoDecimals(salinity);
|
||||
}
|
||||
|
||||
public Double getTreference() {
|
||||
return roundToTwoDecimals(treference);
|
||||
}
|
||||
|
||||
public Double getTfluorescence() {
|
||||
return roundToTwoDecimals(tfluorescence);
|
||||
}
|
||||
|
||||
public Double getPhaseDifference() {
|
||||
return roundToTwoDecimals(phaseDifference);
|
||||
}
|
||||
|
||||
public Double getBattery() {
|
||||
return roundToTwoDecimals(battery);
|
||||
}
|
||||
|
||||
// 工具方法:保留两位小数
|
||||
private Double roundToTwoDecimals(Double value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return BigDecimal.valueOf(value)
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
.doubleValue();
|
||||
}
|
||||
|
||||
// 标签字段(元数据,不随时间频繁变化)
|
||||
private String serialNum; // 设备序列号
|
||||
|
||||
Reference in New Issue
Block a user