From 4976f2bd9d5cff8f71f4c34965fc7e71c6c5b44d Mon Sep 17 00:00:00 2001 From: shinhn Date: Wed, 19 Apr 2023 17:20:41 +0900 Subject: [PATCH] =?UTF-8?q?Apn=20=EC=95=8C=EB=A6=BC=20-=20time,=20isOpen?= =?UTF-8?q?=20=EC=BB=AC=EB=9F=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/apns/dto/req/CreateBoardUserJoinAPNReq.java | 6 +++++- .../yogit/server/apns/dto/req/CreateClipBoardAPNReq.java | 6 +++++- .../yogit/server/apns/dto/req/DelBoardUserJoinAPNReq.java | 6 +++++- .../board/service/boarduser/BoardUserServiceImpl.java | 5 +++-- .../board/service/clipboard/ClipBoardServiceImpl.java | 3 ++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/com/yogit/server/apns/dto/req/CreateBoardUserJoinAPNReq.java b/server/src/main/java/com/yogit/server/apns/dto/req/CreateBoardUserJoinAPNReq.java index 696f066..d701d08 100644 --- a/server/src/main/java/com/yogit/server/apns/dto/req/CreateBoardUserJoinAPNReq.java +++ b/server/src/main/java/com/yogit/server/apns/dto/req/CreateBoardUserJoinAPNReq.java @@ -17,12 +17,16 @@ public class CreateBoardUserJoinAPNReq { private String joinUserName; private Long boardId; private String boardName; + private String time; + boolean isOpened; @Builder - public CreateBoardUserJoinAPNReq(String destinationDeviceToken, String joinUserName, Long boardId, String boardName) { + public CreateBoardUserJoinAPNReq(String destinationDeviceToken, String joinUserName, Long boardId, String boardName, String time) { this.destinationDeviceToken = destinationDeviceToken; this.joinUserName = joinUserName; this.boardId = boardId; this.boardName = boardName; + this.time = time; + this.isOpened = false; } } diff --git a/server/src/main/java/com/yogit/server/apns/dto/req/CreateClipBoardAPNReq.java b/server/src/main/java/com/yogit/server/apns/dto/req/CreateClipBoardAPNReq.java index fc179bd..974a9cc 100644 --- a/server/src/main/java/com/yogit/server/apns/dto/req/CreateClipBoardAPNReq.java +++ b/server/src/main/java/com/yogit/server/apns/dto/req/CreateClipBoardAPNReq.java @@ -17,12 +17,16 @@ public class CreateClipBoardAPNReq { private String userName; private Long boardId; private String boardName; + private String time; + boolean isOpened; @Builder - public CreateClipBoardAPNReq(String destinationDeviceToken, String userName, Long boardId, String boardName) { + public CreateClipBoardAPNReq(String destinationDeviceToken, String userName, Long boardId, String boardName, String time) { this.destinationDeviceToken = destinationDeviceToken; this.userName = userName; this.boardId = boardId; this.boardName = boardName; + this.time = time; + this.isOpened = false; } } diff --git a/server/src/main/java/com/yogit/server/apns/dto/req/DelBoardUserJoinAPNReq.java b/server/src/main/java/com/yogit/server/apns/dto/req/DelBoardUserJoinAPNReq.java index 6d7ea80..9422e88 100644 --- a/server/src/main/java/com/yogit/server/apns/dto/req/DelBoardUserJoinAPNReq.java +++ b/server/src/main/java/com/yogit/server/apns/dto/req/DelBoardUserJoinAPNReq.java @@ -17,12 +17,16 @@ public class DelBoardUserJoinAPNReq { private String delUserName; private Long boardId; private String boardName; + private String time; + boolean isOpened; @Builder - public DelBoardUserJoinAPNReq(String destinationDeviceToken, String delUserName, Long boardId, String boardName) { + public DelBoardUserJoinAPNReq(String destinationDeviceToken, String delUserName, Long boardId, String boardName, String time) { this.destinationDeviceToken = destinationDeviceToken; this.delUserName = delUserName; this.boardId = boardId; this.boardName = boardName; + this.time = time; + this.isOpened = false; } } diff --git a/server/src/main/java/com/yogit/server/board/service/boarduser/BoardUserServiceImpl.java b/server/src/main/java/com/yogit/server/board/service/boarduser/BoardUserServiceImpl.java index b4d80f3..2d99f28 100644 --- a/server/src/main/java/com/yogit/server/board/service/boarduser/BoardUserServiceImpl.java +++ b/server/src/main/java/com/yogit/server/board/service/boarduser/BoardUserServiceImpl.java @@ -25,6 +25,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; import java.util.concurrent.ExecutionException; @@ -85,7 +86,7 @@ public ApplicationResponse joinBoardUser(CreateBoardUserReq dto) { // 호스트에게 멤버 참여 APN 푸쉬 알림 try { - if(user.getUserStatus().equals(UserStatus.LOGIN) && board.getHost().getDeviceToken() != null) apnService.createBoardUserJoinAPN(new CreateBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle())); + if(user.getUserStatus().equals(UserStatus.LOGIN) && board.getHost().getDeviceToken() != null) apnService.createBoardUserJoinAPN(new CreateBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle(), LocalDateTime.now().toString())); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { @@ -154,7 +155,7 @@ public ApplicationResponse delBoardUser(CreateBoardUserReq dto){ // 호스트에게 멤버 참여 취소 APN 푸쉬 알림 try { - if(user.getUserStatus().equals(UserStatus.LOGIN) && board.getHost().getDeviceToken() != null) apnService.delBoardUserJoinAPN(new DelBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle())); + if(user.getUserStatus().equals(UserStatus.LOGIN) && board.getHost().getDeviceToken() != null) apnService.delBoardUserJoinAPN(new DelBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle(), LocalDateTime.now().toString())); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { diff --git a/server/src/main/java/com/yogit/server/board/service/clipboard/ClipBoardServiceImpl.java b/server/src/main/java/com/yogit/server/board/service/clipboard/ClipBoardServiceImpl.java index ef83194..28e51c9 100644 --- a/server/src/main/java/com/yogit/server/board/service/clipboard/ClipBoardServiceImpl.java +++ b/server/src/main/java/com/yogit/server/board/service/clipboard/ClipBoardServiceImpl.java @@ -33,6 +33,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; @@ -82,7 +83,7 @@ public ApplicationResponse createClipBoard(CreateClipBoardReq dto) if(boardUsers!=null){ for(BoardUser bu: boardUsers){ try { - if(user.getUserStatus().equals(UserStatus.LOGIN) && !user.equals(bu.getUser()) && bu.getUser().getDeviceToken() != null) apnService.createClipBoardAPN(new CreateClipBoardAPNReq(bu.getUser().getDeviceToken(), user.getName(), board.getId(), board.getTitle())); + if(user.getUserStatus().equals(UserStatus.LOGIN) && !user.equals(bu.getUser()) && bu.getUser().getDeviceToken() != null) apnService.createClipBoardAPN(new CreateClipBoardAPNReq(bu.getUser().getDeviceToken(), user.getName(), board.getId(), board.getTitle(), LocalDateTime.now().toString())); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) {