This commit is contained in:
孙小云 2026-01-30 14:52:28 +08:00
parent 80f22702b1
commit 50bd48b0e1
1 changed files with 0 additions and 5 deletions

View File

@ -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) {
//转换风速将风力等级转换为风速中间值