Просмотр исходного кода

修改WeatherUtil工具类

tags/v1.1.0
wanghaoran 2 лет назад
Родитель
Сommit
83e1770b44
1 измененных файлов: 5 добавлений и 3 удалений
  1. +5
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/utils/WeatherUtil.java

+ 5
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/utils/WeatherUtil.java Просмотреть файл

@@ -3,15 +3,17 @@ package com.tuoheng.admin.utils;
import cn.hutool.core.util.ObjectUtil;
import com.tuoheng.admin.entity.vo.AirWeatherVO;

import java.math.BigDecimal;

public class WeatherUtil {

public static String getWeather(AirWeatherVO airWeather) {
if(ObjectUtil.isEmpty(airWeather) ||ObjectUtil.isEmpty(airWeather.getWth())){
return "";
}
return "气温:" + airWeather.getWth().getParm().getTmp()/10+"℃"
+ ";湿度:" + airWeather.getWth().getParm().getHum()/10+"RH"
+ ";风速:" + airWeather.getWth().getParm().getWspd()/10+"M/S"
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() + "°";
}
}

Загрузка…
Отмена
Сохранить