From 2adc2710c656d69947a978c5b8ee3b75556c1a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Tue, 9 Jul 2024 15:26:19 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=B4=9D=EB=AC=B4=20fcm=20=EB=B0=8F=20?= =?UTF-8?q?=EB=AA=A8=EC=9E=84=ED=86=B5=EC=9E=A5=20=EC=9E=94=EC=95=A1=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/hana/hanalink/account/domain/Account.java | 1 + .../com/hana/hanalink/team/controller/TeamController.java | 6 +++++- .../hanalink/transaction/service/TransactionService.java | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/hana/hanalink/account/domain/Account.java b/src/main/java/com/hana/hanalink/account/domain/Account.java index 3b82797..3b915ea 100644 --- a/src/main/java/com/hana/hanalink/account/domain/Account.java +++ b/src/main/java/com/hana/hanalink/account/domain/Account.java @@ -38,4 +38,5 @@ public class Account extends BaseEntity { public void withDraw(Long amount) { this.balance -= amount; } + public void deposit(Long amount) { this.balance += amount; } } diff --git a/src/main/java/com/hana/hanalink/team/controller/TeamController.java b/src/main/java/com/hana/hanalink/team/controller/TeamController.java index 29f4d15..4df6342 100644 --- a/src/main/java/com/hana/hanalink/team/controller/TeamController.java +++ b/src/main/java/com/hana/hanalink/team/controller/TeamController.java @@ -1,6 +1,8 @@ package com.hana.hanalink.team.controller; +import com.google.firebase.messaging.FirebaseMessagingException; import com.hana.hanalink.common.dto.SuccessResponse; +import com.hana.hanalink.common.firebase.FirebaseFcmService; import com.hana.hanalink.common.service.ImageUploadService; import com.hana.hanalink.member.domain.MemberDetails; import com.hana.hanalink.team.dto.request.CreateTeamReq; @@ -23,6 +25,7 @@ public class TeamController { private final TeamService teamService; private final ImageUploadService imageUploadService; + private final FirebaseFcmService firebaseFcmService; @PostMapping(value = "", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) public SuccessResponse createTeam(@AuthenticationPrincipal MemberDetails member, @@ -43,8 +46,9 @@ public SuccessResponse updateBanner(@PathVariable("teamId") Long teamId, @PostMapping("/{teamId}") SuccessResponse joinTeam(@AuthenticationPrincipal MemberDetails member, @PathVariable("teamId") Long teamId, - @RequestBody JoinTeamReq req) { + @RequestBody JoinTeamReq req) throws FirebaseMessagingException { teamService.joinTeam(member.getUsername(), teamId, req); + firebaseFcmService.subscribeToTopic(member.getMemberFcmToken(),teamId.toString()); return SuccessResponse.successWithNoData(); } diff --git a/src/main/java/com/hana/hanalink/transaction/service/TransactionService.java b/src/main/java/com/hana/hanalink/transaction/service/TransactionService.java index 3f622d1..797e256 100644 --- a/src/main/java/com/hana/hanalink/transaction/service/TransactionService.java +++ b/src/main/java/com/hana/hanalink/transaction/service/TransactionService.java @@ -116,6 +116,8 @@ public Long paymentDues(Long teamId, TransactionReq transactionReq) { /*내 계좌 출금*/ myAccountWithdraw(myAccount,transactionReq.amount()); + meetingAccount.getAccount().deposit(transactionReq.amount()); + accountRepository.save(meetingAccount.getAccount()); Transaction transaction = Transaction.builder() .amount(transactionReq.amount())