Pārlūkot izejas kodu

获取天气增加日志

tags/v1.2.0^2
wanjing pirms 1 gada
vecāks
revīzija
b2a91e81d7
1 mainītis faili ar 14 papildinājumiem un 0 dzēšanām
  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 Parādīt failu

@@ -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);

Notiek ielāde…
Atcelt
Saglabāt