From 589f83e99565f6d7dad129989ad96ba6346dc7e9 Mon Sep 17 00:00:00 2001 From: mummhy0811 Date: Wed, 5 Jun 2024 11:05:28 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=82=AD=EC=A0=9C=EB=90=9C=20=EB=AA=A8?= =?UTF-8?q?=EC=9E=84/=EB=AA=A8=EC=9E=84=EC=9B=90=20=EB=A6=AC=ED=84=B4=20?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AccountServiceImpl.java | 17 +++++++++-------- .../service/impl/TeamMemberServiceImpl.java | 12 +++++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/hanaro/triptogether/account/service/impl/AccountServiceImpl.java b/src/main/java/com/hanaro/triptogether/account/service/impl/AccountServiceImpl.java index 42b8930..7c2cb38 100644 --- a/src/main/java/com/hanaro/triptogether/account/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/hanaro/triptogether/account/service/impl/AccountServiceImpl.java @@ -40,16 +40,17 @@ public List teamServiceList(Long memberIdx) { List teams = teamRepository.findTeamsByMemberIdx(memberIdx); - for(int i = 0; i < teams.size(); i++) { - Optional teamMember= teamMemberRepository.findTeamMemberByMember_MemberIdxAndTeam_TeamIdx(memberIdx, teams.get(i).getTeamIdx()); - if(teamMember.isPresent() && (teamMember.get().getTeamMemberState() == TeamMemberState.총무 || teamMember.get().getTeamMemberState() == TeamMemberState.모임원)) { + for (Team team : teams) { + if (team.getDeletedAt() != null || team.getDeletedBy()!=null ) continue; + Optional teamMember = teamMemberRepository.findTeamMemberByMember_MemberIdxAndTeam_TeamIdx(memberIdx, team.getTeamIdx()); + if (teamMember.isPresent() && (teamMember.get().getTeamMemberState() == TeamMemberState.총무 || teamMember.get().getTeamMemberState() == TeamMemberState.모임원)) { Long teamMemberIdx = teamMember.get().getTeamMemberIdx(); TeamServiceListResDto teamServiceListResDto = TeamServiceListResDto.builder() - .accIdx(teams.get(i).getAccount().getAccIdx()) - .accNumber(teams.get(i).getAccount().getAccNumber()) - .accBalance(teams.get(i).getAccount().getAccBalance()) - .teamName(teams.get(i).getTeamName()) - .teamIdx(teams.get(i).getTeamIdx()) + .accIdx(team.getAccount().getAccIdx()) + .accNumber(team.getAccount().getAccNumber()) + .accBalance(team.getAccount().getAccBalance()) + .teamName(team.getTeamName()) + .teamIdx(team.getTeamIdx()) .teamMemberIdx(teamMemberIdx) .teamMemberState(teamMember.get().getTeamMemberState().name()) .build(); diff --git a/src/main/java/com/hanaro/triptogether/teamMember/service/impl/TeamMemberServiceImpl.java b/src/main/java/com/hanaro/triptogether/teamMember/service/impl/TeamMemberServiceImpl.java index cc01f17..52daa22 100644 --- a/src/main/java/com/hanaro/triptogether/teamMember/service/impl/TeamMemberServiceImpl.java +++ b/src/main/java/com/hanaro/triptogether/teamMember/service/impl/TeamMemberServiceImpl.java @@ -37,12 +37,14 @@ public List teamMembers(Long teamIdx) { Team team = teamRepository.findById(teamIdx).orElseThrow(() -> new ApiException(ExceptionEnum.TEAM_NOT_FOUND)); List teamMembers = teamMemberRepository.findTeamMembersByTeam(team); - for(int i = 0; i < teamMembers.size(); i++) { + for (TeamMember teamMember : teamMembers) { + if(teamMember.getDeletedBy()!=null || teamMember.getDeletedAt()!=null ) continue; + TeamMembersResDto teamMembersResDto = TeamMembersResDto.builder() - .teamMemberIdx(teamMembers.get(i).getTeamMemberIdx()) - .memberName(teamMembers.get(i).getMember().getMemberName()) - .teamMemberState(teamMembers.get(i).getTeamMemberState()) - .memberIdx(teamMembers.get(i).getMember().getMemberIdx()) + .teamMemberIdx(teamMember.getTeamMemberIdx()) + .memberName(teamMember.getMember().getMemberName()) + .teamMemberState(teamMember.getTeamMemberState()) + .memberIdx(teamMember.getMember().getMemberIdx()) .build(); teamMembersResDtos.add(teamMembersResDto);