-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ feat: 체감온도 계산식 구현 및 api 구현 #155
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bfa8717
✨ feat: 체감온도 계산식 구현 및 Kafka 연결
seheonnn c4e7372
♻️ refactor: 패키지 수정
seheonnn eea895d
♻️ refactor: Redis 캐싱 시간 변경
seheonnn 5489638
♻️ refactor: 체감온도 조회 api 구현
seheonnn 066ad70
♻️ refactor: 체감온도 조회 api 구현
seheonnn 33c5054
♻️ refactor: 체감온도 조회 api 구현
seheonnn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...her-service/src/main/java/com/waither/weatherservice/dto/request/GetWindChillRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.waither.weatherservice.dto.request; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import jakarta.validation.constraints.DecimalMax; | ||
import jakarta.validation.constraints.DecimalMin; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record GetWindChillRequest( | ||
@NotNull(message = "[ERROR] 위도 입력은 필수 입니다.") | ||
@DecimalMin(value = "33.0", message = "[ERROR] 위도는 33.0도에서 43.0도 사이여야 합니다.") | ||
@DecimalMax(value = "43.0", message = "[ERROR] 위도는 33.0도에서 43.0도 사이여야 합니다.") | ||
Double latitude, | ||
@NotNull(message = "[ERROR] 경도 입력은 필수 입니다.") | ||
@DecimalMin(value = "124.0", message = "[ERROR] 경도는 124.0도에서 132.0도 사이여야 합니다.") | ||
@DecimalMax(value = "132.0", message = "[ERROR] 경도는 124.0도에서 132.0도 사이여야 합니다.") | ||
Double longitude, | ||
@NotNull(message = "[ERROR] 날짜 입력은 필수 입니다.") | ||
LocalDateTime baseTime | ||
) | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
weather-service/src/main/java/com/waither/weatherservice/utills/DateTimeUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.waither.weatherservice.utills; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class DateTimeUtils { | ||
|
||
public static LocalDateTime convertLocalDateTimeToDailyWeatherTime(LocalDateTime time) { | ||
|
||
// DailyWeather 정보는 3시간마다 | ||
List<Integer> scheduledHours = Arrays.asList(0, 3, 6, 9, 12, 15, 18, 21); | ||
|
||
int currentHour = time.getHour(); | ||
int adjustedHour = scheduledHours.stream() | ||
.filter(hour -> hour <= currentHour) | ||
.reduce((first, second) -> second) | ||
.orElse(scheduledHours.get(scheduledHours.size() - 1)); // 이전 날의 마지막 스케줄 시간(21시) 반환 | ||
|
||
// 현재 시간이 첫 스케줄 시간(0시)보다 작을 경우, 전날의 마지막 스케줄 시간으로 설정 | ||
if (currentHour < scheduledHours.get(0)) { | ||
time = time.minusDays(1); | ||
} | ||
|
||
return time.withHour(adjustedHour).withMinute(0).withSecond(0).withNano(0); | ||
} | ||
|
||
public static String convertLocalDateTimeToString(LocalDateTime time) { | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | ||
String formattedDateTime = time.format(formatter); | ||
|
||
String[] lst = formattedDateTime.split(" "); | ||
String baseDate = lst[0].replace("-", ""); | ||
|
||
String[] temp = lst[1].split(":"); | ||
String baseTime = temp[0] + "00"; | ||
|
||
return baseDate + "_" + baseTime; | ||
} | ||
|
||
public static String convertLocalDateToString(LocalDate localDate) { | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); | ||
return localDate.format(formatter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../waither/weatherservice/gps/LatXLngY.java → ...ither/weatherservice/utills/LatXLngY.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.waither.weatherservice.gps; | ||
package com.waither.weatherservice.utills; | ||
|
||
import lombok.Builder; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 오타 주의해주세요 ㅡㅡ