diff --git a/src/main/java/com/codingwasabi/bigtong/admin/controller/AdminController.java b/src/main/java/com/codingwasabi/bigtong/admin/controller/AdminController.java index 2958f3a..15b5acc 100644 --- a/src/main/java/com/codingwasabi/bigtong/admin/controller/AdminController.java +++ b/src/main/java/com/codingwasabi/bigtong/admin/controller/AdminController.java @@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -25,9 +26,15 @@ public class AdminController { // 바꿔야함 @GetMapping("/connecting") - public String showConnectiongUser(){ + public String showConnectiongUser(Model model){ - return null; + List accountList = adminService.userConnecting(); + + model.addAttribute("accountList",accountList); + model.addAttribute("count",accountList.size()); + model.addAttribute("isNull","접속된 유저가 현재 없습니다."); + + return "connecting"; } diff --git a/src/main/java/com/codingwasabi/bigtong/admin/repository/ChatRoomRepository.java b/src/main/java/com/codingwasabi/bigtong/admin/repository/ChatRoomRepository.java index 216b0ae..caef6fb 100644 --- a/src/main/java/com/codingwasabi/bigtong/admin/repository/ChatRoomRepository.java +++ b/src/main/java/com/codingwasabi/bigtong/admin/repository/ChatRoomRepository.java @@ -9,4 +9,6 @@ public interface ChatRoomRepository extends JpaRepository { Optional findChatRoomByType(RoomType type); + + boolean existsChatRoomByType(RoomType type); } diff --git a/src/main/java/com/codingwasabi/bigtong/admin/service/ChatRoomService.java b/src/main/java/com/codingwasabi/bigtong/admin/service/ChatRoomService.java index ae9e4b6..fadf5d0 100644 --- a/src/main/java/com/codingwasabi/bigtong/admin/service/ChatRoomService.java +++ b/src/main/java/com/codingwasabi/bigtong/admin/service/ChatRoomService.java @@ -39,12 +39,14 @@ public Long createChatRoom(String type){ public boolean checkRoomExist(){ - chatRoomRepository.findChatRoomByType(RoomType.GRAIN).orElseThrow(ChatRoomNotExistException::new); - chatRoomRepository.findChatRoomByType(RoomType.FISH).orElseThrow(ChatRoomNotExistException::new); - chatRoomRepository.findChatRoomByType(RoomType.FRUIT).orElseThrow(ChatRoomNotExistException::new); - chatRoomRepository.findChatRoomByType(RoomType.VEGETABLE).orElseThrow(ChatRoomNotExistException::new); - chatRoomRepository.findChatRoomByType(RoomType.MEAT).orElseThrow(ChatRoomNotExistException::new); - - return true; + if(chatRoomRepository.existsChatRoomByType(RoomType.GRAIN) + &&chatRoomRepository.existsChatRoomByType(RoomType.FRUIT) + &&chatRoomRepository.existsChatRoomByType(RoomType.FISH) + &&chatRoomRepository.existsChatRoomByType(RoomType.VEGETABLE) + &&chatRoomRepository.existsChatRoomByType(RoomType.MEAT) + ) + return true; + + return false; } } diff --git a/src/main/resources/templates/connecting.html b/src/main/resources/templates/connecting.html new file mode 100644 index 0000000..bbb5a69 --- /dev/null +++ b/src/main/resources/templates/connecting.html @@ -0,0 +1,53 @@ + + + + + + + +
+
+ +
+
+

접속중인 유저

+
+ +
+

현재 접속중인 유저 수 :

+

+ + + + + + + + + + + + + + + + + + + + + + +
닉네임연결된 시각ip 주소접속중인 채팅방
닉네임연결된 시각ipip채팅방채팅방
+
+ +
+ +
+
+ +
+ +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/fragments/connecting_header.html b/src/main/resources/templates/fragments/connecting_header.html new file mode 100644 index 0000000..b64c94f --- /dev/null +++ b/src/main/resources/templates/fragments/connecting_header.html @@ -0,0 +1,13 @@ + + + + + + + + + + 현재 연결된 유저 리스트 + \ No newline at end of file diff --git a/src/main/resources/templates/home.html b/src/main/resources/templates/home.html index 1e08843..dbd8eec 100644 --- a/src/main/resources/templates/home.html +++ b/src/main/resources/templates/home.html @@ -10,15 +10,17 @@