fix(gift): 배송지 미입력 만료 상태 범위를 확장한다
This commit is contained in:
+6
-2
@@ -80,7 +80,11 @@ interface GiftRepository : JpaRepository<Gift, Long> {
|
||||
"""
|
||||
select g
|
||||
from Gift g
|
||||
where g.status = kr.co.vividnext.sodalive.v2.gift.domain.GiftStatus.TRACKING_REGISTERED
|
||||
where g.status in (
|
||||
kr.co.vividnext.sodalive.v2.gift.domain.GiftStatus.TRACKING_REGISTERED,
|
||||
kr.co.vividnext.sodalive.v2.gift.domain.GiftStatus.ARRIVED_AT_MAILBOX,
|
||||
kr.co.vividnext.sodalive.v2.gift.domain.GiftStatus.INSPECTION_COMPLETED
|
||||
)
|
||||
and exists (
|
||||
select d.id
|
||||
from GiftDelivery d
|
||||
@@ -90,7 +94,7 @@ interface GiftRepository : JpaRepository<Gift, Long> {
|
||||
)
|
||||
"""
|
||||
)
|
||||
fun findTrackingRegisteredGiftsWithRecipientAddressDeadlineBefore(
|
||||
fun findGiftsWithRecipientAddressDeadlineBefore(
|
||||
@Param("now") now: LocalDateTime
|
||||
): List<Gift>
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ class GiftScheduler(
|
||||
|
||||
@Transactional
|
||||
fun markExpiredRecipientAddressGiftsUndeliverable(now: LocalDateTime): Int {
|
||||
val expiredGifts = giftRepository.findTrackingRegisteredGiftsWithRecipientAddressDeadlineBefore(now)
|
||||
val expiredGifts = giftRepository.findGiftsWithRecipientAddressDeadlineBefore(now)
|
||||
expiredGifts.forEach { gift ->
|
||||
gift.status = GiftStatus.UNDELIVERABLE
|
||||
val delivery = requireNotNull(giftDeliveryRepository.findByGiftId(requireNotNull(gift.id)))
|
||||
|
||||
Reference in New Issue
Block a user