diff --git a/src/main/java/capstone/facefriend/chat/service/MessageService.java b/src/main/java/capstone/facefriend/chat/service/MessageService.java index d9407a4c3e..1e5656f312 100644 --- a/src/main/java/capstone/facefriend/chat/service/MessageService.java +++ b/src/main/java/capstone/facefriend/chat/service/MessageService.java @@ -139,8 +139,7 @@ public void sendMessage(MessageRequest messageRequest, Long senderId) { // getSender() 는 하트틀 보내는 사람(방 개설자)을 의미 // senderId() 는 메세지를 보내는 사람을 의미 MessageResponse messageResponse = new MessageResponse(); - - if (chatRoomMember.getSender().equals(findMemberByid(senderId))) { + if (chatRoomMember.getSender().equals(sender)) { messageResponse.setMethod("receiveChat"); messageResponse.setRoomId(chatMessage.getChatRoom().getId()); messageResponse.setSenderId(senderId); @@ -153,7 +152,7 @@ public void sendMessage(MessageRequest messageRequest, Long senderId) { messageResponse.setIsRead(chatMessage.isRead()); } - if (chatRoomMember.getReceiver().equals(findMemberByid(senderId))) { + if (chatRoomMember.getReceiver().equals(receiver)) { messageResponse.setMethod("receiveChat"); messageResponse.setRoomId(chatMessage.getChatRoom().getId()); messageResponse.setSenderId(senderId); @@ -167,7 +166,9 @@ public void sendMessage(MessageRequest messageRequest, Long senderId) { } String topic = channelTopic.getTopic(); + redisTemplate.convertAndSend(topic, messageResponse); + } private ChatRoomMember findChatRoomMember(ChatRoom chatRoom) { diff --git a/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java b/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java index 48df5291d3..bad7abd6d6 100644 --- a/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java +++ b/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java @@ -39,14 +39,15 @@ public void onMessage(Message message, byte[] pattern) { log.info(messageResponse.toString()); GetMessageResponse chatMessageResponse = new GetMessageResponse(messageResponse); log.info(chatMessageResponse.toString()); + if (isExistSubscriber(messageResponse.getReceiveId())) { messagingTemplate.convertAndSend("/sub/chat/" + messageResponse.getReceiveId(), chatMessageResponse); } else { saveUnReadMessage("/sub/chat" + messageResponse.getReceiveId() + "message", messageResponse); } + messagingTemplate.convertAndSend("/sub/chat/" + messageResponse.getSenderId(), chatMessageResponse); - messagingTemplate.convertAndSend("/sub/chat/" + messageResponse.getReceiveId(), chatMessageResponse); } else if (publishMessage.contains("Heart")) { SendHeartResponse sendHeartResponse = objectMapper.readValue(publishMessage, SendHeartResponse.class); @@ -57,7 +58,7 @@ public void onMessage(Message message, byte[] pattern) { saveUnReadHeart("/sub/chat" + sendHeartResponse.getMemberId() + "heart", sendHeartResponse); } - messagingTemplate.convertAndSend("/sub/chat/" + sendHeartResponse.getMemberId(), chatSendHeartResponse); + messagingTemplate.convertAndSend("/sub/chat/" + sendHeartResponse.getSenderId(), chatSendHeartResponse); } } catch (IOException e) { throw new RuntimeException("Failed to process message", e); diff --git a/src/main/java/capstone/facefriend/resume/domain/ResumeRepositoryImpl.java b/src/main/java/capstone/facefriend/resume/domain/ResumeRepositoryImpl.java index 5334fb3112..0bcf461352 100644 --- a/src/main/java/capstone/facefriend/resume/domain/ResumeRepositoryImpl.java +++ b/src/main/java/capstone/facefriend/resume/domain/ResumeRepositoryImpl.java @@ -63,6 +63,7 @@ public Page getResumesByGoodCombi(Long memberId, Pagea .from(resume) .leftJoin(resume.member, QMember.member) // left join .where(builder) // boolean builder + .where(resume.member.ne(me)) .orderBy(resume.id.desc()) .offset(pageable.getOffset()) .limit(pageable.getPageSize()) @@ -79,10 +80,9 @@ public Page getResumesByGoodCombi(Long memberId, Pagea return new PageImpl<>(content, pageable, total); } - - // 카테고리별 동적 쿼리 public Page getResumesByCategory(Long memberId, String category, Pageable pageable) { + Member me = findMemberById(memberId); List content = queryFactory .select(new QResumeHomeDetailResponse( @@ -91,6 +91,7 @@ public Page getResumesByCategory(Long memberId, String .from(resume) .leftJoin(resume.member, QMember.member) // left join .where(resume.categories.contains(Resume.Category.valueOf(category))) + .where(resume.member.ne(me)) .orderBy(resume.id.desc()) .offset(pageable.getOffset()) .limit(pageable.getPageSize())