diff --git a/domain/crm/src/main/kotlin/com/few/crm/email/event/send/replayer/NotificationEmailSendTimeOutEventReplayer.kt b/domain/crm/src/main/kotlin/com/few/crm/email/event/send/replayer/NotificationEmailSendTimeOutEventReplayer.kt index 2c1a168f0..576ae4d16 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/email/event/send/replayer/NotificationEmailSendTimeOutEventReplayer.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/email/event/send/replayer/NotificationEmailSendTimeOutEventReplayer.kt @@ -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 @@ -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( diff --git a/domain/crm/src/main/kotlin/com/few/crm/support/LocalDateTimeExtension.kt b/domain/crm/src/main/kotlin/com/few/crm/support/LocalDateTimeExtension.kt index 5dbbf0f2b..70011ac27 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/support/LocalDateTimeExtension.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/support/LocalDateTimeExtension.kt @@ -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( @@ -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") } } \ No newline at end of file