This commit is contained in:
parent
80f22702b1
commit
50bd48b0e1
|
|
@ -40,15 +40,10 @@ public class WeatherDomainImpl implements IWeatherDomain {
|
|||
try {
|
||||
|
||||
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
||||
|
||||
String json = EntityUtils.toString(response.getEntity());
|
||||
System.out.println(json);
|
||||
|
||||
// 将JSON字符串转换为对象
|
||||
WeatherResponse weatherResponse = JSON.parseObject(json, WeatherResponse.class);
|
||||
|
||||
// 降雨量(枚举值:0-无雨,1-小雨,2-中雨,3-大雨)
|
||||
|
||||
// 使用转换后的对象
|
||||
if (weatherResponse != null && weatherResponse.getCode() == 0) {
|
||||
//转换风速:将风力等级转换为风速中间值
|
||||
|
|
|
|||
Loading…
Reference in New Issue