liurunyu
2 天以前 5c514cf50eb825b02c839b5b0e6ba2a5880586bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package com.dy.common.mw.protocol4Mqtt.pSdV1.upVos;
 
import com.alibaba.fastjson2.annotation.JSONField;
import com.dy.common.mw.protocol4Mqtt.Vo4Up;
import com.dy.common.util.DateTime;
import lombok.Data;
 
/**
 * @Author: liurunyu
 * @Date: 2025/6/10 10:04
 * @Description
 */
@Data
public class WeatherVo implements Vo4Up {
    //{"PM10":10,"PM2.5":0,"flexem_message_id":1311,"flexem_timestamp":1749522958,"二氧化碳":10,"光照强度":0,"大气压力":20,"空气温度":0,"空气湿度":65}
    @JSONField(name = "flexem_message_id")
    public Integer messageId ;//消息ID
 
    public Integer no ;//测站编号,其不在JSON数据中,其在主题中
 
    //@JSONField(name = "二氧化碳")
    //public Integer carbonDioxide ;
 
    //@JSONField(name = "大气压力")
    //public Integer atmosphericPressure ;
 
    @JSONField(name = "空气温度")
    public Integer airTemperature ;
 
    @JSONField(name = "空气湿度")
    public Integer airHumidity ;
 
    @JSONField(name = "紫外线")
    public Integer ultraviolet ;
 
    @JSONField(name = "光照强度")
    public Integer lightIntensity ;
 
    @JSONField(name = "雨量")
    public Integer rainfall ;
 
    @JSONField(name = "风速")
    public Integer windSpeed ;
 
    @JSONField(name = "风向")
    public Integer windDirection ;
 
 
    @JSONField(name = "flexem_timestamp")
    public Long devDt ;//设备时间
 
    public String devDtStr ;//设备时间
 
    @Override
    public void setNo(Integer no ){
        this.no = no ;
    }
 
    public String getDevDtStr() {
        if(devDt != null){
            return DateTime.yyyy_MM_dd_HH_mm_ss(DateTime.getDate(devDt)) ;
        }else{
            return "" ;
        }
    }
 
    @Override
    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("气象数据=>") ;
        //sb.append(" 二氧化碳:" + carbonDioxide + ", ") ;
        //sb.append(" 大气压力:" + atmosphericPressure + ", ") ;
        sb.append(" 消息ID:" + messageId + ", ") ;
        sb.append(" 空气温度:" + airTemperature + ", ") ;
        sb.append(" 空气湿度:" + airHumidity + ", ") ;
        sb.append(" 紫外线:" + ultraviolet + ", ") ;
        sb.append(" 光照强度:" + lightIntensity + ", ") ;
        sb.append(" 雨量:" + rainfall + ", ") ;
        sb.append(" 风速:" + windSpeed + ", ") ;
        sb.append(" 风向:" + windDirection + ", ") ;
        sb.append(" 设备时间:" + devDt + ", ") ;
        sb.append(" 设备时间:" +  this.getDevDtStr() + ", ") ;
        sb.append("\n") ;
        return sb.toString() ;
    }
}