|
@@ -1,7 +1,6 @@
|
|
|
package com.gyee.dataadapter.entity;
|
|
|
|
|
|
-import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
-import com.fasterxml.jackson.annotation.JsonInclude;
|
|
|
+import com.fasterxml.jackson.annotation.*;
|
|
|
import com.gyee.dataadapter.dao.TsDataType;
|
|
|
|
|
|
import java.util.Date;
|
|
@@ -14,20 +13,23 @@ public class PointData {
|
|
|
* 时间戳
|
|
|
*/
|
|
|
private long ts;
|
|
|
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
|
private Date time;
|
|
|
- //@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
|
private String tagName;
|
|
|
/**
|
|
|
* 数据
|
|
|
*/
|
|
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
|
+// @JsonSetter(nulls = Nulls.SKIP)
|
|
|
private Double doubleValue;
|
|
|
/**
|
|
|
* Boolean 数据
|
|
|
*/
|
|
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
|
+// @JsonSetter(nulls = Nulls.SKIP)
|
|
|
private Boolean booleanValue;
|
|
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
|
+// @JsonSetter(nulls = Nulls.SKIP)
|
|
|
private Long longValue;
|
|
|
|
|
|
public PointData() {
|
|
@@ -51,9 +53,9 @@ public class PointData {
|
|
|
|
|
|
@JsonIgnore
|
|
|
public TsDataType getDataType() {
|
|
|
- if (booleanValue != null) {
|
|
|
+ if (booleanValue != null && booleanValue) {
|
|
|
return TsDataType.BOOLEAN;
|
|
|
- } else if (longValue != null) {
|
|
|
+ } else if (longValue != null && longValue != 0) {
|
|
|
return TsDataType.LONG;
|
|
|
}
|
|
|
return TsDataType.DOUBLE;
|
|
@@ -105,9 +107,9 @@ public class PointData {
|
|
|
|
|
|
@JsonIgnore
|
|
|
public Double getValue() {
|
|
|
- if (booleanValue != null) {
|
|
|
- return booleanValue ? 1.0 : 0.0;
|
|
|
- } else if (longValue != null) {
|
|
|
+ if (booleanValue != null && booleanValue) {
|
|
|
+ return 1.0;
|
|
|
+ } else if (longValue != null && longValue != 0) {
|
|
|
doubleValue = Double.valueOf(longValue);
|
|
|
}
|
|
|
return doubleValue;
|