瀏覽代碼

获取天气增加日志

tags/v1.2.0^2
wanjing 1 年之前
父節點
當前提交
b2a91e81d7
共有 1 個文件被更改,包括 14 次插入0 次删除
  1. +14
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateWaittStatusService.java

+ 14
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateWaittStatusService.java 查看文件

@@ -101,12 +101,24 @@ public class UpdateWaittStatusService {
}

public JsonResult getWeather(String airportUrl, Integer airportId) {
log.info("获取天气信息begin");
String url = airportUrl + SystemConstant.API_AIRPORT_GET_WEATHER;
String param = "airportId=" + airportId;

log.info("获取天气信息, url={}", url);
log.info("获取天气信息, param={}", param);

String weatherStr = HttpUtils.sendGet(url, param);

log.info("获取天气信息, weatherStr1={}", weatherStr);

JsonResult jsonResult;
try {
log.info("获取天气信息, weatherStr2={}", weatherStr);
jsonResult = JacksonUtil.json2pojo(weatherStr, JsonResult.class);

log.info("获取天气信息, jsonResult={}", jsonResult);

if (ObjectUtil.isEmpty(jsonResult) || Objects.requireNonNull(jsonResult).getCode() != 0) {
log.info("获取天气信息失败,返回为空或code不为0");
log.info("获取天气信息失败,url={}", url);
@@ -117,7 +129,9 @@ public class UpdateWaittStatusService {
log.info("获取天气信息,返回数据为空");
return JsonResult.success(new AirWeatherVO());
}
log.info("获取天气信息, jsonResult.getData={}", jsonResult.getData());
AirWeatherVO airWeatherVO = JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData()), AirWeatherVO.class);
log.info("获取天气信息,airWeatherVO={}", airWeatherVO);
return JsonResult.success(airWeatherVO);
} catch (Exception e) {
log.info("获取天气信息异常,url={}", url);

Loading…
取消
儲存