diff --git a/src/main/java/com/dnd/gongmuin/chat_inquiry/repository/ChatInquiryQueryRepository.java b/src/main/java/com/dnd/gongmuin/chat_inquiry/repository/ChatInquiryQueryRepository.java index f77c5c22..e8a326e4 100644 --- a/src/main/java/com/dnd/gongmuin/chat_inquiry/repository/ChatInquiryQueryRepository.java +++ b/src/main/java/com/dnd/gongmuin/chat_inquiry/repository/ChatInquiryQueryRepository.java @@ -1,5 +1,6 @@ package com.dnd.gongmuin.chat_inquiry.repository; +import java.time.LocalDateTime; import java.util.List; import org.springframework.data.domain.Pageable; @@ -14,7 +15,7 @@ public interface ChatInquiryQueryRepository { List getAutoRejectedInquirerIds(); - void updateChatInquiryStatusRejected(); + void updateChatInquiryStatusRejected(LocalDateTime now); List getAutoRejectedChatInquiries(); } diff --git a/src/main/java/com/dnd/gongmuin/chat_inquiry/repository/ChatInquiryQueryRepositoryImpl.java b/src/main/java/com/dnd/gongmuin/chat_inquiry/repository/ChatInquiryQueryRepositoryImpl.java index 496d4adf..eec76192 100644 --- a/src/main/java/com/dnd/gongmuin/chat_inquiry/repository/ChatInquiryQueryRepositoryImpl.java +++ b/src/main/java/com/dnd/gongmuin/chat_inquiry/repository/ChatInquiryQueryRepositoryImpl.java @@ -69,9 +69,10 @@ public List getAutoRejectedChatInquiries() { .fetch(); } - public void updateChatInquiryStatusRejected() { + public void updateChatInquiryStatusRejected(LocalDateTime now) { queryFactory.update(chatInquiry) .set(chatInquiry.status, InquiryStatus.REJECTED) + .set(chatInquiry.updatedAt, now) .where( chatInquiry.createdAt.loe(LocalDateTime.now().minusWeeks(1)), chatInquiry.status.eq(InquiryStatus.PENDING) diff --git a/src/main/java/com/dnd/gongmuin/chat_inquiry/service/ChatInquiryService.java b/src/main/java/com/dnd/gongmuin/chat_inquiry/service/ChatInquiryService.java index 73259149..592d42d6 100644 --- a/src/main/java/com/dnd/gongmuin/chat_inquiry/service/ChatInquiryService.java +++ b/src/main/java/com/dnd/gongmuin/chat_inquiry/service/ChatInquiryService.java @@ -1,5 +1,6 @@ package com.dnd.gongmuin.chat_inquiry.service; +import java.time.LocalDateTime; import java.util.List; import java.util.Objects; @@ -135,7 +136,7 @@ public RejectChatResponse rejectChat(Long chatInquiryId, Member answerer) { public void rejectChatAuto() { List rejectedChatInquiryDtos = chatInquiryRepository.getAutoRejectedChatInquiries(); List rejectedInquirerIds = getRejectedInquirerIds(rejectedChatInquiryDtos); - chatInquiryRepository.updateChatInquiryStatusRejected(); + chatInquiryRepository.updateChatInquiryStatusRejected(LocalDateTime.now()); memberRepository.refundInMemberIds(rejectedInquirerIds, CHAT_REWARD); creditHistoryService.saveCreditHistoryInMemberIds( rejectedInquirerIds, CreditType.CHAT_REFUND, CHAT_REWARD