| package com.dy.pipIrrGlobal.pojoRm; | 
|   | 
| import com.alibaba.fastjson2.annotation.JSONField; | 
| import com.alibaba.fastjson2.writer.ObjectWriterImplToString; | 
| import com.baomidou.mybatisplus.annotation.IdType; | 
| import com.baomidou.mybatisplus.annotation.TableId; | 
| import com.baomidou.mybatisplus.annotation.TableName; | 
| import com.dy.common.mw.protocol4Mqtt.MqttSubMsg; | 
| import com.dy.common.mw.protocol4Mqtt.pSdV1.upVos.WeatherVo; | 
| import com.dy.common.po.BaseEntity; | 
| import com.fasterxml.jackson.annotation.JsonFormat; | 
| import io.swagger.v3.oas.annotations.media.Schema; | 
| import lombok.*; | 
|   | 
| import java.util.Date; | 
|   | 
| /** | 
|  * @Author: liurunyu | 
|  * @Date: 2025/6/25 10:39 | 
|  * @Description | 
|  */ | 
| @TableName(value="rm_weather_history", autoResultMap = true) | 
| @Data | 
| @Builder | 
| @ToString | 
| @NoArgsConstructor | 
| @AllArgsConstructor | 
| @Schema(name = "气象历史数据") | 
| public class RmWeatherHistory implements BaseEntity { | 
|   | 
|     public static final long serialVersionUID = 202506251035002L; | 
|     /** | 
|      * 主键 | 
|      */ | 
|     @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) | 
|     @JSONField(serializeUsing= ObjectWriterImplToString.class) | 
|     @TableId(type = IdType.INPUT) | 
|     public Long id; | 
|   | 
|     /** | 
|      * 气象站实体外键id | 
|      */ | 
|     @Schema(description = "气象站实体外键id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     @JSONField(serializeUsing= ObjectWriterImplToString.class) | 
|     public Long weatherId; | 
|   | 
|     /** | 
|      * 数据上报时间(年月日时分秒) | 
|      */ | 
|     @Schema(description = "数据接收日期时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 
|     public Date dt; | 
|   | 
|     /** | 
|      * 空气温度 | 
|      */ | 
|     @Schema(description = "空气温度", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) | 
|     public Double airTemperature; | 
|   | 
|     /** | 
|      * 空气湿度 | 
|      */ | 
|     @Schema(description = "空气湿度", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) | 
|     public Double airHumidity; | 
|   | 
|     /** | 
|      * 紫外线 | 
|      */ | 
|     @Schema(description = "紫外线", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     public Integer ultraviolet; | 
|   | 
|     /** | 
|      * 光照强度 | 
|      */ | 
|     @Schema(description = "光照强度", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     public Integer lightIntensity; | 
|   | 
|     /** | 
|      * 雨量 | 
|      */ | 
|     @Schema(description = "雨量", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) | 
|     public Double rainfall; | 
|   | 
|     /** | 
|      * 风速 | 
|      */ | 
|     @Schema(description = "风速", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) | 
|     public Double windSpeed; | 
|   | 
|     /** | 
|      * 风向 | 
|      */ | 
|     @Schema(description = "风向", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|     public Integer windDirection; | 
|   | 
|     public void valueFrom(MqttSubMsg msg, WeatherVo cdData) throws Exception{ | 
|         this.dt = new Date(); | 
|         this.airTemperature = cdData.airTemperature==null?null:(0.0D + cdData.airTemperature) ; | 
|         this.airHumidity = cdData.airHumidity==null?null:(0.0D + cdData.airHumidity) ; | 
|         this.ultraviolet = cdData.ultraviolet ; | 
|         this.lightIntensity = cdData.lightIntensity ; | 
|         this.rainfall = cdData.rainfall==null?null:(0.0D + cdData.rainfall) ; | 
|         this.windSpeed = cdData.windSpeed==null?null:(0.0D + cdData.windSpeed) ; | 
|         this.windDirection = cdData.windDirection ; | 
|     } | 
| } |