diff --git a/src/main/java/com/palnet/biz/api/acnt/cstmr/service/AcntCstmrService.java b/src/main/java/com/palnet/biz/api/acnt/cstmr/service/AcntCstmrService.java index 6729991..acf3a5b 100644 --- a/src/main/java/com/palnet/biz/api/acnt/cstmr/service/AcntCstmrService.java +++ b/src/main/java/com/palnet/biz/api/acnt/cstmr/service/AcntCstmrService.java @@ -274,10 +274,6 @@ public class AcntCstmrService { } public boolean userDelete(int cstmrSno) { - PtyCstmrBas userEntity = ptyCstmrBasRepository.findByUserGroupId(cstmrSno); - userEntity.setCstmrStatusCd("W"); - userEntity.setCstmrStatusCngDt(DateUtils.nowDate()); - ptyCstmrBasRepository.save(userEntity); List groupInfo = jwtTokenUtil.getGroupAuthByToken(); for(JwtGroupModel group : groupInfo) { @@ -287,19 +283,30 @@ public class AcntCstmrService { groupEntity.setUseYn("N"); ptyGroupBasRepository.save(groupEntity); } - } + PtyCstmrGroup cstmrEntity = ptyCstmrGroupRepository.changeGroupJoinYn(group.getGroupId()); + if(!(cstmrEntity == null)) { + cstmrEntity.setJoinYn("N"); + ptyCstmrGroupRepository.save(cstmrEntity); + } + } + List AprvlEntity = ptyCstmrGroupRepository.changeGroupAprvlYn(cstmrSno); + if(!(AprvlEntity == null)) { + for(PtyCstmrGroup Aprvl : AprvlEntity) { + Aprvl.setAprvlYn("N"); + Aprvl.setAprvlDt(null); + ptyCstmrGroupRepository.save(Aprvl); + } PtyCstmrGroup cstmrEntity = ptyCstmrGroupRepository.findGroupId(group.getGroupId(), cstmrSno); if(!(cstmrEntity == null)) { cstmrEntity.setJoinYn("N"); ptyCstmrGroupRepository.save(cstmrEntity); } } - List AprvlEntity = ptyCstmrGroupRepository.changeGroupAprvlYn(cstmrSno); - for(PtyCstmrGroup Aprvl : AprvlEntity) { - Aprvl.setAprvlYn("N"); - Aprvl.setAprvlDt(null); - ptyCstmrGroupRepository.save(Aprvl); - } + } + PtyCstmrBas userEntity = ptyCstmrBasRepository.findByUserGroupId(cstmrSno); + userEntity.setCstmrStatusCd("W"); + userEntity.setCstmrStatusCngDt(DateUtils.nowDate()); + ptyCstmrBasRepository.save(userEntity); boolean result = true; return result; diff --git a/src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrGroupRepository.java b/src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrGroupRepository.java index a16c27b..ab965ad 100644 --- a/src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrGroupRepository.java +++ b/src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrGroupRepository.java @@ -20,7 +20,7 @@ public interface PtyCstmrGroupRepository extends JpaRepository changeGroupJoinYn(@Param("groupId") String groupId); + PtyCstmrGroup changeGroupJoinYn(@Param("groupId") String groupId); @Query("select p from PtyCstmrGroup p " + "where p.cstmrSno = :cstmrSno " )