From c61eb7feb5a4d50d0b4b4ddeadf04d4fe014f4d6 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 16:18:08 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=B4=9D=EB=AC=B4=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meetingaccount/service/MeetingAccountService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hana/hanalink/meetingaccount/service/MeetingAccountService.java b/src/main/java/com/hana/hanalink/meetingaccount/service/MeetingAccountService.java index ace24aa..1b0d1d1 100644 --- a/src/main/java/com/hana/hanalink/meetingaccount/service/MeetingAccountService.java +++ b/src/main/java/com/hana/hanalink/meetingaccount/service/MeetingAccountService.java @@ -30,15 +30,17 @@ public void changeMeetingAccount(Long teamId,Long nextChairId) { TeamMember curChair = teamMemberRepository.findTeamMemberByTeam_TeamIdAndRole(teamId, TeamMemberRole.CHAIR); Account chairAccount = accountRepository.findAccountByMember_MemberId(curChair.getMember().getMemberId()); + TeamMember nextChair = teamMemberRepository.findById(nextChairId).orElseThrow(); + Account nextChairAccount = accountRepository.findAccountByMember_MemberId(nextChair.getMember().getMemberId()); + /*모임통장 계좌 변경가능 확인*/ - if(meetingAccountRepository.existsByAccount(chairAccount)) { + if(meetingAccountRepository.existsByAccount(nextChairAccount)) { throw new NotChangeChairException(); } - /* role 변경*/ - TeamMember nextChair = teamMemberRepository.findById(nextChairId).orElseThrow(); + /* role 변경*/ curChair.changeRole(TeamMemberRole.REGULAR); nextChair.changeRole(TeamMemberRole.CHAIR); teamMemberRepository.save(curChair); @@ -46,7 +48,6 @@ public void changeMeetingAccount(Long teamId,Long nextChairId) { /*총무 계좌와 다음 총무 계좌 변경*/ MeetingAccount meetingAccount = meetingAccountRepository.findMeetingAccountByAccount(chairAccount); - Account nextChairAccount = accountRepository.findAccountByMember_MemberId(nextChair.getMember().getMemberId()); meetingAccount.changeMeetingAccount(nextChairAccount); meetingAccountRepository.save(meetingAccount);