PointData.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package com.gyee.dataadapter.entity;
  2. import com.fasterxml.jackson.annotation.JsonIgnore;
  3. import com.gyee.dataadapter.dao.TsDataType;
  4. import java.util.Date;
  5. /**
  6. * 测点数据
  7. */
  8. public class PointData {
  9. /**
  10. * 时间戳
  11. */
  12. private Date time;
  13. @JsonIgnore
  14. private String tagName;
  15. /**
  16. * 数据
  17. */
  18. private double doubleValue;
  19. /**
  20. * boolean 数据
  21. */
  22. private boolean booleanValue;
  23. private long longValue;
  24. public PointData() {
  25. }
  26. public PointData(Date time, double doubleValue) {
  27. this.time = time;
  28. this.doubleValue = doubleValue;
  29. }
  30. public long getTs() {
  31. return time.getTime();
  32. }
  33. @JsonIgnore
  34. public TsDataType getDataType() {
  35. if (booleanValue) {
  36. return TsDataType.BOOLEAN;
  37. } else if (longValue != 0) {
  38. return TsDataType.LONG;
  39. }
  40. return TsDataType.DOUBLE;
  41. }
  42. public void setBooleanValue(boolean booleanValue) {
  43. this.booleanValue = booleanValue;
  44. }
  45. public void setLongValue(long longValue) {
  46. this.longValue = longValue;
  47. }
  48. public Date getTime() {
  49. return time;
  50. }
  51. public void setTime(Date time) {
  52. this.time = time;
  53. }
  54. public String getTagName() {
  55. return tagName;
  56. }
  57. public void setTagName(String tagName) {
  58. this.tagName = tagName;
  59. }
  60. public double getValue() {
  61. if (booleanValue) {
  62. return 1;
  63. } else if (longValue != 0) {
  64. doubleValue = longValue;
  65. }
  66. return doubleValue;
  67. }
  68. public void setDoubleValue(double doubleValue) {
  69. this.doubleValue = doubleValue;
  70. }
  71. }