瀏覽代碼

调整获取添加获取参数

tags/v1.2.0^2
wanjing 1 年之前
父節點
當前提交
1a4119542a
共有 2 個檔案被更改,包括 21 行新增5 行删除
  1. +5
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/AirWeatherUtil.java
  2. +16
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/AirWeatherVO.java

+ 5
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/AirWeatherUtil.java 查看文件

@@ -8,12 +8,12 @@ import java.math.BigDecimal;
public class AirWeatherUtil {

public static String getWeather(AirWeatherVO airWeather) {
if(ObjectUtil.isEmpty(airWeather) ||ObjectUtil.isEmpty(airWeather.getWth())){
if (ObjectUtil.isEmpty(airWeather) || ObjectUtil.isEmpty(airWeather.getWth())) {
return "";
}
return "气温:" + new BigDecimal(airWeather.getWth().getParm().getTmp()).divide(new BigDecimal(10))+"℃"
+ ";湿度:" + new BigDecimal(airWeather.getWth().getParm().getHum()).divide(new BigDecimal(10))+"RH"
+ ";风速:" + new BigDecimal(airWeather.getWth().getParm().getWspd()).divide(new BigDecimal(10))+"M/S"
+ ";风向:" + airWeather.getWth().getParm().getWdir() + "°";
return "气温:" + airWeather.getWth().getParmNew().getTmp() + "℃"
+ ";湿度:" + airWeather.getWth().getParmNew().getHum() + "RH"
+ ";风速:" + airWeather.getWth().getParmNew().getWspd() + "M/S"
+ ";风向:" + airWeather.getWth().getParmNew().getWdirname();
}
}

+ 16
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/AirWeatherVO.java 查看文件

@@ -40,6 +40,7 @@ public class AirWeatherVO implements Serializable {
@Data
public static class WTHDTO {
private ParmDTO parm;
private ParmNewDTO parmNew;
private Integer mid;
private String deviceid;
private Integer timestamp;
@@ -61,6 +62,21 @@ public class AirWeatherVO implements Serializable {
private Integer pm10;
private Integer wdir;
}

@NoArgsConstructor
@Data
public static class ParmNewDTO {
private Double hum;
private Double noise;
private Double rainfull;
private Double tmp;
private String wdirname;
private Double dew;
private Double wspd;
private Double hpa;
private Double wdir;
private Double lux;
}
}

@NoArgsConstructor

Loading…
取消
儲存