From 390a43400afa332894e36b9f7ab99ebd33f9dbc9 Mon Sep 17 00:00:00 2001 From: Jihun Kim Date: Tue, 26 Aug 2025 19:13:39 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B8=B0=EC=A1=B4=20storeId=20publ?= =?UTF-8?q?icCode=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/StorePaymentController.java | 6 +++--- .../storepayment/service/StorePaymentService.java | 2 +- .../service/StorePaymentServiceImpl.java | 13 +++++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/controller/StorePaymentController.java b/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/controller/StorePaymentController.java index 12901d64..c8cd09c4 100644 --- a/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/controller/StorePaymentController.java +++ b/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/controller/StorePaymentController.java @@ -28,11 +28,11 @@ public class StorePaymentController { private final StorePaymentService storePaymentService; - @GetMapping(("/{storeId}")) + @GetMapping(("/{publicCode}")) @Operation(summary = "주점 결제 정보 조회", description = "주점 ID로 주점 결제 정보를 조회합니다.") @ApiResponse(responseCode = "200", description = "주점 결제 정보 조회 성공") - public ResponseEntity getStorePaymentByStoreId(@PathVariable Long storeId) { - Optional response = storePaymentService.getStorePaymentByStoreId(storeId); + public ResponseEntity getStorePaymentByStoreId(@PathVariable String publicCode) { + Optional response = storePaymentService.getStorePaymentByStoreId(publicCode); if (response.isPresent()) { return ResponseEntity diff --git a/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/service/StorePaymentService.java b/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/service/StorePaymentService.java index 703b8df7..100b6dac 100644 --- a/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/service/StorePaymentService.java +++ b/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/service/StorePaymentService.java @@ -5,5 +5,5 @@ import com.nowait.applicationuser.storepayment.dto.StorePaymentReadDto; public interface StorePaymentService { - Optional getStorePaymentByStoreId(Long storeId); + Optional getStorePaymentByStoreId(String publicCode); } diff --git a/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/service/StorePaymentServiceImpl.java b/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/service/StorePaymentServiceImpl.java index 5e15b7ff..c4c9c295 100644 --- a/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/service/StorePaymentServiceImpl.java +++ b/nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/service/StorePaymentServiceImpl.java @@ -5,6 +5,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.nowait.applicationuser.storepayment.dto.StorePaymentReadDto; +import com.nowait.domaincorerdb.store.entity.Store; +import com.nowait.domaincorerdb.store.exception.StoreNotFoundException; +import com.nowait.domaincorerdb.store.repository.StoreRepository; import com.nowait.domaincorerdb.storepayment.exception.StorePaymentParamEmptyException; import com.nowait.domaincorerdb.storepayment.repository.StorePaymentRepository; @@ -15,13 +18,15 @@ public class StorePaymentServiceImpl implements StorePaymentService { private final StorePaymentRepository storePaymentRepository; + private final StoreRepository storeRepository; @Override @Transactional(readOnly = true) - public Optional getStorePaymentByStoreId(Long storeId) { - if (storeId == null) throw new StorePaymentParamEmptyException(); - - return storePaymentRepository.findByStoreId(storeId) + public Optional getStorePaymentByStoreId(String publicCode) { + if (publicCode == null) throw new StorePaymentParamEmptyException(); + Store store = storeRepository.findByPublicCodeAndDeletedFalse(publicCode) + .orElseThrow(StoreNotFoundException::new); + return storePaymentRepository.findByStoreId(store.getStoreId()) .map(StorePaymentReadDto::fromEntity); } }