package com.gyee.dataadapter.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import com.gyee.dataadapter.dao.TsDataType; import java.util.Date; /** * 测点数据 */ public class PointData { /** * 时间戳 */ private Date time; @JsonIgnore private String tagName; /** * 数据 */ private double doubleValue; /** * boolean 数据 */ private boolean booleanValue; private long longValue; public PointData() { } public PointData(Date time, double doubleValue) { this.time = time; this.doubleValue = doubleValue; } public long getTs() { return time.getTime(); } @JsonIgnore public TsDataType getDataType() { if (booleanValue) { return TsDataType.BOOLEAN; } else if (longValue != 0) { return TsDataType.LONG; } return TsDataType.DOUBLE; } public void setBooleanValue(boolean booleanValue) { this.booleanValue = booleanValue; } public void setLongValue(long longValue) { this.longValue = longValue; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } public String getTagName() { return tagName; } public void setTagName(String tagName) { this.tagName = tagName; } public double getValue() { if (booleanValue) { return 1; } else if (longValue != 0) { doubleValue = longValue; } return doubleValue; } public void setDoubleValue(double doubleValue) { this.doubleValue = doubleValue; } }