Skip to content

Commit

Permalink
Refactor: 원래 코드로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
imjanghyeok committed May 19, 2024
1 parent 5ca9b23 commit 9bda406
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/java/capstone/facefriend/chat/aop/ChatAop.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Arrays;

import static capstone.facefriend.chat.exception.ChatExceptionType.NOT_FOUND_CHAT_ROOM_MEMBER;
import static capstone.facefriend.member.exception.member.MemberExceptionType.NOT_FOUND;
Expand Down Expand Up @@ -78,10 +77,10 @@ public void afterSendHeart(JoinPoint joinPoint) throws IOException {
Long receiveId = -1L;
for (int i = 0; i < method.getParameters().length; i++) {
String paramName = method.getParameters()[i].getName();
if (paramName.equals("arg0")) {
if (paramName.equals("senderId")) {
senderId = (Long) params[i];
}
if (paramName.equals("arg1")) {
if (paramName.equals("receiveId")) {
receiveId = (Long) params[i];
}
}
Expand Down Expand Up @@ -131,7 +130,7 @@ public void beforeSaveChatMessage(JoinPoint joinPoint) throws IOException {
ChatMessage chatMessage = null;
for (int i = 0; i < method.getParameters().length; i++) {
String paramName = method.getParameters()[i].getName();
if (paramName.equals("arg0")) {
if (paramName.equals("chatMessage")) {
chatMessage = (ChatMessage) params[i];
}
}
Expand Down Expand Up @@ -210,10 +209,10 @@ public void beforeLeftRoom(JoinPoint joinPoint) {
Long memberId = null;
for (int i = 0; i < method.getParameters().length; i++) {
String paramName = method.getParameters()[i].getName();
if (paramName.equals("arg0")) {
if (paramName.equals("roomId")) {
roomId = (Long) params[i];
}
if (paramName.equals("arg1")) {
if (paramName.equals("memberId")) {
memberId = (Long) params[i];
}
}
Expand Down Expand Up @@ -272,4 +271,4 @@ private ChatRoomMember findChatRoomMemberByRoomId(Long roomId) {
return chatRoomMemberRepository.findByChatRoomId(roomId)
.orElseThrow(() -> new ChatException(NOT_FOUND_CHAT_ROOM_MEMBER)); // 영속
}
}
}

0 comments on commit 9bda406

Please sign in to comment.