From 26c5958887498d74fbbee0a5b893c6e1d9319d61 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Thu, 29 Aug 2024 23:24:16 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Rename:=20#146=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/AdminCashoutApi.java} | 22 +++--- .../api/CreatorCashoutApi.java} | 12 +-- .../controller/AdminCashoutController.java} | 78 ++++++++----------- .../controller/CreatorCashoutController.java} | 37 ++++----- .../CashoutCompletionResponseDto.java} | 12 +-- .../CashoutFindByAdminResponseDto.java} | 18 ++--- .../CashoutFindByCreatorResponseDto.java} | 16 ++-- .../service/CashoutService.java} | 47 +++++------ ...wRequestStatus.java => CashoutStatus.java} | 6 +- 9 files changed, 116 insertions(+), 132 deletions(-) rename genti-api/src/main/java/com/gt/genti/{withdraw/api/AdminWithdrawRequestApi.java => cashout/api/AdminCashoutApi.java} (82%) rename genti-api/src/main/java/com/gt/genti/{withdraw/api/CreatorWithdrawApi.java => cashout/api/CreatorCashoutApi.java} (81%) rename genti-api/src/main/java/com/gt/genti/{withdraw/controller/AdminWithdrawRequestController.java => cashout/controller/AdminCashoutController.java} (51%) rename genti-api/src/main/java/com/gt/genti/{withdraw/controller/CreatorWithdrawController.java => cashout/controller/CreatorCashoutController.java} (62%) rename genti-api/src/main/java/com/gt/genti/{withdraw/dto/response/WithdrawCompletionResponseDto.java => cashout/dto/response/CashoutCompletionResponseDto.java} (58%) rename genti-api/src/main/java/com/gt/genti/{withdraw/dto/response/WithdrawFindByAdminResponseDto.java => cashout/dto/response/CashoutFindByAdminResponseDto.java} (66%) rename genti-api/src/main/java/com/gt/genti/{withdraw/dto/response/WithdrawFindByCreatorResponseDto.java => cashout/dto/response/CashoutFindByCreatorResponseDto.java} (53%) rename genti-api/src/main/java/com/gt/genti/{withdraw/service/WithdrawService.java => cashout/service/CashoutService.java} (70%) rename genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/{WithdrawRequestStatus.java => CashoutStatus.java} (76%) diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/api/AdminWithdrawRequestApi.java b/genti-api/src/main/java/com/gt/genti/cashout/api/AdminCashoutApi.java similarity index 82% rename from genti-api/src/main/java/com/gt/genti/withdraw/api/AdminWithdrawRequestApi.java rename to genti-api/src/main/java/com/gt/genti/cashout/api/AdminCashoutApi.java index efbbb29e..fd3ae4de 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/api/AdminWithdrawRequestApi.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/api/AdminCashoutApi.java @@ -1,10 +1,12 @@ -package com.gt.genti.withdraw.api; +package com.gt.genti.cashout.api; import org.springframework.data.domain.Page; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; +import com.gt.genti.cashout.dto.response.CashoutCompletionResponseDto; +import com.gt.genti.cashout.dto.response.CashoutFindByAdminResponseDto; import com.gt.genti.error.ResponseCode; import com.gt.genti.response.GentiResponse.ApiResult; import com.gt.genti.swagger.AuthorizedAdmin; @@ -12,9 +14,7 @@ import com.gt.genti.swagger.EnumResponses; import com.gt.genti.user.model.AuthUser; import com.gt.genti.validator.ValidEnum; -import com.gt.genti.withdraw.dto.response.WithdrawCompletionResponseDto; -import com.gt.genti.withdraw.dto.response.WithdrawFindByAdminResponseDto; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -24,13 +24,13 @@ import jakarta.validation.constraints.NotNull; @AuthorizedAdmin -@Tag(name = "[AdminWithdrawRequestController] 어드민 출금요청 컨트롤러", description = "공급자의 출금 요청을 조회,수정합니다.") -public interface AdminWithdrawRequestApi { +@Tag(name = "[AdminCashoutController] 어드민 출금요청 컨트롤러", description = "공급자의 출금 요청을 조회,수정합니다.") +public interface AdminCashoutApi { @Operation(summary = "출금요청 전체조회", description = "출금요청 페이지네이션 조회") @EnumResponses(value = { @EnumResponse(ResponseCode.OK) }) - ResponseEntity>> getAllWithdrawList( + ResponseEntity>> getAllCashoutList( @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, @Parameter(description = "페이지 당 요소 개수 >=1", example = "10", required = true) @@ -43,7 +43,7 @@ ResponseEntity>> getAllWithdrawLi @RequestParam(name = "direction", defaultValue = "desc") String direction, @Parameter(description = "출금요청 상태, ALL : 모든 상태", example = "IN_PROGRESS", schema = @Schema( allowableValues = {"IN_PROGRESS", "COMPLETED", "REJECTED", "ALL"})) - @RequestParam(name = "status", defaultValue = "ALL") @ValidEnum(value = WithdrawRequestStatus.class, hasAllOption = true) String status + @RequestParam(name = "status", defaultValue = "ALL") @ValidEnum(value = CashoutStatus.class, hasAllOption = true) String status ); @Operation(summary = "특정 공급자의 출금요청 조회", description = "공급자의 email을 전달 받아 해당 공급자의 전체 출금요청을 페이지네이션 조회") @@ -51,7 +51,7 @@ ResponseEntity>> getAllWithdrawLi @EnumResponse(ResponseCode.OK), @EnumResponse(ResponseCode.UserNotFoundByEmail) }) - ResponseEntity>> getWithdrawListByCreatorEmail( + ResponseEntity>> getCashoutListByCreatorEmail( @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, @Parameter(description = "페이지 당 요소 개수 >=1", example = "10", required = true) @@ -64,7 +64,7 @@ ResponseEntity>> getWithdrawListB @RequestParam(name = "direction", defaultValue = "desc") String direction, @Parameter(description = "출금요청 상태, ALL : 모든 상태", example = "IN_PROGRESS", schema = @Schema( allowableValues = {"IN_PROGRESS", "COMPLETED", "REJECTED", "ALL"})) - @RequestParam(name = "status", defaultValue = "ALL") @ValidEnum(value = WithdrawRequestStatus.class, hasAllOption = true) String status, + @RequestParam(name = "status", defaultValue = "ALL") @ValidEnum(value = CashoutStatus.class, hasAllOption = true) String status, @Parameter(description = "사용자 이메일", example = "example@naver.com", required = true) @PathVariable("email") @NotNull String email ); @@ -75,7 +75,7 @@ ResponseEntity>> getWithdrawListB @EnumResponse(ResponseCode.UserNotFound), @EnumResponse(ResponseCode.DepositNotFound) }) - ResponseEntity> complete( + ResponseEntity> complete( @Parameter(description = "출금요청 Id", example = "1") @PathVariable(value = "withdrawRequestId") Long withdrawRequestId, @AuthUser Long userId diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/api/CreatorWithdrawApi.java b/genti-api/src/main/java/com/gt/genti/cashout/api/CreatorCashoutApi.java similarity index 81% rename from genti-api/src/main/java/com/gt/genti/withdraw/api/CreatorWithdrawApi.java rename to genti-api/src/main/java/com/gt/genti/cashout/api/CreatorCashoutApi.java index 44662535..988fd7d2 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/api/CreatorWithdrawApi.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/api/CreatorCashoutApi.java @@ -1,16 +1,16 @@ -package com.gt.genti.withdraw.api; +package com.gt.genti.cashout.api; import org.springframework.data.domain.Page; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestParam; +import com.gt.genti.cashout.dto.response.CashoutFindByCreatorResponseDto; import com.gt.genti.error.ResponseCode; import com.gt.genti.response.GentiResponse.ApiResult; import com.gt.genti.swagger.AuthorizedCreator; import com.gt.genti.swagger.EnumResponse; import com.gt.genti.swagger.EnumResponses; import com.gt.genti.user.model.AuthUser; -import com.gt.genti.withdraw.dto.response.WithdrawFindByCreatorResponseDto; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -20,8 +20,8 @@ import jakarta.validation.constraints.NotNull; @AuthorizedCreator -@Tag(name = "[CreatorWithdrawController] 공급자 출금요청 컨트롤러", description = "공급자가 출금요청을 수행합니다.") -public interface CreatorWithdrawApi { +@Tag(name = "[CreatorCashoutController] 공급자 출금요청 컨트롤러", description = "공급자가 출금요청을 수행합니다.") +public interface CreatorCashoutApi { @Operation(summary = "출금요청", description = "공급자가 작업한 정산결과를 바탕으로 출금요청을 생성합니다.") @EnumResponses(value = { @@ -29,7 +29,7 @@ public interface CreatorWithdrawApi { @EnumResponse(ResponseCode.CreatorNotFound), @EnumResponse(ResponseCode.CannotCreateWithdrawalDueToSettlementsNotAvailable) }) - ResponseEntity> createWithdrawRequest( + ResponseEntity> createCashout( @AuthUser Long userId ); @@ -37,7 +37,7 @@ ResponseEntity> createWithdrawReques @EnumResponses(value = { @EnumResponse(ResponseCode.OK) }) - ResponseEntity>> getWithdrawRequest( + ResponseEntity>> getCashout( @AuthUser Long userId, @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/controller/AdminWithdrawRequestController.java b/genti-api/src/main/java/com/gt/genti/cashout/controller/AdminCashoutController.java similarity index 51% rename from genti-api/src/main/java/com/gt/genti/withdraw/controller/AdminWithdrawRequestController.java rename to genti-api/src/main/java/com/gt/genti/cashout/controller/AdminCashoutController.java index d653d286..667e98b3 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/controller/AdminWithdrawRequestController.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/controller/AdminCashoutController.java @@ -1,4 +1,4 @@ -package com.gt.genti.withdraw.controller; +package com.gt.genti.cashout.controller; import static com.gt.genti.response.GentiResponse.*; @@ -14,16 +14,17 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import com.gt.genti.cashout.api.AdminCashoutApi; +import com.gt.genti.cashout.dto.response.CashoutCompletionResponseDto; +import com.gt.genti.cashout.dto.response.CashoutFindByAdminResponseDto; +import com.gt.genti.cashout.service.CashoutService; import com.gt.genti.model.LogAction; import com.gt.genti.model.LogItem; import com.gt.genti.model.LogRequester; import com.gt.genti.model.Logging; import com.gt.genti.user.model.AuthUser; import com.gt.genti.validator.ValidEnum; -import com.gt.genti.withdraw.dto.response.WithdrawCompletionResponseDto; -import com.gt.genti.withdraw.dto.response.WithdrawFindByAdminResponseDto; -import com.gt.genti.withdraw.service.WithdrawService; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; @@ -32,66 +33,53 @@ import lombok.RequiredArgsConstructor; @RestController -@RequestMapping("/api/v1/admin/withdraw-requests") +@RequestMapping("/api/v1/admin/cashouts") @RequiredArgsConstructor -public class AdminWithdrawRequestController implements com.gt.genti.withdraw.api.AdminWithdrawRequestApi { - private final WithdrawService withDrawService; +public class AdminCashoutController implements AdminCashoutApi { + private final CashoutService cashoutService; @Logging(item = LogItem.CASHOUT, action = LogAction.VIEW, requester = LogRequester.ADMIN) @GetMapping - public ResponseEntity>> getAllWithdrawList( - @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) - @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, - @Parameter(description = "페이지 당 요소 개수 >=1", example = "10", required = true) - @RequestParam(name = "size", defaultValue = "10") @NotNull @Min(0) int size, + public ResponseEntity>> getAllCashoutList( + @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, + @Parameter(description = "페이지 당 요소 개수 >=1", example = "10", required = true) @RequestParam(name = "size", defaultValue = "10") @NotNull @Min(0) int size, @Parameter(description = "정렬 조건 - 기본값 생성일시", example = "createdAt", schema = @Schema(allowableValues = {"id", - "createdAt"})) - @RequestParam(name = "sortBy", defaultValue = "createdAt") String sortBy, + "createdAt"})) @RequestParam(name = "sortBy", defaultValue = "createdAt") String sortBy, @Parameter(description = "정렬 방향 - 기본값 내림차순", example = "desc", schema = @Schema(allowableValues = {"acs", - "desc"})) - @RequestParam(name = "direction", defaultValue = "desc") String direction, - @Parameter(description = "출금요청 상태, ALL : 모든 상태", example = "IN_PROGRESS", schema = @Schema( - allowableValues = {"IN_PROGRESS", "COMPLETED", "REJECTED", "ALL"})) - @RequestParam(name = "status", defaultValue = "ALL") @ValidEnum(value = WithdrawRequestStatus.class, hasAllOption = true) String status - ) { + "desc"})) @RequestParam(name = "direction", defaultValue = "desc") String direction, + @Parameter(description = "출금요청 상태, ALL : 모든 상태", example = "IN_PROGRESS", schema = @Schema(allowableValues = { + "IN_PROGRESS", "COMPLETED", "REJECTED", + "ALL"})) @RequestParam(name = "status", defaultValue = "ALL") @ValidEnum(value = CashoutStatus.class, hasAllOption = true) String status) { Sort.Direction sortDirection = Sort.Direction.fromString(direction); Pageable pageable = PageRequest.of(page, size, Sort.by(sortDirection, sortBy)); - return success(withDrawService.getAllWithdrawRequests(pageable, status)); + return success(cashoutService.getAllWithdrawRequests(pageable, status)); } @Logging(item = LogItem.CASHOUT, action = LogAction.VIEW, requester = LogRequester.ADMIN) @GetMapping("/{email}") - public ResponseEntity>> getWithdrawListByCreatorEmail( - @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) - @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, - @Parameter(description = "페이지 당 요소 개수 >=1", example = "10", required = true) - @RequestParam(name = "size", defaultValue = "10") @NotNull @Min(0) int size, + public ResponseEntity>> getCashoutListByCreatorEmail( + @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, + @Parameter(description = "페이지 당 요소 개수 >=1", example = "10", required = true) @RequestParam(name = "size", defaultValue = "10") @NotNull @Min(0) int size, @Parameter(description = "정렬 조건 - 기본값 생성일시", example = "createdAt", schema = @Schema(allowableValues = { - "createdAt"})) - @RequestParam(name = "sortBy", defaultValue = "createdAt") String sortBy, + "createdAt"})) @RequestParam(name = "sortBy", defaultValue = "createdAt") String sortBy, @Parameter(description = "정렬 방향 - 기본값 내림차순", example = "desc", schema = @Schema(allowableValues = {"acs", - "desc"})) - @RequestParam(name = "direction", defaultValue = "desc") String direction, - @Parameter(description = "출금요청 상태, ALL : 모든 상태", example = "IN_PROGRESS", schema = @Schema( - allowableValues = {"IN_PROGRESS", "COMPLETED", "REJECTED", "ALL"})) - @RequestParam(name = "status", defaultValue = "ALL") @ValidEnum(value = WithdrawRequestStatus.class, hasAllOption = true) String status, - @Parameter(description = "사용자 이메일", example = "example@naver.com", required = true) - @PathVariable("email") @NotNull String email - ) { + "desc"})) @RequestParam(name = "direction", defaultValue = "desc") String direction, + @Parameter(description = "출금요청 상태, ALL : 모든 상태", example = "IN_PROGRESS", schema = @Schema(allowableValues = { + "IN_PROGRESS", "COMPLETED", "REJECTED", + "ALL"})) @RequestParam(name = "status", defaultValue = "ALL") @ValidEnum(value = CashoutStatus.class, hasAllOption = true) String status, + @Parameter(description = "사용자 이메일", example = "example@naver.com", required = true) @PathVariable("email") @NotNull String email) { Sort.Direction sortDirection = Sort.Direction.fromString(direction); Pageable pageable = PageRequest.of(page, size, Sort.by(sortDirection, sortBy)); - return success(withDrawService.getWithdrawListByCreatorEmail(email, pageable, status)); + return success(cashoutService.getCashoutByCreatorEmail(email, pageable, status)); } @Logging(item = LogItem.CASHOUT, action = LogAction.COMPLETE, requester = LogRequester.ADMIN) - @PostMapping("/{withdrawRequestId}") - public ResponseEntity> complete( - @Parameter(description = "출금요청 Id", example = "1") - @PathVariable(value = "withdrawRequestId") Long withdrawRequestId, - @AuthUser Long userId - ) { - return success(withDrawService.complete(withdrawRequestId, userId)); + @PostMapping("/{cashoutId}") + public ResponseEntity> complete( + @Parameter(description = "출금요청 Id", example = "1") @PathVariable(value = "cashoutId") Long cashoutId, + @AuthUser Long userId) { + return success(cashoutService.complete(cashoutId, userId)); } } diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/controller/CreatorWithdrawController.java b/genti-api/src/main/java/com/gt/genti/cashout/controller/CreatorCashoutController.java similarity index 62% rename from genti-api/src/main/java/com/gt/genti/withdraw/controller/CreatorWithdrawController.java rename to genti-api/src/main/java/com/gt/genti/cashout/controller/CreatorCashoutController.java index bc2e0aa0..822c94e0 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/controller/CreatorWithdrawController.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/controller/CreatorCashoutController.java @@ -1,4 +1,4 @@ -package com.gt.genti.withdraw.controller; +package com.gt.genti.cashout.controller; import static com.gt.genti.response.GentiResponse.*; @@ -13,13 +13,14 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import com.gt.genti.cashout.api.CreatorCashoutApi; +import com.gt.genti.cashout.dto.response.CashoutFindByCreatorResponseDto; +import com.gt.genti.cashout.service.CashoutService; import com.gt.genti.model.LogAction; import com.gt.genti.model.LogItem; import com.gt.genti.model.LogRequester; import com.gt.genti.model.Logging; import com.gt.genti.user.model.AuthUser; -import com.gt.genti.withdraw.dto.response.WithdrawFindByCreatorResponseDto; -import com.gt.genti.withdraw.service.WithdrawService; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; @@ -28,37 +29,29 @@ import lombok.RequiredArgsConstructor; @RestController -@RequestMapping("/api/v1/creators/withdraw") +@RequestMapping("/api/v1/creators/cashouts") @RequiredArgsConstructor -public class CreatorWithdrawController implements com.gt.genti.withdraw.api.CreatorWithdrawApi { - private final WithdrawService withDrawService; +public class CreatorCashoutController implements CreatorCashoutApi { + private final CashoutService cashoutService; @Logging(item = LogItem.CASHOUT, action = LogAction.CREATE, requester = LogRequester.CREATOR) @PostMapping - public ResponseEntity> createWithdrawRequest( - @AuthUser Long userId - ) { + public ResponseEntity> createCashout(@AuthUser Long userId) { - return success(withDrawService.create(userId)); + return success(cashoutService.create(userId)); } @Logging(item = LogItem.CASHOUT, action = LogAction.VIEW, requester = LogRequester.CREATOR) @GetMapping - public ResponseEntity>> getWithdrawRequest( - @AuthUser Long userId, - @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) - @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, - @Parameter(description = "페이지 당 요소 개수 >=1", example = "10", required = true) - @RequestParam(name = "size", defaultValue = "10") @NotNull @Min(1) int size, + public ResponseEntity>> getCashout(@AuthUser Long userId, + @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, + @Parameter(description = "페이지 당 요소 개수 >=1", example = "10", required = true) @RequestParam(name = "size", defaultValue = "10") @NotNull @Min(1) int size, @Parameter(description = "정렬 조건 - 기본값 생성일시", example = "createdAt", schema = @Schema(allowableValues = {"id", - "createdAt"})) - @RequestParam(name = "sortBy", defaultValue = "createdAt") String sortBy, + "createdAt"})) @RequestParam(name = "sortBy", defaultValue = "createdAt") String sortBy, @Parameter(description = "정렬 방향 - 기본값 내림차순", example = "desc", schema = @Schema(allowableValues = {"acs", - "desc"})) - @RequestParam(name = "direction", defaultValue = "desc") String direction - ) { + "desc"})) @RequestParam(name = "direction", defaultValue = "desc") String direction) { Sort.Direction sortDirection = Sort.Direction.fromString(direction); Pageable pageable = PageRequest.of(page, size, Sort.by(sortDirection, sortBy)); - return success(withDrawService.findWithdrawList(userId, pageable)); + return success(cashoutService.findWithdrawList(userId, pageable)); } } diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawCompletionResponseDto.java b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutCompletionResponseDto.java similarity index 58% rename from genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawCompletionResponseDto.java rename to genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutCompletionResponseDto.java index 78d63f69..b35cf938 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawCompletionResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutCompletionResponseDto.java @@ -1,25 +1,25 @@ -package com.gt.genti.withdraw.dto.response; +package com.gt.genti.cashout.dto.response; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(name = "[Withdraw][Admin] 출금 요청 해결(송금) 완료시 응답 dto") +@Schema(name = "[Cashout][Admin] 출금 요청 해결(송금) 완료시 응답 dto") @Getter @NoArgsConstructor -public class WithdrawCompletionResponseDto { +public class CashoutCompletionResponseDto { @Schema(description = "출금요청 DB Id", example = "1") Long withdrawRequestId; @Schema(description = "출금요청의 상태", example = "출금 진행중") - WithdrawRequestStatus status; + CashoutStatus status; @Schema(description = "작업한 어드민 이름", example = "로빈") String modifiedBy; @Builder - public WithdrawCompletionResponseDto(Long withdrawRequestId, WithdrawRequestStatus status, String modifiedBy) { + public CashoutCompletionResponseDto(Long withdrawRequestId, CashoutStatus status, String modifiedBy) { this.withdrawRequestId = withdrawRequestId; this.status = status; this.modifiedBy = modifiedBy; diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByAdminResponseDto.java similarity index 66% rename from genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByAdminResponseDto.java rename to genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByAdminResponseDto.java index a8e355ae..c8b94fc6 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByAdminResponseDto.java @@ -1,6 +1,6 @@ -package com.gt.genti.withdraw.dto.response; +package com.gt.genti.cashout.dto.response; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import com.gt.genti.withdrawrequest.model.WithdrawRequest; import io.swagger.v3.oas.annotations.media.Schema; @@ -8,10 +8,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(name = "[Withdraw][Admin] 출금요청 조회 by 어드민 응답 dto") +@Schema(name = "[Cashout][Admin] 출금요청 조회 by 어드민 응답 dto") @Getter @NoArgsConstructor -public class WithdrawFindByAdminResponseDto { +public class CashoutFindByAdminResponseDto { @Schema(description = "출금요청 DB Id", example = "1") Long withdrawRequestId; @Schema(description = "출금요청한 유저의 이메일", example = "example@gmail.com") @@ -21,10 +21,10 @@ public class WithdrawFindByAdminResponseDto { @Schema(description = "출금 요청에 포함된 작업 수", example = "3") int taskCount; @Schema(description = "출금 요청 상태", example = "출금 완료") - WithdrawRequestStatus status; + CashoutStatus status; - public static WithdrawFindByAdminResponseDto of(WithdrawRequest withdrawRequest) { - return WithdrawFindByAdminResponseDto.builder() + public static CashoutFindByAdminResponseDto of(WithdrawRequest withdrawRequest) { + return CashoutFindByAdminResponseDto.builder() .withdrawRequestId(withdrawRequest.getId()) .requesterEmail(withdrawRequest.getCreator().getUser().getEmail()) .amount(withdrawRequest.getAmount()) @@ -34,8 +34,8 @@ public static WithdrawFindByAdminResponseDto of(WithdrawRequest withdrawRequest) } @Builder - public WithdrawFindByAdminResponseDto(Long withdrawRequestId, String requesterEmail, long amount, int taskCount, - WithdrawRequestStatus status) { + public CashoutFindByAdminResponseDto(Long withdrawRequestId, String requesterEmail, long amount, int taskCount, + CashoutStatus status) { this.withdrawRequestId = withdrawRequestId; this.requesterEmail = requesterEmail; this.amount = amount; diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByCreatorResponseDto.java b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByCreatorResponseDto.java similarity index 53% rename from genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByCreatorResponseDto.java rename to genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByCreatorResponseDto.java index 8ed3ad33..39d295d5 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByCreatorResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByCreatorResponseDto.java @@ -1,16 +1,16 @@ -package com.gt.genti.withdraw.dto.response; +package com.gt.genti.cashout.dto.response; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(name = "[Withdraw][Creator] 출금요청 조회 by 공급자 응답 dto") +@Schema(name = "[Cashout][Creator] 출금요청 조회 by 공급자 응답 dto") @Getter @NoArgsConstructor -public class WithdrawFindByCreatorResponseDto { +public class CashoutFindByCreatorResponseDto { @Schema(description = "출금요청 DB Id", example = "1") Long withdrawRequestId; @Schema(description = "출금 신청액", example = "15000") @@ -18,14 +18,14 @@ public class WithdrawFindByCreatorResponseDto { @Schema(description = "출금된 작업 개수", example = "3") int taskCount; @Schema(description = "출금요청 상태") - WithdrawRequestStatus withdrawRequestStatus; + CashoutStatus cashoutStatus; @Builder - public WithdrawFindByCreatorResponseDto(Long withdrawRequestId, Long amount, int taskCount, - WithdrawRequestStatus withdrawRequestStatus) { + public CashoutFindByCreatorResponseDto(Long withdrawRequestId, Long amount, int taskCount, + CashoutStatus cashoutStatus) { this.withdrawRequestId = withdrawRequestId; this.amount = amount; this.taskCount = taskCount; - this.withdrawRequestStatus = withdrawRequestStatus; + this.cashoutStatus = cashoutStatus; } } diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/service/WithdrawService.java b/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java similarity index 70% rename from genti-api/src/main/java/com/gt/genti/withdraw/service/WithdrawService.java rename to genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java index b00e26c1..b62152d8 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/service/WithdrawService.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java @@ -1,4 +1,4 @@ -package com.gt.genti.withdraw.service; +package com.gt.genti.cashout.service; import java.util.List; @@ -7,6 +7,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.gt.genti.cashout.dto.response.CashoutCompletionResponseDto; +import com.gt.genti.cashout.dto.response.CashoutFindByAdminResponseDto; +import com.gt.genti.cashout.dto.response.CashoutFindByCreatorResponseDto; import com.gt.genti.creator.model.Creator; import com.gt.genti.creator.repository.CreatorRepository; import com.gt.genti.deposit.model.Deposit; @@ -17,11 +20,8 @@ import com.gt.genti.settlement.repository.SettlementRepository; import com.gt.genti.user.model.User; import com.gt.genti.user.repository.UserRepository; -import com.gt.genti.withdraw.dto.response.WithdrawCompletionResponseDto; -import com.gt.genti.withdraw.dto.response.WithdrawFindByAdminResponseDto; -import com.gt.genti.withdraw.dto.response.WithdrawFindByCreatorResponseDto; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import com.gt.genti.withdrawrequest.model.WithdrawRequest; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; import com.gt.genti.withdrawrequest.repository.WithdrawRequestRepository; import lombok.RequiredArgsConstructor; @@ -29,14 +29,14 @@ @Service @Transactional @RequiredArgsConstructor -public class WithdrawService { +public class CashoutService { private final SettlementRepository settlementRepository; private final WithdrawRequestRepository withdrawRequestRepository; private final CreatorRepository creatorRepository; private final UserRepository userRepository; private final DepositRepository depositRepository; - public WithdrawFindByCreatorResponseDto create(Long user) { + public CashoutFindByCreatorResponseDto create(Long user) { Creator foundCreator = findCreatorByUserId(user); List foundSettlementList = settlementRepository.findAllWithdrawableByCreatorOrderByCreatedAtDesc( foundCreator); @@ -55,9 +55,9 @@ public WithdrawFindByCreatorResponseDto create(Long user) { return mapToFindByCreatorResponseDto(savedWithdrawRequest); } - private static WithdrawFindByCreatorResponseDto mapToFindByCreatorResponseDto( + private static CashoutFindByCreatorResponseDto mapToFindByCreatorResponseDto( WithdrawRequest savedWithdrawRequest) { - return WithdrawFindByCreatorResponseDto.builder() + return CashoutFindByCreatorResponseDto.builder() .withdrawRequestId(savedWithdrawRequest.getId()) .amount(savedWithdrawRequest.getAmount()) .taskCount(savedWithdrawRequest.getTaskCount()) @@ -70,35 +70,38 @@ private Creator findCreatorByUserId(Long userId) { .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.CreatorNotFound, userId)); } - public Page findWithdrawList(Long userId, Pageable pageable) { + public Page findWithdrawList(Long userId, Pageable pageable) { Creator foundCreator = findCreatorByUserId(userId); return withdrawRequestRepository.findAllByCreator(foundCreator, pageable) - .map(WithdrawService::mapToFindByCreatorResponseDto); + .map(CashoutService::mapToFindByCreatorResponseDto); } - public Page getAllWithdrawRequests(Pageable pageable, + public Page getAllWithdrawRequests(Pageable pageable, String statusString) { if (statusString.equals("ALL")) { return withdrawRequestRepository.findAll(pageable).map( - WithdrawFindByAdminResponseDto::of); + CashoutFindByAdminResponseDto::of); } else { - return withdrawRequestRepository.findAllByStatus(pageable, WithdrawRequestStatus.valueOf(statusString)) - .map(WithdrawFindByAdminResponseDto::of); + return withdrawRequestRepository.findAllByStatus(pageable, CashoutStatus.valueOf(statusString)) + .map(CashoutFindByAdminResponseDto::of); } } - public Page getWithdrawListByCreatorEmail(String email, Pageable pageable, String statusString) { - User foundUser = userRepository.findByEmail(email).orElseThrow(()->ExpectedException.withLogging(ResponseCode.UserNotFoundByEmail, email)); + public Page getCashoutByCreatorEmail(String email, Pageable pageable, + String statusString) { + User foundUser = userRepository.findByEmail(email) + .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.UserNotFoundByEmail, email)); if (statusString.equals("ALL")) { return withdrawRequestRepository.findAllByCreatedBy(foundUser, pageable).map( - WithdrawFindByAdminResponseDto::of); + CashoutFindByAdminResponseDto::of); } else { - return withdrawRequestRepository.findAllByCreatedByAndStatus(foundUser, pageable, WithdrawRequestStatus.valueOf(statusString)) - .map(WithdrawFindByAdminResponseDto::of); + return withdrawRequestRepository.findAllByCreatedByAndStatus(foundUser, pageable, + CashoutStatus.valueOf(statusString)) + .map(CashoutFindByAdminResponseDto::of); } } - public WithdrawCompletionResponseDto complete(Long withdrawRequestId, Long userId) { + public CashoutCompletionResponseDto complete(Long withdrawRequestId, Long userId) { WithdrawRequest foundWR = findWithdrawRequest(withdrawRequestId); User foundAdminUser = userRepository.findById(userId) .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.UserNotFound, userId)); @@ -107,7 +110,7 @@ public WithdrawCompletionResponseDto complete(Long withdrawRequestId, Long userI .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.DepositNotFound)); foundDeposit.completeWithdraw(foundWR.getAmount()); - return WithdrawCompletionResponseDto.builder() + return CashoutCompletionResponseDto.builder() .withdrawRequestId(foundWR.getId()) .modifiedBy(foundWR.getModifiedBy().getUsername()) .status(foundWR.getStatus()) diff --git a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequestStatus.java b/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/CashoutStatus.java similarity index 76% rename from genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequestStatus.java rename to genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/CashoutStatus.java index 4b4dba5c..9a9bbde1 100644 --- a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequestStatus.java +++ b/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/CashoutStatus.java @@ -9,7 +9,7 @@ @Getter @RequiredArgsConstructor -public enum WithdrawRequestStatus implements ConvertableEnum { +public enum CashoutStatus implements ConvertableEnum { AVAILABLE("AVAILABLE", "출금 가능"), IN_PROGRESS("IN_PROGRESS", "출금 진행중"), COMPLETED("COMPLETED", "출금 완료"), @@ -19,8 +19,8 @@ public enum WithdrawRequestStatus implements ConvertableEnum { private final String response; @JsonCreator - public static WithdrawRequestStatus fromString(String value) { - return EnumUtil.stringToEnum(WithdrawRequestStatus.class, value); + public static CashoutStatus fromString(String value) { + return EnumUtil.stringToEnum(CashoutStatus.class, value); } @Override From 937abf6b54a65f831b67f9ca000bc9bc1e103b12 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Thu, 29 Aug 2024 23:26:14 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Rename:=20#146=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genti/cashout/service/CashoutService.java | 2 +- .../WithdrawRequestStatusConverter.java | 6 +++--- .../model/SettlementAndWithdraw.java | 8 ++++---- .../model/WithdrawRequest.java | 19 +++++++++---------- .../repository/WithdrawRequestRepository.java | 8 ++++---- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java b/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java index b62152d8..6c3ed85c 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java @@ -61,7 +61,7 @@ private static CashoutFindByCreatorResponseDto mapToFindByCreatorResponseDto( .withdrawRequestId(savedWithdrawRequest.getId()) .amount(savedWithdrawRequest.getAmount()) .taskCount(savedWithdrawRequest.getTaskCount()) - .withdrawRequestStatus(savedWithdrawRequest.getStatus()) + .cashoutStatus(savedWithdrawRequest.getStatus()) .build(); } diff --git a/genti-domain/src/main/java/com/gt/genti/common/converter/WithdrawRequestStatusConverter.java b/genti-domain/src/main/java/com/gt/genti/common/converter/WithdrawRequestStatusConverter.java index 8bf06aee..d5fe29af 100644 --- a/genti-domain/src/main/java/com/gt/genti/common/converter/WithdrawRequestStatusConverter.java +++ b/genti-domain/src/main/java/com/gt/genti/common/converter/WithdrawRequestStatusConverter.java @@ -1,14 +1,14 @@ package com.gt.genti.common.converter; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import jakarta.persistence.Converter; @Converter -public class WithdrawRequestStatusConverter extends DefaultEnumDBConverter { +public class WithdrawRequestStatusConverter extends DefaultEnumDBConverter { public WithdrawRequestStatusConverter() { - super(WithdrawRequestStatus.class); + super(CashoutStatus.class); } } \ No newline at end of file diff --git a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java b/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java index 21dbff86..1b453109 100644 --- a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java +++ b/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java @@ -4,7 +4,7 @@ import java.time.LocalDateTime; import java.util.Map; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; @@ -29,14 +29,14 @@ public class SettlementAndWithdraw { "[정산내역&출금내역]출금 완료된 경우 : COMPLETED " + "
" + "[출금내역] 출금 거절된 경우(현재 사용X) : REJECTED " ) - WithdrawRequestStatus status; + CashoutStatus status; public SettlementAndWithdraw(Map attributes) { this.id = (Long)attributes.get("id"); this.isSettlement = (Boolean)attributes.get("isSettlement"); this.amount = (Long)attributes.get("amount"); this.createdAt = (LocalDateTime)attributes.get("createdAt"); - this.status = WithdrawRequestStatus.valueOf((String)attributes.get("status")); + this.status = CashoutStatus.valueOf((String)attributes.get("status")); } public SettlementAndWithdraw(Object[] o) { @@ -48,6 +48,6 @@ public SettlementAndWithdraw(Object[] o) { } this.amount = (Long)o[2]; this.createdAt = ((Timestamp)o[3]).toLocalDateTime(); - this.status = WithdrawRequestStatus.valueOf((String)o[4]); + this.status = CashoutStatus.valueOf((String)o[4]); } } diff --git a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequest.java b/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequest.java index 8be6085e..4082d48b 100644 --- a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequest.java +++ b/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequest.java @@ -1,8 +1,8 @@ package com.gt.genti.withdrawrequest.model; import com.gt.genti.common.baseentity.model.BaseEntity; -import com.gt.genti.creator.model.Creator; import com.gt.genti.common.converter.WithdrawRequestStatusConverter; +import com.gt.genti.creator.model.Creator; import com.gt.genti.user.model.User; import jakarta.persistence.Column; @@ -40,25 +40,24 @@ public class WithdrawRequest extends BaseEntity { @Convert(converter = WithdrawRequestStatusConverter.class) @Column(name = "status", nullable = false) - WithdrawRequestStatus status; - + CashoutStatus status; @PrePersist - public void prePersist(){ - if(this.amount == null){ + public void prePersist() { + if (this.amount == null) { this.amount = 0L; } - if(this.taskCount == null){ + if (this.taskCount == null) { this.taskCount = 0; } - if(this.status == null){ - this.status = WithdrawRequestStatus.IN_PROGRESS; + if (this.status == null) { + this.status = CashoutStatus.IN_PROGRESS; } } public WithdrawRequest(Creator creator) { this.creator = creator; - this.status = WithdrawRequestStatus.IN_PROGRESS; + this.status = CashoutStatus.IN_PROGRESS; } public void addSettlement(long amount) { @@ -68,6 +67,6 @@ public void addSettlement(long amount) { public void complete(User modifiedBy) { this.setModifiedBy(modifiedBy); - this.status = WithdrawRequestStatus.COMPLETED; + this.status = CashoutStatus.COMPLETED; } } diff --git a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/repository/WithdrawRequestRepository.java b/genti-domain/src/main/java/com/gt/genti/withdrawrequest/repository/WithdrawRequestRepository.java index 2559ca27..43aab70d 100644 --- a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/repository/WithdrawRequestRepository.java +++ b/genti-domain/src/main/java/com/gt/genti/withdrawrequest/repository/WithdrawRequestRepository.java @@ -1,23 +1,23 @@ package com.gt.genti.withdrawrequest.repository; -import com.gt.genti.user.model.User; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.gt.genti.creator.model.Creator; +import com.gt.genti.user.model.User; +import com.gt.genti.withdrawrequest.model.CashoutStatus; import com.gt.genti.withdrawrequest.model.WithdrawRequest; -import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; @Repository public interface WithdrawRequestRepository extends JpaRepository { Page findAllByCreator(Creator creator, Pageable pageable); - Page findAllByStatus(Pageable pageable, WithdrawRequestStatus status); + Page findAllByStatus(Pageable pageable, CashoutStatus status); Page findAllByCreatedBy(User user, Pageable pageable); - Page findAllByCreatedByAndStatus(User user, Pageable pageable, WithdrawRequestStatus status); + Page findAllByCreatedByAndStatus(User user, Pageable pageable, CashoutStatus status); } From 851f6a2f6c193c36702893178764140bf7ca88aa Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Fri, 30 Aug 2024 21:32:29 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Rename:=20#146=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gt/genti/cashout/api/AdminCashoutApi.java | 4 +- .../genti/cashout/api/CreatorCashoutApi.java | 2 +- .../controller/AdminCashoutController.java | 4 +- .../controller/CreatorCashoutController.java | 2 +- .../CashoutCompletionResponseDto.java | 8 +- .../CashoutFindByAdminResponseDto.java | 22 +++--- .../CashoutFindByCreatorResponseDto.java | 8 +- .../genti/cashout/service/CashoutService.java | 75 +++++++++---------- .../genti/settlement/api/SettlementApi.java | 4 +- .../controller/SettlementController.java | 4 +- .../settlement/service/SettlementService.java | 16 ++-- .../SettlementAndCashoutPageResponseDto.java | 28 +++++++ .../SettlementAndWithdrawPageResponseDto.java | 28 ------- .../gt/genti/swagger/EnumResponseGroup.java | 2 +- .../gt/genti/constants/ErrorConstants.java | 8 +- .../java/com/gt/genti/error/ResponseCode.java | 8 +- .../model/Cashout.java} | 12 +-- .../model/CashoutStatus.java | 2 +- .../cashout/repository/CashoutRepository.java | 23 ++++++ .../converter/CashoutStatusConverter.java | 14 ++++ .../WithdrawRequestStatusConverter.java | 14 ---- .../com/gt/genti/deposit/model/Deposit.java | 4 +- .../gt/genti/settlement/model/Settlement.java | 6 +- .../settlement/model/SettlementStatus.java | 4 +- .../repository/SettlementRepository.java | 4 +- .../model/SettlementAndCashout.java} | 12 +-- .../SettlementAndCashoutRepositoryCustom.java | 8 ++ ...lementAndCashoutRepositoryCustomImpl.java} | 14 ++-- ...ttlementAndWithdrawalRepositoryCustom.java | 8 -- .../repository/WithdrawRequestRepository.java | 23 ------ 30 files changed, 183 insertions(+), 188 deletions(-) create mode 100644 genti-api/src/main/java/com/gt/genti/settlementandcashout/dto/response/SettlementAndCashoutPageResponseDto.java delete mode 100644 genti-api/src/main/java/com/gt/genti/settlementandwithdraw/dto/response/SettlementAndWithdrawPageResponseDto.java rename genti-domain/src/main/java/com/gt/genti/{withdrawrequest/model/WithdrawRequest.java => cashout/model/Cashout.java} (83%) rename genti-domain/src/main/java/com/gt/genti/{withdrawrequest => cashout}/model/CashoutStatus.java (94%) create mode 100644 genti-domain/src/main/java/com/gt/genti/cashout/repository/CashoutRepository.java create mode 100644 genti-domain/src/main/java/com/gt/genti/common/converter/CashoutStatusConverter.java delete mode 100644 genti-domain/src/main/java/com/gt/genti/common/converter/WithdrawRequestStatusConverter.java rename genti-domain/src/main/java/com/gt/genti/{settlementanwithdraw/model/SettlementAndWithdraw.java => settlementandcashout/model/SettlementAndCashout.java} (82%) create mode 100644 genti-domain/src/main/java/com/gt/genti/settlementandcashout/repository/SettlementAndCashoutRepositoryCustom.java rename genti-domain/src/main/java/com/gt/genti/{settlementanwithdraw/repository/SettlementAndWithdrawalRepositoryCustomImpl.java => settlementandcashout/repository/SettlementAndCashoutRepositoryCustomImpl.java} (70%) delete mode 100644 genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/repository/SettlementAndWithdrawalRepositoryCustom.java delete mode 100644 genti-domain/src/main/java/com/gt/genti/withdrawrequest/repository/WithdrawRequestRepository.java diff --git a/genti-api/src/main/java/com/gt/genti/cashout/api/AdminCashoutApi.java b/genti-api/src/main/java/com/gt/genti/cashout/api/AdminCashoutApi.java index fd3ae4de..38782cdd 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/api/AdminCashoutApi.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/api/AdminCashoutApi.java @@ -7,6 +7,7 @@ import com.gt.genti.cashout.dto.response.CashoutCompletionResponseDto; import com.gt.genti.cashout.dto.response.CashoutFindByAdminResponseDto; +import com.gt.genti.cashout.model.CashoutStatus; import com.gt.genti.error.ResponseCode; import com.gt.genti.response.GentiResponse.ApiResult; import com.gt.genti.swagger.AuthorizedAdmin; @@ -14,7 +15,6 @@ import com.gt.genti.swagger.EnumResponses; import com.gt.genti.user.model.AuthUser; import com.gt.genti.validator.ValidEnum; -import com.gt.genti.withdrawrequest.model.CashoutStatus; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -77,7 +77,7 @@ ResponseEntity>> getCashoutListByC }) ResponseEntity> complete( @Parameter(description = "출금요청 Id", example = "1") - @PathVariable(value = "withdrawRequestId") Long withdrawRequestId, + @PathVariable(value = "cashoutId") Long cashoutId, @AuthUser Long userId ); } diff --git a/genti-api/src/main/java/com/gt/genti/cashout/api/CreatorCashoutApi.java b/genti-api/src/main/java/com/gt/genti/cashout/api/CreatorCashoutApi.java index 988fd7d2..5d9011b8 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/api/CreatorCashoutApi.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/api/CreatorCashoutApi.java @@ -27,7 +27,7 @@ public interface CreatorCashoutApi { @EnumResponses(value = { @EnumResponse(ResponseCode.OK), @EnumResponse(ResponseCode.CreatorNotFound), - @EnumResponse(ResponseCode.CannotCreateWithdrawalDueToSettlementsNotAvailable) + @EnumResponse(ResponseCode.CannotRequestCashoutDueToSettlementsNotAvailable) }) ResponseEntity> createCashout( @AuthUser Long userId diff --git a/genti-api/src/main/java/com/gt/genti/cashout/controller/AdminCashoutController.java b/genti-api/src/main/java/com/gt/genti/cashout/controller/AdminCashoutController.java index 667e98b3..023bf846 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/controller/AdminCashoutController.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/controller/AdminCashoutController.java @@ -17,6 +17,7 @@ import com.gt.genti.cashout.api.AdminCashoutApi; import com.gt.genti.cashout.dto.response.CashoutCompletionResponseDto; import com.gt.genti.cashout.dto.response.CashoutFindByAdminResponseDto; +import com.gt.genti.cashout.model.CashoutStatus; import com.gt.genti.cashout.service.CashoutService; import com.gt.genti.model.LogAction; import com.gt.genti.model.LogItem; @@ -24,7 +25,6 @@ import com.gt.genti.model.Logging; import com.gt.genti.user.model.AuthUser; import com.gt.genti.validator.ValidEnum; -import com.gt.genti.withdrawrequest.model.CashoutStatus; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; @@ -53,7 +53,7 @@ public ResponseEntity>> getAllCash Sort.Direction sortDirection = Sort.Direction.fromString(direction); Pageable pageable = PageRequest.of(page, size, Sort.by(sortDirection, sortBy)); - return success(cashoutService.getAllWithdrawRequests(pageable, status)); + return success(cashoutService.getAllCashout(pageable, status)); } @Logging(item = LogItem.CASHOUT, action = LogAction.VIEW, requester = LogRequester.ADMIN) diff --git a/genti-api/src/main/java/com/gt/genti/cashout/controller/CreatorCashoutController.java b/genti-api/src/main/java/com/gt/genti/cashout/controller/CreatorCashoutController.java index 822c94e0..f49561df 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/controller/CreatorCashoutController.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/controller/CreatorCashoutController.java @@ -52,6 +52,6 @@ public ResponseEntity>> getCasho "desc"})) @RequestParam(name = "direction", defaultValue = "desc") String direction) { Sort.Direction sortDirection = Sort.Direction.fromString(direction); Pageable pageable = PageRequest.of(page, size, Sort.by(sortDirection, sortBy)); - return success(cashoutService.findWithdrawList(userId, pageable)); + return success(cashoutService.findCashoutList(userId, pageable)); } } diff --git a/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutCompletionResponseDto.java b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutCompletionResponseDto.java index b35cf938..0130295a 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutCompletionResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutCompletionResponseDto.java @@ -1,6 +1,6 @@ package com.gt.genti.cashout.dto.response; -import com.gt.genti.withdrawrequest.model.CashoutStatus; +import com.gt.genti.cashout.model.CashoutStatus; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -12,15 +12,15 @@ @NoArgsConstructor public class CashoutCompletionResponseDto { @Schema(description = "출금요청 DB Id", example = "1") - Long withdrawRequestId; + Long cashoutId; @Schema(description = "출금요청의 상태", example = "출금 진행중") CashoutStatus status; @Schema(description = "작업한 어드민 이름", example = "로빈") String modifiedBy; @Builder - public CashoutCompletionResponseDto(Long withdrawRequestId, CashoutStatus status, String modifiedBy) { - this.withdrawRequestId = withdrawRequestId; + public CashoutCompletionResponseDto(Long cashoutId, CashoutStatus status, String modifiedBy) { + this.cashoutId = cashoutId; this.status = status; this.modifiedBy = modifiedBy; } diff --git a/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByAdminResponseDto.java index c8b94fc6..cdfd3385 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByAdminResponseDto.java @@ -1,7 +1,7 @@ package com.gt.genti.cashout.dto.response; -import com.gt.genti.withdrawrequest.model.CashoutStatus; -import com.gt.genti.withdrawrequest.model.WithdrawRequest; +import com.gt.genti.cashout.model.Cashout; +import com.gt.genti.cashout.model.CashoutStatus; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -13,7 +13,7 @@ @NoArgsConstructor public class CashoutFindByAdminResponseDto { @Schema(description = "출금요청 DB Id", example = "1") - Long withdrawRequestId; + Long cashoutId; @Schema(description = "출금요청한 유저의 이메일", example = "example@gmail.com") String requesterEmail; @Schema(description = "출금 금액", example = "15000") @@ -23,20 +23,20 @@ public class CashoutFindByAdminResponseDto { @Schema(description = "출금 요청 상태", example = "출금 완료") CashoutStatus status; - public static CashoutFindByAdminResponseDto of(WithdrawRequest withdrawRequest) { + public static CashoutFindByAdminResponseDto of(Cashout cashout) { return CashoutFindByAdminResponseDto.builder() - .withdrawRequestId(withdrawRequest.getId()) - .requesterEmail(withdrawRequest.getCreator().getUser().getEmail()) - .amount(withdrawRequest.getAmount()) - .status(withdrawRequest.getStatus()) - .taskCount(withdrawRequest.getTaskCount()) + .cashoutId(cashout.getId()) + .requesterEmail(cashout.getCreator().getUser().getEmail()) + .amount(cashout.getAmount()) + .status(cashout.getStatus()) + .taskCount(cashout.getTaskCount()) .build(); } @Builder - public CashoutFindByAdminResponseDto(Long withdrawRequestId, String requesterEmail, long amount, int taskCount, + public CashoutFindByAdminResponseDto(Long cashoutId, String requesterEmail, long amount, int taskCount, CashoutStatus status) { - this.withdrawRequestId = withdrawRequestId; + this.cashoutId = cashoutId; this.requesterEmail = requesterEmail; this.amount = amount; this.taskCount = taskCount; diff --git a/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByCreatorResponseDto.java b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByCreatorResponseDto.java index 39d295d5..56b4e405 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByCreatorResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/dto/response/CashoutFindByCreatorResponseDto.java @@ -1,6 +1,6 @@ package com.gt.genti.cashout.dto.response; -import com.gt.genti.withdrawrequest.model.CashoutStatus; +import com.gt.genti.cashout.model.CashoutStatus; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -12,7 +12,7 @@ @NoArgsConstructor public class CashoutFindByCreatorResponseDto { @Schema(description = "출금요청 DB Id", example = "1") - Long withdrawRequestId; + Long cashoutId; @Schema(description = "출금 신청액", example = "15000") Long amount; @Schema(description = "출금된 작업 개수", example = "3") @@ -21,9 +21,9 @@ public class CashoutFindByCreatorResponseDto { CashoutStatus cashoutStatus; @Builder - public CashoutFindByCreatorResponseDto(Long withdrawRequestId, Long amount, int taskCount, + public CashoutFindByCreatorResponseDto(Long cashoutId, Long amount, int taskCount, CashoutStatus cashoutStatus) { - this.withdrawRequestId = withdrawRequestId; + this.cashoutId = cashoutId; this.amount = amount; this.taskCount = taskCount; this.cashoutStatus = cashoutStatus; diff --git a/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java b/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java index 6c3ed85c..788d0417 100644 --- a/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java +++ b/genti-api/src/main/java/com/gt/genti/cashout/service/CashoutService.java @@ -10,6 +10,9 @@ import com.gt.genti.cashout.dto.response.CashoutCompletionResponseDto; import com.gt.genti.cashout.dto.response.CashoutFindByAdminResponseDto; import com.gt.genti.cashout.dto.response.CashoutFindByCreatorResponseDto; +import com.gt.genti.cashout.model.Cashout; +import com.gt.genti.cashout.model.CashoutStatus; +import com.gt.genti.cashout.repository.CashoutRepository; import com.gt.genti.creator.model.Creator; import com.gt.genti.creator.repository.CreatorRepository; import com.gt.genti.deposit.model.Deposit; @@ -20,9 +23,6 @@ import com.gt.genti.settlement.repository.SettlementRepository; import com.gt.genti.user.model.User; import com.gt.genti.user.repository.UserRepository; -import com.gt.genti.withdrawrequest.model.CashoutStatus; -import com.gt.genti.withdrawrequest.model.WithdrawRequest; -import com.gt.genti.withdrawrequest.repository.WithdrawRequestRepository; import lombok.RequiredArgsConstructor; @@ -31,37 +31,36 @@ @RequiredArgsConstructor public class CashoutService { private final SettlementRepository settlementRepository; - private final WithdrawRequestRepository withdrawRequestRepository; + private final CashoutRepository cashoutRepository; private final CreatorRepository creatorRepository; private final UserRepository userRepository; private final DepositRepository depositRepository; public CashoutFindByCreatorResponseDto create(Long user) { Creator foundCreator = findCreatorByUserId(user); - List foundSettlementList = settlementRepository.findAllWithdrawableByCreatorOrderByCreatedAtDesc( + List foundSettlementList = settlementRepository.findAllValidSettlementByCreatorOrderByCreatedAtDesc( foundCreator); if (foundSettlementList.isEmpty()) { - throw ExpectedException.withoutLogging(ResponseCode.CannotCreateWithdrawalDueToSettlementsNotAvailable); + throw ExpectedException.withoutLogging(ResponseCode.CannotRequestCashoutDueToSettlementsNotAvailable); } - WithdrawRequest withdrawRequest = new WithdrawRequest(foundCreator); + Cashout cashout = new Cashout(foundCreator); foundSettlementList.forEach(settlement -> { - settlement.setWithdrawRequest(withdrawRequest); - withdrawRequest.addSettlement(settlement.getReward()); + settlement.setCashout(cashout); + cashout.addSettlement(settlement.getReward()); }); - WithdrawRequest savedWithdrawRequest = withdrawRequestRepository.save(withdrawRequest); - return mapToFindByCreatorResponseDto(savedWithdrawRequest); + Cashout savedCashout = cashoutRepository.save(cashout); + return mapToFindByCreatorResponseDto(savedCashout); } - private static CashoutFindByCreatorResponseDto mapToFindByCreatorResponseDto( - WithdrawRequest savedWithdrawRequest) { + private static CashoutFindByCreatorResponseDto mapToFindByCreatorResponseDto(Cashout savedCashout) { return CashoutFindByCreatorResponseDto.builder() - .withdrawRequestId(savedWithdrawRequest.getId()) - .amount(savedWithdrawRequest.getAmount()) - .taskCount(savedWithdrawRequest.getTaskCount()) - .cashoutStatus(savedWithdrawRequest.getStatus()) + .cashoutId(savedCashout.getId()) + .amount(savedCashout.getAmount()) + .taskCount(savedCashout.getTaskCount()) + .cashoutStatus(savedCashout.getStatus()) .build(); } @@ -70,19 +69,17 @@ private Creator findCreatorByUserId(Long userId) { .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.CreatorNotFound, userId)); } - public Page findWithdrawList(Long userId, Pageable pageable) { + public Page findCashoutList(Long userId, Pageable pageable) { Creator foundCreator = findCreatorByUserId(userId); - return withdrawRequestRepository.findAllByCreator(foundCreator, pageable) + return cashoutRepository.findAllByCreator(foundCreator, pageable) .map(CashoutService::mapToFindByCreatorResponseDto); } - public Page getAllWithdrawRequests(Pageable pageable, - String statusString) { + public Page getAllCashout(Pageable pageable, String statusString) { if (statusString.equals("ALL")) { - return withdrawRequestRepository.findAll(pageable).map( - CashoutFindByAdminResponseDto::of); + return cashoutRepository.findAll(pageable).map(CashoutFindByAdminResponseDto::of); } else { - return withdrawRequestRepository.findAllByStatus(pageable, CashoutStatus.valueOf(statusString)) + return cashoutRepository.findAllByStatus(pageable, CashoutStatus.valueOf(statusString)) .map(CashoutFindByAdminResponseDto::of); } } @@ -92,33 +89,31 @@ public Page getCashoutByCreatorEmail(String email User foundUser = userRepository.findByEmail(email) .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.UserNotFoundByEmail, email)); if (statusString.equals("ALL")) { - return withdrawRequestRepository.findAllByCreatedBy(foundUser, pageable).map( - CashoutFindByAdminResponseDto::of); + return cashoutRepository.findAllByCreatedBy(foundUser, pageable).map(CashoutFindByAdminResponseDto::of); } else { - return withdrawRequestRepository.findAllByCreatedByAndStatus(foundUser, pageable, - CashoutStatus.valueOf(statusString)) - .map(CashoutFindByAdminResponseDto::of); + return cashoutRepository.findAllByCreatedByAndStatus(foundUser, pageable, + CashoutStatus.valueOf(statusString)).map(CashoutFindByAdminResponseDto::of); } } - public CashoutCompletionResponseDto complete(Long withdrawRequestId, Long userId) { - WithdrawRequest foundWR = findWithdrawRequest(withdrawRequestId); + public CashoutCompletionResponseDto complete(Long cashoutId, Long userId) { + Cashout foundCashout = getCashout(cashoutId); User foundAdminUser = userRepository.findById(userId) .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.UserNotFound, userId)); - foundWR.complete(foundAdminUser); - Deposit foundDeposit = depositRepository.findByCreator(foundWR.getCreator()) + foundCashout.complete(foundAdminUser); + Deposit foundDeposit = depositRepository.findByCreator(foundCashout.getCreator()) .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.DepositNotFound)); - foundDeposit.completeWithdraw(foundWR.getAmount()); + foundDeposit.completeCashout(foundCashout.getAmount()); return CashoutCompletionResponseDto.builder() - .withdrawRequestId(foundWR.getId()) - .modifiedBy(foundWR.getModifiedBy().getUsername()) - .status(foundWR.getStatus()) + .cashoutId(foundCashout.getId()) + .modifiedBy(foundCashout.getModifiedBy().getUsername()) + .status(foundCashout.getStatus()) .build(); } - private WithdrawRequest findWithdrawRequest(Long withdrawRequestId) { - return withdrawRequestRepository.findById(withdrawRequestId) - .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.WithdrawRequestNotFound)); + private Cashout getCashout(Long cashoutId) { + return cashoutRepository.findById(cashoutId) + .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.CashoutNotFound)); } } diff --git a/genti-api/src/main/java/com/gt/genti/settlement/api/SettlementApi.java b/genti-api/src/main/java/com/gt/genti/settlement/api/SettlementApi.java index 2a83bcad..71407f04 100644 --- a/genti-api/src/main/java/com/gt/genti/settlement/api/SettlementApi.java +++ b/genti-api/src/main/java/com/gt/genti/settlement/api/SettlementApi.java @@ -5,7 +5,7 @@ import com.gt.genti.error.ResponseCode; import com.gt.genti.response.GentiResponse.ApiResult; -import com.gt.genti.settlementandwithdraw.dto.response.SettlementAndWithdrawPageResponseDto; +import com.gt.genti.settlementandcashout.dto.response.SettlementAndCashoutPageResponseDto; import com.gt.genti.swagger.AuthorizedCreator; import com.gt.genti.swagger.EnumResponse; import com.gt.genti.swagger.EnumResponses; @@ -28,7 +28,7 @@ public interface SettlementApi { @EnumResponse(ResponseCode.CreatorNotFound), @EnumResponse(ResponseCode.DepositNotFound) }) - ResponseEntity> getMySettlements( + ResponseEntity> getMySettlements( @AuthUser Long userId, @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, diff --git a/genti-api/src/main/java/com/gt/genti/settlement/controller/SettlementController.java b/genti-api/src/main/java/com/gt/genti/settlement/controller/SettlementController.java index 31fc2c34..68064782 100644 --- a/genti-api/src/main/java/com/gt/genti/settlement/controller/SettlementController.java +++ b/genti-api/src/main/java/com/gt/genti/settlement/controller/SettlementController.java @@ -17,7 +17,7 @@ import com.gt.genti.model.Logging; import com.gt.genti.settlement.api.SettlementApi; import com.gt.genti.settlement.service.SettlementService; -import com.gt.genti.settlementandwithdraw.dto.response.SettlementAndWithdrawPageResponseDto; +import com.gt.genti.settlementandcashout.dto.response.SettlementAndCashoutPageResponseDto; import com.gt.genti.user.model.AuthUser; import io.swagger.v3.oas.annotations.Parameter; @@ -34,7 +34,7 @@ public class SettlementController implements SettlementApi { @Logging(item = LogItem.SETTLEMENT, action = LogAction.VIEW, requester = LogRequester.CREATOR) @GetMapping - public ResponseEntity> getMySettlements( + public ResponseEntity> getMySettlements( @AuthUser Long userId, @Parameter(description = "페이지 번호 (0-based)", example = "0", required = true) @RequestParam(name = "page", defaultValue = "0") @NotNull @Min(0) int page, diff --git a/genti-api/src/main/java/com/gt/genti/settlement/service/SettlementService.java b/genti-api/src/main/java/com/gt/genti/settlement/service/SettlementService.java index e1059166..c112d5ef 100644 --- a/genti-api/src/main/java/com/gt/genti/settlement/service/SettlementService.java +++ b/genti-api/src/main/java/com/gt/genti/settlement/service/SettlementService.java @@ -10,9 +10,9 @@ import com.gt.genti.deposit.repository.DepositRepository; import com.gt.genti.error.ExpectedException; import com.gt.genti.error.ResponseCode; -import com.gt.genti.settlementandwithdraw.dto.response.SettlementAndWithdrawPageResponseDto; -import com.gt.genti.settlementanwithdraw.model.SettlementAndWithdraw; -import com.gt.genti.settlementanwithdraw.repository.SettlementAndWithdrawalRepositoryCustom; +import com.gt.genti.settlementandcashout.dto.response.SettlementAndCashoutPageResponseDto; +import com.gt.genti.settlementandcashout.model.SettlementAndCashout; +import com.gt.genti.settlementandcashout.repository.SettlementAndCashoutRepositoryCustom; import lombok.RequiredArgsConstructor; @@ -22,16 +22,16 @@ public class SettlementService { private final CreatorRepository creatorRepository; private final DepositRepository depositRepository; - private final SettlementAndWithdrawalRepositoryCustom settlementAndWithdrawalRepositoryCustom; + private final SettlementAndCashoutRepositoryCustom settlementAndCashoutRepositoryCustom; - public SettlementAndWithdrawPageResponseDto getAllSettlements(Long userId, Pageable pageable) { + public SettlementAndCashoutPageResponseDto getAllSettlements(Long userId, Pageable pageable) { Creator foundCreator = findCreatorByUserId(userId); Deposit foundDeposit = findDepositByCreator(foundCreator); - return new SettlementAndWithdrawPageResponseDto(foundDeposit, - settlementAndWithdrawalRepositoryCustom.findSettlementAndWithdrawByCreatorPagination(foundCreator.getId(), + return new SettlementAndCashoutPageResponseDto(foundDeposit, + settlementAndCashoutRepositoryCustom.findSettlementAndCashoutByCreatorPagination(foundCreator.getId(), pageable) - .map(SettlementAndWithdraw::new)); + .map(SettlementAndCashout::new)); } private Deposit findDepositByCreator(Creator foundCreator) { diff --git a/genti-api/src/main/java/com/gt/genti/settlementandcashout/dto/response/SettlementAndCashoutPageResponseDto.java b/genti-api/src/main/java/com/gt/genti/settlementandcashout/dto/response/SettlementAndCashoutPageResponseDto.java new file mode 100644 index 00000000..5028ccf7 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/settlementandcashout/dto/response/SettlementAndCashoutPageResponseDto.java @@ -0,0 +1,28 @@ +package com.gt.genti.settlementandcashout.dto.response; + +import org.springframework.data.domain.Page; + +import com.gt.genti.deposit.dto.response.DepositFindByCreatorResponseDto; +import com.gt.genti.deposit.model.Deposit; +import com.gt.genti.settlementandcashout.model.SettlementAndCashout; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Schema(name = "[SettlementAndCashout][Creator] 정산&출금내역 조회 페이지네이션 응답 dto", description = "정산&출금내역 리스트와 함께 잔액을 조회한다.") +@Getter +@NoArgsConstructor +public class SettlementAndCashoutPageResponseDto { + + @Schema(description = "잔액조회 dto") + DepositFindByCreatorResponseDto deposit; + @Schema(description = "정산&출금내역 페이지 응답") + Page settlementAndCashoutPage; + + public SettlementAndCashoutPageResponseDto(Deposit deposit, + Page settlementAndCashoutPage) { + this.deposit = new DepositFindByCreatorResponseDto(deposit); + this.settlementAndCashoutPage = settlementAndCashoutPage; + } +} diff --git a/genti-api/src/main/java/com/gt/genti/settlementandwithdraw/dto/response/SettlementAndWithdrawPageResponseDto.java b/genti-api/src/main/java/com/gt/genti/settlementandwithdraw/dto/response/SettlementAndWithdrawPageResponseDto.java deleted file mode 100644 index 6cc04d57..00000000 --- a/genti-api/src/main/java/com/gt/genti/settlementandwithdraw/dto/response/SettlementAndWithdrawPageResponseDto.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.gt.genti.settlementandwithdraw.dto.response; - -import org.springframework.data.domain.Page; - -import com.gt.genti.deposit.dto.response.DepositFindByCreatorResponseDto; -import com.gt.genti.deposit.model.Deposit; -import com.gt.genti.settlementanwithdraw.model.SettlementAndWithdraw; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@Schema(name = "[Settlement][Creator] 정산&출금내역 조회 페이지네이션 응답 dto", description = "정산&출금내역 리스트와 함께 잔액을 조회한다.") -@Getter -@NoArgsConstructor -public class SettlementAndWithdrawPageResponseDto { - - @Schema(description = "잔액조회 dto") - DepositFindByCreatorResponseDto deposit; - @Schema(description = "정산&출금내역 페이지 응답") - Page settlementAndWithdrawPage; - - public SettlementAndWithdrawPageResponseDto(Deposit deposit, - Page settlementAndWithdrawPage) { - this.deposit = new DepositFindByCreatorResponseDto(deposit); - this.settlementAndWithdrawPage = settlementAndWithdrawPage; - } -} diff --git a/genti-api/src/main/java/com/gt/genti/swagger/EnumResponseGroup.java b/genti-api/src/main/java/com/gt/genti/swagger/EnumResponseGroup.java index 1936d153..86644b97 100644 --- a/genti-api/src/main/java/com/gt/genti/swagger/EnumResponseGroup.java +++ b/genti-api/src/main/java/com/gt/genti/swagger/EnumResponseGroup.java @@ -25,7 +25,7 @@ public enum EnumResponseGroup { @EnumResponse(PictureCompletedNotFound), @EnumResponse(PictureCreatedByCreatorNotFound), @EnumResponse(PictureProfileNotFound), - @EnumResponse(WithdrawRequestNotFound) + @EnumResponse(CashoutNotFound) }) NOT_FOUND, diff --git a/genti-common/src/main/java/com/gt/genti/constants/ErrorConstants.java b/genti-common/src/main/java/com/gt/genti/constants/ErrorConstants.java index c7bcb92a..45c55a74 100644 --- a/genti-common/src/main/java/com/gt/genti/constants/ErrorConstants.java +++ b/genti-common/src/main/java/com/gt/genti/constants/ErrorConstants.java @@ -10,7 +10,7 @@ public class ErrorConstants { private static final String PICTURE = "PICTURE"; private static final String DEPOSIT = "DEPOSIT"; - private static final String WITHDRAW = "WITHDRAW"; + private static final String CASHOUT = "CASHOUT"; private static final String UPLOAD = "UPLOAD"; private static final String DISCORD = "DISCORD"; @@ -92,9 +92,9 @@ private static String CODE(String type, int seq) { public static final String HandlerMethodValidation = CODE(VALIDATION, 1); public static final String HttpMessageNotReadable = CODE(VALIDATION, 2); - public static final String CannotCreateWithdrawalDueToSettlementsNotAvailable = CODE(WITHDRAW, 1); - public static final String WithdrawRequestNotFound = CODE(WITHDRAW, 2); - public static final String NotEnoughBalance = CODE(WITHDRAW, 3); + public static final String CannotRequestCashoutDueToSettlementsNotAvailable = CODE(CASHOUT, 1); + public static final String CashoutNotFound = CODE(CASHOUT, 2); + public static final String NotEnoughBalance = CODE(CASHOUT, 3); public static final String OauthProviderNotAllowed = CODE(OAUTH, 1); public static final String AppleOauthIdTokenIncorrect = CODE(OAUTH, 2); diff --git a/genti-common/src/main/java/com/gt/genti/error/ResponseCode.java b/genti-common/src/main/java/com/gt/genti/error/ResponseCode.java index f7897724..8b44cbb3 100644 --- a/genti-common/src/main/java/com/gt/genti/error/ResponseCode.java +++ b/genti-common/src/main/java/com/gt/genti/error/ResponseCode.java @@ -182,12 +182,12 @@ public enum ResponseCode { NotEnoughBalance(ErrorConstants.NotEnoughBalance, NOT_ACCEPTABLE, false, "해당 공급자의 출금가능 잔액이 부족하여 요청을 완료할 수 없습니다."), /** - * WithdrawRequest && Settlement + * Cashout && Settlement */ - CannotCreateWithdrawalDueToSettlementsNotAvailable( - ErrorConstants.CannotCreateWithdrawalDueToSettlementsNotAvailable, BAD_REQUEST, false, + CannotRequestCashoutDueToSettlementsNotAvailable( + ErrorConstants.CannotRequestCashoutDueToSettlementsNotAvailable, BAD_REQUEST, false, "출금 가능한 정산 내역이 없습니다."), - WithdrawRequestNotFound(ErrorConstants.WithdrawRequestNotFound, NOT_FOUND, false, + CashoutNotFound(ErrorConstants.CashoutNotFound, NOT_FOUND, false, "해당 출금 요청을 찾을 수 없습니다."), HttpMessageNotReadable(ErrorConstants.HttpMessageNotReadable, BAD_REQUEST, false, "잘못된 입력 : %s"), FileTypeNotProvided(ErrorConstants.FileTypeNotProvided, BAD_REQUEST, false, "파일 형식이 주어지지 않았습니다."), diff --git a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequest.java b/genti-domain/src/main/java/com/gt/genti/cashout/model/Cashout.java similarity index 83% rename from genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequest.java rename to genti-domain/src/main/java/com/gt/genti/cashout/model/Cashout.java index 4082d48b..2b6f2bf3 100644 --- a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/WithdrawRequest.java +++ b/genti-domain/src/main/java/com/gt/genti/cashout/model/Cashout.java @@ -1,7 +1,7 @@ -package com.gt.genti.withdrawrequest.model; +package com.gt.genti.cashout.model; import com.gt.genti.common.baseentity.model.BaseEntity; -import com.gt.genti.common.converter.WithdrawRequestStatusConverter; +import com.gt.genti.common.converter.CashoutStatusConverter; import com.gt.genti.creator.model.Creator; import com.gt.genti.user.model.User; @@ -19,11 +19,11 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Table(name = "withdraw_request") +@Table(name = "cashout") @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class WithdrawRequest extends BaseEntity { +public class Cashout extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long id; @@ -38,7 +38,7 @@ public class WithdrawRequest extends BaseEntity { @Column(name = "task_count", nullable = false) Integer taskCount; - @Convert(converter = WithdrawRequestStatusConverter.class) + @Convert(converter = CashoutStatusConverter.class) @Column(name = "status", nullable = false) CashoutStatus status; @@ -55,7 +55,7 @@ public void prePersist() { } } - public WithdrawRequest(Creator creator) { + public Cashout(Creator creator) { this.creator = creator; this.status = CashoutStatus.IN_PROGRESS; } diff --git a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/CashoutStatus.java b/genti-domain/src/main/java/com/gt/genti/cashout/model/CashoutStatus.java similarity index 94% rename from genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/CashoutStatus.java rename to genti-domain/src/main/java/com/gt/genti/cashout/model/CashoutStatus.java index 9a9bbde1..35ab7c56 100644 --- a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/model/CashoutStatus.java +++ b/genti-domain/src/main/java/com/gt/genti/cashout/model/CashoutStatus.java @@ -1,4 +1,4 @@ -package com.gt.genti.withdrawrequest.model; +package com.gt.genti.cashout.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.gt.genti.common.ConvertableEnum; diff --git a/genti-domain/src/main/java/com/gt/genti/cashout/repository/CashoutRepository.java b/genti-domain/src/main/java/com/gt/genti/cashout/repository/CashoutRepository.java new file mode 100644 index 00000000..a569146a --- /dev/null +++ b/genti-domain/src/main/java/com/gt/genti/cashout/repository/CashoutRepository.java @@ -0,0 +1,23 @@ +package com.gt.genti.cashout.repository; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.gt.genti.cashout.model.Cashout; +import com.gt.genti.cashout.model.CashoutStatus; +import com.gt.genti.creator.model.Creator; +import com.gt.genti.user.model.User; + +@Repository +public interface CashoutRepository extends JpaRepository { + Page findAllByCreator(Creator creator, Pageable pageable); + + Page findAllByStatus(Pageable pageable, CashoutStatus status); + + Page findAllByCreatedBy(User user, Pageable pageable); + + Page findAllByCreatedByAndStatus(User user, Pageable pageable, CashoutStatus status); + +} diff --git a/genti-domain/src/main/java/com/gt/genti/common/converter/CashoutStatusConverter.java b/genti-domain/src/main/java/com/gt/genti/common/converter/CashoutStatusConverter.java new file mode 100644 index 00000000..2a9a2f09 --- /dev/null +++ b/genti-domain/src/main/java/com/gt/genti/common/converter/CashoutStatusConverter.java @@ -0,0 +1,14 @@ +package com.gt.genti.common.converter; + +import com.gt.genti.cashout.model.CashoutStatus; + +import jakarta.persistence.Converter; + +@Converter +public class CashoutStatusConverter extends DefaultEnumDBConverter { + + public CashoutStatusConverter() { + super(CashoutStatus.class); + } + +} \ No newline at end of file diff --git a/genti-domain/src/main/java/com/gt/genti/common/converter/WithdrawRequestStatusConverter.java b/genti-domain/src/main/java/com/gt/genti/common/converter/WithdrawRequestStatusConverter.java deleted file mode 100644 index d5fe29af..00000000 --- a/genti-domain/src/main/java/com/gt/genti/common/converter/WithdrawRequestStatusConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.gt.genti.common.converter; - -import com.gt.genti.withdrawrequest.model.CashoutStatus; - -import jakarta.persistence.Converter; - -@Converter -public class WithdrawRequestStatusConverter extends DefaultEnumDBConverter { - - public WithdrawRequestStatusConverter() { - super(CashoutStatus.class); - } - -} \ No newline at end of file diff --git a/genti-domain/src/main/java/com/gt/genti/deposit/model/Deposit.java b/genti-domain/src/main/java/com/gt/genti/deposit/model/Deposit.java index 54b9789e..cea74394 100644 --- a/genti-domain/src/main/java/com/gt/genti/deposit/model/Deposit.java +++ b/genti-domain/src/main/java/com/gt/genti/deposit/model/Deposit.java @@ -1,9 +1,9 @@ package com.gt.genti.deposit.model; import com.gt.genti.common.basetimeentity.model.BaseTimeEntity; -import com.gt.genti.user.model.User; import com.gt.genti.error.ExpectedException; import com.gt.genti.error.ResponseCode; +import com.gt.genti.user.model.User; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -59,7 +59,7 @@ private void addInternal(Long amount) { this.totalAmount += amount; } - public void completeWithdraw(Long amount) { + public void completeCashout(Long amount) { if (this.nowAmount < amount) { throw ExpectedException.withLogging(ResponseCode.NotEnoughBalance); } diff --git a/genti-domain/src/main/java/com/gt/genti/settlement/model/Settlement.java b/genti-domain/src/main/java/com/gt/genti/settlement/model/Settlement.java index 69bbabcc..36423e2b 100644 --- a/genti-domain/src/main/java/com/gt/genti/settlement/model/Settlement.java +++ b/genti-domain/src/main/java/com/gt/genti/settlement/model/Settlement.java @@ -1,6 +1,6 @@ package com.gt.genti.settlement.model; -import com.gt.genti.withdrawrequest.model.WithdrawRequest; +import com.gt.genti.cashout.model.Cashout; import com.gt.genti.common.basetimeentity.model.BaseTimeEntity; import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponse; @@ -40,8 +40,8 @@ public class Settlement extends BaseTimeEntity { @Setter @ManyToOne - @JoinColumn(name = "withdraw_request_id") - WithdrawRequest withdrawRequest; + @JoinColumn(name = "cashout_id") + Cashout cashout; @Builder public Settlement(PictureGenerateResponse pictureGenerateResponse, Long elapsedMinutes, Long reward) { diff --git a/genti-domain/src/main/java/com/gt/genti/settlement/model/SettlementStatus.java b/genti-domain/src/main/java/com/gt/genti/settlement/model/SettlementStatus.java index c42b2f60..108ffacb 100644 --- a/genti-domain/src/main/java/com/gt/genti/settlement/model/SettlementStatus.java +++ b/genti-domain/src/main/java/com/gt/genti/settlement/model/SettlementStatus.java @@ -10,9 +10,9 @@ @Getter @RequiredArgsConstructor public enum SettlementStatus implements ConvertableEnum { - WITHDRAWN_COMPLETED("WITHDRAWN_COMPLETED", "출금 완료"), + CASHOUT_COMPLETED("CASHOUT_COMPLETED", "출금 완료"), CREATED("CREATED", "출금 가능"), - WITHDRAWN_IN_PROGRESS("WITHDRAWN_IN_PROGRESS", "출금 진행 중"), + CASHOUT_IN_PROGRESS("CASHOUT_IN_PROGRESS", "출금 진행 중"), CANCELLED("CANCELLED", "취소됨"); private final String stringValue; diff --git a/genti-domain/src/main/java/com/gt/genti/settlement/repository/SettlementRepository.java b/genti-domain/src/main/java/com/gt/genti/settlement/repository/SettlementRepository.java index 3fdce2fe..69e7f052 100644 --- a/genti-domain/src/main/java/com/gt/genti/settlement/repository/SettlementRepository.java +++ b/genti-domain/src/main/java/com/gt/genti/settlement/repository/SettlementRepository.java @@ -16,10 +16,10 @@ public interface SettlementRepository extends JpaRepository { @Query("select s " + "from Settlement s " + "where s.pictureGenerateResponse.creator = :creator " - + "and s.withdrawRequest is null " + + "and s.cashout is null " + "and s.pictureGenerateResponse.status = com.gt.genti.picturegenerateresponse.model.PictureGenerateResponseStatus.COMPLETED " + "order by s.createdAt desc ") - List findAllWithdrawableByCreatorOrderByCreatedAtDesc( + List findAllValidSettlementByCreatorOrderByCreatedAtDesc( @Param(value = "creator") Creator creator); diff --git a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java b/genti-domain/src/main/java/com/gt/genti/settlementandcashout/model/SettlementAndCashout.java similarity index 82% rename from genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java rename to genti-domain/src/main/java/com/gt/genti/settlementandcashout/model/SettlementAndCashout.java index 1b453109..cd3c453f 100644 --- a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java +++ b/genti-domain/src/main/java/com/gt/genti/settlementandcashout/model/SettlementAndCashout.java @@ -1,19 +1,19 @@ -package com.gt.genti.settlementanwithdraw.model; +package com.gt.genti.settlementandcashout.model; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.Map; -import com.gt.genti.withdrawrequest.model.CashoutStatus; +import com.gt.genti.cashout.model.CashoutStatus; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(name = "[Settlement&Withdraw][Creator] 정산&출금내역 응답 dto") +@Schema(name = "[SettlementAndCashout][Creator] 정산&출금내역 응답 dto") @Getter @NoArgsConstructor -public class SettlementAndWithdraw { +public class SettlementAndCashout { @Schema(description = "정산 혹은 출금내역 DB Id", example = "1") Long id; @Schema(description = "정산 or 출금내역 구분, true : 정산내역, false : 출금내역") @@ -31,7 +31,7 @@ public class SettlementAndWithdraw { ) CashoutStatus status; - public SettlementAndWithdraw(Map attributes) { + public SettlementAndCashout(Map attributes) { this.id = (Long)attributes.get("id"); this.isSettlement = (Boolean)attributes.get("isSettlement"); this.amount = (Long)attributes.get("amount"); @@ -39,7 +39,7 @@ public SettlementAndWithdraw(Map attributes) { this.status = CashoutStatus.valueOf((String)attributes.get("status")); } - public SettlementAndWithdraw(Object[] o) { + public SettlementAndCashout(Object[] o) { this.id = (Long)o[0]; if ((Long)o[1] == 1L) { this.isSettlement = true; diff --git a/genti-domain/src/main/java/com/gt/genti/settlementandcashout/repository/SettlementAndCashoutRepositoryCustom.java b/genti-domain/src/main/java/com/gt/genti/settlementandcashout/repository/SettlementAndCashoutRepositoryCustom.java new file mode 100644 index 00000000..60b7f9aa --- /dev/null +++ b/genti-domain/src/main/java/com/gt/genti/settlementandcashout/repository/SettlementAndCashoutRepositoryCustom.java @@ -0,0 +1,8 @@ +package com.gt.genti.settlementandcashout.repository; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +public interface SettlementAndCashoutRepositoryCustom { + Page findSettlementAndCashoutByCreatorPagination(Long creatorId, Pageable pageable); +} diff --git a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/repository/SettlementAndWithdrawalRepositoryCustomImpl.java b/genti-domain/src/main/java/com/gt/genti/settlementandcashout/repository/SettlementAndCashoutRepositoryCustomImpl.java similarity index 70% rename from genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/repository/SettlementAndWithdrawalRepositoryCustomImpl.java rename to genti-domain/src/main/java/com/gt/genti/settlementandcashout/repository/SettlementAndCashoutRepositoryCustomImpl.java index f7986c35..e46e89e1 100644 --- a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/repository/SettlementAndWithdrawalRepositoryCustomImpl.java +++ b/genti-domain/src/main/java/com/gt/genti/settlementandcashout/repository/SettlementAndCashoutRepositoryCustomImpl.java @@ -1,4 +1,4 @@ -package com.gt.genti.settlementanwithdraw.repository; +package com.gt.genti.settlementandcashout.repository; import java.util.List; @@ -12,23 +12,23 @@ import jakarta.persistence.Query; @Repository -public class SettlementAndWithdrawalRepositoryCustomImpl implements SettlementAndWithdrawalRepositoryCustom { +public class SettlementAndCashoutRepositoryCustomImpl implements SettlementAndCashoutRepositoryCustom { @PersistenceContext private EntityManager entityManager; @Override - public Page findSettlementAndWithdrawByCreatorPagination(Long creatorId, Pageable pageable) { + public Page findSettlementAndCashoutByCreatorPagination(Long creatorId, Pageable pageable) { String queryStr = "(SELECT s.id as id , true as isSettlement, s.reward as amount, s.created_at as createdAt, " + - "CASE WHEN wr.id IS NULL THEN 'AVAILABLE' ELSE wr.status END as status " + + "CASE WHEN c.id IS NULL THEN 'AVAILABLE' ELSE c.status END as status " + "FROM settlement s " + - "LEFT OUTER JOIN withdraw_request wr ON wr.creator_id = :creatorId " + "LEFT OUTER JOIN cashout c ON c.creator_id = :creatorId " + "LEFT JOIN picture_generate_response ON s.picture_generate_response_id = picture_generate_response.id " + "UNION ALL " + "SELECT w.id as id , false as isSettlement, w.amount as amount, w.created_at as createdAt, w.status " + - "FROM withdraw_request w " + - "WHERE w.creator_id = :creatorId) " + + "FROM cashout c " + + "WHERE c.creator_id = :creatorId) " + "ORDER BY createdAt DESC"; Query query = entityManager.createNativeQuery(queryStr); diff --git a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/repository/SettlementAndWithdrawalRepositoryCustom.java b/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/repository/SettlementAndWithdrawalRepositoryCustom.java deleted file mode 100644 index ace92c31..00000000 --- a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/repository/SettlementAndWithdrawalRepositoryCustom.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.gt.genti.settlementanwithdraw.repository; - -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; - -public interface SettlementAndWithdrawalRepositoryCustom { - Page findSettlementAndWithdrawByCreatorPagination(Long creatorId, Pageable pageable); -} diff --git a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/repository/WithdrawRequestRepository.java b/genti-domain/src/main/java/com/gt/genti/withdrawrequest/repository/WithdrawRequestRepository.java deleted file mode 100644 index 43aab70d..00000000 --- a/genti-domain/src/main/java/com/gt/genti/withdrawrequest/repository/WithdrawRequestRepository.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.gt.genti.withdrawrequest.repository; - -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import com.gt.genti.creator.model.Creator; -import com.gt.genti.user.model.User; -import com.gt.genti.withdrawrequest.model.CashoutStatus; -import com.gt.genti.withdrawrequest.model.WithdrawRequest; - -@Repository -public interface WithdrawRequestRepository extends JpaRepository { - Page findAllByCreator(Creator creator, Pageable pageable); - - Page findAllByStatus(Pageable pageable, CashoutStatus status); - - Page findAllByCreatedBy(User user, Pageable pageable); - - Page findAllByCreatedByAndStatus(User user, Pageable pageable, CashoutStatus status); - -}