From 51485e57a4927d225418871d3747794cad0e5133 Mon Sep 17 00:00:00 2001 From: seheonnn Date: Mon, 1 Jul 2024 16:08:42 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20OpenApi=20baseTime=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../waither/weatherservice/batch/DailyWeatherTasklet.java | 6 +++--- .../weatherservice/batch/ExpectedWeatherTasklet.java | 6 +++--- .../com/waither/weatherservice/openapi/OpenApiUtil.java | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/weather-service/src/main/java/com/waither/weatherservice/batch/DailyWeatherTasklet.java b/weather-service/src/main/java/com/waither/weatherservice/batch/DailyWeatherTasklet.java index 69491f03..da6bc41d 100644 --- a/weather-service/src/main/java/com/waither/weatherservice/batch/DailyWeatherTasklet.java +++ b/weather-service/src/main/java/com/waither/weatherservice/batch/DailyWeatherTasklet.java @@ -22,9 +22,9 @@ public class DailyWeatherTasklet implements Tasklet { private final WeatherService weatherService; @Override - public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { - LocalDateTime now = LocalDateTime.now(); - String[] dateTime = weatherService.convertLocalDateTimeToString(now).split("_"); + public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) { + LocalDateTime baseTime = LocalDateTime.now().minusHours(1); + String[] dateTime = weatherService.convertLocalDateTimeToString(baseTime).split("_"); List regionList = weatherService.getRegionList(); regionList.stream() .forEach(region -> { diff --git a/weather-service/src/main/java/com/waither/weatherservice/batch/ExpectedWeatherTasklet.java b/weather-service/src/main/java/com/waither/weatherservice/batch/ExpectedWeatherTasklet.java index 314e67ce..d901dc87 100644 --- a/weather-service/src/main/java/com/waither/weatherservice/batch/ExpectedWeatherTasklet.java +++ b/weather-service/src/main/java/com/waither/weatherservice/batch/ExpectedWeatherTasklet.java @@ -22,9 +22,9 @@ public class ExpectedWeatherTasklet implements Tasklet { private final WeatherService weatherService; @Override - public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { - LocalDateTime now = LocalDateTime.now(); - String[] dateTime = weatherService.convertLocalDateTimeToString(now).split("_"); + public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) { + LocalDateTime baseTime = LocalDateTime.now().minusHours(1); + String[] dateTime = weatherService.convertLocalDateTimeToString(baseTime).split("_"); List regionList = weatherService.getRegionList(); regionList.stream() .forEach(region -> { diff --git a/weather-service/src/main/java/com/waither/weatherservice/openapi/OpenApiUtil.java b/weather-service/src/main/java/com/waither/weatherservice/openapi/OpenApiUtil.java index 01e8424c..ffc66ad6 100644 --- a/weather-service/src/main/java/com/waither/weatherservice/openapi/OpenApiUtil.java +++ b/weather-service/src/main/java/com/waither/weatherservice/openapi/OpenApiUtil.java @@ -150,7 +150,6 @@ public String convertLocalDateToString(LocalDate localDate) { return localDate.format(formatter); } - // TODO AccuWeather 대기 정보로 변경 예정 public List callAirKorea(String searchDate) throws URISyntaxException { int pageNo = 1; int numOfRows = 10;