From caa629c36d699fe3b359aa7b07a94a6199a096d8 Mon Sep 17 00:00:00 2001 From: Heo Junseo <107256859+Junseo0324@users.noreply.github.com> Date: Fri, 14 Nov 2025 17:09:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EB=94=94=EB=B2=84=EA=B9=85=20?= =?UTF-8?q?=EC=97=B0=EC=8A=B5=EB=AC=B8=EC=A0=9C=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/YukymController.kt | 65 +++++++++++------------------- 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/src/main/kotlin/YukymController.kt b/src/main/kotlin/YukymController.kt index cd4bba7..37837bf 100644 --- a/src/main/kotlin/YukymController.kt +++ b/src/main/kotlin/YukymController.kt @@ -5,59 +5,40 @@ import java.time.format.DateTimeFormatter class YukymController { - val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-mm-dd")) - - lateinit var nowTime: String + val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) fun getTyA(): String { - val timeDataOne = _getTimeDataOne(nowDate) - - if (timeDataOne.isNotEmpty()) { - nowTime = timeDataOne.first().ty1 - - val month = nowDate.substring(5, 7) - return when (month) { - "01", "02" -> "경오1국" - "03", "04" -> "경오2국" - "05", "06" -> "경오3국" - "07", "08" -> "경오4국" - "09", "10" -> "경오5국" - "11", "12" -> "경오6국" - else -> nowTime - } - } else { - return "경오7국" + val month = nowDate.substring(5, 7) + return when (month) { + "01", "02" -> "경오1국" + "03", "04" -> "경오2국" + "05", "06" -> "경오3국" + "07", "08" -> "경오4국" + "09", "10" -> "경오5국" + "11", "12" -> "경오6국" + else -> "경오7국" } } fun getTyB(): String { - val timeDataOne = _getTimeDataOne(nowDate) - var result = timeDataOne.first().ty12 - + val timeData = YukymTimeModel() val nowTime = LocalDateTime.now() - when { - nowTime.hour >= 0 || nowTime.hour < 2 -> return timeDataOne.first().ty1 - nowTime.hour >= 4 || nowTime.hour < 6 -> return timeDataOne.first().ty2 - nowTime.hour >= 6 || nowTime.hour < 8 -> return timeDataOne.first().ty3 - nowTime.hour >= 8 || nowTime.hour < 10 -> return timeDataOne.first().ty4 - nowTime.hour >= 10 || nowTime.hour < 12 -> return timeDataOne.first().ty5 - nowTime.hour >= 12 || nowTime.hour < 14 -> return timeDataOne.first().ty6 - nowTime.hour >= 16 || nowTime.hour < 18 -> return timeDataOne.first().ty7 - nowTime.hour >= 18 || nowTime.hour < 20 -> return timeDataOne.first().ty8 - nowTime.hour >= 20 || nowTime.hour < 22 -> return timeDataOne.first().ty9 - nowTime.hour >= 22 || nowTime.hour < 24 -> return timeDataOne.first().ty10 + when (nowTime.hour) { + in 0..1 -> return timeData.ty1 + in 4..5 -> return timeData.ty2 + in 6..7 -> return timeData.ty3 + in 8..9 -> return timeData.ty4 + in 10..11 -> return timeData.ty5 + in 12..13 -> return timeData.ty6 + in 16..17 -> return timeData.ty7 + in 18..19 -> return timeData.ty8 + in 20..21 -> return timeData.ty9 + in 22..23 -> return timeData.ty10 } - return result + return timeData.ty12 } - private fun _getTimeDataOne(nowDate: String): List { - val timeDataOne = mutableListOf() - for (i in 0..24) { - timeDataOne.add(YukymTimeModel()) - } - return timeDataOne - } } data class YukymTimeModel( From 28c8feaf561808b2954b01a32ddcdf3b22cd3e76 Mon Sep 17 00:00:00 2001 From: Heo Junseo <107256859+Junseo0324@users.noreply.github.com> Date: Fri, 14 Nov 2025 17:22:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=EB=94=94=EB=B2=84=EA=B9=85=20?= =?UTF-8?q?=EC=97=B0=EC=8A=B5=EB=AC=B8=EC=A0=9C=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/YukymController.kt | 42 ++++++++++++++---------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/main/kotlin/YukymController.kt b/src/main/kotlin/YukymController.kt index 37837bf..a553a84 100644 --- a/src/main/kotlin/YukymController.kt +++ b/src/main/kotlin/YukymController.kt @@ -5,38 +5,36 @@ import java.time.format.DateTimeFormatter class YukymController { - val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + val nowDate = LocalDateTime.now() fun getTyA(): String { - val month = nowDate.substring(5, 7) - return when (month) { - "01", "02" -> "경오1국" - "03", "04" -> "경오2국" - "05", "06" -> "경오3국" - "07", "08" -> "경오4국" - "09", "10" -> "경오5국" - "11", "12" -> "경오6국" + return when (nowDate.monthValue) { + 1,2 -> "경오1국" + 3,4 -> "경오2국" + 5,6 -> "경오3국" + 7,8 -> "경오4국" + 9,10 -> "경오5국" + 11,12 -> "경오6국" else -> "경오7국" } } fun getTyB(): String { val timeData = YukymTimeModel() - val nowTime = LocalDateTime.now() - when (nowTime.hour) { - in 0..1 -> return timeData.ty1 - in 4..5 -> return timeData.ty2 - in 6..7 -> return timeData.ty3 - in 8..9 -> return timeData.ty4 - in 10..11 -> return timeData.ty5 - in 12..13 -> return timeData.ty6 - in 16..17 -> return timeData.ty7 - in 18..19 -> return timeData.ty8 - in 20..21 -> return timeData.ty9 - in 22..23 -> return timeData.ty10 + return when (nowDate.hour) { + in 0..1 -> timeData.ty1 + in 4..5 -> timeData.ty2 + in 6..7 -> timeData.ty3 + in 8..9 -> timeData.ty4 + in 10..11 -> timeData.ty5 + in 12..13 -> timeData.ty6 + in 16..17 -> timeData.ty7 + in 18..19 -> timeData.ty8 + in 20..21 -> timeData.ty9 + in 22..23 -> timeData.ty10 + else -> timeData.ty12 } - return timeData.ty12 } }