From 3bccc5fa80232e50ff470fe8a7379d8b144323df Mon Sep 17 00:00:00 2001 From: seheonnn Date: Fri, 5 Jul 2024 18:33:03 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20fix:=20=ED=95=98=EB=A3=A8=20=EB=82=A0?= =?UTF-8?q?=EC=94=A8=20=EC=A0=95=EB=B3=B4=20BaseTime=20=EB=B3=80=ED=99=98?= =?UTF-8?q?=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../waither/weatherservice/response/WeatherErrorCode.java | 6 +++--- .../com/waither/weatherservice/service/WeatherService.java | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/weather-service/src/main/java/com/waither/weatherservice/response/WeatherErrorCode.java b/weather-service/src/main/java/com/waither/weatherservice/response/WeatherErrorCode.java index 173c95ca..e927f8a3 100644 --- a/weather-service/src/main/java/com/waither/weatherservice/response/WeatherErrorCode.java +++ b/weather-service/src/main/java/com/waither/weatherservice/response/WeatherErrorCode.java @@ -15,9 +15,9 @@ public enum WeatherErrorCode implements BaseErrorCode { WEATHER_OPENAPI_ERROR(HttpStatus.BAD_REQUEST, "WEAT400_3", "OpenApi 관련 오류입니다."), WEATHER_MAIN_ERROR(HttpStatus.BAD_REQUEST, "WEAT400_2", "잘못된 위도, 경도입니다."), // 레디스에 캐싱 데이터가 없는 경우 WEATHER_URI_ERROR(HttpStatus.BAD_REQUEST, "WEAT400_3", "URI 변환에 실패하였습니다."), - REGION_NOT_FOUND(HttpStatus.NOT_FOUND, "WEAT400_4", "URI 변환에 실패하였습니다."), - DAILY_NOT_FOUND(HttpStatus.NOT_FOUND, "WEAT400_5", "URI 변환에 실패하였습니다."), - EXPECTED_NOT_FOUND(HttpStatus.NOT_FOUND, "WEAT400_6", "URI 변환에 실패하였습니다."), + REGION_NOT_FOUND(HttpStatus.NOT_FOUND, "WEAT400_4", "지역명을 찾을 수 없습니다."), + DAILY_NOT_FOUND(HttpStatus.NOT_FOUND, "WEAT400_5", "하루 날씨 정보를 찾을 수 없습니다."), + EXPECTED_NOT_FOUND(HttpStatus.NOT_FOUND, "WEAT400_6", "예상 날씨 정보를 찾을 수 없습니다."), ; private final HttpStatus httpStatus; diff --git a/weather-service/src/main/java/com/waither/weatherservice/service/WeatherService.java b/weather-service/src/main/java/com/waither/weatherservice/service/WeatherService.java index 9a29d4dd..f8b75b5f 100644 --- a/weather-service/src/main/java/com/waither/weatherservice/service/WeatherService.java +++ b/weather-service/src/main/java/com/waither/weatherservice/service/WeatherService.java @@ -173,7 +173,12 @@ public MainWeatherResponse getMainWeather(double latitude, double longitude) { String expectedWeatherKey = regionName + "_" + convertLocalDateTimeToString(now); - String dailyWeatherKey = regionName + "_" + convertLocalDateTimeToDailyWeatherTime(now); + LocalDateTime dailyWeatherBaseTime = convertLocalDateTimeToDailyWeatherTime(now); + + String dailyWeatherKey = regionName + "_" + convertLocalDateTimeToString(dailyWeatherBaseTime); + + log.info("[Main - api] dailyWeatherKey : {}", dailyWeatherKey); + log.info("[Main - api] expectedWeatherKey : {}", expectedWeatherKey); DailyWeather dailyWeather = dailyWeatherRepository.findById(dailyWeatherKey) .orElseThrow(() -> new WeatherExceptionHandler(WeatherErrorCode.DAILY_NOT_FOUND));