Skip to content

Commit

Permalink
[Fix/#495] 시간 파싱 포멧 문제 해결 (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 authored Jan 7, 2025
1 parent e955868 commit e130349
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import com.few.crm.email.event.send.NotificationEmailSendTimeOutEvent
import com.few.crm.email.repository.ScheduledEventRepository
import com.few.crm.support.LocalDateTimeExtension
import com.few.crm.support.jpa.CrmTransactional
import com.few.crm.support.parse
import com.few.crm.support.parseEventTime
import com.few.crm.support.parseExpiredTime
import com.few.crm.support.toScheduleTime
import event.EventRePlayer
import io.github.oshai.kotlinlogging.KotlinLogging
Expand All @@ -20,9 +21,9 @@ fun JsonNode.templateId() = this["templateId"].asLong()

fun JsonNode.userIds() = this["userIds"].map { it.asLong() }

fun JsonNode.eventTime() = LocalDateTimeExtension().parse(this["eventTime"].asText())
fun JsonNode.eventTime() = LocalDateTimeExtension().parseEventTime(this["eventTime"].asText())

fun JsonNode.expiredTime() = LocalDateTimeExtension().parse(this["expiredTime"].asText())
fun JsonNode.expiredTime() = LocalDateTimeExtension().parseExpiredTime(this["expiredTime"].asText())

@Component
class NotificationEmailSendTimeOutEventReplayer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter

fun LocalDateTimeExtension.parse(date: String): LocalDateTime = LocalDateTime.parse(date, LocalDateTimeExtension.dateTimeFormatter)
fun LocalDateTimeExtension.parseEventTime(date: String): LocalDateTime =
LocalDateTime.parse(date, LocalDateTimeExtension.eventTimeFormatter)

fun LocalDateTimeExtension.parseExpiredTime(date: String): LocalDateTime =
LocalDateTime.parse(date, LocalDateTimeExtension.expiredTimeFormatter)

fun LocalDateTime.toScheduleTime(): Instant =
Instant.ofEpochSecond(
Expand All @@ -19,6 +23,7 @@ fun LocalDateTime.toScheduleTime(): Instant =

class LocalDateTimeExtension {
companion object {
val dateTimeFormatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSS")
val eventTimeFormatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS")
val expiredTimeFormatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")
}
}

0 comments on commit e130349

Please sign in to comment.