Skip to content

Commit ff0d992

Browse files
committed
test commit to check ktlint
1 parent 66f1d70 commit ff0d992

File tree

9 files changed

+63
-19
lines changed

9 files changed

+63
-19
lines changed

src/main/kotlin/com/back/koreaTravelGuide/domain/ai/weather/dto/LandForecastData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.back.koreaTravelGuide.domain.ai.weather.dto
22

33
@Suppress("unused") // JSON 직렬화를 위해 필요
4-
class LandForecastData(
4+
data class LandForecastData(
55
private val days: MutableMap<Int, LandForecastInfo?> = mutableMapOf(),
66
) {
77
fun setDay(
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.back.koreaTravelGuide.domain.ai.weather.dto
22

33
data class MidForecastDto(
4-
val regionCode: String,
5-
val baseTime: String,
6-
val precipitation: String,
7-
val temperature: String,
8-
val maritime: String,
9-
val variability: String,
4+
val regionCode: String?,
5+
val baseTime: String?,
6+
val precipitation: String?,
7+
val temperature: String?,
8+
val maritime: String?,
9+
val variability: String?,
1010
)
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
package com.back.koreaTravelGuide.domain.ai.weather.dto
22

33
data class TemperatureAndLandForecastDto(
4-
val a: String,
4+
val regionCode: String?,
5+
val baseTime: String?,
6+
val minTemp : Int?,
7+
val maxTemp : Int?,
8+
val minTempRange : String?,
9+
val maxTempRange : String?,
10+
val amRainPercent : Int?,
11+
val pmRainPercent : Int?,
12+
val amWeather : String?,
13+
val pmWeather : String?,
514
)

src/main/kotlin/com/back/koreaTravelGuide/domain/ai/weather/dto/TemperatureData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.back.koreaTravelGuide.domain.ai.weather.dto
22

33
// TODO: 날씨 내부 데이터 구조 - 기상청 API 응답 데이터 매핑용 내부 클래스들
44
@Suppress("unused") // JSON 직렬화를 위해 필요
5-
class TemperatureData(
5+
data class TemperatureData(
66
private val days: MutableMap<Int, TemperatureInfo?> = mutableMapOf(),
77
) {
88
fun setDay(

src/main/kotlin/com/back/koreaTravelGuide/domain/ai/weather/dto/parser/DtoParser.kt

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,48 @@ class DtoParser {
5656
}
5757

5858
fun parseTemperatureAndLandForecast(
59+
regionCode: String,
60+
baseTime: String,
5961
temperatureData: TemperatureData,
6062
landForecastData: LandForecastData,
61-
): TemperatureAndLandForecastDto {
62-
return TemperatureAndLandForecastDto(
63-
"a",
64-
)
63+
): List<TemperatureAndLandForecastDto> {
64+
val resultList = mutableListOf<TemperatureAndLandForecastDto>()
65+
66+
for(i in 4..10) {
67+
val tempInfo = temperatureData.getDay(i)
68+
val landInfo = landForecastData.getDay(i)
69+
70+
if (tempInfo == null || landInfo == null) {
71+
continue
72+
}
73+
74+
val minTemp = tempInfo.minTemp
75+
val maxTemp = tempInfo.maxTemp
76+
val minTempRange = tempInfo.minTempRange
77+
val maxTempRange = tempInfo.maxTempRange
78+
79+
val amRainPercent = landInfo.amRainPercent
80+
val pmRainPercent = landInfo.pmRainPercent
81+
val amWeather = landInfo.amWeather
82+
val pmWeather = landInfo.pmWeather
83+
84+
// 각 날짜별로 필요한 처리를 수행합니다.
85+
val dto = TemperatureAndLandForecastDto(
86+
regionCode = regionCode,
87+
baseTime = baseTime,
88+
minTemp = minTemp,
89+
maxTemp = maxTemp,
90+
minTempRange = minTempRange,
91+
maxTempRange = maxTempRange,
92+
amRainPercent = amRainPercent,
93+
pmRainPercent = pmRainPercent,
94+
amWeather = amWeather,
95+
pmWeather = pmWeather,
96+
)
97+
98+
resultList.add(dto)
99+
}
100+
101+
return resultList
65102
}
66103
}

src/main/kotlin/com/back/koreaTravelGuide/domain/ai/weather/service/WeatherService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ class WeatherService(
3434
fun fetchTemperatureAndLandForecast(
3535
actualRegionCode: String,
3636
actualBaseTime: String,
37-
): TemperatureAndLandForecastDto? {
37+
): List<TemperatureAndLandForecastDto>? {
3838
val tempInfo = weatherApiClient.fetchTemperature(actualRegionCode, actualBaseTime)
3939
val landInfo = weatherApiClient.fetchLandForecast(actualRegionCode, actualBaseTime)
4040

4141
if (tempInfo == null || landInfo == null) return null
4242

43-
return parser.parseTemperatureAndLandForecast(tempInfo, landInfo)
43+
return parser.parseTemperatureAndLandForecast(actualRegionCode, actualBaseTime, tempInfo, landInfo)
4444
}
4545

4646
@CacheEvict(cacheNames = ["weatherMidFore", "weatherTempAndLandFore"], allEntries = true)

src/main/kotlin/com/back/koreaTravelGuide/domain/ai/weather/service/WeatherServiceCore.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class WeatherServiceCore(
2222
location: String?,
2323
regionCode: String?,
2424
baseTime: String?,
25-
): TemperatureAndLandForecastDto? {
25+
): List<TemperatureAndLandForecastDto>? {
2626
val actualLocation = location ?: "서울"
2727
val actualRegionCode = regionCode ?: tools.getRegionCodeFromLocation(actualLocation)
2828

src/test/kotlin/com/back/koreaTravelGuide/WeatherApiRealTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package com.back.koreaTravelGuide.application
2-
31
import com.fasterxml.jackson.databind.ObjectMapper
42
import io.github.cdimascio.dotenv.dotenv
53
import org.junit.jupiter.api.BeforeAll

src/test/kotlin/com/back/koreaTravelGuide/domain/ai/tour/client/TourApiClientTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.back.koreaTravelGuide.domain.ai.tour.client
22

3-
import com.back.koreaTravelGuide.application.KoreaTravelGuideApplication
3+
import com.back.koreaTravelGuide.KoreaTravelGuideApplication
44
import com.back.koreaTravelGuide.domain.ai.tour.dto.InternalData
55
import com.back.koreaTravelGuide.domain.ai.tour.dto.TourResponse
66
import com.fasterxml.jackson.databind.ObjectMapper

0 commit comments

Comments
 (0)