From 9e46c94bebd3399cac7c8856564ca256b63dd312 Mon Sep 17 00:00:00 2001 From: 2oo1s Date: Wed, 13 Nov 2024 10:26:40 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[fix]=20#77=20-=20=EA=B8=B0=EC=97=85?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EA=B0=80=EC=9E=85=20=EC=8A=B9=EC=9D=B8=20?= =?UTF-8?q?=EA=B3=BC=EC=A0=95=EC=97=90=EC=84=9C=20Exception=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wooribound/domain/admin/AdminServiceImpl.java | 3 +++ .../global/exception/NoApproveStatusException.java | 10 ++++++++++ .../global/handler/GlobalExceptionHandler.java | 6 +++++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/wooribound/global/exception/NoApproveStatusException.java diff --git a/src/main/java/com/wooribound/domain/admin/AdminServiceImpl.java b/src/main/java/com/wooribound/domain/admin/AdminServiceImpl.java index 55280ad..beec5b6 100644 --- a/src/main/java/com/wooribound/domain/admin/AdminServiceImpl.java +++ b/src/main/java/com/wooribound/domain/admin/AdminServiceImpl.java @@ -4,6 +4,7 @@ import com.wooribound.domain.admin.dto.AdminDTO; import com.wooribound.domain.enterprise.EnterpriseRepository; import com.wooribound.global.constant.YN; +import com.wooribound.global.exception.NoApproveStatusException; import lombok.RequiredArgsConstructor; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; @@ -25,6 +26,8 @@ public void create(AdminDTO adminDTO) { @Override public String joinApprove(AdminApproveReqDTO adminApproveReqDTO) { + if (adminApproveReqDTO.getApprove() == null) + throw new NoApproveStatusException(); // 기업 회원가입을 반려할 때 if (adminApproveReqDTO.getApprove() == YN.N) { if (enterpriseRepository.deleteByEntId(adminApproveReqDTO.getEntId()) == 1) diff --git a/src/main/java/com/wooribound/global/exception/NoApproveStatusException.java b/src/main/java/com/wooribound/global/exception/NoApproveStatusException.java new file mode 100644 index 0000000..17646e4 --- /dev/null +++ b/src/main/java/com/wooribound/global/exception/NoApproveStatusException.java @@ -0,0 +1,10 @@ +package com.wooribound.global.exception; + +import lombok.experimental.StandardException; + +@StandardException +public class NoApproveStatusException extends RuntimeException{ + public NoApproveStatusException() { + super("잘못된 기업회원 가입 승인 요청입니다. 다시 시도해주세요"); + } +} diff --git a/src/main/java/com/wooribound/global/handler/GlobalExceptionHandler.java b/src/main/java/com/wooribound/global/handler/GlobalExceptionHandler.java index cd5b826..bde29f1 100644 --- a/src/main/java/com/wooribound/global/handler/GlobalExceptionHandler.java +++ b/src/main/java/com/wooribound/global/handler/GlobalExceptionHandler.java @@ -89,12 +89,16 @@ public ResponseEntity handleDeletedUserException(DeletedUserException e, responseBody.put("message", "deleted_user"); return new ResponseEntity<>(responseBody, HttpStatus.GONE); // 410 Gone } + @ExceptionHandler(NotValidPasswordException.class) public ResponseEntity handleNotValidPasswordException(NotValidPasswordException e) { return ResponseEntity.status(400).body(e.getMessage()); } - + @ExceptionHandler(NoApproveStatusException.class) + public ResponseEntity handleNoApproveStatusException(NoApproveStatusException e) { + return ResponseEntity.status(400).body(e.getMessage()); + } } From 1e932d4df539873eb47a8b548d464d524cba0cf0 Mon Sep 17 00:00:00 2001 From: 2oo1s Date: Wed, 13 Nov 2024 10:52:52 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[fix]=20#77=20-=20=EA=B8=B0=EC=97=85?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=ED=83=88=ED=87=B4=20=EC=8A=B9=EC=9D=B8=20?= =?UTF-8?q?=EA=B3=BC=EC=A0=95=EC=97=90=EC=84=9C=20Exception=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wooribound/domain/admin/AdminServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/wooribound/domain/admin/AdminServiceImpl.java b/src/main/java/com/wooribound/domain/admin/AdminServiceImpl.java index beec5b6..ba26f82 100644 --- a/src/main/java/com/wooribound/domain/admin/AdminServiceImpl.java +++ b/src/main/java/com/wooribound/domain/admin/AdminServiceImpl.java @@ -28,6 +28,7 @@ public void create(AdminDTO adminDTO) { public String joinApprove(AdminApproveReqDTO adminApproveReqDTO) { if (adminApproveReqDTO.getApprove() == null) throw new NoApproveStatusException(); + // 기업 회원가입을 반려할 때 if (adminApproveReqDTO.getApprove() == YN.N) { if (enterpriseRepository.deleteByEntId(adminApproveReqDTO.getEntId()) == 1) @@ -46,6 +47,9 @@ public String joinApprove(AdminApproveReqDTO adminApproveReqDTO) { @Override public String deleteApprove(AdminApproveReqDTO adminApproveReqDTO) { + if (adminApproveReqDTO.getApprove() == null) + throw new NoApproveStatusException(); + // 기업 회원탈퇴를 승인할 때 if (adminApproveReqDTO.getApprove() == YN.Y) { if (enterpriseRepository.updateIsDeleted(adminApproveReqDTO.getEntId()) == 1)