관리자 - 이벤트 배너

- 이벤트 기간 설정을 시간:분 까지 설정하도록 수정
This commit is contained in:
Klaus 2025-03-14 02:13:42 +09:00
parent 3ef1a732e5
commit 287d133080
2 changed files with 8 additions and 8 deletions

View File

@ -59,7 +59,7 @@ class AdminEventBannerQueryRepositoryImpl(
"UTC", "UTC",
"Asia/Seoul" "Asia/Seoul"
), ),
"%Y-%m-%d" "%Y-%m-%d %H:%i"
) )
} }

View File

@ -10,7 +10,7 @@ import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional import org.springframework.transaction.annotation.Transactional
import org.springframework.web.multipart.MultipartFile import org.springframework.web.multipart.MultipartFile
import java.time.LocalDate import java.time.LocalDateTime
import java.time.ZoneId import java.time.ZoneId
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
@ -36,13 +36,13 @@ class AdminEventBannerService(
): Long { ): Long {
if (detail == null && link.isNullOrBlank()) throw SodaException("상세이미지 혹은 링크를 등록하세요") if (detail == null && link.isNullOrBlank()) throw SodaException("상세이미지 혹은 링크를 등록하세요")
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
val startDate = LocalDate.parse(startDateString, dateTimeFormatter).atTime(0, 0) val startDate = LocalDateTime.parse(startDateString, dateTimeFormatter)
.atZone(ZoneId.of("Asia/Seoul")) .atZone(ZoneId.of("Asia/Seoul"))
.withZoneSameInstant(ZoneId.of("UTC")) .withZoneSameInstant(ZoneId.of("UTC"))
.toLocalDateTime() .toLocalDateTime()
val endDate = LocalDate.parse(endDateString, dateTimeFormatter).atTime(23, 59, 59) val endDate = LocalDateTime.parse(endDateString, dateTimeFormatter).withSecond(59)
.atZone(ZoneId.of("Asia/Seoul")) .atZone(ZoneId.of("Asia/Seoul"))
.withZoneSameInstant(ZoneId.of("UTC")) .withZoneSameInstant(ZoneId.of("UTC"))
.toLocalDateTime() .toLocalDateTime()
@ -172,16 +172,16 @@ class AdminEventBannerService(
event.isAdult = isAdult event.isAdult = isAdult
} }
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
if (startDateString != null) { if (startDateString != null) {
event.startDate = LocalDate.parse(startDateString, dateTimeFormatter).atTime(0, 0) event.startDate = LocalDateTime.parse(startDateString, dateTimeFormatter)
.atZone(ZoneId.of("Asia/Seoul")) .atZone(ZoneId.of("Asia/Seoul"))
.withZoneSameInstant(ZoneId.of("UTC")) .withZoneSameInstant(ZoneId.of("UTC"))
.toLocalDateTime() .toLocalDateTime()
} }
if (endDateString != null) { if (endDateString != null) {
event.endDate = LocalDate.parse(endDateString, dateTimeFormatter).atTime(23, 59, 59) event.endDate = LocalDateTime.parse(endDateString, dateTimeFormatter).withSecond(59)
.atZone(ZoneId.of("Asia/Seoul")) .atZone(ZoneId.of("Asia/Seoul"))
.withZoneSameInstant(ZoneId.of("UTC")) .withZoneSameInstant(ZoneId.of("UTC"))
.toLocalDateTime() .toLocalDateTime()