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 Float airTemperature ; @JSONField(name = "空气湿度") public Float airHumidity ; @JSONField(name = "紫外线") public Integer ultraviolet ; @JSONField(name = "光照强度") public Integer lightIntensity ; @JSONField(name = "雨量") public Float rainfall ; @JSONField(name = "风速") public Float 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() ; } }