Skip to content

Commit

Permalink
Merge pull request #245 from Yanol-Market/feature/chat-message-refactor
Browse files Browse the repository at this point in the history
feat: 채팅방 상세 조회- 한국시간으로 변경, 자동 양도 완료 시, 정산안내 시스템 메세지 전송
  • Loading branch information
dldmldlsy authored Jan 28, 2024
2 parents 14ba3e0 + 98639c3 commit 2707694
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import static site.goldenticket.common.response.ErrorCode.USER_NOT_FOUND;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -261,6 +265,8 @@ public void createSystemMessageOfCompletedTransferByScheduler(Long productId, Lo
ChatRoom chatRoom = getChatRoomByBuyerIdAndProductId(buyerId, productId);
createChat(new ChatRequest(chatRoom.getId(), "SYSTEM", sellerId, "양도가 완료되었습니다!"));
createChat(new ChatRequest(chatRoom.getId(), "SYSTEM", buyerId, "양도가 완료되었습니다!"));
createChat(new ChatRequest(chatRoom.getId(), "SYSTEM", sellerId,
"영업일 9일 이내 등록한 계좌 정보로 정산 금액이 입금됩니다. 원활한 정산 진행을 위해 '마이페이지 > 내 계좌' 정보를 다시 한번 확인해주세요."));
}

/***
Expand Down Expand Up @@ -320,12 +326,15 @@ public ChatRoomDetailResponse getChatRoomDetail(Long userId, Long chatRoomId) {
chat.setViewedByBuyer(true);
}
chatRepository.save(chat); // *확인 필요
ZoneId koreaZoneId = ZoneId.of("Asia/Seoul");
ZonedDateTime koreaZonedDateTime = chat.getCreatedAt().atZone(koreaZoneId);
LocalDateTime koreaLocalDateTime = koreaZonedDateTime.toLocalDateTime();
ChatResponse chatResponse = ChatResponse.builder()
.chatId(chat.getId())
.senderType(chat.getSenderType())
.userId(chat.getUserId())
.content(chat.getContent())
.createdAt(chat.getCreatedAt())
.createdAt(koreaLocalDateTime)
.viewed(true)
.build();
chatResponseList.add(chatResponse);
Expand Down

0 comments on commit 2707694

Please sign in to comment.