From b6d91d3ca3aadf0df24bda219da569cb24ac398f Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Fri, 1 Dec 2023 20:18:13 +0900 Subject: [PATCH 01/32] =?UTF-8?q?[FIX]=20=EC=86=8C=EC=85=9C=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=EA=B0=80=EC=9E=85/=EB=A1=9C=EA=B7=B8=EC=9D=B8=20api?= =?UTF-8?q?=20=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - user 도메인에서 point 제거 --- .../user/controller/UserController.java | 5 ++- .../server/domain/user/domain/User.java | 31 +++++++------------ .../user/facade/impl/UserFacadeImpl.java | 12 +++---- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java b/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java index e567693f..a1612785 100644 --- a/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java +++ b/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java @@ -83,12 +83,11 @@ public class UserController { }) @PostMapping("/signup") public ResponseEntity signup( - @Parameter(description = "Authentication Code", required = true) @RequestHeader("code") String code, + @Parameter(description = "Authentication Code", required = true) @RequestHeader String code, @RequestBody @Valid PostLoginReq req, HttpServletRequest request) { return BaseResponse.success(SuccessType.LOGIN_SUCCESS, - userFacade.signup(CreateLoginReq.of(req.getSocialPlatform(), code, - request.getHeader("origin")))); + userFacade.signup(CreateLoginReq.of(req.getSocialPlatform(), code, request.getHeader("origin")))); } diff --git a/server/src/main/java/org/tattour/server/domain/user/domain/User.java b/server/src/main/java/org/tattour/server/domain/user/domain/User.java index eb873c0c..d6cb7c6b 100644 --- a/server/src/main/java/org/tattour/server/domain/user/domain/User.java +++ b/server/src/main/java/org/tattour/server/domain/user/domain/User.java @@ -30,8 +30,7 @@ public class User { @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String name; - private Long kakaoId; - private Integer point; + private Long socialId; private String phoneNumber; private String accessToken; private String refreshToken; @@ -51,26 +50,26 @@ public class User { @OneToMany(mappedBy = "user", cascade = CascadeType.ALL) private List productLikeds; - public User(Long kakaoId, SocialPlatform socialPlatform, String accessToken, - String refreshToken) { - this.kakaoId = kakaoId; + public User(Long socialId, SocialPlatform socialPlatform, String accessToken, + String refreshToken) { + this.socialId = socialId; this.socialPlatform = socialPlatform; this.accessToken = accessToken; this.refreshToken = refreshToken; } - public User(Long kakaoId, SocialPlatform socialPlatform) { - this.kakaoId = kakaoId; + public User(Long socialId, SocialPlatform socialPlatform) { + this.socialId = socialId; this.socialPlatform = socialPlatform; } - public static User of(Long kakaoId, SocialPlatform socialPlatform, String accessToken, - String refreshToken) { - return new User(kakaoId, socialPlatform, accessToken, refreshToken); + public static User of(Long socialId, SocialPlatform socialPlatform, String accessToken, + String refreshToken) { + return new User(socialId, socialPlatform, accessToken, refreshToken); } - public static User of(Long kakaoId, SocialPlatform socialPlatform) { - return new User(kakaoId, socialPlatform); + public static User of(Long socialId, SocialPlatform socialPlatform) { + return new User(socialId, socialPlatform); } public void setUserInfo(String name, String phoneNumber) { @@ -83,16 +82,8 @@ public void setSocialToken(String accessToken, String refreshToken) { this.refreshToken = refreshToken; } - public void setUserPoint(int amount) { - this.point = amount; - } - public void deleteToken() { this.accessToken = null; this.refreshToken = null; } - - public boolean isLackOfPoint(int amount) { - return this.point < amount; - } } diff --git a/server/src/main/java/org/tattour/server/domain/user/facade/impl/UserFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/user/facade/impl/UserFacadeImpl.java index 56390b0c..469de7b2 100644 --- a/server/src/main/java/org/tattour/server/domain/user/facade/impl/UserFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/user/facade/impl/UserFacadeImpl.java @@ -51,15 +51,13 @@ public PostLoginRes signup(CreateLoginReq req) { } System.out.println("Origin = " + req.getOrigin()); - SocialService socialService = socialServiceProvider - .getSocialService(req.getSocialPlatform()); + SocialService socialService = socialServiceProvider.getSocialService(req.getSocialPlatform()); - KakaoLoginInfo kakaoLoginInfo = - (KakaoLoginInfo) socialService.getSocialLoginResponse( - GetSocialLoginReq.of(req.getCode(), req.getOrigin())); + KakaoLoginInfo kakaoLoginInfo = (KakaoLoginInfo) socialService + .getSocialLoginResponse(GetSocialLoginReq.of(req.getCode(), req.getOrigin())); - boolean isUserExist = userProvider.checkDuplicationByKakaoId( - kakaoLoginInfo.getSocialUserInfoRes().getId()); + boolean isUserExist = userProvider + .checkDuplicationByKakaoId(kakaoLoginInfo.getSocialUserInfoRes().getId()); User user = isUserExist ? userProvider.readUserByKakaoId(kakaoLoginInfo.getSocialUserInfoRes().getId()) From e69fb3aefebf99db5ea4434356e43b4f9ac22307 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Fri, 1 Dec 2023 20:53:54 +0900 Subject: [PATCH 02/32] =?UTF-8?q?[FIX]=20=EB=8F=84=EB=A9=94=EC=9D=B8=20poi?= =?UTF-8?q?nt=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - UserPointLog, PointChargeRequest 등과 관련된 코드 삭제 - User - 속성 point 삭제 - kakaoId -> socialId 이름 변경 --- .../admin/controller/AdminController.java | 160 +---- .../custom/facade/impl/CustomFacadeImpl.java | 212 +++--- .../dto/response/ReadOrderSheetRes.java | 11 +- .../order/facade/impl/OrderFacadeImpl.java | 58 +- .../order/service/impl/OrderServiceImpl.java | 12 - .../server/domain/point/dao/PointDao.java | 87 --- .../point/domain/PointChargeRequest.java | 63 -- .../domain/point/domain/PointLogCategory.java | 27 - .../domain/point/domain/UserPointLog.java | 53 -- .../domain/point/facade/PointFacade.java | 27 - .../dto/request/ConfirmPointChargeReq.java | 17 - .../request/CreatePointChargeRequestReq.java | 17 - .../ReadPointChargeRequestListReq.java | 17 - .../dto/request/ReadPointLogListReq.java | 19 - .../dto/response/ConfirmPointChargeRes.java | 33 - .../ReadPointChargeRequestListRes.java | 21 - .../dto/response/ReadPointLogListRes.java | 18 - .../point/facade/impl/PointFacadeImpl.java | 167 ----- .../domain/point/provider/PointProvider.java | 22 - .../provider/impl/PointProviderImpl.java | 50 -- .../provider/vo/PointChargeRequestInfo.java | 49 -- .../point/provider/vo/PointLogInfo.java | 21 - .../PointChargeRequestRepository.java | 5 - .../repository/UserPointLogRepository.java | 5 - .../PointChargeRequestRepositoryImpl.java | 14 - .../impl/UserPointLogRepositoryImpl.java | 10 - .../domain/point/service/PointService.java | 15 - .../point/service/impl/PointServiceImpl.java | 56 -- .../user/controller/UserController.java | 678 +++++++++--------- .../user/facade/impl/UserFacadeImpl.java | 4 +- .../domain/user/provider/UserProvider.java | 10 - .../user/provider/impl/UserProviderImpl.java | 24 +- .../domain/user/provider/vo/HomeUserInfo.java | 7 +- .../repository/impl/UserRepositoryImpl.java | 9 +- .../domain/user/service/UserService.java | 3 - .../user/service/impl/UserServiceImpl.java | 12 +- .../server/global/util/EntityDtoMapper.java | 10 +- 37 files changed, 442 insertions(+), 1581 deletions(-) delete mode 100644 server/src/main/java/org/tattour/server/domain/point/dao/PointDao.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/domain/PointChargeRequest.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/domain/PointLogCategory.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/domain/UserPointLog.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/PointFacade.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ConfirmPointChargeReq.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/dto/request/CreatePointChargeRequestReq.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ReadPointChargeRequestListReq.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ReadPointLogListReq.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ConfirmPointChargeRes.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ReadPointChargeRequestListRes.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ReadPointLogListRes.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/facade/impl/PointFacadeImpl.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/provider/PointProvider.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/provider/impl/PointProviderImpl.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/provider/vo/PointChargeRequestInfo.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/provider/vo/PointLogInfo.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/repository/PointChargeRequestRepository.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/repository/UserPointLogRepository.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/repository/impl/PointChargeRequestRepositoryImpl.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/repository/impl/UserPointLogRepositoryImpl.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/service/PointService.java delete mode 100644 server/src/main/java/org/tattour/server/domain/point/service/impl/PointServiceImpl.java diff --git a/server/src/main/java/org/tattour/server/domain/admin/controller/AdminController.java b/server/src/main/java/org/tattour/server/domain/admin/controller/AdminController.java index e97ebba3..e201575b 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/controller/AdminController.java +++ b/server/src/main/java/org/tattour/server/domain/admin/controller/AdminController.java @@ -9,7 +9,6 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.List; -import java.util.Objects; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import lombok.RequiredArgsConstructor; @@ -27,8 +26,6 @@ import org.springframework.web.multipart.MultipartFile; import org.tattour.server.domain.admin.controller.dto.request.AdminLoginReq; import org.tattour.server.domain.admin.controller.dto.request.ApplyStickerDiscountReq; -import org.tattour.server.domain.admin.controller.dto.request.CancelPointChargeRequestReq; -import org.tattour.server.domain.admin.controller.dto.request.ConfirmPointChargeRequestReq; import org.tattour.server.domain.admin.controller.dto.request.PatchCustomProcessReq; import org.tattour.server.domain.admin.controller.dto.request.PostDiscountReq; import org.tattour.server.domain.admin.controller.dto.request.PostStickerReq; @@ -41,17 +38,9 @@ import org.tattour.server.domain.order.controller.dto.request.PatchOrderStatusReq; import org.tattour.server.domain.order.facade.OrderFacade; import org.tattour.server.domain.order.facade.dto.request.UpdateOrderStatusReq; -import org.tattour.server.domain.point.domain.PointLogCategory; -import org.tattour.server.domain.point.facade.PointFacade; -import org.tattour.server.domain.point.facade.dto.request.ConfirmPointChargeReq; -import org.tattour.server.domain.point.facade.dto.request.ReadPointChargeRequestListReq; -import org.tattour.server.domain.point.facade.dto.request.ReadPointLogListReq; -import org.tattour.server.domain.point.facade.dto.response.ConfirmPointChargeRes; -import org.tattour.server.domain.point.facade.dto.response.ReadPointChargeRequestListRes; -import org.tattour.server.domain.point.facade.dto.response.ReadPointLogListRes; +import org.tattour.server.domain.order.facade.dto.response.ReadOrderHistoryListRes; import org.tattour.server.domain.sticker.facade.StickerFacade; import org.tattour.server.domain.sticker.facade.dto.response.ReadStickerRes; -import org.tattour.server.domain.user.controller.dto.response.PostLoginRes; import org.tattour.server.global.config.annotations.UserId; import org.tattour.server.global.dto.BaseResponse; import org.tattour.server.global.dto.FailResponse; @@ -66,7 +55,6 @@ public class AdminController { private final AdminFacade adminFacade; - private final PointFacade pointFacade; private final OrderFacade orderFacade; private final DiscountFacade discountFacade; private final StickerFacade stickerFacade; @@ -97,7 +85,7 @@ public ResponseEntity adminLogin( @ApiResponse( responseCode = "200", description = "조회에 성공했습니다.", - content = @Content(schema = @Schema(implementation = PostLoginRes.class))), + content = @Content(schema = @Schema(implementation = ReadOrderHistoryListRes.class))), @ApiResponse( responseCode = "400", description = "잘못된 요청입니다.", @@ -151,149 +139,7 @@ public ResponseEntity patchOrderStatus( return BaseResponse.success(SuccessType.UPDATE_ORDER_STATUS_SUCCESS); } - - @Operation(summary = "포인트 충전 신청 내역 불러오기", description = "userId, 완료 여부를 기준으로 포인트 신청 내역 조회") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "조회에 성공했습니다.", - content = @Content(schema = @Schema(implementation = ReadPointChargeRequestListRes.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @GetMapping("/point/request") - public ResponseEntity getPointChargeRequest( - @Parameter(description = "user Id") @RequestParam(required = false) Integer userId, - @Parameter(description = "처리 완료 여부") @RequestParam(required = false) Boolean isCompleted - ) { - return BaseResponse.success(SuccessType.GET_SUCCESS, - pointFacade.readPointChargeRequest( - ReadPointChargeRequestListReq.of( - userId, - isCompleted))); - } - - @Operation(summary = "포인트 충전 요청 확인") - @ApiResponses(value = { - @ApiResponse( - responseCode = "201", - description = "포인트 충전 확정에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "202", - description = "금액이 일치하지 않아 충전 확정이 불가능합니다.", - content = @Content(schema = @Schema(implementation = ConfirmPointChargeRes.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 포인트 충전 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "409", - description = "이미 처리된 포인트 충전 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PostMapping("/point/request/confirm") - public ResponseEntity confirmPointChargeRequest( - @RequestBody @Valid ConfirmPointChargeRequestReq req - ) { - ConfirmPointChargeRes response = pointFacade.confirmPointChargeRequest( - ConfirmPointChargeReq.of( - req.getId(), - req.getUserId(), - req.getTransferredAmount())); - - if (Objects.isNull(response)) { - return BaseResponse.success(SuccessType.POINT_CHARGE_CONFIRM_SUCCESS); - } else { - return BaseResponse.success(SuccessType.POINT_CHARGE_CONFIRM_FAIL, response); - } - } - - @Operation(summary = "포인트 충전 요청 취소") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "포인트 충전 취소에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 포인트 충전 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "409", - description = "이미 처리된 포인트 충전 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "409", - description = "송금 금액과 충전 금액이 일치합니다. 충전 요청을 취소할 수 없습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PostMapping("/point/request/cancel") - public ResponseEntity cancelPointChargeRequest( - @RequestBody @Valid CancelPointChargeRequestReq req - ) { - pointFacade.cancelPointChargeRequest(req); - return BaseResponse.success(SuccessType.POINT_CHARGE_CANCEL_SUCCESS); - } - - @Operation(summary = "포인트 로그 불러오기") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "포인트 로그 조회에 성공했습니다.", - content = @Content(schema = @Schema(implementation = ReadPointLogListRes.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @GetMapping("/pointlog") - public ResponseEntity getPointLog( - @Parameter(description = "user id") @RequestParam(required = false) Integer userId, - @Parameter(description = "포인트 로그 카테고리", example = "충전 취소") - @RequestParam(required = false) String category - ) { - return BaseResponse.success( - SuccessType.READ_POINT_LOG_SUCCESS, pointFacade.readPointLog( - ReadPointLogListReq.of( - userId, - PointLogCategory.fromValue(category)))); - } - + @PostMapping(value = "/stickers", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "스티커 등록") @ApiResponses(value = { diff --git a/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java index b7595940..2c18aeff 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java @@ -13,18 +13,13 @@ import org.tattour.server.domain.custom.facade.dto.request.UpdateCustomReq; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomRes; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryListRes; +import org.tattour.server.domain.custom.provider.impl.CustomProviderImpl; import org.tattour.server.domain.custom.service.CustomImageService; import org.tattour.server.domain.custom.service.CustomService; import org.tattour.server.domain.custom.service.CustomStyleService; import org.tattour.server.domain.custom.service.CustomThemeService; -import org.tattour.server.domain.point.domain.PointLogCategory; -import org.tattour.server.domain.point.domain.UserPointLog; -import org.tattour.server.domain.point.service.PointService; -import org.tattour.server.domain.custom.provider.impl.CustomProviderImpl; import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.service.UserService; -import org.tattour.server.global.exception.BusinessException; -import org.tattour.server.global.exception.ErrorType; import org.tattour.server.infra.discord.service.DiscordMessageService; import org.tattour.server.infra.s3.S3Service; @@ -33,124 +28,111 @@ @RequiredArgsConstructor public class CustomFacadeImpl implements CustomFacade { - private final CustomService customService; - private final CustomImageService customImageService; - private final CustomThemeService customThemeService; - private final CustomStyleService customStyleService; - private final UserService userService; - private final PointService pointService; - private final S3Service s3Service; - private final DiscordMessageService discordMessageService; - private final CustomProviderImpl customProvider; + private final CustomService customService; + private final CustomImageService customImageService; + private final CustomThemeService customThemeService; + private final CustomStyleService customStyleService; + private final UserService userService; + private final S3Service s3Service; + private final DiscordMessageService discordMessageService; + private final CustomProviderImpl customProvider; - private static final String directoryPath = "custom"; - private static final Integer customPoint = 990; + private static final String directoryPath = "custom"; - @Override - @Transactional - public Integer createCustom(Boolean haveDesign, Integer userId) { - User user = userService.readUserById(userId); - if (user.isLackOfPoint(customPoint)) { - throw new BusinessException(ErrorType.LACK_OF_POINT_EXCEPTION); - } - userService.updateUserPoint(user, -customPoint); - pointService.savePointLog( - UserPointLog.of( - PointLogCategory.APPLY_CUSTOM, - "커스텀 스티커 신청", - customPoint, - user.getPoint(), - user)); - Custom custom = customService.createInitCustom(user, haveDesign); - customService.save(custom); - return custom.getId(); - } + //todo: 수정 + @Override + @Transactional + public Integer createCustom(Boolean haveDesign, Integer userId) { + User user = userService.readUserById(userId); + Custom custom = customService.createInitCustom(user, haveDesign); + customService.save(custom); + return custom.getId(); + } - @Override - public ReadCustomRes readCustomById(Integer customId, Integer userId) { - Custom custom = customProvider.getCustomById(customId, userId); - return ReadCustomRes.from(custom); - } + @Override + public ReadCustomRes readCustomById(Integer customId, Integer userId) { + Custom custom = customProvider.getCustomById(customId, userId); + return ReadCustomRes.from(custom); + } - @Override - @Transactional(readOnly = true) - public ReadCustomSummaryListRes readCustomSummaryCompleteListByUserId(Integer userId) { - List customs = customProvider.getAllByUserIdAndIsCompleted(userId); - return ReadCustomSummaryListRes.from(customs); - } + @Override + @Transactional(readOnly = true) + public ReadCustomSummaryListRes readCustomSummaryCompleteListByUserId(Integer userId) { + List customs = customProvider.getAllByUserIdAndIsCompleted(userId); + return ReadCustomSummaryListRes.from(customs); + } - @Override - @Transactional(readOnly = true) - public ReadCustomSummaryListRes readCustomSummaryInCompleteListByUserId(Integer userId) { - List customs = customProvider.getAllByUserIdAndIsCompletedFalse(userId); - return ReadCustomSummaryListRes.from(customs); - } + @Override + @Transactional(readOnly = true) + public ReadCustomSummaryListRes readCustomSummaryInCompleteListByUserId(Integer userId) { + List customs = customProvider.getAllByUserIdAndIsCompletedFalse(userId); + return ReadCustomSummaryListRes.from(customs); + } - @Override - @Transactional - public ReadCustomRes updateCustom(UpdateCustomReq updateCustomReq) { - Custom custom = customProvider.getCustomById( - updateCustomReq.getCustomId(), - updateCustomReq.getUserId()); - Custom updateCustom = updateCustomReq.newCustom(); + @Override + @Transactional + public ReadCustomRes updateCustom(UpdateCustomReq updateCustomReq) { + Custom custom = customProvider.getCustomById( + updateCustomReq.getCustomId(), + updateCustomReq.getUserId()); + Custom updateCustom = updateCustomReq.newCustom(); - // 손그림 등록 - if (!Objects.isNull(updateCustomReq.getHandDrawingImage())) { - customService.setHandDrawingImage( - updateCustom, - updateCustomReq.getHandDrawingImage()); - } + // 손그림 등록 + if (!Objects.isNull(updateCustomReq.getHandDrawingImage())) { + customService.setHandDrawingImage( + updateCustom, + updateCustomReq.getHandDrawingImage()); + } - // 이미지 리스트의 첫번째가 메인 이미지임 - if (!Objects.isNull(updateCustomReq.getImages())) { - if (updateCustomReq.getImages().size() > 0) { - customService.setMainImageUrl( - updateCustom, - updateCustomReq.getImages().get(0)); - updateCustomReq.getImages().remove(0); - } - } - customService.updateCustom(custom, updateCustom); + // 이미지 리스트의 첫번째가 메인 이미지임 + if (!Objects.isNull(updateCustomReq.getImages())) { + if (updateCustomReq.getImages().size() > 0) { + customService.setMainImageUrl( + updateCustom, + updateCustomReq.getImages().get(0)); + updateCustomReq.getImages().remove(0); + } + } + customService.updateCustom(custom, updateCustom); - // 이미지들 등록 - if (!Objects.isNull(updateCustomReq.getImages())) { - List customImages = - s3Service.uploadImageList( - updateCustomReq.getImages(), - directoryPath) - .stream() - .map(image -> CustomImage.of(image, custom)) - .collect(Collectors.toList()); - customImageService.saveAll(customImages); - } + // 이미지들 등록 + if (!Objects.isNull(updateCustomReq.getImages())) { + List customImages = + s3Service.uploadImageList( + updateCustomReq.getImages(), + directoryPath) + .stream() + .map(image -> CustomImage.of(image, custom)) + .collect(Collectors.toList()); + customImageService.saveAll(customImages); + } - // 테마 등록 - if (!Objects.isNull(updateCustomReq.getThemes())) { - customThemeService.saveAllByCustomAndThemeIdList( - custom, - updateCustomReq.getThemes()); - } - // 스타일 등록 - if (!Objects.isNull(updateCustomReq.getStyles())) { - customStyleService.saveByCustomAndStyleIdList( - custom, - updateCustomReq.getStyles()); - } - if (custom.getIsCompleted()) { - discordMessageService.sendCustomApplyMessage(custom); - userService.updateUserPoint(custom.getUser(), -custom.getPrice()); - } - return ReadCustomRes.from(custom); - } + // 테마 등록 + if (!Objects.isNull(updateCustomReq.getThemes())) { + customThemeService.saveAllByCustomAndThemeIdList( + custom, + updateCustomReq.getThemes()); + } + // 스타일 등록 + if (!Objects.isNull(updateCustomReq.getStyles())) { + customStyleService.saveByCustomAndStyleIdList( + custom, + updateCustomReq.getStyles()); + } + if (custom.getIsCompleted()) { + discordMessageService.sendCustomApplyMessage(custom); + } + return ReadCustomRes.from(custom); + } - @Override - @Transactional - public ReadCustomRes updateCustomProcess(UpdateCustomReq updateCustomReq) { - Custom custom = - customProvider.getCustomById( - updateCustomReq.getCustomId(), - updateCustomReq.getUserId()); - customService.updateCustomProcess(custom, updateCustomReq.getCustomProcess()); - return ReadCustomRes.from(custom); - } + @Override + @Transactional + public ReadCustomRes updateCustomProcess(UpdateCustomReq updateCustomReq) { + Custom custom = + customProvider.getCustomById( + updateCustomReq.getCustomId(), + updateCustomReq.getUserId()); + customService.updateCustomProcess(custom, updateCustomReq.getCustomProcess()); + return ReadCustomRes.from(custom); + } } diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/ReadOrderSheetRes.java b/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/ReadOrderSheetRes.java index 2b0cf00f..c79ffc89 100644 --- a/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/ReadOrderSheetRes.java +++ b/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/ReadOrderSheetRes.java @@ -5,8 +5,6 @@ import lombok.AllArgsConstructor; import lombok.Getter; import org.tattour.server.domain.order.provider.vo.OrderAmountInfo; -import org.tattour.server.domain.user.provider.vo.HomeUserInfo; -import org.tattour.server.domain.user.provider.vo.UserPointAfterOrderInfo; import org.tattour.server.domain.sticker.provider.vo.ReadOrderSheetStickerInfo; import org.tattour.server.domain.user.provider.vo.UserProfileInfo; @@ -16,17 +14,12 @@ public class ReadOrderSheetRes { private UserProfileInfo userProfileInfo; private ReadOrderSheetStickerInfo readOrderSheetStickerInfo; - private OrderAmountInfo orderAmountInfo; - - private UserPointAfterOrderInfo userPointAfterOrderInfo; public static ReadOrderSheetRes of( UserProfileInfo userProfileInfo, ReadOrderSheetStickerInfo readOrderSheetStickerInfo, - OrderAmountInfo orderAmountInfo, - UserPointAfterOrderInfo userPointAfterOrderInfo) { - return new ReadOrderSheetRes(userProfileInfo, readOrderSheetStickerInfo, orderAmountInfo, - userPointAfterOrderInfo); + OrderAmountInfo orderAmountInfo) { + return new ReadOrderSheetRes(userProfileInfo, readOrderSheetStickerInfo, orderAmountInfo); } } diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java index 94cf6d6a..16760bcf 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java @@ -13,19 +13,15 @@ import org.tattour.server.domain.order.facade.dto.request.ReadOrderSheetReq; import org.tattour.server.domain.order.facade.dto.request.UpdateOrderStatusReq; import org.tattour.server.domain.order.facade.dto.response.ReadOrderHistoryListRes; -import org.tattour.server.domain.order.provider.vo.OrderAmountInfo; -import org.tattour.server.domain.order.provider.vo.OrderHistoryPageInfo; -import org.tattour.server.domain.point.domain.PointLogCategory; -import org.tattour.server.domain.point.domain.UserPointLog; -import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.user.domain.User; -import org.tattour.server.domain.user.provider.vo.UserPointAfterOrderInfo; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.provider.impl.OrderProviderImpl; +import org.tattour.server.domain.order.provider.vo.OrderAmountInfo; +import org.tattour.server.domain.order.provider.vo.OrderHistoryPageInfo; import org.tattour.server.domain.order.service.impl.OrderServiceImpl; -import org.tattour.server.domain.point.service.impl.PointServiceImpl; -import org.tattour.server.domain.sticker.provider.vo.ReadOrderSheetStickerInfo; +import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.provider.impl.StickerProviderImpl; +import org.tattour.server.domain.sticker.provider.vo.ReadOrderSheetStickerInfo; +import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.provider.impl.UserProviderImpl; import org.tattour.server.domain.user.provider.vo.UserProfileInfo; import org.tattour.server.domain.user.service.impl.UserServiceImpl; @@ -43,9 +39,9 @@ public class OrderFacadeImpl implements OrderFacade { private final StickerProviderImpl stickerProvider; private final UserProviderImpl userProvider; private final UserServiceImpl userService; - private final PointServiceImpl pointService; private final DiscordMessageService discordMessageService; + //todo: 수정 @Override @Transactional public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { @@ -70,26 +66,15 @@ public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { req.getCount(), req.getShippingFee()); - // 포인트 - // 보유 포인트, 남는 포인트 - UserPointAfterOrderInfo userPointAfterOrderInfo = - userProvider.readUserPointAfterOrderInfo( - user, - orderAmountInfo.getTotalAmount()); - - return ReadOrderSheetRes.of(userProfileInfo, readOrderSheetStickerInfo, orderAmountInfo, - userPointAfterOrderInfo); + return ReadOrderSheetRes.of(userProfileInfo, readOrderSheetStickerInfo, orderAmountInfo); } + //todo: 수정 @Override @Transactional public void createOrder(CreateOrderRequest req) { User user = userProvider.readUserById(req.getUserId()); - if (userProvider.isUserPointLack(user, req.getTotalAmount())) { - throw new BusinessException(ErrorType.LACK_OF_POINT_EXCEPTION); - } - // 주문내역 생성 Sticker sticker = stickerProvider.getById(req.getStickerId()); Order order = orderService.saveOrder( @@ -109,19 +94,6 @@ public void createOrder(CreateOrderRequest req) { user, sticker)); - // userPoint 수정 - userService.updateUserPoint(user, -req.getTotalAmount()); - - // 포인트 로그 저장 - pointService.savePointLog( - UserPointLog.of( - PointLogCategory.PURCHASE, - null, - -req.getTotalAmount(), - user.getPoint(), - user - )); - discordMessageService.sendOrderStickerMessage(order); } @@ -143,10 +115,10 @@ public ReadOrderHistoryListRes readOrderHistoryOnPage(int page) { orderHistoryInfoPage.getTotalPages())); } + // TODO : 수정 @Override public void updateOrderStatus(UpdateOrderStatusReq req) { Order order = orderProvider.readOrderById(req.getOrderId()); - User user = userProvider.readUserById(order.getUser().getId()); // 주문취소일 경우 if (req.getOrderStatus().equals(OrderStatus.CANCEL)) { @@ -154,18 +126,6 @@ public void updateOrderStatus(UpdateOrderStatusReq req) { // 상태 변경 order.setOrderStatus(req.getOrderStatus()); orderService.saveOrder(order); - - // 유저 포인트 변경 - userService.updateUserPoint(user, order.getTotalAmount()); - - // 포인트 로그 남기기 - pointService.savePointLog( - UserPointLog.of( - PointLogCategory.CANCEL_PURCHASE, - order.getSticker().getName(), - order.getTotalAmount(), - user.getPoint(), - user)); } else { throw new BusinessException(ErrorType.ALREADY_CANCELED_ORDER_HISTORY_EXCEPTION); } diff --git a/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java b/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java index ccc88c74..209586ae 100644 --- a/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java @@ -4,20 +4,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.order.domain.Order; -import org.tattour.server.domain.order.facade.dto.request.CreateOrderRequest; -import org.tattour.server.domain.order.provider.impl.OrderProviderImpl; import org.tattour.server.domain.order.repository.impl.OrderRepositoryImpl; import org.tattour.server.domain.order.service.OrderService; -import org.tattour.server.domain.order.facade.dto.request.UpdateOrderStatusReq; -import org.tattour.server.domain.point.service.impl.PointServiceImpl; -import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.sticker.provider.impl.StickerProviderImpl; -import org.tattour.server.domain.order.domain.OrderStatus; -import org.tattour.server.domain.user.domain.User; -import org.tattour.server.domain.user.provider.impl.UserProviderImpl; -import org.tattour.server.domain.user.service.impl.UserServiceImpl; -import org.tattour.server.global.exception.BusinessException; -import org.tattour.server.global.exception.ErrorType; @Service @RequiredArgsConstructor diff --git a/server/src/main/java/org/tattour/server/domain/point/dao/PointDao.java b/server/src/main/java/org/tattour/server/domain/point/dao/PointDao.java deleted file mode 100644 index 9191a12d..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/dao/PointDao.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.tattour.server.domain.point.dao; - -import java.util.ArrayList; -import java.util.List; -import javax.sql.DataSource; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; -import org.tattour.server.domain.order.domain.OrderStatus; -import org.tattour.server.domain.point.domain.PointLogCategory; -import org.tattour.server.domain.point.provider.vo.PointChargeRequestInfo; -import org.tattour.server.domain.point.provider.vo.PointLogInfo; - -@Repository -public class PointDao { - - private final JdbcTemplate jdbcTemplate; - - public PointDao(DataSource dataSource) { - this.jdbcTemplate = new JdbcTemplate(dataSource); - } - - // 조건에 따라 유저 포인트 충전 요청 내역 가져오기 - public List findPointChargeRequestResList(Integer userId, - Boolean isCompleted) { - String query = - "SELECT * " - + "FROM point_charge_request " - + "WHERE 1=1 "; - List params = new ArrayList<>(); - - if (userId != null) { - params.add(userId); - query += "AND user_id = ? "; - } - - if (isCompleted != null) { - params.add(isCompleted); - query += "AND is_completed = ? "; - } - - return jdbcTemplate.query(query, - (rs, rownum) -> PointChargeRequestInfo.builder() - .id(rs.getInt("id")) - .userId(rs.getInt("user_id")) - .chargeAmount(rs.getInt("charge_amount")) - .transferredAmount(rs.getInt("transferred_amount")) - .isDeposited(rs.getBoolean("is_deposited")) - .isAmountMatched(rs.getBoolean("is_amount_matched")) - .isCompleted(rs.getBoolean("is_completed")) - .createdAt(rs.getString("created_at")) - .lastUpdatedAt(rs.getString("last_updated_at")) - .state(rs.getBoolean("state")) - .build(), - params.toArray()); - } - - // 조건에 따라 포인트 로그 불러오기 - public List findPointLogResList(Integer userId, String category) { - String query = - "SELECT * FROM user_point_log " - + "WHERE 1=1 "; - List params = new ArrayList<>(); - - if (userId != null) { - params.add(userId); - query += "AND user_id = ? "; - } - - if (category != null) { - params.add(category); - query += "AND title = ? "; - } - - return jdbcTemplate.query(query, - (rs, rownum) -> PointLogInfo.builder() - .id(rs.getInt("id")) - .userId(rs.getInt("user_id")) - .title(PointLogCategory.valueOf(rs.getString("title")).getValue()) - .content(rs.getString("content")) - .amount(rs.getInt("amount")) - .resultPointAmount(rs.getInt("result_point_amount")) - .createdAt(rs.getString("created_at")) - .state(rs.getBoolean("state")) - .build(), - params.toArray()); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/domain/PointChargeRequest.java b/server/src/main/java/org/tattour/server/domain/point/domain/PointChargeRequest.java deleted file mode 100644 index 70733dba..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/domain/PointChargeRequest.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.tattour.server.domain.point.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.hibernate.annotations.DynamicInsert; -import org.tattour.server.domain.user.domain.User; - -@Entity -@DynamicInsert -@Getter -@NoArgsConstructor(access = AccessLevel.PROTECTED) -public class PointChargeRequest { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - private Integer chargeAmount; - private Integer transferredAmount; - @Column(columnDefinition = "tinyint") - private Boolean isDeposited; - @Column(columnDefinition = "tinyint") - private Boolean isAmountMatched; - @Column(columnDefinition = "tinyint") - private Boolean isApproved; - @Column(columnDefinition = "tinyint") - private Boolean isCompleted; - @Column(columnDefinition = "Timestamp") - private String createdAt; - @Column(columnDefinition = "Timestamp") - private String lastUpdatedAt; - @Column(columnDefinition = "tinyint") - private Boolean state; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user_id") - private User user; - - private PointChargeRequest(User user, Integer chargeAmount) { - this.user = user; - this.chargeAmount = chargeAmount; - } - - public static PointChargeRequest of(User user, Integer chargeAmount) { - return new PointChargeRequest(user, chargeAmount); - } - - public void setProperties(Integer transferredAmount, Boolean isDeposited, - Boolean isAmountMatched, Boolean isApproved, Boolean isCompleted) { - this.transferredAmount = transferredAmount; - this.isDeposited = isDeposited; - this.isAmountMatched = isAmountMatched; - this.isApproved = isApproved; - this.isCompleted = isCompleted; - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/domain/PointLogCategory.java b/server/src/main/java/org/tattour/server/domain/point/domain/PointLogCategory.java deleted file mode 100644 index f9282f9a..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/domain/PointLogCategory.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.tattour.server.domain.point.domain; - -import java.util.Arrays; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum PointLogCategory { - PURCHASE("상품 구매"), - APPLY_CUSTOM("커스텀 신청"), - CANCEL_PURCHASE("결제 취소"), - REQUEST_CHARGE("포인트 충전 요청"), - CANCEL_CHARGE("충전 취소"), - ; - - private final String value; - - public static PointLogCategory fromValue(String value) { - return Arrays.stream(PointLogCategory.values()) - .filter(category -> category.value.equals(value)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException( - "입력한 value와 일치하는 Enum 타입이 없습니다: " + value)); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/domain/UserPointLog.java b/server/src/main/java/org/tattour/server/domain/point/domain/UserPointLog.java deleted file mode 100644 index a379008a..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/domain/UserPointLog.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.tattour.server.domain.point.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.hibernate.annotations.DynamicInsert; -import org.tattour.server.domain.user.domain.User; - -@Entity -@DynamicInsert -@NoArgsConstructor(access = AccessLevel.PROTECTED) -public class UserPointLog { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - @Column(name = "title") - @Enumerated(EnumType.STRING) - private PointLogCategory pointLogCategory; - private String content; - @Column(columnDefinition = "Timestamp") - private String createdAt; - private Integer amount; - private Integer resultPointAmount; - @Column(columnDefinition = "tinyint") - private Boolean state; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user_id") - private User user; - - private UserPointLog(PointLogCategory pointLogCategory, String content, Integer amount, - Integer resultPointAmount, User user) { - this.pointLogCategory = pointLogCategory; - this.content = content; - this.amount = amount; - this.resultPointAmount = resultPointAmount; - this.user = user; - } - - public static UserPointLog of(PointLogCategory pointLogCategory, String content, Integer amount, - Integer resultPointAmount, User user) { - return new UserPointLog(pointLogCategory, content, amount, resultPointAmount, user); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/PointFacade.java b/server/src/main/java/org/tattour/server/domain/point/facade/PointFacade.java deleted file mode 100644 index 8bb5941f..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/PointFacade.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.tattour.server.domain.point.facade; - -import org.tattour.server.domain.admin.controller.dto.request.CancelPointChargeRequestReq; -import org.tattour.server.domain.point.facade.dto.request.CreatePointChargeRequestReq; -import org.tattour.server.domain.point.facade.dto.request.ReadPointChargeRequestListReq; -import org.tattour.server.domain.point.facade.dto.request.ReadPointLogListReq; -import org.tattour.server.domain.point.facade.dto.response.ReadPointChargeRequestListRes; -import org.tattour.server.domain.point.facade.dto.response.ReadPointLogListRes; -import org.tattour.server.domain.point.facade.dto.request.ConfirmPointChargeReq; -import org.tattour.server.domain.point.facade.dto.response.ConfirmPointChargeRes; - -public interface PointFacade { - // 포인트 충전 요청 - void createPointChargeRequest(CreatePointChargeRequestReq req); - - // 포인트 충전 요청 신청 내역 가져오기 - ReadPointChargeRequestListRes readPointChargeRequest(ReadPointChargeRequestListReq req); - - // 포인트 충전 요청 확인 - ConfirmPointChargeRes confirmPointChargeRequest(ConfirmPointChargeReq req); - - // 포인트 충전 요청 취소 - void cancelPointChargeRequest(CancelPointChargeRequestReq req); - - // 포인트 로그 불러오기 - ReadPointLogListRes readPointLog(ReadPointLogListReq req); -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ConfirmPointChargeReq.java b/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ConfirmPointChargeReq.java deleted file mode 100644 index 65eaf79c..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ConfirmPointChargeReq.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.tattour.server.domain.point.facade.dto.request; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class ConfirmPointChargeReq { - private int id; - private int userId; - private int transferredAmount; - - public static ConfirmPointChargeReq of(int id, int userId, int transferredAmount) { - return new ConfirmPointChargeReq(id, userId, transferredAmount); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/CreatePointChargeRequestReq.java b/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/CreatePointChargeRequestReq.java deleted file mode 100644 index 5414713c..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/CreatePointChargeRequestReq.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.tattour.server.domain.point.facade.dto.request; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class CreatePointChargeRequestReq { - - private int userId; - private int chargeAmount; - - public static CreatePointChargeRequestReq of(int userId, int chargeAmount) { - return new CreatePointChargeRequestReq(userId, chargeAmount); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ReadPointChargeRequestListReq.java b/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ReadPointChargeRequestListReq.java deleted file mode 100644 index a1f6fd1d..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ReadPointChargeRequestListReq.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.tattour.server.domain.point.facade.dto.request; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@Getter -@NoArgsConstructor(access = AccessLevel.PRIVATE) -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class ReadPointChargeRequestListReq { - private Integer userId; - private Boolean isCompleted; - public static ReadPointChargeRequestListReq of(Integer userId, Boolean isCompleted){ - return new ReadPointChargeRequestListReq(userId, isCompleted); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ReadPointLogListReq.java b/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ReadPointLogListReq.java deleted file mode 100644 index 4e8ebc86..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/dto/request/ReadPointLogListReq.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.tattour.server.domain.point.facade.dto.request; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.tattour.server.domain.point.domain.PointLogCategory; - -@Getter -@NoArgsConstructor(access = AccessLevel.PRIVATE) -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class ReadPointLogListReq { - Integer userId; - PointLogCategory category; - - public static ReadPointLogListReq of(Integer userId, PointLogCategory category){ - return new ReadPointLogListReq(userId, category); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ConfirmPointChargeRes.java b/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ConfirmPointChargeRes.java deleted file mode 100644 index a21b390b..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ConfirmPointChargeRes.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.tattour.server.domain.point.facade.dto.response; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryListRes; -import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; -import org.tattour.server.domain.user.provider.vo.UserContactInfo; - -@Schema(description = "송금 금액이 다를 경우 user 정보 Response") -@Getter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class ConfirmPointChargeRes { - - // 유저 정보 - UserContactInfo userContactInfo; - // 포인트 충전 내역 - ReadPointChargeRequestListRes readPointChargeRequestListRes; - // 구매 내역 - ReadUserOrderHistoryListRes orderHistoryListRes; - // 커스텀 신청내역 - ReadCustomSummaryListRes readCustomSummaryListRes; - - public static ConfirmPointChargeRes of( - UserContactInfo userContactInfo, - ReadPointChargeRequestListRes readPointChargeRequestListRes, - ReadUserOrderHistoryListRes readUserOrderHistoryListRes, - ReadCustomSummaryListRes readCustomSummaryListRes) { - return new ConfirmPointChargeRes(userContactInfo, readPointChargeRequestListRes, - readUserOrderHistoryListRes, readCustomSummaryListRes); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ReadPointChargeRequestListRes.java b/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ReadPointChargeRequestListRes.java deleted file mode 100644 index 8a3607ad..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ReadPointChargeRequestListRes.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.tattour.server.domain.point.facade.dto.response; - -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.tattour.server.domain.point.provider.vo.PointChargeRequestInfo; - -@Schema(description = "포인트 충전 요청 내역 리스트 Response") -@Getter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class ReadPointChargeRequestListRes { - - List pointChargeRequestInfoList; - - public static ReadPointChargeRequestListRes of( - List pointChargeRequestInfoList) { - return new ReadPointChargeRequestListRes(pointChargeRequestInfoList); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ReadPointLogListRes.java b/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ReadPointLogListRes.java deleted file mode 100644 index 9be910fe..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/dto/response/ReadPointLogListRes.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.tattour.server.domain.point.facade.dto.response; - -import java.util.List; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.tattour.server.domain.point.provider.vo.PointLogInfo; - -@Getter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class ReadPointLogListRes { - - List pointLogInfoList; - - public static ReadPointLogListRes of(List pointLogInfoList) { - return new ReadPointLogListRes(pointLogInfoList); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/facade/impl/PointFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/point/facade/impl/PointFacadeImpl.java deleted file mode 100644 index f8a50847..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/facade/impl/PointFacadeImpl.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.tattour.server.domain.point.facade.impl; - -import java.util.Objects; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.tattour.server.domain.admin.controller.dto.request.CancelPointChargeRequestReq; -import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryListRes; -import org.tattour.server.domain.custom.provider.CustomProvider; -import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; -import org.tattour.server.domain.order.provider.OrderProvider; -import org.tattour.server.domain.point.domain.PointChargeRequest; -import org.tattour.server.domain.point.domain.PointLogCategory; -import org.tattour.server.domain.point.domain.UserPointLog; -import org.tattour.server.domain.point.facade.PointFacade; -import org.tattour.server.domain.point.facade.dto.request.ConfirmPointChargeReq; -import org.tattour.server.domain.point.facade.dto.request.CreatePointChargeRequestReq; -import org.tattour.server.domain.point.facade.dto.request.ReadPointChargeRequestListReq; -import org.tattour.server.domain.point.facade.dto.request.ReadPointLogListReq; -import org.tattour.server.domain.point.facade.dto.response.ConfirmPointChargeRes; -import org.tattour.server.domain.point.facade.dto.response.ReadPointChargeRequestListRes; -import org.tattour.server.domain.point.facade.dto.response.ReadPointLogListRes; -import org.tattour.server.domain.point.provider.PointProvider; -import org.tattour.server.domain.point.service.PointService; -import org.tattour.server.domain.user.domain.User; -import org.tattour.server.domain.user.provider.UserProvider; -import org.tattour.server.domain.user.provider.vo.UserContactInfo; -import org.tattour.server.domain.user.service.UserService; -import org.tattour.server.global.exception.BusinessException; -import org.tattour.server.global.exception.ErrorType; -import org.tattour.server.global.util.EntityDtoMapper; -import org.tattour.server.infra.discord.service.DiscordMessageService; - -@Service -@RequiredArgsConstructor -public class PointFacadeImpl implements PointFacade { - - private final PointService pointService; - private final PointProvider pointProvider; - private final UserService userService; - private final UserProvider userProvider; - private final CustomProvider customProvider; - private final OrderProvider orderProvider; - private final DiscordMessageService discordMessageService; - - - @Override - public void createPointChargeRequest(CreatePointChargeRequestReq req) { - User user = userProvider.readUserById(req.getUserId()); - - pointService.savePointChargeRequest(PointChargeRequest.of(user, req.getChargeAmount())); - userService.updateUserPoint(user, req.getChargeAmount()); - pointService.savePointLog( - UserPointLog.of( - PointLogCategory.REQUEST_CHARGE, - null, - req.getChargeAmount(), - user.getPoint(), - user)); - - discordMessageService.sendPointChargeLogMessage(user, req.getChargeAmount()); - } - - @Override - public ReadPointChargeRequestListRes readPointChargeRequest(ReadPointChargeRequestListReq req) { - return pointProvider.readAllPointChargeRequest(req.getUserId(), req.getIsCompleted()); - } - - @Override - public ConfirmPointChargeRes confirmPointChargeRequest(ConfirmPointChargeReq req) { - PointChargeRequest pointChargeRequest = pointProvider.readPointChargeRequestById( - req.getId()); - - if (!pointChargeRequest.getIsCompleted()) { - // 처리된 요청이 아니면 - if (req.getTransferredAmount() == pointChargeRequest.getChargeAmount()) { - // 송금된 값이 일치하면 - // PointChargeRequest의 상태를 변경하기 - pointService.updatePointChargeRequest(pointChargeRequest, - req.getTransferredAmount(), - true, true, true, true); - - return null; - } else { - // 일치하지 않으면 - String baseDate = pointChargeRequest.getCreatedAt(); - - // 유저 정보 - User user = userProvider.readUserById(req.getUserId()); - UserContactInfo userContactInfo = EntityDtoMapper.INSTANCE.toUserContactInfo(user); - - // 포인트 충전 내역 - ReadPointChargeRequestListRes readPointChargeRequestListRes = - pointProvider.readPointChargeRequestAfterDate(req.getUserId(), baseDate); - readPointChargeRequestListRes - .getPointChargeRequestInfoList() - .add(0, EntityDtoMapper.INSTANCE.toGetPointChargeRequestRes( - pointChargeRequest)); - - // 구매 내역 - ReadUserOrderHistoryListRes readUserOrderHistoryListRes = - ReadUserOrderHistoryListRes.of( - orderProvider.readOrderHistoryAfterDate( - req.getUserId(), - baseDate)); - - // 커스텀 신청내역 - ReadCustomSummaryListRes readCustomSummaryListRes = - ReadCustomSummaryListRes.from( - customProvider.getCustomByUserIdAfterDate( - req.getUserId(), - baseDate) - ); - - return ConfirmPointChargeRes.of(userContactInfo, - readPointChargeRequestListRes, - readUserOrderHistoryListRes, - readCustomSummaryListRes); - } - } else { - // 이미 처리된 요청이면 - throw new BusinessException(ErrorType.ALREADY_COMPLETED_POINT_CHARGE_REQUEST_EXCEPTION); - } - } - - @Override - public void cancelPointChargeRequest(CancelPointChargeRequestReq req) { - PointChargeRequest pointChargeRequest = pointProvider.readPointChargeRequestById( - req.getId()); - - if (pointChargeRequest.getIsCompleted()) { - // 이미 처리된 요청이면 반려 - throw new BusinessException(ErrorType.ALREADY_COMPLETED_POINT_CHARGE_REQUEST_EXCEPTION); - } else { - if (Objects.equals(req.getTransferredAmount(), pointChargeRequest.getChargeAmount())) { - // 송금 금액이 충전 금액이 같으면 반려 - throw new BusinessException(ErrorType.AMOUNT_MATCHED_EXCEPTION); - } else { - // PointChargeRequest의 상태를 변경하기 - pointService.updatePointChargeRequest( - pointChargeRequest, req.getTransferredAmount(), true, - false, false, true); - - // 포인트 로그 남기기 - User user = userProvider.readUserById(req.getUserId()); - int amount = pointChargeRequest.getChargeAmount(); - int resultPoint = user.getPoint() - amount; - - pointService.savePointLog( - UserPointLog.of( - PointLogCategory.CANCEL_CHARGE, - req.getReason(), - -pointChargeRequest.getChargeAmount(), - resultPoint, - user)); - - // 유저 포인트 처리 - userService.updateUserPoint(user, -amount); - } - } - } - - @Override - public ReadPointLogListRes readPointLog(ReadPointLogListReq req) { - return ReadPointLogListRes.of( - pointProvider.readPointLog(req.getUserId(), req.getCategory().name())); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/provider/PointProvider.java b/server/src/main/java/org/tattour/server/domain/point/provider/PointProvider.java deleted file mode 100644 index 28905d08..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/provider/PointProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.tattour.server.domain.point.provider; - -import java.util.List; -import org.tattour.server.domain.point.domain.PointChargeRequest; -import org.tattour.server.domain.point.facade.dto.response.ReadPointChargeRequestListRes; -import org.tattour.server.domain.point.provider.vo.PointLogInfo; -import org.tattour.server.domain.user.domain.User; - -public interface PointProvider { - - // id로 포인트 충전 요청 가져오기 - PointChargeRequest readPointChargeRequestById(Integer id); - - // id와 날짜로 포인트 충전 요청 가져오기 - ReadPointChargeRequestListRes readPointChargeRequestAfterDate(int userId, String date); - - // 조건에 따라 포인트 충전 요청 가져오기 - ReadPointChargeRequestListRes readAllPointChargeRequest(Integer userId, Boolean isCompleted); - - // 조건에 따라 포인트 로그 가져오기 - List readPointLog(Integer userId, String category); -} diff --git a/server/src/main/java/org/tattour/server/domain/point/provider/impl/PointProviderImpl.java b/server/src/main/java/org/tattour/server/domain/point/provider/impl/PointProviderImpl.java deleted file mode 100644 index 1fe57371..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/provider/impl/PointProviderImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.tattour.server.domain.point.provider.impl; - -import java.util.List; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.tattour.server.domain.point.dao.PointDao; -import org.tattour.server.domain.point.domain.PointChargeRequest; -import org.tattour.server.domain.point.domain.PointLogCategory; -import org.tattour.server.domain.point.provider.PointProvider; -import org.tattour.server.domain.point.facade.dto.response.ReadPointChargeRequestListRes; -import org.tattour.server.domain.point.provider.vo.PointLogInfo; -import org.tattour.server.domain.point.repository.impl.PointChargeRequestRepositoryImpl; -import org.tattour.server.global.exception.BusinessException; -import org.tattour.server.global.exception.ErrorType; -import org.tattour.server.global.util.EntityDtoMapper; - -@Service -@RequiredArgsConstructor -public class PointProviderImpl implements PointProvider { - - private final PointDao pointDao; - private final PointChargeRequestRepositoryImpl pointChargeRequestRepository; - - @Override - public PointChargeRequest readPointChargeRequestById(Integer id) { - return pointChargeRequestRepository.findById(id) - .orElseThrow(() -> new BusinessException( - ErrorType.NOT_FOUND_POINT_CHARGE_REQUEST_EXCEPTION)); - } - - @Override - public ReadPointChargeRequestListRes readPointChargeRequestAfterDate(int userId, String date) { - return ReadPointChargeRequestListRes.of( - EntityDtoMapper.INSTANCE.toGetPointChargeRequestResList( - pointChargeRequestRepository - .findPointChargeRequestByUser_IdAndCreatedAtAfter(userId, date))); - } - - @Override - public ReadPointChargeRequestListRes readAllPointChargeRequest(Integer userId, - Boolean isCompleted) { - return ReadPointChargeRequestListRes.of( - pointDao.findPointChargeRequestResList(userId, isCompleted)); - } - - @Override - public List readPointLog(Integer userId, String category) { - return pointDao.findPointLogResList(userId, category); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/point/provider/vo/PointChargeRequestInfo.java b/server/src/main/java/org/tattour/server/domain/point/provider/vo/PointChargeRequestInfo.java deleted file mode 100644 index b57baf40..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/provider/vo/PointChargeRequestInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.tattour.server.domain.point.provider.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.Setter; - -@Schema(description = "포인트 충전 요청 내역 Response") -@Getter -@Setter -@Builder -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class PointChargeRequestInfo { - - @Schema(description = "포인트 충전 요청 id") - private int id; - - @Schema(description = "user Id") - private int userId; - - @Schema(description = "충전 금액", example = "5000") - private Integer chargeAmount; - - @Schema(description = "송금된 금액", example = "3000") - private Integer transferredAmount; - - @Schema(description = "입금 여부", example = "true") - private Boolean isDeposited; - - @Schema(description = "금액 일치 여부", example = "false") - private Boolean isAmountMatched; - - @Schema(description = "", example = "") - private Boolean isApproved; - - @Schema(description = "", example = "") - private Boolean isCompleted; - - @Schema(description = "", example = "") - private String createdAt; - - @Schema(description = "", example = "") - private String lastUpdatedAt; - - @Schema(description = "", example = "") - private Boolean state; -} diff --git a/server/src/main/java/org/tattour/server/domain/point/provider/vo/PointLogInfo.java b/server/src/main/java/org/tattour/server/domain/point/provider/vo/PointLogInfo.java deleted file mode 100644 index a34ec14c..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/provider/vo/PointLogInfo.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.tattour.server.domain.point.provider.vo; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; - -@Getter -@Builder -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class PointLogInfo { - - private int id; - private int userId; - private String title; - private String content; - private Integer amount; - private int resultPointAmount; - private String createdAt; - private Boolean state; -} diff --git a/server/src/main/java/org/tattour/server/domain/point/repository/PointChargeRequestRepository.java b/server/src/main/java/org/tattour/server/domain/point/repository/PointChargeRequestRepository.java deleted file mode 100644 index ad68d5e6..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/repository/PointChargeRequestRepository.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.tattour.server.domain.point.repository; - -public interface PointChargeRequestRepository { - -} diff --git a/server/src/main/java/org/tattour/server/domain/point/repository/UserPointLogRepository.java b/server/src/main/java/org/tattour/server/domain/point/repository/UserPointLogRepository.java deleted file mode 100644 index bf219d4f..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/repository/UserPointLogRepository.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.tattour.server.domain.point.repository; - -public interface UserPointLogRepository { - -} diff --git a/server/src/main/java/org/tattour/server/domain/point/repository/impl/PointChargeRequestRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/point/repository/impl/PointChargeRequestRepositoryImpl.java deleted file mode 100644 index 88d3db17..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/repository/impl/PointChargeRequestRepositoryImpl.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.tattour.server.domain.point.repository.impl; - -import java.util.List; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; -import org.tattour.server.domain.point.domain.PointChargeRequest; - -@Repository -public interface PointChargeRequestRepositoryImpl extends - JpaRepository { - - List findPointChargeRequestByUser_IdAndCreatedAtAfter(Integer userId, - String date); -} diff --git a/server/src/main/java/org/tattour/server/domain/point/repository/impl/UserPointLogRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/point/repository/impl/UserPointLogRepositoryImpl.java deleted file mode 100644 index 4e6c1bec..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/repository/impl/UserPointLogRepositoryImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.tattour.server.domain.point.repository.impl; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; -import org.tattour.server.domain.point.domain.UserPointLog; - -@Repository -public interface UserPointLogRepositoryImpl extends JpaRepository { - -} diff --git a/server/src/main/java/org/tattour/server/domain/point/service/PointService.java b/server/src/main/java/org/tattour/server/domain/point/service/PointService.java deleted file mode 100644 index 40a6c3c6..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/service/PointService.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.tattour.server.domain.point.service; - -import org.tattour.server.domain.point.domain.PointChargeRequest; -import org.tattour.server.domain.point.domain.UserPointLog; - -public interface PointService { - - void savePointChargeRequest(PointChargeRequest pointChargeRequest); - - void savePointLog(UserPointLog userPointLog); - - // TODO : 삭제하기 - void updatePointChargeRequest(PointChargeRequest pointChargeRequest, int transferredAmount, - boolean isDeposited, boolean isAmountMatched, boolean isApproved, boolean isCompleted); -} diff --git a/server/src/main/java/org/tattour/server/domain/point/service/impl/PointServiceImpl.java b/server/src/main/java/org/tattour/server/domain/point/service/impl/PointServiceImpl.java deleted file mode 100644 index 63e3b2c8..00000000 --- a/server/src/main/java/org/tattour/server/domain/point/service/impl/PointServiceImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.tattour.server.domain.point.service.impl; - -import java.util.Objects; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.tattour.server.domain.admin.controller.dto.request.CancelPointChargeRequestReq; -import org.tattour.server.domain.point.domain.PointChargeRequest; -import org.tattour.server.domain.point.domain.PointLogCategory; -import org.tattour.server.domain.point.domain.UserPointLog; -import org.tattour.server.domain.point.provider.impl.PointProviderImpl; -import org.tattour.server.domain.point.repository.impl.PointChargeRequestRepositoryImpl; -import org.tattour.server.domain.point.repository.impl.UserPointLogRepositoryImpl; -import org.tattour.server.domain.point.service.PointService; -import org.tattour.server.domain.user.domain.User; -import org.tattour.server.domain.user.provider.impl.UserProviderImpl; -import org.tattour.server.domain.user.service.impl.UserServiceImpl; -import org.tattour.server.global.exception.BusinessException; -import org.tattour.server.global.exception.ErrorType; - -@Service -@RequiredArgsConstructor -public class PointServiceImpl implements PointService { - - private final PointChargeRequestRepositoryImpl pointChargeRequestRepository; - private final UserPointLogRepositoryImpl userPointLogRepository; - private final UserProviderImpl userProvider; - private final UserServiceImpl userService; - private final PointProviderImpl pointProvider; - - @Override - @Transactional - public void savePointChargeRequest(PointChargeRequest pointChargeRequest) { - pointChargeRequestRepository.save(pointChargeRequest); - } - - @Override - @Transactional - public void savePointLog(UserPointLog userPointLog) { - userPointLogRepository.save(userPointLog); - } - - @Override - @Transactional - public void updatePointChargeRequest(PointChargeRequest pointChargeRequest, - int transferredAmount, - boolean isDeposited, boolean isAmountMatched, boolean isApproved, boolean isCompleted) { - pointChargeRequest.setProperties(transferredAmount, isDeposited, isAmountMatched, - isApproved, isCompleted); - - pointChargeRequestRepository.save(pointChargeRequest); - } -} - - - diff --git a/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java b/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java index a1612785..1da1a6a9 100644 --- a/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java +++ b/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java @@ -28,28 +28,25 @@ import org.tattour.server.domain.custom.facade.CustomFacade; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomRes; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryListRes; -import org.tattour.server.domain.point.facade.PointFacade; -import org.tattour.server.domain.point.facade.dto.request.CreatePointChargeRequestReq; -import org.tattour.server.domain.user.controller.dto.request.PostPointChargeRequest; +import org.tattour.server.domain.user.controller.dto.request.PatchUserInfoReq; +import org.tattour.server.domain.user.controller.dto.request.PostLoginReq; import org.tattour.server.domain.user.controller.dto.request.PostProductLikedReq; import org.tattour.server.domain.user.controller.dto.request.PostUserShippingAddrReq; +import org.tattour.server.domain.user.controller.dto.response.PostLoginRes; import org.tattour.server.domain.user.facade.UserFacade; import org.tattour.server.domain.user.facade.dto.request.CompareVerificationCodeReq; import org.tattour.server.domain.user.facade.dto.request.CreateLoginReq; import org.tattour.server.domain.user.facade.dto.request.RemoveProductLikedReq; import org.tattour.server.domain.user.facade.dto.request.SaveProductLikedReq; -import org.tattour.server.domain.user.facade.dto.response.ReadUserProfileRes; -import org.tattour.server.domain.user.facade.dto.response.ProductLikedListRes; import org.tattour.server.domain.user.facade.dto.request.SaveUserShippingAddrReq; import org.tattour.server.domain.user.facade.dto.request.UpdateUserProfileReq; +import org.tattour.server.domain.user.facade.dto.response.ProductLikedListRes; +import org.tattour.server.domain.user.facade.dto.response.ReadUserProfileRes; import org.tattour.server.global.config.annotations.UserId; import org.tattour.server.global.dto.BaseResponse; import org.tattour.server.global.dto.FailResponse; import org.tattour.server.global.dto.SuccessResponse; import org.tattour.server.global.dto.SuccessType; -import org.tattour.server.domain.user.controller.dto.request.PostLoginReq; -import org.tattour.server.domain.user.controller.dto.request.PatchUserInfoReq; -import org.tattour.server.domain.user.controller.dto.response.PostLoginRes; @RestController @RequestMapping("/api/v1/user") @@ -58,375 +55,344 @@ @Tag(name = "User", description = "User API Document") public class UserController { - private final UserFacade userFacade; - private final PointFacade pointFacade; - private final CustomFacade customFacade; - - @Operation(summary = "소셜 회원가입 / 로그인", description = "소셜 회원가입 / 로그인 api") - @ApiResponses(value = { - @ApiResponse( - responseCode = "201", - description = "로그인에 성공했습니다.", - content = @Content(schema = @Schema(implementation = PostLoginRes.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PostMapping("/signup") - public ResponseEntity signup( - @Parameter(description = "Authentication Code", required = true) @RequestHeader String code, - @RequestBody @Valid PostLoginReq req, - HttpServletRequest request) { - return BaseResponse.success(SuccessType.LOGIN_SUCCESS, - userFacade.signup(CreateLoginReq.of(req.getSocialPlatform(), code, request.getHeader("origin")))); - } - - - @Operation(summary = "user 로그아웃", description = "user 로그아웃") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "로그아웃에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PatchMapping("/logout") - public ResponseEntity userLogout( - @Parameter(hidden = true) @UserId Integer userId - ) { - userFacade.userLogout(userId); - return BaseResponse.success(SuccessType.LOGOUT_SUCCESS); - } + private final UserFacade userFacade; + private final CustomFacade customFacade; + @Operation(summary = "소셜 회원가입 / 로그인", description = "소셜 회원가입 / 로그인 api") + @ApiResponses(value = { + @ApiResponse( + responseCode = "201", + description = "로그인에 성공했습니다.", + content = @Content(schema = @Schema(implementation = PostLoginRes.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @PostMapping("/signup") + public ResponseEntity signup( + @Parameter(description = "Authentication Code", required = true) @RequestHeader String code, + @RequestBody @Valid PostLoginReq req, + HttpServletRequest request) { + return BaseResponse.success(SuccessType.LOGIN_SUCCESS, + userFacade.signup(CreateLoginReq.of(req.getSocialPlatform(), code, request.getHeader("origin")))); + } - @Operation(summary = "user 이름, 전화번호 추가", description = "회원가입 시 user 이름, 전화번호 추가") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "갱신에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PatchMapping("/profile") - public ResponseEntity updateUserProfile( - @Parameter(hidden = true) @UserId Integer userId, - @RequestBody @Valid PatchUserInfoReq req - ) { - userFacade.updateUserProfile( - UpdateUserProfileReq.of( - userId, - req.getName(), - req.getPhoneNumber())); - return BaseResponse.success(SuccessType.UPDATE_SUCCESS); - } + @Operation(summary = "user 로그아웃", description = "user 로그아웃") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "로그아웃에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @PatchMapping("/logout") + public ResponseEntity userLogout( + @Parameter(hidden = true) @UserId Integer userId + ) { + userFacade.userLogout(userId); + return BaseResponse.success(SuccessType.LOGOUT_SUCCESS); + } - @Operation(summary = "user profile 정보 가져오기", description = "user 이름, 포인트 불러오기") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "조회에 성공했습니다.", - content = @Content(schema = @Schema(implementation = ReadUserProfileRes.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @GetMapping("/profile") - public ResponseEntity getUserProfile( - @Parameter(hidden = true) @UserId Integer userId - ) { - return BaseResponse.success(SuccessType.GET_SUCCESS, userFacade.readUserProfile(userId)); - } + @Operation(summary = "user 이름, 전화번호 추가", description = "회원가입 시 user 이름, 전화번호 추가") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "갱신에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @PatchMapping("/profile") + public ResponseEntity updateUserProfile( + @Parameter(hidden = true) @UserId Integer userId, + @RequestBody @Valid PatchUserInfoReq req + ) { + userFacade.updateUserProfile( + UpdateUserProfileReq.of( + userId, + req.getName(), + req.getPhoneNumber())); + return BaseResponse.success(SuccessType.UPDATE_SUCCESS); + } - @Operation(summary = "인증번호 검증", description = "user 전화번호 인증번호 검증") - @ApiResponses(value = { - // TODO : 명세서 Schema 검증하기 - @ApiResponse( - responseCode = "200", - description = "인증코드 검증에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "202", - description = "인증번호 검증에 실패했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "유효한 인증번호가 존재하지 않습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @GetMapping("/phonenumber/verification") - public ResponseEntity verifyCode( - @Parameter(hidden = true) @UserId Integer userId, - @Parameter(description = "인증번호", example = "123456") - @RequestParam - @NotNull(message = "verificationCode is null") - @Min(100000) - @Max(999999) - Integer verificationCode) { - if (userFacade.verifyCode(CompareVerificationCodeReq.of(userId, verificationCode))) { - return BaseResponse.success(SuccessType.CODE_VERIFICATION_SUCCESS, true); - } else { - return BaseResponse.success(SuccessType.CODE_VALIDATION_FAIL, false); - } - } + // TODO : 수정 + @Operation(summary = "user profile 정보 가져오기", description = "user 이름, 포인트 불러오기") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "조회에 성공했습니다.", + content = @Content(schema = @Schema(implementation = ReadUserProfileRes.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @GetMapping("/profile") + public ResponseEntity getUserProfile( + @Parameter(hidden = true) @UserId Integer userId + ) { + return BaseResponse.success(SuccessType.GET_SUCCESS, userFacade.readUserProfile(userId)); + } - @Operation(summary = "좋아요 누른 타투 저장", description = "user 좋아요 누른 타투 저장") - @ApiResponses(value = { - @ApiResponse( - responseCode = "201", - description = "생성에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 스티커입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "409", - description = "이미 존재하는 좋아요한 상품입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PostMapping("/productliked/save") - public ResponseEntity saveProductLiked( - @Parameter(hidden = true) @UserId Integer userId, - @RequestBody @Valid PostProductLikedReq req - ) { - userFacade.saveProductLiked(SaveProductLikedReq.of(userId, req.getStickerId())); + @Operation(summary = "인증번호 검증", description = "user 전화번호 인증번호 검증") + @ApiResponses(value = { + // TODO : 명세서 Schema 검증하기 + @ApiResponse( + responseCode = "200", + description = "인증코드 검증에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "202", + description = "인증번호 검증에 실패했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "유효한 인증번호가 존재하지 않습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @GetMapping("/phonenumber/verification") + public ResponseEntity verifyCode( + @Parameter(hidden = true) @UserId Integer userId, + @Parameter(description = "인증번호", example = "123456") + @RequestParam + @NotNull(message = "verificationCode is null") + @Min(100000) + @Max(999999) + Integer verificationCode) { + if (userFacade.verifyCode(CompareVerificationCodeReq.of(userId, verificationCode))) { + return BaseResponse.success(SuccessType.CODE_VERIFICATION_SUCCESS, true); + } else { + return BaseResponse.success(SuccessType.CODE_VALIDATION_FAIL, false); + } + } - return BaseResponse.success(SuccessType.CREATE_SUCCESS); - } + @Operation(summary = "좋아요 누른 타투 저장", description = "user 좋아요 누른 타투 저장") + @ApiResponses(value = { + @ApiResponse( + responseCode = "201", + description = "생성에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 스티커입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "409", + description = "이미 존재하는 좋아요한 상품입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @PostMapping("/productliked/save") + public ResponseEntity saveProductLiked( + @Parameter(hidden = true) @UserId Integer userId, + @RequestBody @Valid PostProductLikedReq req + ) { + userFacade.saveProductLiked(SaveProductLikedReq.of(userId, req.getStickerId())); - @Operation(summary = "좋아요 누른 타투 삭제", description = "user 좋아요 누른 타투 삭제") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "삭제에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 데이터입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @DeleteMapping("/productliked/sticker/{stickerId}/delete") - public ResponseEntity deleteProductLiked( - @Parameter(hidden = true) @UserId Integer userId, - @Parameter(description = "스티커 id", required = true) - @PathVariable @NotNull(message = "stickerId is null") Integer stickerId - ) { - userFacade.deleteProductLiked(RemoveProductLikedReq.of(userId, stickerId)); + return BaseResponse.success(SuccessType.CREATE_SUCCESS); + } - return BaseResponse.success(SuccessType.DELETE_SUCCESS); - } + @Operation(summary = "좋아요 누른 타투 삭제", description = "user 좋아요 누른 타투 삭제") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "삭제에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 데이터입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @DeleteMapping("/productliked/sticker/{stickerId}/delete") + public ResponseEntity deleteProductLiked( + @Parameter(hidden = true) @UserId Integer userId, + @Parameter(description = "스티커 id", required = true) + @PathVariable @NotNull(message = "stickerId is null") Integer stickerId + ) { + userFacade.deleteProductLiked(RemoveProductLikedReq.of(userId, stickerId)); - @Operation(summary = "좋아요 누른 타투 불러오기", description = "user 좋아요 누른 타투 스티커 불러오기") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "조회에 성공했습니다.", - content = @Content(schema = @Schema(implementation = ProductLikedListRes.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @GetMapping("/productliked/saved") - public ResponseEntity getProductLiked( - @Parameter(hidden = true) @UserId Integer userId - ) { - return BaseResponse.success(SuccessType.GET_SUCCESS, - userFacade.readProductLikedByUserId(userId)); - } + return BaseResponse.success(SuccessType.DELETE_SUCCESS); + } - @Operation(summary = "배송지 등록", description = "user 배송지 등록") - @ApiResponses(value = { - @ApiResponse( - responseCode = "201", - description = "생성에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PostMapping("/address") - public ResponseEntity createShippingAddr( - @Parameter(hidden = true) @UserId Integer userId, - @RequestBody @Valid PostUserShippingAddrReq req - ) { - userFacade.saveUserShippingAddr( - SaveUserShippingAddrReq.of( - userId, - req.getRecipientName(), - req.getContact(), - req.getMailingAddress(), - req.getBaseAddress(), - req.getDetailAddress())); + @Operation(summary = "좋아요 누른 타투 불러오기", description = "user 좋아요 누른 타투 스티커 불러오기") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "조회에 성공했습니다.", + content = @Content(schema = @Schema(implementation = ProductLikedListRes.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @GetMapping("/productliked/saved") + public ResponseEntity getProductLiked( + @Parameter(hidden = true) @UserId Integer userId + ) { + return BaseResponse.success(SuccessType.GET_SUCCESS, + userFacade.readProductLikedByUserId(userId)); + } - return BaseResponse.success(SuccessType.CREATE_SUCCESS); - } + @Operation(summary = "배송지 등록", description = "user 배송지 등록") + @ApiResponses(value = { + @ApiResponse( + responseCode = "201", + description = "생성에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @PostMapping("/address") + public ResponseEntity createShippingAddr( + @Parameter(hidden = true) @UserId Integer userId, + @RequestBody @Valid PostUserShippingAddrReq req + ) { + userFacade.saveUserShippingAddr( + SaveUserShippingAddrReq.of( + userId, + req.getRecipientName(), + req.getContact(), + req.getMailingAddress(), + req.getBaseAddress(), + req.getDetailAddress())); - @Operation(summary = "포인트 충전 신청", description = "user 포인트 충전 신청") - @ApiResponses(value = { - @ApiResponse( - responseCode = "201", - description = "생성에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PostMapping("/point/charge") - public ResponseEntity createPointChargeRequest( - @Parameter(hidden = true) @UserId Integer userId, - @RequestBody @Valid PostPointChargeRequest req - ) { - pointFacade.createPointChargeRequest( - CreatePointChargeRequestReq.of(userId, req.getChargeAmount())); - return BaseResponse.success(SuccessType.CREATE_POINT_CHARGE_REQUEST_SUCCESS); - } + return BaseResponse.success(SuccessType.CREATE_SUCCESS); + } - @GetMapping("/custom/complete") - @Operation(summary = "신청한 커스텀 도안 조회") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", - description = "success", - content = @Content(schema = @Schema(implementation = ReadCustomSummaryListRes.class))), - @ApiResponse(responseCode = "400, 500", - description = "error", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - public ResponseEntity getUserCustomCompleteList( - @Parameter(hidden = true) @UserId Integer userId - ) { - ReadCustomSummaryListRes response = - customFacade.readCustomSummaryCompleteListByUserId(userId); - return BaseResponse.success(SuccessType.READ_COMPLETE_CUSTOM_SUMMARY_SUCCESS, response); - } + @GetMapping("/custom/complete") + @Operation(summary = "신청한 커스텀 도안 조회") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", + description = "success", + content = @Content(schema = @Schema(implementation = ReadCustomSummaryListRes.class))), + @ApiResponse(responseCode = "400, 500", + description = "error", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + public ResponseEntity getUserCustomCompleteList( + @Parameter(hidden = true) @UserId Integer userId + ) { + ReadCustomSummaryListRes response = + customFacade.readCustomSummaryCompleteListByUserId(userId); + return BaseResponse.success(SuccessType.READ_COMPLETE_CUSTOM_SUMMARY_SUCCESS, response); + } - @GetMapping("/custom/incomplete") - @Operation(summary = "커스텀 도안 임시저장 조회") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", - description = "success", - content = @Content(schema = @Schema(implementation = ReadCustomSummaryListRes.class))), - @ApiResponse(responseCode = "400, 500", - description = "error", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - public ResponseEntity getUserCustomIncompleteList( - @Parameter(hidden = true) @UserId Integer userId - ) { - ReadCustomSummaryListRes response = - customFacade.readCustomSummaryInCompleteListByUserId(userId); - return BaseResponse.success(SuccessType.READ_INCOMPLETE_CUSTOM_SUMMARY_SUCCESS, response); - } + @GetMapping("/custom/incomplete") + @Operation(summary = "커스텀 도안 임시저장 조회") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", + description = "success", + content = @Content(schema = @Schema(implementation = ReadCustomSummaryListRes.class))), + @ApiResponse(responseCode = "400, 500", + description = "error", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + public ResponseEntity getUserCustomIncompleteList( + @Parameter(hidden = true) @UserId Integer userId + ) { + ReadCustomSummaryListRes response = + customFacade.readCustomSummaryInCompleteListByUserId(userId); + return BaseResponse.success(SuccessType.READ_INCOMPLETE_CUSTOM_SUMMARY_SUCCESS, response); + } - @GetMapping("/custom/{customId}") - @Operation(summary = "내 도안 상세정보 조회") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", - description = "success", - content = @Content(schema = @Schema(implementation = ReadCustomRes.class))), - @ApiResponse(responseCode = "400, 500", - description = "error", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - public ResponseEntity getOneUserCustomInfo( - @Parameter(hidden = true) @UserId Integer userId, - @PathVariable(value = "customId") Integer customId - ) { - ReadCustomRes response = customFacade.readCustomById(customId, userId); - return BaseResponse.success(SuccessType.READ_ONE_CUSTOM_SUCCESS, response); - } + @GetMapping("/custom/{customId}") + @Operation(summary = "내 도안 상세정보 조회") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", + description = "success", + content = @Content(schema = @Schema(implementation = ReadCustomRes.class))), + @ApiResponse(responseCode = "400, 500", + description = "error", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + public ResponseEntity getOneUserCustomInfo( + @Parameter(hidden = true) @UserId Integer userId, + @PathVariable(value = "customId") Integer customId + ) { + ReadCustomRes response = customFacade.readCustomById(customId, userId); + return BaseResponse.success(SuccessType.READ_ONE_CUSTOM_SUCCESS, response); + } } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/user/facade/impl/UserFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/user/facade/impl/UserFacadeImpl.java index 469de7b2..d05cb308 100644 --- a/server/src/main/java/org/tattour/server/domain/user/facade/impl/UserFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/user/facade/impl/UserFacadeImpl.java @@ -98,8 +98,8 @@ public ReadUserProfileRes readUserProfile(int userId) { @Override public Boolean verifyCode(CompareVerificationCodeReq req) { - return phoneNumberVerificationCodeProvider.compareVerficationCode(req.getUserId(), - req.getVerificationCode()); + return phoneNumberVerificationCodeProvider + .compareVerficationCode(req.getUserId(), req.getVerificationCode()); } @Override diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java b/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java index 5e2f6cc5..a355edc5 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java @@ -2,7 +2,6 @@ import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; -import org.tattour.server.domain.user.provider.vo.UserPointAfterOrderInfo; import org.tattour.server.domain.user.provider.vo.UserProfileInfo; public interface UserProvider { @@ -20,13 +19,4 @@ public interface UserProvider { // 이메일로 유저 중복 확인 boolean checkDuplicationByKakaoId(Long kakaoId); - - // 포인트 부족 확인 - Boolean isUserPointLack(User user, int totalAmount); - - // 주문 후 포인트 정보 가져오기 - UserPointAfterOrderInfo readUserPointAfterOrderInfo(User user, int totalAmount); - - // 주문 후 남은 포인트 계산 - int calculateRestPointAfterOrder(int userPoint, int totalAmount); } diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java b/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java index 0f7878e4..1991005c 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java @@ -6,7 +6,6 @@ import org.tattour.server.domain.user.exception.NotFoundUserException; import org.tattour.server.domain.user.provider.UserProvider; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; -import org.tattour.server.domain.user.provider.vo.UserPointAfterOrderInfo; import org.tattour.server.domain.user.provider.vo.UserProfileInfo; import org.tattour.server.domain.user.repository.impl.UserRepositoryImpl; import org.tattour.server.global.util.EntityDtoMapper; @@ -25,7 +24,7 @@ public User readUserById(int id) { @Override public User readUserByKakaoId(Long kakaoId) { - return userRepository.findByKakaoId(kakaoId) + return userRepository.findBySocialId(kakaoId) .orElseThrow(NotFoundUserException::new); } @@ -41,25 +40,6 @@ public UserProfileInfo readUserProfileInfo(User user) { @Override public boolean checkDuplicationByKakaoId(Long kakaoId) { - return userRepository.findByKakaoId(kakaoId).isPresent(); - } - - @Override - public Boolean isUserPointLack(User user, int totalAmount) { - return totalAmount > user.getPoint(); - } - - @Override - public UserPointAfterOrderInfo readUserPointAfterOrderInfo(User user, int totalAmount) { - int userPoint = user.getPoint(); - int resultPoint = calculateRestPointAfterOrder(userPoint, totalAmount); - boolean isLacked = resultPoint < 0; - - return UserPointAfterOrderInfo.of(userPoint, resultPoint, isLacked); - } - - @Override - public int calculateRestPointAfterOrder(int userPoint, int totalAmount) { - return userPoint - totalAmount; + return userRepository.findBySocialId(kakaoId).isPresent(); } } diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/vo/HomeUserInfo.java b/server/src/main/java/org/tattour/server/domain/user/provider/vo/HomeUserInfo.java index 94599f73..f4d43715 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/vo/HomeUserInfo.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/vo/HomeUserInfo.java @@ -11,10 +11,7 @@ public class HomeUserInfo { @Schema(description = "이름", example = "userName") private String name; - @Schema(description = "포인트", example = "3000") - private Integer point; - - public static HomeUserInfo of(String name, Integer point) { - return new HomeUserInfo(name, point); + public static HomeUserInfo of(String name) { + return new HomeUserInfo(name); } } diff --git a/server/src/main/java/org/tattour/server/domain/user/repository/impl/UserRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/user/repository/impl/UserRepositoryImpl.java index ae488966..e4241d3e 100644 --- a/server/src/main/java/org/tattour/server/domain/user/repository/impl/UserRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/user/repository/impl/UserRepositoryImpl.java @@ -7,12 +7,5 @@ @Repository public interface UserRepositoryImpl extends JpaRepository { - - @Override - S save(S entity); - - @Override - Optional findById(Integer integer); - - Optional findByKakaoId(Long kakaoId); + Optional findBySocialId(Long socialId); } diff --git a/server/src/main/java/org/tattour/server/domain/user/service/UserService.java b/server/src/main/java/org/tattour/server/domain/user/service/UserService.java index 60d5dd62..b1b1b78c 100644 --- a/server/src/main/java/org/tattour/server/domain/user/service/UserService.java +++ b/server/src/main/java/org/tattour/server/domain/user/service/UserService.java @@ -15,7 +15,4 @@ public interface UserService { // 로그아웃 void deleteSocialAccessToken(Integer userId); - - // 유저 포인트 수정 - void updateUserPoint(User user, Integer totalAmount); } diff --git a/server/src/main/java/org/tattour/server/domain/user/service/impl/UserServiceImpl.java b/server/src/main/java/org/tattour/server/domain/user/service/impl/UserServiceImpl.java index 9dfb42a5..3024e11b 100644 --- a/server/src/main/java/org/tattour/server/domain/user/service/impl/UserServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/user/service/impl/UserServiceImpl.java @@ -3,13 +3,11 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.exception.NotFoundUserException; import org.tattour.server.domain.user.provider.impl.UserProviderImpl; import org.tattour.server.domain.user.repository.impl.UserRepositoryImpl; import org.tattour.server.domain.user.service.UserService; -import org.tattour.server.domain.user.domain.User; -import org.tattour.server.global.exception.BusinessException; -import org.tattour.server.global.exception.ErrorType; @Service @RequiredArgsConstructor @@ -43,12 +41,4 @@ public void deleteSocialAccessToken(Integer userId) { user.deleteToken(); userRepository.save(user); } - - @Override - @Transactional - public void updateUserPoint(User user, Integer totalAmount) { - int resultPoint = user.getPoint() + totalAmount; - user.setUserPoint(resultPoint); - userRepository.save(user); - } } diff --git a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java index dece6f17..86d227e5 100644 --- a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java +++ b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java @@ -11,13 +11,11 @@ import org.tattour.server.domain.order.domain.Order; import org.tattour.server.domain.order.provider.vo.OrderHistoryInfo; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; -import org.tattour.server.domain.point.domain.PointChargeRequest; -import org.tattour.server.domain.point.provider.vo.PointChargeRequestInfo; import org.tattour.server.domain.sticker.provider.vo.StickerLikedInfo; import org.tattour.server.domain.user.domain.ProductLiked; import org.tattour.server.domain.user.domain.User; -import org.tattour.server.domain.user.provider.vo.UserContactInfo; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; +import org.tattour.server.domain.user.provider.vo.UserContactInfo; import org.tattour.server.domain.user.provider.vo.UserProfileInfo; @org.mapstruct.Mapper(componentModel = "spring") @@ -65,12 +63,6 @@ public interface EntityDtoMapper { @IterableMapping(elementTargetType = OrderHistoryInfo.class) List toOrderHistoryInfoPage(Page orderPage); - // Point - @Mapping(target = "userId", source = "user.id") - PointChargeRequestInfo toGetPointChargeRequestRes(PointChargeRequest pointChargeRequest); - - List toGetPointChargeRequestResList( - List pointChargeRequestList); // Custom CreateCustomSummaryRes toCustomApplySummaryInfo(Custom custom); From aab10e97a45fd34f0bd076cf83e5fe6820daf985 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sat, 2 Dec 2023 15:01:56 +0900 Subject: [PATCH 03/32] =?UTF-8?q?[REFACTOR]=20=EC=A3=BC=EB=AC=B8=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EB=B3=80=EA=B2=BD=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EB=A1=9C=EC=A7=81=20=EA=B0=84=EB=8B=A8=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/facade/impl/OrderFacadeImpl.java | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java index 16760bcf..f7251d00 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java @@ -24,7 +24,6 @@ import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.provider.impl.UserProviderImpl; import org.tattour.server.domain.user.provider.vo.UserProfileInfo; -import org.tattour.server.domain.user.service.impl.UserServiceImpl; import org.tattour.server.global.exception.BusinessException; import org.tattour.server.global.exception.ErrorType; import org.tattour.server.global.util.EntityDtoMapper; @@ -38,10 +37,8 @@ public class OrderFacadeImpl implements OrderFacade { private final OrderServiceImpl orderService; private final StickerProviderImpl stickerProvider; private final UserProviderImpl userProvider; - private final UserServiceImpl userService; private final DiscordMessageService discordMessageService; - //todo: 수정 @Override @Transactional public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { @@ -52,8 +49,7 @@ public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { UserProfileInfo userProfileInfo = userProvider.readUserProfileInfo(user); // 스티커 정보(배너이미지, 이름, 원래가격, 할인가격) + 개수 - ReadOrderSheetStickerInfo readOrderSheetStickerInfo = - stickerProvider.readOrderSheetStickerInfo(sticker); + ReadOrderSheetStickerInfo readOrderSheetStickerInfo = stickerProvider.readOrderSheetStickerInfo(sticker); readOrderSheetStickerInfo.setCount(req.getCount()); // 결제 금액 정보 @@ -69,14 +65,12 @@ public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { return ReadOrderSheetRes.of(userProfileInfo, readOrderSheetStickerInfo, orderAmountInfo); } - //todo: 수정 @Override @Transactional public void createOrder(CreateOrderRequest req) { User user = userProvider.readUserById(req.getUserId()); - - // 주문내역 생성 Sticker sticker = stickerProvider.getById(req.getStickerId()); + Order order = orderService.saveOrder( Order.of( sticker.getName(), @@ -115,23 +109,19 @@ public ReadOrderHistoryListRes readOrderHistoryOnPage(int page) { orderHistoryInfoPage.getTotalPages())); } - // TODO : 수정 @Override + @Transactional public void updateOrderStatus(UpdateOrderStatusReq req) { Order order = orderProvider.readOrderById(req.getOrderId()); + OrderStatus requestedStatus = req.getOrderStatus(); - // 주문취소일 경우 - if (req.getOrderStatus().equals(OrderStatus.CANCEL)) { - if (!order.getOrderStatus().equals(OrderStatus.CANCEL)) { - // 상태 변경 - order.setOrderStatus(req.getOrderStatus()); - orderService.saveOrder(order); - } else { + if (order.getOrderStatus().equals(requestedStatus)) { + if (requestedStatus.equals(OrderStatus.CANCEL)) { throw new BusinessException(ErrorType.ALREADY_CANCELED_ORDER_HISTORY_EXCEPTION); } - } else { - order.setOrderStatus(req.getOrderStatus()); - orderService.saveOrder(order); } + + order.setOrderStatus(req.getOrderStatus()); + orderService.saveOrder(order); } } From 70968b9bf04caf9041559fb574b3b20effb1bb8d Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sat, 2 Dec 2023 15:07:27 +0900 Subject: [PATCH 04/32] =?UTF-8?q?[STYLE]=20=EC=BD=94=EB=93=9C=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=20=EC=A0=95=EB=A6=AC:=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=A0=95=EB=A0=AC,=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/controller/CustomController.java | 87 +++++---- .../server/domain/custom/domain/Custom.java | 2 +- .../facade/dto/response/ReadCustomRes.java | 169 +++++++++--------- .../custom/facade/impl/CustomFacadeImpl.java | 1 - .../facade/dto/request/ReadOrderSheetReq.java | 3 +- .../order/provider/vo/OrderAmountInfo.java | 4 +- .../provider/impl/StickerProviderImpl.java | 109 ++++++----- .../user/controller/UserController.java | 4 +- .../impl/ProductLikedProviderImpl.java | 5 - .../user/provider/vo/UserContactInfo.java | 20 --- .../user/provider/vo/UserProfileInfo.java | 4 +- .../interceptors/AdminRoleInterceptor.java | 2 - .../config/resolver/UserIdResolver.java | 3 - .../server/global/util/EntityDtoMapper.java | 4 - .../service/impl/KakaoSocialService.java | 8 +- 15 files changed, 186 insertions(+), 239 deletions(-) delete mode 100644 server/src/main/java/org/tattour/server/domain/user/provider/vo/UserContactInfo.java diff --git a/server/src/main/java/org/tattour/server/domain/custom/controller/CustomController.java b/server/src/main/java/org/tattour/server/domain/custom/controller/CustomController.java index 3f3a9f0b..30ba5b72 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/controller/CustomController.java +++ b/server/src/main/java/org/tattour/server/domain/custom/controller/CustomController.java @@ -21,8 +21,8 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import org.tattour.server.domain.custom.controller.dto.request.PostCustomReq; import org.tattour.server.domain.custom.controller.dto.request.PatchCustomReq; +import org.tattour.server.domain.custom.controller.dto.request.PostCustomReq; import org.tattour.server.domain.custom.controller.dto.response.PatchCustomRes; import org.tattour.server.domain.custom.controller.dto.response.PostCustomRes; import org.tattour.server.domain.custom.facade.CustomFacade; @@ -39,49 +39,48 @@ @Tag(name = "Custom", description = "Custom API Document") public class CustomController { - private final CustomFacade customFacade; + private final CustomFacade customFacade; + + @PostMapping(value = "/apply") + @Operation(summary = "커스텀 도안 신청") + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "success", + content = @Content(schema = @Schema(implementation = PostCustomRes.class))), + @ApiResponse(responseCode = "400, 500", description = "error", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + public ResponseEntity postCustom( + @Parameter(hidden = true) @UserId Integer userId, + @RequestBody @Valid PostCustomReq request + ) { + PostCustomRes response = PostCustomRes.from( + (customFacade.createCustom(request.getHaveDesign(), userId))); + return BaseResponse.success(SuccessType.CREATE_CUSTOM_SUCCESS, response); + } - @PostMapping(value = "/apply") - @Operation(summary = "커스텀 도안 신청") - @ApiResponses(value = { - @ApiResponse(responseCode = "201", description = "success", - content = @Content(schema = @Schema(implementation = PostCustomRes.class))), - @ApiResponse(responseCode = "400, 500", description = "error", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - public ResponseEntity postCustom( - @Parameter(hidden = true) @UserId Integer userId, - @RequestBody @Valid PostCustomReq request - ) { - PostCustomRes response = PostCustomRes.from( - (customFacade.createCustom(request.getHaveDesign(), userId))); - return BaseResponse.success(SuccessType.CREATE_CUSTOM_SUCCESS, response); - } + // todo: 클라이언트에서 customInfo의 content-type을 application/json으로 설정해줘야함 + @PatchMapping(value = "/update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) + @Operation(summary = "커스텀 도안 수정", description = "customInfo ContentType: application/json" + + " / customId 를 제외한 모든 컬럼 null 값 가능" + + " / size : " + + " / 테마, 스타일 타입은 Integer") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "success", + content = @Content(schema = @Schema(implementation = PatchCustomRes.class))), + @ApiResponse(responseCode = "400, 500", description = "error", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + public ResponseEntity patchCustom( + @Parameter(hidden = true) @UserId Integer userId, + @RequestPart @Valid PatchCustomReq customInfo, + @RequestPart(required = false) MultipartFile handDrawingImage, + @RequestPart(required = false) List customImages + ) { + PatchCustomRes response = + PatchCustomRes.from( + customFacade.updateCustom( + customInfo.newUpdateCustomReq(userId, customImages, handDrawingImage))); - @PatchMapping(value = "/update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - @Operation(summary = "커스텀 도안 수정", description = "customInfo ContentType: application/json" - + " / customId 를 제외한 모든 컬럼 null 값 가능" - + " / size : " - + " / 테마, 스타일 타입은 Integer") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "success", - content = @Content(schema = @Schema(implementation = PatchCustomRes.class))), - @ApiResponse(responseCode = "400, 500", description = "error", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - public ResponseEntity patchCustom( - @Parameter(hidden = true) @UserId Integer userId, - @RequestPart @Valid PatchCustomReq customInfo, - @RequestPart(required = false) MultipartFile handDrawingImage, - @RequestPart(required = false) List customImages - ) { - PatchCustomRes response = - PatchCustomRes.from( - customFacade.updateCustom( - customInfo.newUpdateCustomReq( - userId, - customImages, - handDrawingImage))); - return BaseResponse.success(SuccessType.UPDATE_CUSTOM_SUCCESS, response); - } + return BaseResponse.success(SuccessType.UPDATE_CUSTOM_SUCCESS, response); + } } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java b/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java index 45474278..1924e423 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java +++ b/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java @@ -162,7 +162,7 @@ public void setCustomProcess(CustomProcess process) { } public Integer calPrice() { - Integer price = size.getPrice() * count; + int price = size.getPrice() * count; if (isPublic) { price -= size.getDiscountPrice(); } diff --git a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomRes.java b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomRes.java index ebc5fd4d..f6a5fbce 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomRes.java +++ b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomRes.java @@ -7,104 +7,95 @@ import lombok.Builder; import lombok.Getter; import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.domain.CustomImage; @Getter @Builder(access = AccessLevel.PRIVATE) public class ReadCustomRes { - private Integer id; - private Integer userId; - private Integer stickerId; - private List themes; - private List styles; - private String mainImageUrl; - private String handDrawingImageUrl; - private List images; - private Boolean haveDesign; - private String size; - private String name; - private String description; - private String demand; - private Integer count; - private Boolean isColored; - private Boolean isPublic; - private Boolean isCompleted; - private Integer price; - private String process; - private Integer viewCount; + private Integer id; + private Integer userId; + private Integer stickerId; + private List themes; + private List styles; + private String mainImageUrl; + private String handDrawingImageUrl; + private List images; + private Boolean haveDesign; + private String size; + private String name; + private String description; + private String demand; + private Integer count; + private Boolean isColored; + private Boolean isPublic; + private Boolean isCompleted; + private Integer price; + private String process; + private Integer viewCount; - public static ReadCustomRes from(Custom custom) { - List themes = getThemeNameList(custom); - List styles = getStyleList(custom); - List images = getImageList(custom); - return ReadCustomRes.builder() - .id(custom.getId()) - .userId(custom.getUser().getId()) - .themes(themes) - .styles(styles) - .mainImageUrl(custom.getMainImageUrl()) - .images(images) - .handDrawingImageUrl(custom.getHandDrawingImageUrl()) - .haveDesign(custom.getHaveDesign()) - .size(getSizeString(custom)) - .name(custom.getName()) - .description(custom.getDescription()) - .demand(custom.getDemand()) - .count(custom.getCount()) - .isColored(custom.getIsColored()) - .isPublic(custom.getIsPublic()) - .isCompleted(custom.getIsCompleted()) - .price(custom.getPrice()) - .process(getProcessString(custom)) - .viewCount(custom.getViewCount()) - .build(); - } - // Todo : 주석 지우기 + public static ReadCustomRes from(Custom custom) { + List themes = getThemeNameList(custom); + List styles = getStyleList(custom); + List images = getImageList(custom); + return ReadCustomRes.builder() + .id(custom.getId()) + .userId(custom.getUser().getId()) + .themes(themes) + .styles(styles) + .mainImageUrl(custom.getMainImageUrl()) + .images(images) + .handDrawingImageUrl(custom.getHandDrawingImageUrl()) + .haveDesign(custom.getHaveDesign()) + .size(getSizeString(custom)) + .name(custom.getName()) + .description(custom.getDescription()) + .demand(custom.getDemand()) + .count(custom.getCount()) + .isColored(custom.getIsColored()) + .isPublic(custom.getIsPublic()) + .isCompleted(custom.getIsCompleted()) + .price(custom.getPrice()) + .process(getProcessString(custom)) + .viewCount(custom.getViewCount()) + .build(); + } - private static List getImageList(Custom custom) { -// if (Objects.isNull(custom.getImages())) { -// return null; -// } - return custom - .getImages() - .stream() - .map(customImage -> customImage.getImageUrl()) - .collect(Collectors.toList()); - } + private static List getImageList(Custom custom) { + return custom + .getImages() + .stream() + .map(CustomImage::getImageUrl) + .collect(Collectors.toList()); + } - private static List getStyleList(Custom custom) { -// if (Objects.isNull(custom.getCustomStyles())) { -// return null; -// } - return custom - .getCustomStyles() - .stream() - .map(customStyle -> customStyle.getStyle().getName()) - .collect(Collectors.toList()); - } + private static List getStyleList(Custom custom) { + return custom + .getCustomStyles() + .stream() + .map(customStyle -> customStyle.getStyle().getName()) + .collect(Collectors.toList()); + } - private static List getThemeNameList(Custom custom) { -// if (Objects.isNull(custom.getCustomThemes())) { -// return null; -// } - return custom - .getCustomThemes() - .stream() - .map(customTheme -> customTheme.getTheme().getName()) - .collect(Collectors.toList()); - } + private static List getThemeNameList(Custom custom) { + return custom + .getCustomThemes() + .stream() + .map(customTheme -> customTheme.getTheme().getName()) + .collect(Collectors.toList()); + } - private static String getSizeString(Custom custom) { - if (Objects.isNull(custom.getSize())) { - return null; - } - return custom.getSize().getSize(); - } + private static String getSizeString(Custom custom) { + if (Objects.isNull(custom.getSize())) { + return null; + } + return custom.getSize().getSize(); + } - private static String getProcessString(Custom custom) { - if (Objects.isNull(custom.getProcess())) { - return null; - } - return custom.getProcess().getValue(); - } + private static String getProcessString(Custom custom) { + if (Objects.isNull(custom.getProcess())) { + return null; + } + return custom.getProcess().getValue(); + } } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java index 2c18aeff..55cc38d6 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java @@ -39,7 +39,6 @@ public class CustomFacadeImpl implements CustomFacade { private static final String directoryPath = "custom"; - //todo: 수정 @Override @Transactional public Integer createCustom(Boolean haveDesign, Integer userId) { diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java index 5a59939a..fde562e2 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java @@ -20,8 +20,7 @@ public class ReadOrderSheetReq { @NotNull(message = "shippingFee is null") private Integer shippingFee; - public static ReadOrderSheetReq of(Integer userId, Integer stickerId, Integer count, - Integer shippingFee) { + public static ReadOrderSheetReq of(Integer userId, Integer stickerId, Integer count, Integer shippingFee) { return new ReadOrderSheetReq(userId, stickerId, count, shippingFee); } } diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountInfo.java b/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountInfo.java index 38109d0a..0617802f 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountInfo.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountInfo.java @@ -9,7 +9,6 @@ @AllArgsConstructor public class OrderAmountInfo { - @Schema(description = "총 결제금액", example = "12000") private Integer totalAmount; @@ -19,8 +18,7 @@ public class OrderAmountInfo { @Schema(description = "배송비", example = "3000") private Integer shippingFee; - public static OrderAmountInfo of(Integer totalAmount, Integer productAmount, - Integer shippingFee) { + public static OrderAmountInfo of(Integer totalAmount, Integer productAmount, Integer shippingFee) { return new OrderAmountInfo(totalAmount, productAmount, shippingFee); } } diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java index 47a52b8c..1cf3cf57 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java @@ -16,68 +16,67 @@ @RequiredArgsConstructor public class StickerProviderImpl implements StickerProvider { - private final StickerRepository stickerRepository; + private final StickerRepository stickerRepository; - @Override - public Sticker getById(Integer id) { - return stickerRepository.findById(id) - .orElseThrow(NotFoundStickerException::new); - } + @Override + public Sticker getById(Integer id) { + return stickerRepository.findById(id) + .orElseThrow(NotFoundStickerException::new); + } - @Override - public List getAllCustomStickerOrderByOrder() { - return stickerRepository - .findAllByStateAndIsCustomInOrderOrder(); - } + @Override + public List getAllCustomStickerOrderByOrder() { + return stickerRepository + .findAllByStateAndIsCustomInOrderOrder(); + } - @Override - public List getAllByThemeAndStyleOrderByOrder(String themeName, String styleName) { - return stickerRepository - .findAllByThemeNameAndStyleNameAndStateInOrderOrder(themeName, styleName); - } + @Override + public List getAllByThemeAndStyleOrderByOrder(String themeName, String styleName) { + return stickerRepository + .findAllByThemeNameAndStyleNameAndStateInOrderOrder(themeName, styleName); + } - @Override - public List getAllByThemeAndStyleOrderByPrice(String themeName, String styleName) { - return stickerRepository - .findAllByThemeNameAndStyleNameAndStateInOrderPrice(themeName, styleName); - } + @Override + public List getAllByThemeAndStyleOrderByPrice(String themeName, String styleName) { + return stickerRepository + .findAllByThemeNameAndStyleNameAndStateInOrderPrice(themeName, styleName); + } - @Override - public List getAllByThemeAndStyleOrderByPriceDesc(String themeName, String styleName) { - return stickerRepository - .findAllByThemeNameAndStyleNameAndStateInOrderPriceDesc(themeName, styleName); - } + @Override + public List getAllByThemeAndStyleOrderByPriceDesc(String themeName, String styleName) { + return stickerRepository + .findAllByThemeNameAndStyleNameAndStateInOrderPriceDesc(themeName, styleName); + } - @Override - public List getAllSameThemeOrStyleById(Integer id) { - return stickerRepository - .findAllSameThemeOrStyleById(id); - } + @Override + public List getAllSameThemeOrStyleById(Integer id) { + return stickerRepository + .findAllSameThemeOrStyleById(id); + } - @Override - public List getAllByThemeOrStyleOrNameLike(String word) { - if(Objects.isNull(word)) { - return null; - } - return stickerRepository - .findAllByThemeNameOrStyleNameOrNameContaining(word); - } + @Override + public List getAllByThemeOrStyleOrNameLike(String word) { + if (Objects.isNull(word)) { + return null; + } + return stickerRepository + .findAllByThemeNameOrStyleNameOrNameContaining(word); + } - // Todo : 리펙토링하기 of -> from? - @Override - public ReadOrderSheetStickerInfo readOrderSheetStickerInfo(Sticker sticker) { - Integer discountedPrice = getDiscountPrice(sticker); - return ReadOrderSheetStickerInfo.of( - sticker.getMainImageUrl(), - sticker.getName(), - sticker.getPrice(), - discountedPrice); - } + @Override + public ReadOrderSheetStickerInfo readOrderSheetStickerInfo(Sticker sticker) { + Integer discountedPrice = getDiscountPrice(sticker); + return ReadOrderSheetStickerInfo.of( + sticker.getMainImageUrl(), + sticker.getName(), + sticker.getPrice(), + discountedPrice); + } - private static Integer getDiscountPrice(Sticker sticker) { - if (Objects.isNull(sticker.getDiscount())) { - return null; - } - return (sticker.getPrice() * (100 - sticker.getDiscount().getDiscountRate())) / 100; - } + private static Integer getDiscountPrice(Sticker sticker) { + if (Objects.isNull(sticker.getDiscount())) { + return null; + } + return (sticker.getPrice() * (100 - sticker.getDiscount().getDiscountRate())) / 100; + } } diff --git a/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java b/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java index 1da1a6a9..9bc9f11a 100644 --- a/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java +++ b/server/src/main/java/org/tattour/server/domain/user/controller/UserController.java @@ -148,8 +148,7 @@ public ResponseEntity updateUserProfile( return BaseResponse.success(SuccessType.UPDATE_SUCCESS); } - // TODO : 수정 - @Operation(summary = "user profile 정보 가져오기", description = "user 이름, 포인트 불러오기") + @Operation(summary = "user profile 정보 가져오기") @ApiResponses(value = { @ApiResponse( responseCode = "200", @@ -178,7 +177,6 @@ public ResponseEntity getUserProfile( @Operation(summary = "인증번호 검증", description = "user 전화번호 인증번호 검증") @ApiResponses(value = { - // TODO : 명세서 Schema 검증하기 @ApiResponse( responseCode = "200", description = "인증코드 검증에 성공했습니다.", diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/impl/ProductLikedProviderImpl.java b/server/src/main/java/org/tattour/server/domain/user/provider/impl/ProductLikedProviderImpl.java index 901d723e..5c1053cc 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/impl/ProductLikedProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/impl/ProductLikedProviderImpl.java @@ -27,14 +27,9 @@ public ProductLiked readProductLikedByUserIdAndStickerId(Integer userId, Integer .orElseThrow(() -> new BusinessException(ErrorType.NOT_FOUND_RESOURCE)); } - //TODO : 리팩토링? @Override public List readLikedProductsByUserId(Integer userId) { return productLikedRepository.findAllByUser_IdOrderByCreatedAtDesc(userId); - // 모아서 리스트로 만들기 -// List stickerList = productLikedList.stream() -// .map(ProductLiked::getSticker) -// .collect(Collectors.toList()); } @Override diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserContactInfo.java b/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserContactInfo.java deleted file mode 100644 index 2934af33..00000000 --- a/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserContactInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.tattour.server.domain.user.provider.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; - -@Schema(description = "user 정보") -@Getter -@Setter -public class UserContactInfo { - - @Schema(description = "user id") - private Integer id; - - @Schema(description = "이름", example = "userName") - private String name; - - @Schema(description = "전화번호", example = "01012345678") - private String phoneNumber; -} diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileInfo.java b/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileInfo.java index d01afa10..89eba478 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileInfo.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileInfo.java @@ -8,11 +8,13 @@ @Builder @Getter public class UserProfileInfo { + @Schema(description = "user Id") private int id; + @Schema(description = "user 이름", example = "김타투") private String name; + @Schema(description = "user 전화번호", example = "01012345678") private String phoneNumber; - } diff --git a/server/src/main/java/org/tattour/server/global/config/interceptors/AdminRoleInterceptor.java b/server/src/main/java/org/tattour/server/global/config/interceptors/AdminRoleInterceptor.java index b1835ff6..6602dfbc 100644 --- a/server/src/main/java/org/tattour/server/global/config/interceptors/AdminRoleInterceptor.java +++ b/server/src/main/java/org/tattour/server/global/config/interceptors/AdminRoleInterceptor.java @@ -32,8 +32,6 @@ public boolean preHandle( final JwtContent content = jwtService.getJwtContents(token); try { - System.out.println("content.getRole() = " + content.getRole()); - final UserRole role = UserRole.valueOf(content.getRole()); if (!role.equals(UserRole.ADMIN)) { diff --git a/server/src/main/java/org/tattour/server/global/config/resolver/UserIdResolver.java b/server/src/main/java/org/tattour/server/global/config/resolver/UserIdResolver.java index 257d5bed..824c459c 100644 --- a/server/src/main/java/org/tattour/server/global/config/resolver/UserIdResolver.java +++ b/server/src/main/java/org/tattour/server/global/config/resolver/UserIdResolver.java @@ -21,7 +21,6 @@ public class UserIdResolver implements HandlerMethodArgumentResolver { private final JwtService jwtService; - private static final String HEADER_PREFIX = "Bearer "; @Override public boolean supportsParameter(MethodParameter parameter) { @@ -46,8 +45,6 @@ public Object resolveArgument( final JwtContent content = jwtService.getJwtContents(token); try { - System.out.println("content.getRole() = " + content.getRole()); - final UserRole role = UserRole.valueOf(content.getRole()); final Integer userId = Integer.parseInt(content.getUserId()); diff --git a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java index 86d227e5..d96389be 100644 --- a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java +++ b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java @@ -15,7 +15,6 @@ import org.tattour.server.domain.user.domain.ProductLiked; import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; -import org.tattour.server.domain.user.provider.vo.UserContactInfo; import org.tattour.server.domain.user.provider.vo.UserProfileInfo; @org.mapstruct.Mapper(componentModel = "spring") @@ -26,9 +25,6 @@ public interface EntityDtoMapper { // User HomeUserInfo toHomeUserInfo(User user); - @Mapping(target = "id", source = "user.id") - UserContactInfo toUserContactInfo(User user); - @Mapping(target = "id", source = "user.id") UserProfileInfo toUserProfileInfo(User user); diff --git a/server/src/main/java/org/tattour/server/infra/socialLogin/client/kakao/service/impl/KakaoSocialService.java b/server/src/main/java/org/tattour/server/infra/socialLogin/client/kakao/service/impl/KakaoSocialService.java index 89fbe722..307c2e1c 100644 --- a/server/src/main/java/org/tattour/server/infra/socialLogin/client/kakao/service/impl/KakaoSocialService.java +++ b/server/src/main/java/org/tattour/server/infra/socialLogin/client/kakao/service/impl/KakaoSocialService.java @@ -5,12 +5,10 @@ import org.springframework.stereotype.Service; import org.tattour.server.infra.socialLogin.client.kakao.KakaoApiClient; import org.tattour.server.infra.socialLogin.client.kakao.KakaoAuthApiClient; -import org.tattour.server.infra.socialLogin.client.kakao.service.dto.response.KakaoAccessTokenRes; -import org.tattour.server.infra.socialLogin.client.kakao.service.dto.response.KakaoUserInfoRes; import org.tattour.server.infra.socialLogin.client.kakao.service.SocialService; import org.tattour.server.infra.socialLogin.client.kakao.service.dto.request.GetSocialLoginReq; -import org.tattour.server.domain.user.provider.impl.UserProviderImpl; -import org.tattour.server.domain.user.service.impl.UserServiceImpl; +import org.tattour.server.infra.socialLogin.client.kakao.service.dto.response.KakaoAccessTokenRes; +import org.tattour.server.infra.socialLogin.client.kakao.service.dto.response.KakaoUserInfoRes; import org.tattour.server.infra.socialLogin.client.kakao.service.vo.KakaoLoginInfo; @Service @@ -22,8 +20,6 @@ public class KakaoSocialService extends SocialService { private final KakaoApiClient kakaoApiClient; private final KakaoAuthApiClient kakaoAuthApiClient; - private final UserServiceImpl userService; - private final UserProviderImpl userProvider; @Override public KakaoLoginInfo getSocialLoginResponse(GetSocialLoginReq req) { From 81052d0ffd87200865f956810db06f4b30f3e3e5 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sat, 2 Dec 2023 18:33:00 +0900 Subject: [PATCH 05/32] =?UTF-8?q?[FEAT]=20=EC=9E=A5=EB=B0=94=EA=B5=AC?= =?UTF-8?q?=EB=8B=88=20=EC=83=9D=EC=84=B1=20or=20=EB=B3=91=ED=95=A9=20api?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cart/controller/CartController.java | 68 +++++++++++++++++++ .../controller/dto/request/SaveCartReq.java | 11 +++ .../server/domain/cart/domain/Cart.java | 38 +++++++++++ .../server/domain/cart/facade/CartFacade.java | 7 ++ .../cart/facade/impl/CartFacadeImpl.java | 29 ++++++++ .../cart/repository/CartRepository.java | 13 ++++ .../domain/cart/service/CartService.java | 16 +++++ .../cart/service/impl/CartServiceImpl.java | 46 +++++++++++++ 8 files changed, 228 insertions(+) create mode 100644 server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java create mode 100644 server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java create mode 100644 server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java create mode 100644 server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java create mode 100644 server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java create mode 100644 server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java create mode 100644 server/src/main/java/org/tattour/server/domain/cart/service/CartService.java create mode 100644 server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java new file mode 100644 index 00000000..861eae28 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java @@ -0,0 +1,68 @@ +package org.tattour.server.domain.cart.controller; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; +import org.tattour.server.domain.cart.facade.CartFacade; +import org.tattour.server.global.config.annotations.UserId; +import org.tattour.server.global.dto.BaseResponse; +import org.tattour.server.global.dto.FailResponse; +import org.tattour.server.global.dto.SuccessResponse; +import org.tattour.server.global.dto.SuccessType; + +@RestController +@RequestMapping("/api/v1/cart") +@SecurityRequirement(name = "JWT Auth") +@Tag(name = "Cart(장바구니)", description = "Cart API Document") +@RequiredArgsConstructor +@Validated +public class CartController { + private final CartFacade cartFacade; + + @Operation(summary = "장바구니 추가") + @ApiResponses(value = { + @ApiResponse( + responseCode = "201", + description = "생성에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 스티커입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @PostMapping("/items") + public ResponseEntity saveCartItem( + @Parameter(hidden = true) @UserId Integer userId, + @RequestBody SaveCartReq saveCartReq + ) { + cartFacade.saveCartItem(userId, saveCartReq); + return BaseResponse.success(SuccessType.CREATE_SUCCESS); + } +} + + diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java new file mode 100644 index 00000000..af1e8924 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java @@ -0,0 +1,11 @@ +package org.tattour.server.domain.cart.controller.dto.request; + +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +public class SaveCartReq { + private int count; + private int stickerId; +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java b/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java new file mode 100644 index 00000000..30d8b1e0 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java @@ -0,0 +1,38 @@ +package org.tattour.server.domain.cart.domain; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.NoArgsConstructor; +import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.user.domain.User; + +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor(access = AccessLevel.PROTECTED) +public class Cart { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + private Integer count; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "sticker_id") + private Sticker sticker; + + public void addCount(int count) { + this.count += count; + } +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java new file mode 100644 index 00000000..5ae5a69b --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java @@ -0,0 +1,7 @@ +package org.tattour.server.domain.cart.facade; + +import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; + +public interface CartFacade { + void saveCartItem(int userId, SaveCartReq req); +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java new file mode 100644 index 00000000..ca458ce6 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java @@ -0,0 +1,29 @@ +package org.tattour.server.domain.cart.facade.impl; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; +import org.tattour.server.domain.cart.facade.CartFacade; +import org.tattour.server.domain.cart.service.CartService; +import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.provider.StickerProvider; +import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.user.service.UserService; + +@Service +@RequiredArgsConstructor +public class CartFacadeImpl implements CartFacade { + private final CartService cartService; + private final UserService userService; + private final StickerProvider stickerProvider; + + @Override + @Transactional + public void saveCartItem(int userId, SaveCartReq req) { + User user = userService.readUserById(userId); + Sticker sticker = stickerProvider.getById(req.getStickerId()); + + cartService.mergeOrAddToCart(user, sticker, req.getCount()); + } +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java new file mode 100644 index 00000000..b4264ff6 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java @@ -0,0 +1,13 @@ +package org.tattour.server.domain.cart.repository; + +import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; +import org.tattour.server.domain.cart.domain.Cart; +import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.user.domain.User; + +@Repository +public interface CartRepository extends JpaRepository { + Optional findCartByUserAndSticker(User user, Sticker sticker); +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java new file mode 100644 index 00000000..64193007 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java @@ -0,0 +1,16 @@ +package org.tattour.server.domain.cart.service; + +import java.util.Optional; +import org.tattour.server.domain.cart.domain.Cart; +import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.user.domain.User; + +public interface CartService { + void mergeOrAddToCart(User user, Sticker sticker, int count); + + Cart createNewCart(User user, Sticker sticker, int count); + + void save(Cart cart); + + Optional findByUserAndSticker(User user, Sticker sticker); +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java new file mode 100644 index 00000000..d2aca45b --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java @@ -0,0 +1,46 @@ +package org.tattour.server.domain.cart.service.impl; + +import java.util.Optional; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.tattour.server.domain.cart.domain.Cart; +import org.tattour.server.domain.cart.repository.CartRepository; +import org.tattour.server.domain.cart.service.CartService; +import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.user.domain.User; + +@Service +@RequiredArgsConstructor +public class CartServiceImpl implements CartService { + private final CartRepository cartRepository; + + @Override + public void mergeOrAddToCart(User user, Sticker sticker, int count) { + Cart cart = findByUserAndSticker(user, sticker) + .map(cartExisting -> { + cartExisting.addCount(count); + return cartExisting; + }) + .orElseGet(() -> createNewCart(user, sticker, count)); + save(cart); + } + + @Override + public Optional findByUserAndSticker(User user, Sticker sticker) { + return cartRepository.findCartByUserAndSticker(user, sticker); + } + + @Override + public Cart createNewCart(User user, Sticker sticker, int count) { + return Cart.builder() + .count(count) + .user(user) + .sticker(sticker) + .build(); + } + + @Override + public void save(Cart cart) { + cartRepository.save(cart); + } +} From 6885b0497c3b0f9a82421f027026fdb2d15b2a37 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sat, 2 Dec 2023 18:58:46 +0900 Subject: [PATCH 06/32] =?UTF-8?q?[FEAT]=20=EC=9C=A0=EC=A0=80=20=EC=9E=A5?= =?UTF-8?q?=EB=B0=94=EA=B5=AC=EB=8B=88=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20api=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cart/controller/CartController.java | 25 ++++++++++++++++++- .../controller/dto/response/CartItemRes.java | 15 +++++++++++ .../controller/dto/response/CartItemsRes.java | 17 +++++++++++++ .../server/domain/cart/domain/Cart.java | 2 ++ .../server/domain/cart/facade/CartFacade.java | 3 +++ .../cart/facade/impl/CartFacadeImpl.java | 11 ++++++++ .../cart/repository/CartRepository.java | 3 +++ .../domain/cart/service/CartService.java | 3 +++ .../cart/service/impl/CartServiceImpl.java | 6 +++++ .../server/global/util/EntityDtoMapper.java | 14 +++++++++++ 10 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemRes.java create mode 100644 server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemsRes.java diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java index 861eae28..3774dec1 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java @@ -11,6 +11,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -32,7 +33,7 @@ public class CartController { private final CartFacade cartFacade; - @Operation(summary = "장바구니 추가") + @Operation(summary = "장바구니 아이템 추가") @ApiResponses(value = { @ApiResponse( responseCode = "201", @@ -63,6 +64,28 @@ public ResponseEntity saveCartItem( cartFacade.saveCartItem(userId, saveCartReq); return BaseResponse.success(SuccessType.CREATE_SUCCESS); } + + @Operation(summary = "유저 장바구니 목록 조회") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "조회에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @GetMapping("/items") + public ResponseEntity getUserCartItem( + @Parameter(hidden = true) @UserId Integer userId + ) { + return BaseResponse.success(SuccessType.GET_SUCCESS, cartFacade.getUserCartItems(userId)); + } } diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemRes.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemRes.java new file mode 100644 index 00000000..36de701b --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemRes.java @@ -0,0 +1,15 @@ +package org.tattour.server.domain.cart.controller.dto.response; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CartItemRes { + private int stickerId; + private String mainImageUrl; + private String name; + private int price; + private int discountPrice; + private int count; +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemsRes.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemsRes.java new file mode 100644 index 00000000..14dd316c --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemsRes.java @@ -0,0 +1,17 @@ +package org.tattour.server.domain.cart.controller.dto.response; + +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class CartItemsRes { + private List cartItemsRes; + + public static CartItemsRes of(List cartItemsRes) { + return new CartItemsRes(cartItemsRes); + } +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java b/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java index 30d8b1e0..19d7c942 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java +++ b/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java @@ -10,12 +10,14 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; +import lombok.Getter; import lombok.NoArgsConstructor; import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.user.domain.User; @Entity @Builder +@Getter @NoArgsConstructor @AllArgsConstructor(access = AccessLevel.PROTECTED) public class Cart { diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java index 5ae5a69b..d379e04e 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java @@ -1,7 +1,10 @@ package org.tattour.server.domain.cart.facade; import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; +import org.tattour.server.domain.cart.controller.dto.response.CartItemsRes; public interface CartFacade { void saveCartItem(int userId, SaveCartReq req); + + CartItemsRes getUserCartItems(int userId); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java index ca458ce6..343af89f 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java @@ -4,12 +4,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; +import org.tattour.server.domain.cart.controller.dto.response.CartItemsRes; import org.tattour.server.domain.cart.facade.CartFacade; import org.tattour.server.domain.cart.service.CartService; import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.provider.StickerProvider; import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.service.UserService; +import org.tattour.server.global.util.EntityDtoMapper; @Service @RequiredArgsConstructor @@ -26,4 +28,13 @@ public void saveCartItem(int userId, SaveCartReq req) { cartService.mergeOrAddToCart(user, sticker, req.getCount()); } + + @Override + public CartItemsRes getUserCartItems(int userId) { + User user = userService.readUserById(userId); + + return CartItemsRes.of( + EntityDtoMapper.INSTANCE + .toCartItemsRes(cartService.findByUser(user))); + } } diff --git a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java index b4264ff6..35ea2771 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java +++ b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java @@ -1,5 +1,6 @@ package org.tattour.server.domain.cart.repository; +import java.util.List; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @@ -10,4 +11,6 @@ @Repository public interface CartRepository extends JpaRepository { Optional findCartByUserAndSticker(User user, Sticker sticker); + + List findByUser(User user); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java index 64193007..0903082e 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java @@ -1,5 +1,6 @@ package org.tattour.server.domain.cart.service; +import java.util.List; import java.util.Optional; import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.sticker.domain.Sticker; @@ -13,4 +14,6 @@ public interface CartService { void save(Cart cart); Optional findByUserAndSticker(User user, Sticker sticker); + + List findByUser(User user); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java index d2aca45b..0f45e692 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java @@ -1,5 +1,6 @@ package org.tattour.server.domain.cart.service.impl; +import java.util.List; import java.util.Optional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -30,6 +31,11 @@ public Optional findByUserAndSticker(User user, Sticker sticker) { return cartRepository.findCartByUserAndSticker(user, sticker); } + @Override + public List findByUser(User user) { + return cartRepository.findByUser(user); + } + @Override public Cart createNewCart(User user, Sticker sticker, int count) { return Cart.builder() diff --git a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java index d96389be..49970ec9 100644 --- a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java +++ b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java @@ -5,6 +5,8 @@ import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import org.springframework.data.domain.Page; +import org.tattour.server.domain.cart.controller.dto.response.CartItemRes; +import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.custom.domain.Custom; import org.tattour.server.domain.custom.facade.dto.response.CreateCustomSummaryRes; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryRes; @@ -69,4 +71,16 @@ public interface EntityDtoMapper { ReadCustomSummaryRes toReadCustomSummaryRes(Custom custom); List toReadCustomSummaryResList(List customList); + + + // Cart + @Mapping(target = "stickerId", source = "cart.sticker.id") + @Mapping(target = "mainImageUrl", source = "cart.sticker.mainImageUrl") + @Mapping(target = "name", source = "cart.sticker.name") + @Mapping(target = "price", source = "cart.sticker.price") + @Mapping(target = "discountPrice", source = "cart.sticker.discountPrice") + CartItemRes toCartItemRes(Cart cart); + + List toCartItemsRes(List carts); + } From b4727f93bbcbadf29155052670b7e2cd4c95d26b Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 3 Dec 2023 00:02:12 +0900 Subject: [PATCH 07/32] =?UTF-8?q?[FEAT]=20Order:=20=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EA=B0=80=EC=A0=B8=EC=98=A4?= =?UTF-8?q?=EA=B8=B0=20api=20-=20=EC=9E=A5=EB=B0=94=EA=B5=AC=EB=8B=88?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=B6=88=EB=9F=AC=EC=98=A4=EA=B8=B0=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/controller/OrderController.java | 229 +++++++++--------- .../dto/response/OrderSheetStickerRes.java | 43 ++++ .../dto/response/ReadOrderSheetRes.java | 20 +- .../server/domain/order/domain/Order.java | 14 +- .../facade/dto/request/ReadOrderSheetReq.java | 10 +- .../order/facade/impl/OrderFacadeImpl.java | 49 ++-- .../domain/order/provider/OrderProvider.java | 10 - .../provider/impl/OrderProviderImpl.java | 31 +-- ...untInfo.java => OrderAmountDetailRes.java} | 6 +- .../domain/order/service/OrderService.java | 3 - .../sticker/provider/StickerProvider.java | 7 +- .../provider/impl/StickerProviderImpl.java | 25 +- .../vo/ReadOrderSheetStickerInfo.java | 56 ----- .../sticker/provider/vo/StickerOrderInfo.java | 17 ++ .../domain/user/provider/UserProvider.java | 4 - .../user/provider/impl/UserProviderImpl.java | 6 - ...erProfileInfo.java => UserProfileRes.java} | 2 +- 17 files changed, 244 insertions(+), 288 deletions(-) create mode 100644 server/src/main/java/org/tattour/server/domain/order/controller/dto/response/OrderSheetStickerRes.java rename server/src/main/java/org/tattour/server/domain/order/provider/vo/{OrderAmountInfo.java => OrderAmountDetailRes.java} (70%) delete mode 100644 server/src/main/java/org/tattour/server/domain/sticker/provider/vo/ReadOrderSheetStickerInfo.java create mode 100644 server/src/main/java/org/tattour/server/domain/sticker/provider/vo/StickerOrderInfo.java rename server/src/main/java/org/tattour/server/domain/user/provider/vo/{UserProfileInfo.java => UserProfileRes.java} (93%) diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java b/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java index a89a29ed..ce88a3b6 100644 --- a/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java +++ b/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java @@ -12,6 +12,7 @@ import javax.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -21,9 +22,9 @@ import org.tattour.server.domain.order.controller.dto.request.PostOrderReq; import org.tattour.server.domain.order.controller.dto.response.ReadOrderSheetRes; import org.tattour.server.domain.order.facade.dto.request.CreateOrderRequest; -import org.tattour.server.domain.order.facade.impl.OrderFacadeImpl; import org.tattour.server.domain.order.facade.dto.request.ReadOrderSheetReq; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; +import org.tattour.server.domain.order.facade.impl.OrderFacadeImpl; import org.tattour.server.global.config.annotations.UserId; import org.tattour.server.global.dto.BaseResponse; import org.tattour.server.global.dto.FailResponse; @@ -35,127 +36,123 @@ @RequiredArgsConstructor @SecurityRequirement(name = "JWT Auth") @Tag(name = "Order", description = "Order API Document") +@Validated public class OrderController { - private final OrderFacadeImpl orderFacade; + private final OrderFacadeImpl orderFacade; - @Operation(summary = "결제 페이지 불러오기", description = "제품 상세 페이지에서 받은 정보를 바탕으로 결제 시트 정보 불러오기") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "조회에 성공했습니다.", - content = @Content(schema = @Schema(implementation = ReadOrderSheetRes.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 스티커입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @GetMapping("/ordersheet") - public ResponseEntity getOrderSheet( - @Parameter(hidden = true) @UserId Integer userId, - @Parameter(description = "타투 스티커 id") @RequestParam @NotNull(message = "stickerId is null") Integer stickerId, - @Parameter(description = "상품 개수", example = "3") @RequestParam @NotNull(message = "count is null") Integer count, - @Parameter(description = "배송비", example = "3000") @RequestParam @NotNull(message = "shippingFee is null") Integer shippingFee - ) { - return BaseResponse.success(SuccessType.GET_SUCCESS, - orderFacade.readOrderSheet( - ReadOrderSheetReq.of( - userId, - stickerId, - count, - shippingFee))); - } + @Operation(summary = "결제 페이지 불러오기", description = "제품 상세 페이지에서 받은 정보를 바탕으로 결제 시트 정보 불러오기\n" + + "stickerId, count 매개변수가 없으면 장바구니에서 불러오는 결제 페이지 제공") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "조회에 성공했습니다.", + content = @Content(schema = @Schema(implementation = ReadOrderSheetRes.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 스티커입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @GetMapping("/ordersheet") + public ResponseEntity getOrderSheet( + @Parameter(hidden = true) @UserId Integer userId, + @Parameter(description = "타투 스티커 id") @RequestParam @NotNull(message = "stickerId is null") Integer stickerId, + @Parameter(description = "상품 개수", example = "3") @RequestParam @NotNull(message = "count is null") Integer count + ) { + return BaseResponse.success( + SuccessType.GET_SUCCESS, orderFacade.readOrderSheet(ReadOrderSheetReq.of(userId, stickerId, count))); + } - @Operation(summary = "결제하기", description = "결제 시트 페이지에서 결제하기") - @ApiResponses(value = { - @ApiResponse( - responseCode = "201", - description = "주문에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "403", - description = "포인트가 부족하여 결제할 수 없습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 스티커입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @PostMapping - public ResponseEntity order( - @Parameter(hidden = true) @UserId Integer userId, - @RequestBody @Valid PostOrderReq req - ) { - orderFacade.createOrder(CreateOrderRequest.of( - userId, - req.getStickerId(), - req.getProductCount(), - req.getShippingFee(), - req.getTotalAmount(), - req.getRecipientName(), - req.getContact(), - req.getMailingAddress(), - req.getBaseAddress(), - req.getDetailAddress())); + @Operation(summary = "결제하기", description = "결제 시트 페이지에서 결제하기") + @ApiResponses(value = { + @ApiResponse( + responseCode = "201", + description = "주문에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "403", + description = "포인트가 부족하여 결제할 수 없습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 스티커입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @PostMapping + public ResponseEntity order( + @Parameter(hidden = true) @UserId Integer userId, + @RequestBody @Valid PostOrderReq req + ) { + orderFacade.createOrder(CreateOrderRequest.of( + userId, + req.getStickerId(), + req.getProductCount(), + req.getShippingFee(), + req.getTotalAmount(), + req.getRecipientName(), + req.getContact(), + req.getMailingAddress(), + req.getBaseAddress(), + req.getDetailAddress())); - return BaseResponse.success(SuccessType.CREATE_ORDER_SUCCESS); - } + return BaseResponse.success(SuccessType.CREATE_ORDER_SUCCESS); + } - // TODO : pageable로 리팩토링하기 - @Operation(summary = "유저 결제 내역 불러오기", description = "유저 id로 결제 내역 불러오기") - @ApiResponses(value = { - @ApiResponse( - responseCode = "200", - description = "조회에 성공했습니다.", - content = @Content(schema = @Schema(implementation = ReadUserOrderHistoryListRes.class))), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 유저입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "404", - description = "존재하지 않는 스티커입니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "500", - description = "알 수 없는 서버 에러가 발생했습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))) - }) - @GetMapping("/history") - public ResponseEntity getUserOrderList( - @Parameter(hidden = true) @UserId Integer userId - ) { - return BaseResponse.success(SuccessType.GET_SUCCESS, - orderFacade.readOrderHistoryByUserId(userId)); - } + // TODO : pageable로 리팩토링하기 + @Operation(summary = "유저 결제 내역 불러오기", description = "유저 id로 결제 내역 불러오기") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "조회에 성공했습니다.", + content = @Content(schema = @Schema(implementation = ReadUserOrderHistoryListRes.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 유저입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 스티커입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @GetMapping("/history") + public ResponseEntity getUserOrderList( + @Parameter(hidden = true) @UserId Integer userId + ) { + return BaseResponse.success(SuccessType.GET_SUCCESS, + orderFacade.readOrderHistoryByUserId(userId)); + } } diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/OrderSheetStickerRes.java b/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/OrderSheetStickerRes.java new file mode 100644 index 00000000..09b5bac0 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/OrderSheetStickerRes.java @@ -0,0 +1,43 @@ +package org.tattour.server.domain.order.controller.dto.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +// Todo: 리펙토링 필요 +@Schema(description = "타투 스티커 정보") +@Getter +@Setter +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class OrderSheetStickerRes { + + @Schema(description = "메인 배너 이미지", example = "https://tattoo170829.wisacdn.com/data/file/tattoo_posting/833046566_5d1d5fc1db100.jpg") + private String mainImageUrl; + + @Schema(description = "타투 스티커 이름", example = "포효하는 호랑이") + private String name; + + @Schema(description = "가격", example = "3500") + private Integer price; + + @Schema(description = "할인된 가격", example = "3150") + private Integer discountPrice; + + @Schema(description = "상품 개수", example = "3") + private Integer count; + + public static OrderSheetStickerRes of( + String mainImageUrl, + String name, + int price, + Integer discountPrice, + int count) { + return new OrderSheetStickerRes(mainImageUrl, name, price, discountPrice, count); + } + + public void setCount(int count) { + this.count = count; + } +} diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/ReadOrderSheetRes.java b/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/ReadOrderSheetRes.java index c79ffc89..f32dec4c 100644 --- a/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/ReadOrderSheetRes.java +++ b/server/src/main/java/org/tattour/server/domain/order/controller/dto/response/ReadOrderSheetRes.java @@ -1,25 +1,25 @@ package org.tattour.server.domain.order.controller.dto.response; import io.swagger.v3.oas.annotations.media.Schema; +import java.util.List; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.order.provider.vo.OrderAmountInfo; -import org.tattour.server.domain.sticker.provider.vo.ReadOrderSheetStickerInfo; -import org.tattour.server.domain.user.provider.vo.UserProfileInfo; +import org.tattour.server.domain.order.provider.vo.OrderAmountDetailRes; +import org.tattour.server.domain.user.provider.vo.UserProfileRes; @Schema(description = "결제 페이지 불러오기") @Getter @AllArgsConstructor(access = AccessLevel.PRIVATE) public class ReadOrderSheetRes { - private UserProfileInfo userProfileInfo; - private ReadOrderSheetStickerInfo readOrderSheetStickerInfo; - private OrderAmountInfo orderAmountInfo; + private UserProfileRes userProfileRes; + private List orderSheetStickersRes; + private OrderAmountDetailRes orderAmountDetailRes; public static ReadOrderSheetRes of( - UserProfileInfo userProfileInfo, - ReadOrderSheetStickerInfo readOrderSheetStickerInfo, - OrderAmountInfo orderAmountInfo) { - return new ReadOrderSheetRes(userProfileInfo, readOrderSheetStickerInfo, orderAmountInfo); + UserProfileRes userProfileRes, + List orderSheetStickersRes, + OrderAmountDetailRes orderAmountDetailRes) { + return new ReadOrderSheetRes(userProfileRes, orderSheetStickersRes, orderAmountDetailRes); } } diff --git a/server/src/main/java/org/tattour/server/domain/order/domain/Order.java b/server/src/main/java/org/tattour/server/domain/order/domain/Order.java index 849a6026..67d1bd92 100644 --- a/server/src/main/java/org/tattour/server/domain/order/domain/Order.java +++ b/server/src/main/java/org/tattour/server/domain/order/domain/Order.java @@ -62,9 +62,9 @@ public class Order { private Sticker sticker; public Order(String productName, String productSize, String productImageUrl, Integer productAmount, - Integer productCount, Integer shippingFee, Integer totalAmount, String recipientName, - String contact, String mailingAddress, String baseAddress, String detailAddress, - User user, Sticker sticker) { + Integer productCount, Integer shippingFee, Integer totalAmount, String recipientName, + String contact, String mailingAddress, String baseAddress, String detailAddress, + User user, Sticker sticker) { this.productName = productName; this.productSize = productSize; this.productImageUrl = productImageUrl; @@ -82,15 +82,15 @@ public Order(String productName, String productSize, String productImageUrl, Int } public static Order of(String productName, String productSize, String productImageUrl, Integer productAmount, - Integer productCount, Integer shippingFee, Integer totalAmount, String recipientName, - String contact, String mailingAddress, String baseAddress, String detailAddress, - User user, Sticker sticker){ + Integer productCount, Integer shippingFee, Integer totalAmount, String recipientName, + String contact, String mailingAddress, String baseAddress, String detailAddress, + User user, Sticker sticker) { return new Order(productName, productSize, productImageUrl, productCount, productAmount, shippingFee, totalAmount, recipientName, contact, mailingAddress, baseAddress, detailAddress, user, sticker); } - public void setOrderStatus(OrderStatus orderStatus){ + public void setOrderStatus(OrderStatus orderStatus) { this.orderStatus = orderStatus; } } diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java index fde562e2..f49bd792 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java @@ -11,16 +11,18 @@ public class ReadOrderSheetReq { @NotNull(message = "userId is null") private Integer userId; + @NotNull(message = "stickerId is null") private Integer stickerId; @NotNull(message = "count is null") private Integer count; - @NotNull(message = "shippingFee is null") - private Integer shippingFee; + public static ReadOrderSheetReq of(Integer userId, Integer stickerId, Integer count) { + return new ReadOrderSheetReq(userId, stickerId, count); + } - public static ReadOrderSheetReq of(Integer userId, Integer stickerId, Integer count, Integer shippingFee) { - return new ReadOrderSheetReq(userId, stickerId, count, shippingFee); + public boolean isCartOrder() { + return stickerId != null && count != null; } } diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java index f7251d00..f294c9a2 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java @@ -1,10 +1,13 @@ package org.tattour.server.domain.order.facade.impl; -import java.util.Objects; +import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.tattour.server.domain.cart.domain.Cart; +import org.tattour.server.domain.cart.service.CartService; +import org.tattour.server.domain.order.controller.dto.response.OrderSheetStickerRes; import org.tattour.server.domain.order.controller.dto.response.ReadOrderSheetRes; import org.tattour.server.domain.order.domain.Order; import org.tattour.server.domain.order.domain.OrderStatus; @@ -15,15 +18,15 @@ import org.tattour.server.domain.order.facade.dto.response.ReadOrderHistoryListRes; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.provider.impl.OrderProviderImpl; -import org.tattour.server.domain.order.provider.vo.OrderAmountInfo; +import org.tattour.server.domain.order.provider.vo.OrderAmountDetailRes; import org.tattour.server.domain.order.provider.vo.OrderHistoryPageInfo; import org.tattour.server.domain.order.service.impl.OrderServiceImpl; import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.provider.impl.StickerProviderImpl; -import org.tattour.server.domain.sticker.provider.vo.ReadOrderSheetStickerInfo; +import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.provider.impl.UserProviderImpl; -import org.tattour.server.domain.user.provider.vo.UserProfileInfo; +import org.tattour.server.domain.user.provider.vo.UserProfileRes; import org.tattour.server.global.exception.BusinessException; import org.tattour.server.global.exception.ErrorType; import org.tattour.server.global.util.EntityDtoMapper; @@ -32,37 +35,41 @@ @Service @RequiredArgsConstructor public class OrderFacadeImpl implements OrderFacade { + public final static int SHIPPING_FEE = 3000; private final OrderProviderImpl orderProvider; private final OrderServiceImpl orderService; + private final CartService cartService; private final StickerProviderImpl stickerProvider; private final UserProviderImpl userProvider; private final DiscordMessageService discordMessageService; + //todo : 나중에 배달 지역별로 배송비 책정하기 @Override @Transactional public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { User user = userProvider.readUserById(req.getUserId()); - Sticker sticker = stickerProvider.getById(req.getStickerId()); + StickerOrderInfo stickerOrderInfo = getStickerOrderInfo(req); - // 유저 프로필 정보 - UserProfileInfo userProfileInfo = userProvider.readUserProfileInfo(user); + UserProfileRes userProfileRes = + EntityDtoMapper.INSTANCE.toUserProfileInfo(user); - // 스티커 정보(배너이미지, 이름, 원래가격, 할인가격) + 개수 - ReadOrderSheetStickerInfo readOrderSheetStickerInfo = stickerProvider.readOrderSheetStickerInfo(sticker); - readOrderSheetStickerInfo.setCount(req.getCount()); + List orderSheetStickersRes = + EntityDtoMapper.INSTANCE.toOrderSheetStickerRes(stickerOrderInfo); - // 결제 금액 정보 - // 총 결제 금액, 총 상품 금액, 배송비 - OrderAmountInfo orderAmountInfo = - orderProvider.readOrderAmountRes( - Objects.isNull(sticker.getDiscountPrice()) - ? sticker.getPrice() - : sticker.getDiscountPrice(), - req.getCount(), - req.getShippingFee()); + OrderAmountDetailRes orderAmountDetailRes = + EntityDtoMapper.INSTANCE.toOrderAmountRes(stickerOrderInfo, SHIPPING_FEE); - return ReadOrderSheetRes.of(userProfileInfo, readOrderSheetStickerInfo, orderAmountInfo); + return ReadOrderSheetRes.of(userProfileRes, orderSheetStickersRes, orderAmountDetailRes); + } + + private StickerOrderInfo getStickerOrderInfo(ReadOrderSheetReq req) { + if (req.isCartOrder()) { + List carts = cartService.findByUserId(req.getUserId()); + return stickerProvider.getStickerOrderInfoFromCart(carts); + } else { + return stickerProvider.getStickerOrderInfoFromOrder(req.getStickerId(), req.getCount()); + } } @Override @@ -70,7 +77,7 @@ public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { public void createOrder(CreateOrderRequest req) { User user = userProvider.readUserById(req.getUserId()); Sticker sticker = stickerProvider.getById(req.getStickerId()); - + Order order = orderService.saveOrder( Order.of( sticker.getName(), diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java b/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java index 3cea6e3a..95e0720c 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java @@ -3,7 +3,6 @@ import java.util.List; import org.springframework.data.domain.Page; import org.tattour.server.domain.order.domain.Order; -import org.tattour.server.domain.order.provider.vo.OrderAmountInfo; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; @@ -20,13 +19,4 @@ public interface OrderProvider { // 기준날짜로 결제 내역 불러오기 List readOrderHistoryAfterDate(int userId, String date); - - // 결제 금액정보 가져오기 - OrderAmountInfo readOrderAmountRes(int price, int count, int shippingFee); - - // 상품 금액 계산 - int calculateProductAmount(int price, int count); - - // 총 결제금액 계산 - int calculateTotalAmount(int productAmount, int shippingFee); } diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java b/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java index e5230d7b..2a484289 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java @@ -7,10 +7,9 @@ import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.tattour.server.domain.order.domain.Order; -import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; -import org.tattour.server.domain.order.provider.vo.OrderAmountInfo; -import org.tattour.server.domain.order.provider.OrderProvider; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; +import org.tattour.server.domain.order.provider.OrderProvider; +import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; import org.tattour.server.domain.order.repository.impl.OrderRepositoryImpl; import org.tattour.server.global.exception.BusinessException; import org.tattour.server.global.exception.ErrorType; @@ -49,27 +48,9 @@ public ReadUserOrderHistoryListRes readOrderHistoryByUserId(int userId) { @Override public List readOrderHistoryAfterDate(int userId, String date) { return EntityDtoMapper.INSTANCE - .toGetUserOrderHistoryListRes( - orderRepository.findAllByUser_IdAndCreatedAtAfter( - userId, - date)); - } - - @Override - public OrderAmountInfo readOrderAmountRes(int price, int count, int shippingFee) { - int productAmount = calculateProductAmount(price, count); - int totalAmount = calculateTotalAmount(productAmount, shippingFee); - - return OrderAmountInfo.of(totalAmount, productAmount, shippingFee); - } - - @Override - public int calculateProductAmount(int price, int count) { - return price * count; - } - - @Override - public int calculateTotalAmount(int productAmount, int shippingFee) { - return productAmount + shippingFee; + .toGetUserOrderHistoryListRes( + orderRepository.findAllByUser_IdAndCreatedAtAfter( + userId, + date)); } } diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountInfo.java b/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountDetailRes.java similarity index 70% rename from server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountInfo.java rename to server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountDetailRes.java index 0617802f..8a3a97bb 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountInfo.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderAmountDetailRes.java @@ -7,7 +7,7 @@ @Schema(description = "결제 금액 정보") @Getter @AllArgsConstructor -public class OrderAmountInfo { +public class OrderAmountDetailRes { @Schema(description = "총 결제금액", example = "12000") private Integer totalAmount; @@ -18,7 +18,7 @@ public class OrderAmountInfo { @Schema(description = "배송비", example = "3000") private Integer shippingFee; - public static OrderAmountInfo of(Integer totalAmount, Integer productAmount, Integer shippingFee) { - return new OrderAmountInfo(totalAmount, productAmount, shippingFee); + public static OrderAmountDetailRes of(Integer totalAmount, Integer productAmount, Integer shippingFee) { + return new OrderAmountDetailRes(totalAmount, productAmount, shippingFee); } } diff --git a/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java b/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java index 882d71f3..6e542edc 100644 --- a/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java +++ b/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java @@ -1,9 +1,6 @@ package org.tattour.server.domain.order.service; import org.tattour.server.domain.order.domain.Order; -import org.tattour.server.domain.order.domain.OrderStatus; -import org.tattour.server.domain.order.facade.dto.request.CreateOrderRequest; -import org.tattour.server.domain.order.facade.dto.request.UpdateOrderStatusReq; public interface OrderService { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java index e7431ad4..07b0d20b 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java @@ -2,13 +2,14 @@ import java.util.List; import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.sticker.provider.vo.ReadOrderSheetStickerInfo; +import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; public interface StickerProvider { - // 스티커 엔티티 가져오기 Sticker getById(Integer id); + StickerOrderInfo getStickerOrderInfoFromOrder(int stickerId, int count); + List getAllCustomStickerOrderByOrder(); List getAllByThemeAndStyleOrderByOrder(String theme, String style); @@ -21,6 +22,4 @@ public interface StickerProvider { List getAllByThemeOrStyleOrNameLike(String word); - // 결제 시트에서 스티커 정보 가져오기 - ReadOrderSheetStickerInfo readOrderSheetStickerInfo(Sticker sticker); } diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java index 1cf3cf57..938fddbc 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java @@ -1,6 +1,7 @@ package org.tattour.server.domain.sticker.provider.impl; import java.util.List; +import java.util.Map; import java.util.Objects; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -8,7 +9,7 @@ import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.exception.NotFoundStickerException; import org.tattour.server.domain.sticker.provider.StickerProvider; -import org.tattour.server.domain.sticker.provider.vo.ReadOrderSheetStickerInfo; +import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; import org.tattour.server.domain.sticker.repository.StickerRepository; @Slf4j @@ -24,6 +25,11 @@ public Sticker getById(Integer id) { .orElseThrow(NotFoundStickerException::new); } + @Override + public StickerOrderInfo getStickerOrderInfoFromOrder(int stickerId, int count) { + return StickerOrderInfo.of(Map.of(getById(stickerId), count)); + } + @Override public List getAllCustomStickerOrderByOrder() { return stickerRepository @@ -62,21 +68,4 @@ public List getAllByThemeOrStyleOrNameLike(String word) { return stickerRepository .findAllByThemeNameOrStyleNameOrNameContaining(word); } - - @Override - public ReadOrderSheetStickerInfo readOrderSheetStickerInfo(Sticker sticker) { - Integer discountedPrice = getDiscountPrice(sticker); - return ReadOrderSheetStickerInfo.of( - sticker.getMainImageUrl(), - sticker.getName(), - sticker.getPrice(), - discountedPrice); - } - - private static Integer getDiscountPrice(Sticker sticker) { - if (Objects.isNull(sticker.getDiscount())) { - return null; - } - return (sticker.getPrice() * (100 - sticker.getDiscount().getDiscountRate())) / 100; - } } diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/ReadOrderSheetStickerInfo.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/ReadOrderSheetStickerInfo.java deleted file mode 100644 index d8c5bb02..00000000 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/ReadOrderSheetStickerInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.tattour.server.domain.sticker.provider.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; -import org.tattour.server.domain.sticker.domain.Sticker; - -// Todo: 리펙토링 필요 -@Schema(description = "타투 스티커 정보") -@Getter -@Setter -public class ReadOrderSheetStickerInfo { - - @Schema(description = "메인 배너 이미지", example = "https://tattoo170829.wisacdn.com/data/file/tattoo_posting/833046566_5d1d5fc1db100.jpg") - private String mainImageUrl; - - @Schema(description = "타투 스티커 이름", example = "포효하는 호랑이") - private String name; - - @Schema(description = "가격", example = "3500") - private Integer price; - - @Schema(description = "할인된 가격", example = "3150") - private Integer discountedPrice; - - @Schema(description = "상품 개수", example = "3") - private Integer count; - - private ReadOrderSheetStickerInfo(String mainImageUrl, String name, Integer price, - Integer discountedPrice) { - this.mainImageUrl = mainImageUrl; - this.name = name; - this.price = price; - this.discountedPrice = discountedPrice; - } - - public static ReadOrderSheetStickerInfo of( - String mainImageUrl, - String name, - Integer price, - Integer discountedPrice) { - return new ReadOrderSheetStickerInfo(mainImageUrl, name, price, discountedPrice); - } - - public static ReadOrderSheetStickerInfo from(Sticker sticker) { - return new ReadOrderSheetStickerInfo( - sticker.getMainImageUrl(), - sticker.getName(), - sticker.getPrice(), - sticker.getDiscountPrice()); - } - - public void setCount(int count) { - this.count = count; - } -} diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/StickerOrderInfo.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/StickerOrderInfo.java new file mode 100644 index 00000000..30c1d85e --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/StickerOrderInfo.java @@ -0,0 +1,17 @@ +package org.tattour.server.domain.sticker.provider.vo; + +import java.util.Map; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.tattour.server.domain.sticker.domain.Sticker; + +@Getter +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class StickerOrderInfo { + private Map stickerOrderInfos; + + public static StickerOrderInfo of(Map stickerOrderInfo) { + return new StickerOrderInfo(stickerOrderInfo); + } +} diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java b/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java index a355edc5..c213c77d 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java @@ -2,7 +2,6 @@ import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; -import org.tattour.server.domain.user.provider.vo.UserProfileInfo; public interface UserProvider { @@ -14,9 +13,6 @@ public interface UserProvider { // 홈 유저 정보 가져오기 HomeUserInfo readHomeUserInfo(User user); - // 유저 프로필 정보 가져오기 - UserProfileInfo readUserProfileInfo(User user); - // 이메일로 유저 중복 확인 boolean checkDuplicationByKakaoId(Long kakaoId); } diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java b/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java index 1991005c..956648e3 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java @@ -6,7 +6,6 @@ import org.tattour.server.domain.user.exception.NotFoundUserException; import org.tattour.server.domain.user.provider.UserProvider; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; -import org.tattour.server.domain.user.provider.vo.UserProfileInfo; import org.tattour.server.domain.user.repository.impl.UserRepositoryImpl; import org.tattour.server.global.util.EntityDtoMapper; @@ -33,11 +32,6 @@ public HomeUserInfo readHomeUserInfo(User user) { return EntityDtoMapper.INSTANCE.toHomeUserInfo(user); } - @Override - public UserProfileInfo readUserProfileInfo(User user) { - return EntityDtoMapper.INSTANCE.toUserProfileInfo(user); - } - @Override public boolean checkDuplicationByKakaoId(Long kakaoId) { return userRepository.findBySocialId(kakaoId).isPresent(); diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileInfo.java b/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileRes.java similarity index 93% rename from server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileInfo.java rename to server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileRes.java index 89eba478..59d5feda 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileInfo.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/vo/UserProfileRes.java @@ -7,7 +7,7 @@ @Schema(name = "유저 프로필 정보") @Builder @Getter -public class UserProfileInfo { +public class UserProfileRes { @Schema(description = "user Id") private int id; From 94760b21af51b9308708e75191a0de2c8630f0c6 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 3 Dec 2023 00:12:46 +0900 Subject: [PATCH 08/32] =?UTF-8?q?[FEAT]=20=EC=9C=A0=EC=A0=80=20=EC=9E=A5?= =?UTF-8?q?=EB=B0=94=EA=B5=AC=EB=8B=88=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API=20-=20=EA=B2=B0=EC=A0=9C=20=EA=B8=88=EC=95=A1?= =?UTF-8?q?=20=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/dto/response/CartItemsRes.java | 7 ++- .../cart/facade/impl/CartFacadeImpl.java | 13 ++++-- .../cart/repository/CartRepository.java | 4 +- .../domain/cart/service/CartService.java | 9 ++-- .../cart/service/impl/CartServiceImpl.java | 25 +++++------ .../sticker/provider/StickerProvider.java | 3 ++ .../provider/impl/StickerProviderImpl.java | 12 +++++ .../server/global/util/EntityDtoMapper.java | 44 +++++++++++++++++-- 8 files changed, 87 insertions(+), 30 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemsRes.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemsRes.java index 14dd316c..ba1471b3 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemsRes.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemsRes.java @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; +import org.tattour.server.domain.order.provider.vo.OrderAmountDetailRes; @Getter @Setter @@ -11,7 +12,9 @@ public class CartItemsRes { private List cartItemsRes; - public static CartItemsRes of(List cartItemsRes) { - return new CartItemsRes(cartItemsRes); + private OrderAmountDetailRes orderAmountDetailRes; + + public static CartItemsRes of(List cartItemsRes, OrderAmountDetailRes orderAmountDetailRes) { + return new CartItemsRes(cartItemsRes, orderAmountDetailRes); } } diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java index 343af89f..96fb8f10 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java @@ -1,14 +1,19 @@ package org.tattour.server.domain.cart.facade.impl; +import static org.tattour.server.domain.order.facade.impl.OrderFacadeImpl.SHIPPING_FEE; + +import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; import org.tattour.server.domain.cart.controller.dto.response.CartItemsRes; +import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.cart.facade.CartFacade; import org.tattour.server.domain.cart.service.CartService; import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.provider.StickerProvider; +import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.service.UserService; import org.tattour.server.global.util.EntityDtoMapper; @@ -29,12 +34,14 @@ public void saveCartItem(int userId, SaveCartReq req) { cartService.mergeOrAddToCart(user, sticker, req.getCount()); } + //todo : 배송 지역별 배송비 책정 @Override public CartItemsRes getUserCartItems(int userId) { - User user = userService.readUserById(userId); + List carts = cartService.findByUserId(userId); + StickerOrderInfo stickerOrderInfo = stickerProvider.getStickerOrderInfoFromCart(carts); return CartItemsRes.of( - EntityDtoMapper.INSTANCE - .toCartItemsRes(cartService.findByUser(user))); + EntityDtoMapper.INSTANCE.toCartItemsRes(carts), + EntityDtoMapper.INSTANCE.toOrderAmountRes(stickerOrderInfo, SHIPPING_FEE)); } } diff --git a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java index 35ea2771..33f23069 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java +++ b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java @@ -10,7 +10,7 @@ @Repository public interface CartRepository extends JpaRepository { - Optional findCartByUserAndSticker(User user, Sticker sticker); + List findByUser_Id(int userId); - List findByUser(User user); + Optional findCartByUserAndSticker(User user, Sticker sticker); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java index 0903082e..bf6f00ed 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java @@ -7,13 +7,12 @@ import org.tattour.server.domain.user.domain.User; public interface CartService { + List findByUserId(int userId); + + Optional findByUserAndSticker(User user, Sticker sticker); + void mergeOrAddToCart(User user, Sticker sticker, int count); Cart createNewCart(User user, Sticker sticker, int count); - void save(Cart cart); - - Optional findByUserAndSticker(User user, Sticker sticker); - - List findByUser(User user); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java index 0f45e692..b00b8c16 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java @@ -16,14 +16,8 @@ public class CartServiceImpl implements CartService { private final CartRepository cartRepository; @Override - public void mergeOrAddToCart(User user, Sticker sticker, int count) { - Cart cart = findByUserAndSticker(user, sticker) - .map(cartExisting -> { - cartExisting.addCount(count); - return cartExisting; - }) - .orElseGet(() -> createNewCart(user, sticker, count)); - save(cart); + public List findByUserId(int userId) { + return cartRepository.findByUser_Id(userId); } @Override @@ -32,8 +26,14 @@ public Optional findByUserAndSticker(User user, Sticker sticker) { } @Override - public List findByUser(User user) { - return cartRepository.findByUser(user); + public void mergeOrAddToCart(User user, Sticker sticker, int count) { + Cart cart = findByUserAndSticker(user, sticker) + .map(cartExisting -> { + cartExisting.addCount(count); + return cartExisting; + }) + .orElseGet(() -> createNewCart(user, sticker, count)); + cartRepository.save(cart); } @Override @@ -44,9 +44,4 @@ public Cart createNewCart(User user, Sticker sticker, int count) { .sticker(sticker) .build(); } - - @Override - public void save(Cart cart) { - cartRepository.save(cart); - } } diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java index 07b0d20b..57c16d79 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java @@ -1,6 +1,7 @@ package org.tattour.server.domain.sticker.provider; import java.util.List; +import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; @@ -10,6 +11,8 @@ public interface StickerProvider { StickerOrderInfo getStickerOrderInfoFromOrder(int stickerId, int count); + StickerOrderInfo getStickerOrderInfoFromCart(List carts); + List getAllCustomStickerOrderByOrder(); List getAllByThemeAndStyleOrderByOrder(String theme, String style); diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java index 938fddbc..9a371afc 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java @@ -3,9 +3,11 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.exception.NotFoundStickerException; import org.tattour.server.domain.sticker.provider.StickerProvider; @@ -30,6 +32,16 @@ public StickerOrderInfo getStickerOrderInfoFromOrder(int stickerId, int count) { return StickerOrderInfo.of(Map.of(getById(stickerId), count)); } + @Override + public StickerOrderInfo getStickerOrderInfoFromCart(List carts) { + return carts.stream() + .collect(Collectors.collectingAndThen( + Collectors.toMap( + Cart::getSticker, + Cart::getCount), + StickerOrderInfo::of)); + } + @Override public List getAllCustomStickerOrderByOrder() { return stickerRepository diff --git a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java index 49970ec9..55e2c8ab 100644 --- a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java +++ b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java @@ -1,6 +1,8 @@ package org.tattour.server.global.util; import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; import org.mapstruct.IterableMapping; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; @@ -10,14 +12,18 @@ import org.tattour.server.domain.custom.domain.Custom; import org.tattour.server.domain.custom.facade.dto.response.CreateCustomSummaryRes; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryRes; +import org.tattour.server.domain.order.controller.dto.response.OrderSheetStickerRes; import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.provider.vo.OrderAmountDetailRes; import org.tattour.server.domain.order.provider.vo.OrderHistoryInfo; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; +import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.provider.vo.StickerLikedInfo; +import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; import org.tattour.server.domain.user.domain.ProductLiked; import org.tattour.server.domain.user.domain.User; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; -import org.tattour.server.domain.user.provider.vo.UserProfileInfo; +import org.tattour.server.domain.user.provider.vo.UserProfileRes; @org.mapstruct.Mapper(componentModel = "spring") public interface EntityDtoMapper { @@ -28,7 +34,7 @@ public interface EntityDtoMapper { HomeUserInfo toHomeUserInfo(User user); @Mapping(target = "id", source = "user.id") - UserProfileInfo toUserProfileInfo(User user); + UserProfileRes toUserProfileInfo(User user); // StickerLikedInfo @Mapping(target = "stickerId", source = "productLiked.sticker.id") @@ -61,6 +67,39 @@ public interface EntityDtoMapper { @IterableMapping(elementTargetType = OrderHistoryInfo.class) List toOrderHistoryInfoPage(Page orderPage); + default List toOrderSheetStickerRes(StickerOrderInfo stickerOrderInfo) { + return stickerOrderInfo.getStickerOrderInfos() + .entrySet() + .stream() + .map(entry -> OrderSheetStickerRes.of( + entry.getKey().getMainImageUrl(), + entry.getKey().getName(), + entry.getKey().getPrice(), + entry.getKey().getDiscountPrice(), + entry.getValue())) + .collect(Collectors.toList()); + } + + default OrderAmountDetailRes toOrderAmountRes(StickerOrderInfo stickerOrderInfo, int shippingFee) { + int productAmount = stickerOrderInfo.getStickerOrderInfos() + .entrySet() + .stream() + .mapToInt(entry -> calculateProductAmount(entry.getKey(), entry.getValue())) + .sum(); + int totalAmount = calculateTotalAmount(productAmount, shippingFee); + + return OrderAmountDetailRes.of(totalAmount, productAmount, shippingFee); + } + + private int calculateProductAmount(Sticker sticker, int count) { + int price = Objects.isNull(sticker.getDiscountPrice()) ? sticker.getPrice() : sticker.getDiscountPrice(); + return price * count; + } + + private int calculateTotalAmount(int productAmount, int shippingFee) { + return productAmount + shippingFee; + } + // Custom CreateCustomSummaryRes toCustomApplySummaryInfo(Custom custom); @@ -82,5 +121,4 @@ public interface EntityDtoMapper { CartItemRes toCartItemRes(Cart cart); List toCartItemsRes(List carts); - } From e924843f708a691389f62665a445a8d7ddb7fba5 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 3 Dec 2023 00:16:01 +0900 Subject: [PATCH 09/32] =?UTF-8?q?[FEAT]=20=EC=9E=A5=EB=B0=94=EA=B5=AC?= =?UTF-8?q?=EB=8B=88=20=EC=88=98=EB=9F=89=201=EA=B0=9C=20=EB=8D=94?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cart/controller/CartController.java | 32 ++++++++++++++++++- .../controller/dto/request/SaveCartReq.java | 8 ++++- .../server/domain/cart/domain/Cart.java | 6 ++++ .../server/domain/cart/facade/CartFacade.java | 2 ++ .../cart/facade/impl/CartFacadeImpl.java | 8 ++++- .../cart/repository/CartRepository.java | 4 ++- .../domain/cart/service/CartService.java | 7 ++-- .../cart/service/impl/CartServiceImpl.java | 18 ++++++++++- .../server/global/exception/ErrorType.java | 1 + 9 files changed, 79 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java index 3774dec1..dfd1d3d2 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java @@ -8,10 +8,13 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; +import javax.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -59,7 +62,7 @@ public class CartController { @PostMapping("/items") public ResponseEntity saveCartItem( @Parameter(hidden = true) @UserId Integer userId, - @RequestBody SaveCartReq saveCartReq + @RequestBody @Valid SaveCartReq saveCartReq ) { cartFacade.saveCartItem(userId, saveCartReq); return BaseResponse.success(SuccessType.CREATE_SUCCESS); @@ -86,6 +89,33 @@ public ResponseEntity getUserCartItem( ) { return BaseResponse.success(SuccessType.GET_SUCCESS, cartFacade.getUserCartItems(userId)); } + + @Operation(summary = "장바구니 수량 1개 더하기") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "갱신에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 장바구니입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @PatchMapping("/items/{cartId}") + public ResponseEntity addCartCount( + @Parameter(hidden = true) @UserId Integer userId, + @PathVariable Integer cartId) { + cartFacade.increaseCartCount(userId, cartId); + return BaseResponse.success(SuccessType.UPDATE_SUCCESS); + } } diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java index af1e8924..4b6e1302 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java @@ -1,11 +1,17 @@ package org.tattour.server.domain.cart.controller.dto.request; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; import lombok.Getter; import lombok.NoArgsConstructor; @Getter @NoArgsConstructor public class SaveCartReq { - private int count; + @NotNull private int stickerId; + + @NotNull + @Min(1) + private int count; } diff --git a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java b/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java index 19d7c942..489684c7 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java +++ b/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java @@ -21,6 +21,8 @@ @NoArgsConstructor @AllArgsConstructor(access = AccessLevel.PROTECTED) public class Cart { + private final static int COUNT_INCREMENT = 1; + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @@ -37,4 +39,8 @@ public class Cart { public void addCount(int count) { this.count += count; } + + public void increaseCount() { + this.count += COUNT_INCREMENT; + } } diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java index d379e04e..5bb5f392 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java @@ -7,4 +7,6 @@ public interface CartFacade { void saveCartItem(int userId, SaveCartReq req); CartItemsRes getUserCartItems(int userId); + + void increaseCartCount(int userId, int cartId); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java index 96fb8f10..983ed0f1 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java @@ -44,4 +44,10 @@ public CartItemsRes getUserCartItems(int userId) { EntityDtoMapper.INSTANCE.toCartItemsRes(carts), EntityDtoMapper.INSTANCE.toOrderAmountRes(stickerOrderInfo, SHIPPING_FEE)); } -} + + @Override + public void increaseCartCount(int userId, int cartId) { + Cart cart = cartService.findByIdAndUserId(userId, cartId); + cartService.increaseCartCount(cart); + } +} \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java index 33f23069..a9a474d0 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java +++ b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java @@ -12,5 +12,7 @@ public interface CartRepository extends JpaRepository { List findByUser_Id(int userId); + Optional findByIdAndUser_Id(int id, int userId); + Optional findCartByUserAndSticker(User user, Sticker sticker); -} +} \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java index bf6f00ed..66950b90 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java @@ -10,9 +10,12 @@ public interface CartService { List findByUserId(int userId); Optional findByUserAndSticker(User user, Sticker sticker); - + + Cart findByIdAndUserId(int userId, int cartId); + void mergeOrAddToCart(User user, Sticker sticker, int count); Cart createNewCart(User user, Sticker sticker, int count); -} + void increaseCartCount(Cart cart); +} \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java index b00b8c16..e60a9fd1 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java @@ -4,11 +4,14 @@ import java.util.Optional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.cart.repository.CartRepository; import org.tattour.server.domain.cart.service.CartService; import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.user.domain.User; +import org.tattour.server.global.exception.BusinessException; +import org.tattour.server.global.exception.ErrorType; @Service @RequiredArgsConstructor @@ -25,6 +28,12 @@ public Optional findByUserAndSticker(User user, Sticker sticker) { return cartRepository.findCartByUserAndSticker(user, sticker); } + @Override + public Cart findByIdAndUserId(int userId, int id) { + return cartRepository.findByIdAndUser_Id(id, userId) + .orElseThrow(() -> new BusinessException(ErrorType.NOT_FOUND_CART_EXCEPTION)); + } + @Override public void mergeOrAddToCart(User user, Sticker sticker, int count) { Cart cart = findByUserAndSticker(user, sticker) @@ -44,4 +53,11 @@ public Cart createNewCart(User user, Sticker sticker, int count) { .sticker(sticker) .build(); } -} + + @Override + @Transactional + public void increaseCartCount(Cart cart) { + cart.increaseCount(); + cartRepository.save(cart); + } +} \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/global/exception/ErrorType.java b/server/src/main/java/org/tattour/server/global/exception/ErrorType.java index c3627d56..ecf0b6a0 100644 --- a/server/src/main/java/org/tattour/server/global/exception/ErrorType.java +++ b/server/src/main/java/org/tattour/server/global/exception/ErrorType.java @@ -47,6 +47,7 @@ public enum ErrorType { NOT_FOUND_ORDER_HISTORY(HttpStatus.NOT_FOUND, "존재하지 않는 결제내역입니다."), NOT_FOUND_THEME_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 테마입니다."), NOT_FOUND_STYLE_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 스타일입니다."), + NOT_FOUND_CART_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 장바구니입니다."), NOT_FOUND_VERIFICATION_CODE_EXCEPTION(HttpStatus.NOT_FOUND, "유효한 인증번호가 존재하지 않습니다."), NOT_FOUND_SAVE_IMAGE_EXCEPTION(HttpStatus.NOT_FOUND, "이미지가 존재하지 않습니다."), NOT_FOUND_POINT_CHARGE_REQUEST_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 포인트 충전 요청입니다."), From e90980048142215e10d6cc6e9c031a56d336f502 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 3 Dec 2023 00:17:05 +0900 Subject: [PATCH 10/32] =?UTF-8?q?[STYLE]=20=EC=BD=94=EB=93=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/ReadOrderHistoryListRes.java | 3 +- .../order/provider/vo/OrderHistoryInfo.java | 2 - .../server/domain/sticker/domain/Sticker.java | 1 - .../impl/StickerRepositoryImpl.java | 286 +++++++++--------- 4 files changed, 145 insertions(+), 147 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/response/ReadOrderHistoryListRes.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/response/ReadOrderHistoryListRes.java index 4ed52e30..21e0713f 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/dto/response/ReadOrderHistoryListRes.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/dto/response/ReadOrderHistoryListRes.java @@ -16,7 +16,8 @@ public class ReadOrderHistoryListRes { private List orderHistoryInfoList; private OrderHistoryPageInfo orderHistoryPageInfo; - public static ReadOrderHistoryListRes of(List orderHistoryInfoList, + public static ReadOrderHistoryListRes of( + List orderHistoryInfoList, OrderHistoryPageInfo orderHistoryPageInfo) { return new ReadOrderHistoryListRes(orderHistoryInfoList, orderHistoryPageInfo); } diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderHistoryInfo.java b/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderHistoryInfo.java index 1a818de9..ec089aa7 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderHistoryInfo.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderHistoryInfo.java @@ -1,10 +1,8 @@ package org.tattour.server.domain.order.provider.vo; -import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import org.tattour.server.domain.order.domain.OrderStatus; @Getter @Setter diff --git a/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java b/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java index 639b0eee..1ea02304 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java @@ -22,7 +22,6 @@ import org.hibernate.annotations.DynamicUpdate; import org.tattour.server.domain.discount.domain.Discount; import org.tattour.server.domain.order.domain.Order; -import org.tattour.server.domain.user.domain.ProductLiked; import org.tattour.server.global.util.AuditingTimeEntity; @Table(name = "sticker") diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java index 8dafb280..3dc2d465 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java @@ -1,11 +1,11 @@ package org.tattour.server.domain.sticker.repository.impl; -import static org.tattour.server.domain.order.domain.QOrder.*; -import static org.tattour.server.domain.sticker.domain.QSticker.*; -import static org.tattour.server.domain.sticker.domain.QStickerStyle.*; -import static org.tattour.server.domain.sticker.domain.QStickerTheme.*; -import static org.tattour.server.domain.style.domain.QStyle.*; -import static org.tattour.server.domain.theme.domain.QTheme.*; +import static org.tattour.server.domain.order.domain.QOrder.order; +import static org.tattour.server.domain.sticker.domain.QSticker.sticker; +import static org.tattour.server.domain.sticker.domain.QStickerStyle.stickerStyle; +import static org.tattour.server.domain.sticker.domain.QStickerTheme.stickerTheme; +import static org.tattour.server.domain.style.domain.QStyle.style; +import static org.tattour.server.domain.theme.domain.QTheme.theme; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQueryFactory; @@ -17,148 +17,148 @@ @RequiredArgsConstructor public class StickerRepositoryImpl implements StickerRepositoryCustom { - private final JPAQueryFactory queryFactory; + private final JPAQueryFactory queryFactory; - @Override - public List findAllByStateAndIsCustomInOrderOrder() { - return queryFactory - .select(sticker) - .from(sticker) - .leftJoin(sticker.orders) - .where(sticker.isCustom.eq(true), sticker.state.eq(true)) - .groupBy(sticker.id) - .orderBy(sticker.orders.size().desc()) - .fetch(); - } + @Override + public List findAllByStateAndIsCustomInOrderOrder() { + return queryFactory + .select(sticker) + .from(sticker) + .leftJoin(sticker.orders) + .where(sticker.isCustom.eq(true), sticker.state.eq(true)) + .groupBy(sticker.id) + .orderBy(sticker.orders.size().desc()) + .fetch(); + } - @Override - public List findAllSameThemeOrStyleById(Integer id) { - return queryFactory - .select(sticker).distinct() - .from(sticker) - .leftJoin(sticker.stickerThemes, stickerTheme) - .leftJoin(sticker.stickerStyles, stickerStyle) - .where(sticker.state.eq(true)) - .where(stickerTheme.theme.in( - queryFactory - .select(stickerTheme.theme) - .from(stickerTheme) - .where(stickerTheme.sticker.id.eq(id)) - ).or(stickerStyle.style.in( - queryFactory - .select(stickerStyle.style) - .from(stickerStyle) - .where(stickerStyle.sticker.id.eq(id)) - ))) - .orderBy(sticker.id.asc()) - .fetch(); - } + @Override + public List findAllSameThemeOrStyleById(Integer id) { + return queryFactory + .select(sticker).distinct() + .from(sticker) + .leftJoin(sticker.stickerThemes, stickerTheme) + .leftJoin(sticker.stickerStyles, stickerStyle) + .where(sticker.state.eq(true)) + .where(stickerTheme.theme.in( + queryFactory + .select(stickerTheme.theme) + .from(stickerTheme) + .where(stickerTheme.sticker.id.eq(id)) + ).or(stickerStyle.style.in( + queryFactory + .select(stickerStyle.style) + .from(stickerStyle) + .where(stickerStyle.sticker.id.eq(id)) + ))) + .orderBy(sticker.id.asc()) + .fetch(); + } - @Override - public List findAllByThemeNameAndStyleNameAndStateInOrderOrder( - String themeName, - String styleName) { - return queryFactory - .select(sticker).distinct() - .from(sticker) - .leftJoin(sticker.stickerThemes, stickerTheme) - .leftJoin(sticker.stickerStyles, stickerStyle) - .leftJoin(sticker.orders, order) - .fetchJoin() - .where(sticker.state.eq(true)) - .where(stickerTheme.theme.in( - queryFactory - .select(theme) - .from(theme) - .where(eqThemeName(themeName)) - ).and(stickerStyle.style.in( - queryFactory - .select(style) - .from(style) - .where(eqStyleName(styleName)) - ))) - .fetch(); - } + @Override + public List findAllByThemeNameAndStyleNameAndStateInOrderOrder( + String themeName, + String styleName) { + return queryFactory + .select(sticker).distinct() + .from(sticker) + .leftJoin(sticker.stickerThemes, stickerTheme) + .leftJoin(sticker.stickerStyles, stickerStyle) + .leftJoin(sticker.orders, order) + .fetchJoin() + .where(sticker.state.eq(true)) + .where(stickerTheme.theme.in( + queryFactory + .select(theme) + .from(theme) + .where(eqThemeName(themeName)) + ).and(stickerStyle.style.in( + queryFactory + .select(style) + .from(style) + .where(eqStyleName(styleName)) + ))) + .fetch(); + } - @Override - public List findAllByThemeNameAndStyleNameAndStateInOrderPrice(String themeName, - String styleName) { - return queryFactory - .select(sticker).distinct() - .from(sticker) - .leftJoin(sticker.stickerThemes, stickerTheme) - .leftJoin(sticker.stickerStyles, stickerStyle) - .leftJoin(sticker.orders, order) - .fetchJoin() - .where(sticker.state.eq(true)) - .where(stickerTheme.theme.in( - queryFactory - .select(theme) - .from(theme) - .where(eqThemeName(themeName)) - ).and(stickerStyle.style.in( - queryFactory - .select(style) - .from(style) - .where(eqStyleName(styleName)) - ))) - .orderBy(sticker.price.asc()) - .fetch(); - } + @Override + public List findAllByThemeNameAndStyleNameAndStateInOrderPrice(String themeName, + String styleName) { + return queryFactory + .select(sticker).distinct() + .from(sticker) + .leftJoin(sticker.stickerThemes, stickerTheme) + .leftJoin(sticker.stickerStyles, stickerStyle) + .leftJoin(sticker.orders, order) + .fetchJoin() + .where(sticker.state.eq(true)) + .where(stickerTheme.theme.in( + queryFactory + .select(theme) + .from(theme) + .where(eqThemeName(themeName)) + ).and(stickerStyle.style.in( + queryFactory + .select(style) + .from(style) + .where(eqStyleName(styleName)) + ))) + .orderBy(sticker.price.asc()) + .fetch(); + } - @Override - public List findAllByThemeNameAndStyleNameAndStateInOrderPriceDesc(String themeName, - String styleName) { - return queryFactory - .select(sticker).distinct() - .from(sticker) - .leftJoin(sticker.stickerThemes, stickerTheme) - .leftJoin(sticker.stickerStyles, stickerStyle) - .leftJoin(sticker.orders, order) - .fetchJoin() - .where(sticker.state.eq(true)) - .where(stickerTheme.theme.in( - queryFactory - .select(theme) - .from(theme) - .where(eqThemeName(themeName)) - ).and(stickerStyle.style.in( - queryFactory - .select(style) - .from(style) - .where(eqStyleName(styleName)) - ))) - .orderBy(sticker.price.desc()) - .fetch(); - } + @Override + public List findAllByThemeNameAndStyleNameAndStateInOrderPriceDesc(String themeName, + String styleName) { + return queryFactory + .select(sticker).distinct() + .from(sticker) + .leftJoin(sticker.stickerThemes, stickerTheme) + .leftJoin(sticker.stickerStyles, stickerStyle) + .leftJoin(sticker.orders, order) + .fetchJoin() + .where(sticker.state.eq(true)) + .where(stickerTheme.theme.in( + queryFactory + .select(theme) + .from(theme) + .where(eqThemeName(themeName)) + ).and(stickerStyle.style.in( + queryFactory + .select(style) + .from(style) + .where(eqStyleName(styleName)) + ))) + .orderBy(sticker.price.desc()) + .fetch(); + } - @Override - public List findAllByThemeNameOrStyleNameOrNameContaining(String word) { - return queryFactory - .select(sticker).distinct() - .from(sticker) - .leftJoin(sticker.stickerThemes, stickerTheme) - .leftJoin(sticker.stickerStyles, stickerStyle) - .where(sticker.state.eq(true)) - .where(stickerTheme.theme.in( - queryFactory - .select(theme) - .from(theme) - .where(theme.name.contains(word)) - ).or(stickerStyle.style.in( - queryFactory - .select(style) - .from(style) - .where(style.name.contains(word)) - )).or(sticker.name.contains(word))) - .fetch(); - } + @Override + public List findAllByThemeNameOrStyleNameOrNameContaining(String word) { + return queryFactory + .select(sticker).distinct() + .from(sticker) + .leftJoin(sticker.stickerThemes, stickerTheme) + .leftJoin(sticker.stickerStyles, stickerStyle) + .where(sticker.state.eq(true)) + .where(stickerTheme.theme.in( + queryFactory + .select(theme) + .from(theme) + .where(theme.name.contains(word)) + ).or(stickerStyle.style.in( + queryFactory + .select(style) + .from(style) + .where(style.name.contains(word)) + )).or(sticker.name.contains(word))) + .fetch(); + } - private BooleanExpression eqStyleName(String styleName) { - return styleName == null ? null : style.name.eq(styleName); - } + private BooleanExpression eqStyleName(String styleName) { + return styleName == null ? null : style.name.eq(styleName); + } - private BooleanExpression eqThemeName(String themeName) { - return themeName == null ? null : theme.name.eq(themeName); - } -} + private BooleanExpression eqThemeName(String themeName) { + return themeName == null ? null : theme.name.eq(themeName); + } +} \ No newline at end of file From 703f7af5d2dfcd79463f4b2400c0607289bcbcf5 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 3 Dec 2023 00:33:05 +0900 Subject: [PATCH 11/32] =?UTF-8?q?[FEAT]=20=EC=9E=A5=EB=B0=94=EA=B5=AC?= =?UTF-8?q?=EB=8B=88=20=EC=82=AD=EC=A0=9C=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cart/controller/CartController.java | 28 +++++ .../server/domain/cart/facade/CartFacade.java | 2 + .../cart/facade/impl/CartFacadeImpl.java | 6 + .../domain/cart/service/CartService.java | 2 + .../cart/service/impl/CartServiceImpl.java | 5 + .../server/global/dto/SuccessType.java | 108 +++++++++--------- 6 files changed, 97 insertions(+), 54 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java index dfd1d3d2..75dec3c9 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java @@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -116,6 +117,33 @@ public ResponseEntity addCartCount( cartFacade.increaseCartCount(userId, cartId); return BaseResponse.success(SuccessType.UPDATE_SUCCESS); } + + @Operation(summary = "장바구니 삭제") + @ApiResponses(value = { + @ApiResponse( + responseCode = "200", + description = "삭제에 성공했습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 장바구니입니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))), + @ApiResponse( + responseCode = "500", + description = "알 수 없는 서버 에러가 발생했습니다.", + content = @Content(schema = @Schema(implementation = FailResponse.class))) + }) + @DeleteMapping("/items/{cartId}") + public ResponseEntity deleteCartCount( + @Parameter(hidden = true) @UserId Integer userId, + @PathVariable Integer cartId) { + cartFacade.deleteCartItem(userId, cartId); + return BaseResponse.success(SuccessType.DELETE_SUCCESS); + } } diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java index 5bb5f392..a553d067 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java @@ -9,4 +9,6 @@ public interface CartFacade { CartItemsRes getUserCartItems(int userId); void increaseCartCount(int userId, int cartId); + + void deleteCartItem(int userId, int cartId); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java index 983ed0f1..970d543a 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java @@ -50,4 +50,10 @@ public void increaseCartCount(int userId, int cartId) { Cart cart = cartService.findByIdAndUserId(userId, cartId); cartService.increaseCartCount(cart); } + + @Override + public void deleteCartItem(int userId, int cartId) { + Cart cart = cartService.findByIdAndUserId(userId, cartId); + cartService.delete(cart); + } } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java index 66950b90..847ad084 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java @@ -18,4 +18,6 @@ public interface CartService { Cart createNewCart(User user, Sticker sticker, int count); void increaseCartCount(Cart cart); + + void delete(Cart cart); } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java index e60a9fd1..ebc20637 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java @@ -60,4 +60,9 @@ public void increaseCartCount(Cart cart) { cart.increaseCount(); cartRepository.save(cart); } + + @Override + public void delete(Cart cart) { + cartRepository.delete(cart); + } } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/global/dto/SuccessType.java b/server/src/main/java/org/tattour/server/global/dto/SuccessType.java index 3c097c54..cb933fd9 100644 --- a/server/src/main/java/org/tattour/server/global/dto/SuccessType.java +++ b/server/src/main/java/org/tattour/server/global/dto/SuccessType.java @@ -7,65 +7,65 @@ @AllArgsConstructor(access = AccessLevel.PRIVATE) public enum SuccessType { - /** - * 200 OK - */ - GET_SUCCESS(HttpStatus.OK, "조회에 성공했습니다."), - LOGIN_SUCCESS(HttpStatus.OK, "로그인에 성공했습니다."), - LOGOUT_SUCCESS(HttpStatus.OK, "로그아웃에 성공했습니다."), - CODE_VERIFICATION_SUCCESS(HttpStatus.OK, "인증코드 검증에 성공했습니다."), - READ_ALL_STICKER_SUCCESS(HttpStatus.OK, "모든 스티커 요약 정보 조회에 성공했습니다."), - READ_HOT_CUSTOM_STICKER_SUCCESS(HttpStatus.OK, "인기 스티커 요약 정보 조회에 성공했습니다."), - READ_STICKER_INFO_SUCCESS(HttpStatus.OK, "한 게시물 상세 정보 조회에 성공했습니다."), - READ_SIMILAR_STICKER_SUCCESS(HttpStatus.OK, "비슷한 스티커 리스트 조회에 성공했습니다"), - READ_FILTER_ALL_STICKER_SUCCESS(HttpStatus.OK, "스티커 필터링 조회에 성공했습니다."), - READ_SEARCH_ALL_STICKER_SUCCESS(HttpStatus.OK, "스티커 검색 조회에 성공했습니다."), - READ_ALL_THEME_SUCCESS(HttpStatus.OK, "테마 조회에 성공했습니다."), - READ_ALL_THEME_SUMMARY_SUCCESS(HttpStatus.OK, "테마 요약 정보 조회에 성공했습니다."), - READ_ALL_STYLE_SUCCESS(HttpStatus.OK, "스타일 조회에 성공했습니다."), - READ_ALL_STYLE_SUMMARY_SUCCESS(HttpStatus.OK, "스타일 요약 정보 조회에 성공했습니다."), - READ_ONE_CUSTOM_SUCCESS(HttpStatus.OK, "커스텀 정보 조회에 성공했습니다."), - READ_ONE_MAGAZINE_SUCCESS(HttpStatus.OK, "한 개 매거진 정보 조회에 성공했습니다."), - READ_ALL_MAGAZINE_SUCCESS(HttpStatus.OK, "매거진 조회에 성공했습니다."), - UPDATE_CUSTOM_PROCESS_SUCCESS(HttpStatus.OK, "커스텀 배송 상태 수정에 성공했습니다."), - READ_COMPLETE_CUSTOM_SUMMARY_SUCCESS(HttpStatus.OK, "신청 완료된 커스텀 요약 정보 조회에 성공했습니다."), - READ_INCOMPLETE_CUSTOM_SUMMARY_SUCCESS(HttpStatus.OK, "임시저장 커스텀 요약 정보 조회에 성공했습니다."), - READ_POINT_LOG_SUCCESS(HttpStatus.OK, "포인트 로그 조회에 성공했습니다."), - UPDATE_SUCCESS(HttpStatus.OK, "갱신에 성공했습니다."), - UPDATE_CUSTOM_SUCCESS(HttpStatus.OK, "커스텀 업데이트에 성공했습니다"), - DELETE_SUCCESS(HttpStatus.OK, "삭제에 성공했습니다."), - UPDATE_ORDER_STATUS_SUCCESS(HttpStatus.OK, "주문상태 변경에 성공했습니다."), - APPLY_STICKER_DISCOUNT_SUCCESS(HttpStatus.CREATED, "스티커 할인 적용에 성공했습니다."), + /** + * 200 OK + */ + GET_SUCCESS(HttpStatus.OK, "조회에 성공했습니다."), + UPDATE_SUCCESS(HttpStatus.OK, "갱신에 성공했습니다."), + DELETE_SUCCESS(HttpStatus.OK, "삭제에 성공했습니다."), + LOGIN_SUCCESS(HttpStatus.OK, "로그인에 성공했습니다."), + LOGOUT_SUCCESS(HttpStatus.OK, "로그아웃에 성공했습니다."), + CODE_VERIFICATION_SUCCESS(HttpStatus.OK, "인증코드 검증에 성공했습니다."), + READ_ALL_STICKER_SUCCESS(HttpStatus.OK, "모든 스티커 요약 정보 조회에 성공했습니다."), + READ_HOT_CUSTOM_STICKER_SUCCESS(HttpStatus.OK, "인기 스티커 요약 정보 조회에 성공했습니다."), + READ_STICKER_INFO_SUCCESS(HttpStatus.OK, "한 게시물 상세 정보 조회에 성공했습니다."), + READ_SIMILAR_STICKER_SUCCESS(HttpStatus.OK, "비슷한 스티커 리스트 조회에 성공했습니다"), + READ_FILTER_ALL_STICKER_SUCCESS(HttpStatus.OK, "스티커 필터링 조회에 성공했습니다."), + READ_SEARCH_ALL_STICKER_SUCCESS(HttpStatus.OK, "스티커 검색 조회에 성공했습니다."), + READ_ALL_THEME_SUCCESS(HttpStatus.OK, "테마 조회에 성공했습니다."), + READ_ALL_THEME_SUMMARY_SUCCESS(HttpStatus.OK, "테마 요약 정보 조회에 성공했습니다."), + READ_ALL_STYLE_SUCCESS(HttpStatus.OK, "스타일 조회에 성공했습니다."), + READ_ALL_STYLE_SUMMARY_SUCCESS(HttpStatus.OK, "스타일 요약 정보 조회에 성공했습니다."), + READ_ONE_CUSTOM_SUCCESS(HttpStatus.OK, "커스텀 정보 조회에 성공했습니다."), + READ_ONE_MAGAZINE_SUCCESS(HttpStatus.OK, "한 개 매거진 정보 조회에 성공했습니다."), + READ_ALL_MAGAZINE_SUCCESS(HttpStatus.OK, "매거진 조회에 성공했습니다."), + UPDATE_CUSTOM_PROCESS_SUCCESS(HttpStatus.OK, "커스텀 배송 상태 수정에 성공했습니다."), + READ_COMPLETE_CUSTOM_SUMMARY_SUCCESS(HttpStatus.OK, "신청 완료된 커스텀 요약 정보 조회에 성공했습니다."), + READ_INCOMPLETE_CUSTOM_SUMMARY_SUCCESS(HttpStatus.OK, "임시저장 커스텀 요약 정보 조회에 성공했습니다."), + READ_POINT_LOG_SUCCESS(HttpStatus.OK, "포인트 로그 조회에 성공했습니다."), + UPDATE_CUSTOM_SUCCESS(HttpStatus.OK, "커스텀 업데이트에 성공했습니다"), + UPDATE_ORDER_STATUS_SUCCESS(HttpStatus.OK, "주문상태 변경에 성공했습니다."), + APPLY_STICKER_DISCOUNT_SUCCESS(HttpStatus.CREATED, "스티커 할인 적용에 성공했습니다."), - /** - * 201 CREATED - */ - CREATE_SUCCESS(HttpStatus.CREATED, "생성에 성공했습니다."), - SIGNUP_SUCCESS(HttpStatus.CREATED, "회원가입이 완료됐습니다."), - CREATE_CUSTOM_SUCCESS(HttpStatus.CREATED, "커스텀 도안 신청이 완료됐습니다."), - CREATE_ORDER_SUCCESS(HttpStatus.CREATED, "주문에 성공했습니다."), - CREATE_POINT_CHARGE_REQUEST_SUCCESS(HttpStatus.CREATED, "포인트 충전 요청에 성공했습니다."), - POINT_CHARGE_CONFIRM_SUCCESS(HttpStatus.CREATED, "포인트 충전 확정에 성공했습니다."), - POINT_CHARGE_CANCEL_SUCCESS(HttpStatus.CREATED, "포인트 충전 취소에 성공했습니다."), - CREATE_DISCOUNT_SUCCESS(HttpStatus.CREATED, "할인 정책 생성에 성공했습니다."), + /** + * 201 CREATED + */ + CREATE_SUCCESS(HttpStatus.CREATED, "생성에 성공했습니다."), + SIGNUP_SUCCESS(HttpStatus.CREATED, "회원가입이 완료됐습니다."), + CREATE_CUSTOM_SUCCESS(HttpStatus.CREATED, "커스텀 도안 신청이 완료됐습니다."), + CREATE_ORDER_SUCCESS(HttpStatus.CREATED, "주문에 성공했습니다."), + CREATE_POINT_CHARGE_REQUEST_SUCCESS(HttpStatus.CREATED, "포인트 충전 요청에 성공했습니다."), + POINT_CHARGE_CONFIRM_SUCCESS(HttpStatus.CREATED, "포인트 충전 확정에 성공했습니다."), + POINT_CHARGE_CANCEL_SUCCESS(HttpStatus.CREATED, "포인트 충전 취소에 성공했습니다."), + CREATE_DISCOUNT_SUCCESS(HttpStatus.CREATED, "할인 정책 생성에 성공했습니다."), - /** - * 202 ACCEPTED - */ - CODE_VALIDATION_FAIL(HttpStatus.ACCEPTED, "인증번호 검증에 실패했습니다."), - POINT_CHARGE_CONFIRM_FAIL(HttpStatus.ACCEPTED, "금액이 일치하지 않아 충전 확정이 불가능합니다."), + /** + * 202 ACCEPTED + */ + CODE_VALIDATION_FAIL(HttpStatus.ACCEPTED, "인증번호 검증에 실패했습니다."), + POINT_CHARGE_CONFIRM_FAIL(HttpStatus.ACCEPTED, "금액이 일치하지 않아 충전 확정이 불가능합니다."), - ; + ; - private final HttpStatus httpStatus; - private final String message; + private final HttpStatus httpStatus; + private final String message; - public int getHttpStatusCode() { - return httpStatus.value(); - } + public int getHttpStatusCode() { + return httpStatus.value(); + } - public String getMessage() { - return message; - } + public String getMessage() { + return message; + } } \ No newline at end of file From 4fb433bd328f1e2a77393184b88a1e7f35e9218e Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 3 Dec 2023 00:35:07 +0900 Subject: [PATCH 12/32] =?UTF-8?q?[DOCS]=20=EC=9C=A0=EC=A0=80=20=EC=9E=A5?= =?UTF-8?q?=EB=B0=94=EA=B5=AC=EB=8B=88=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20-=20ApiResponse=20content=EB=A5=BC=20=ED=95=B4?= =?UTF-8?q?=EB=8B=B9=20Request=20dto=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tattour/server/domain/cart/controller/CartController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java index 75dec3c9..7d8224c6 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java @@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; +import org.tattour.server.domain.cart.controller.dto.response.CartItemsRes; import org.tattour.server.domain.cart.facade.CartFacade; import org.tattour.server.global.config.annotations.UserId; import org.tattour.server.global.dto.BaseResponse; @@ -74,7 +75,7 @@ public ResponseEntity saveCartItem( @ApiResponse( responseCode = "200", description = "조회에 성공했습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))), + content = @Content(schema = @Schema(implementation = CartItemsRes.class))), @ApiResponse( responseCode = "400", description = "잘못된 요청입니다.", From e51c8515c549fc11e4e75affa634f352003f8604 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 3 Dec 2023 01:02:38 +0900 Subject: [PATCH 13/32] =?UTF-8?q?[FIX]=20=EA=B2=B0=EC=A0=9C=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=B6=88=EB=9F=AC=EC=98=A4=EA=B8=B0=20-?= =?UTF-8?q?=20RequestParam=20required=20=EC=97=90=EB=9F=AC=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/domain/order/controller/OrderController.java | 5 ++--- .../domain/order/facade/dto/request/ReadOrderSheetReq.java | 4 ++++ .../server/domain/order/facade/impl/OrderFacadeImpl.java | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java b/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java index ce88a3b6..3db207ec 100644 --- a/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java +++ b/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java @@ -9,7 +9,6 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import javax.validation.Valid; -import javax.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; @@ -68,8 +67,8 @@ public class OrderController { @GetMapping("/ordersheet") public ResponseEntity getOrderSheet( @Parameter(hidden = true) @UserId Integer userId, - @Parameter(description = "타투 스티커 id") @RequestParam @NotNull(message = "stickerId is null") Integer stickerId, - @Parameter(description = "상품 개수", example = "3") @RequestParam @NotNull(message = "count is null") Integer count + @Parameter(description = "타투 스티커 id") @RequestParam(required = false) Integer stickerId, + @Parameter(description = "상품 개수") @RequestParam(required = false) Integer count ) { return BaseResponse.success( SuccessType.GET_SUCCESS, orderFacade.readOrderSheet(ReadOrderSheetReq.of(userId, stickerId, count))); diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java index f49bd792..2ecf13f5 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java @@ -23,6 +23,10 @@ public static ReadOrderSheetReq of(Integer userId, Integer stickerId, Integer co } public boolean isCartOrder() { + return stickerId == null && count == null; + } + + public boolean isNotCartOrder() { return stickerId != null && count != null; } } diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java index f294c9a2..458de587 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java @@ -67,8 +67,10 @@ private StickerOrderInfo getStickerOrderInfo(ReadOrderSheetReq req) { if (req.isCartOrder()) { List carts = cartService.findByUserId(req.getUserId()); return stickerProvider.getStickerOrderInfoFromCart(carts); - } else { + } else if (req.isNotCartOrder()) { return stickerProvider.getStickerOrderInfoFromOrder(req.getStickerId(), req.getCount()); + } else { + throw new BusinessException(ErrorType.INVALID_ARGUMENT_EXCEPTION); } } From 7497f42b5ba9588b7ea82a3a6e24b415634cbee6 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 01:33:06 +0900 Subject: [PATCH 14/32] =?UTF-8?q?[FIX]=20=EC=9E=A5=EB=B0=94=EA=B5=AC?= =?UTF-8?q?=EB=8B=88=20API=20URL=20=ED=98=95=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 겅로에서 items 제거 --- .../server/domain/cart/controller/CartController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java index 7d8224c6..7e4f4016 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java @@ -61,7 +61,7 @@ public class CartController { description = "알 수 없는 서버 에러가 발생했습니다.", content = @Content(schema = @Schema(implementation = FailResponse.class))) }) - @PostMapping("/items") + @PostMapping public ResponseEntity saveCartItem( @Parameter(hidden = true) @UserId Integer userId, @RequestBody @Valid SaveCartReq saveCartReq @@ -85,7 +85,7 @@ public ResponseEntity saveCartItem( description = "알 수 없는 서버 에러가 발생했습니다.", content = @Content(schema = @Schema(implementation = FailResponse.class))) }) - @GetMapping("/items") + @GetMapping public ResponseEntity getUserCartItem( @Parameter(hidden = true) @UserId Integer userId ) { @@ -111,7 +111,7 @@ public ResponseEntity getUserCartItem( description = "알 수 없는 서버 에러가 발생했습니다.", content = @Content(schema = @Schema(implementation = FailResponse.class))) }) - @PatchMapping("/items/{cartId}") + @PatchMapping("/{cartId}") public ResponseEntity addCartCount( @Parameter(hidden = true) @UserId Integer userId, @PathVariable Integer cartId) { @@ -138,7 +138,7 @@ public ResponseEntity addCartCount( description = "알 수 없는 서버 에러가 발생했습니다.", content = @Content(schema = @Schema(implementation = FailResponse.class))) }) - @DeleteMapping("/items/{cartId}") + @DeleteMapping("/{cartId}") public ResponseEntity deleteCartCount( @Parameter(hidden = true) @UserId Integer userId, @PathVariable Integer cartId) { From 3a58905684a38d0f5446f49d1aa03b56815153ca Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 01:50:54 +0900 Subject: [PATCH 15/32] =?UTF-8?q?[REFACTOR]=20Entity=20Order=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=BB=AC=EB=9F=BC?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Order -> OrderHistory - 컬럼 삭제 - product_size - product_name - product_main_image_url - product_count - sticker_id: sticker 외래키 삭제 --- .../domain/{Order.java => OrderHistory.java} | 35 ++++--------------- .../domain/order/provider/OrderProvider.java | 10 ++---- .../provider/impl/OrderProviderImpl.java | 8 ++--- .../repository/impl/OrderRepositoryImpl.java | 8 ++--- 4 files changed, 17 insertions(+), 44 deletions(-) rename server/src/main/java/org/tattour/server/domain/order/domain/{Order.java => OrderHistory.java} (55%) diff --git a/server/src/main/java/org/tattour/server/domain/order/domain/Order.java b/server/src/main/java/org/tattour/server/domain/order/domain/OrderHistory.java similarity index 55% rename from server/src/main/java/org/tattour/server/domain/order/domain/Order.java rename to server/src/main/java/org/tattour/server/domain/order/domain/OrderHistory.java index 67d1bd92..825cb2c5 100644 --- a/server/src/main/java/org/tattour/server/domain/order/domain/Order.java +++ b/server/src/main/java/org/tattour/server/domain/order/domain/OrderHistory.java @@ -12,10 +12,10 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import lombok.AccessLevel; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import org.hibernate.annotations.DynamicInsert; -import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.user.domain.User; @Entity @@ -23,16 +23,12 @@ @DynamicInsert @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class Order { +public class OrderHistory { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; - private String productName; - private String productSize; - @Column(columnDefinition = "text") - private String productImageUrl; + private Integer productAmount; - private Integer productCount; private Integer shippingFee; private Integer totalAmount; private String recipientName; @@ -57,18 +53,9 @@ public class Order { @JoinColumn(name = "user_id") private User user; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "sticker_id") - private Sticker sticker; - - public Order(String productName, String productSize, String productImageUrl, Integer productAmount, - Integer productCount, Integer shippingFee, Integer totalAmount, String recipientName, - String contact, String mailingAddress, String baseAddress, String detailAddress, - User user, Sticker sticker) { - this.productName = productName; - this.productSize = productSize; - this.productImageUrl = productImageUrl; - this.productCount = productCount; + @Builder + public OrderHistory(Integer productAmount, Integer shippingFee, Integer totalAmount, String recipientName, + String contact, String mailingAddress, String baseAddress, String detailAddress, User user) { this.productAmount = productAmount; this.shippingFee = shippingFee; this.totalAmount = totalAmount; @@ -78,16 +65,6 @@ public Order(String productName, String productSize, String productImageUrl, Int this.baseAddress = baseAddress; this.detailAddress = detailAddress; this.user = user; - this.sticker = sticker; - } - - public static Order of(String productName, String productSize, String productImageUrl, Integer productAmount, - Integer productCount, Integer shippingFee, Integer totalAmount, String recipientName, - String contact, String mailingAddress, String baseAddress, String detailAddress, - User user, Sticker sticker) { - return new Order(productName, productSize, productImageUrl, productCount, productAmount, - shippingFee, totalAmount, recipientName, contact, mailingAddress, baseAddress, - detailAddress, user, sticker); } public void setOrderStatus(OrderStatus orderStatus) { diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java b/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java index 95e0720c..1a217f91 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java @@ -2,21 +2,17 @@ import java.util.List; import org.springframework.data.domain.Page; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; public interface OrderProvider { - // 결제 내역 1개 가져오기 - Order readOrderById(int orderId); + OrderHistory readOrderHistoryById(int orderHistoryId); - // 페이지로 결제 내역 불러오기 - Page readOrderHistoryByPage(int page); + Page readOrderHistoryByPage(int page); - // 유저 결제 내역 불러오기 ReadUserOrderHistoryListRes readOrderHistoryByUserId(int userId); - // 기준날짜로 결제 내역 불러오기 List readOrderHistoryAfterDate(int userId, String date); } diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java b/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java index 2a484289..5ce64abf 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java @@ -6,7 +6,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.provider.OrderProvider; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; @@ -22,13 +22,13 @@ public class OrderProviderImpl implements OrderProvider { private final OrderRepositoryImpl orderRepository; @Override - public Order readOrderById(int orderId) { - return orderRepository.findById(orderId) + public OrderHistory readOrderHistoryById(int orderHistoryId) { + return orderRepository.findById(orderHistoryId) .orElseThrow(() -> new BusinessException(ErrorType.NOT_FOUND_ORDER_HISTORY)); } @Override - public Page readOrderHistoryByPage(int page) { + public Page readOrderHistoryByPage(int page) { return orderRepository.findAll( PageRequest.of( page - 1, diff --git a/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderRepositoryImpl.java index cbd82806..4a94b61e 100644 --- a/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderRepositoryImpl.java @@ -3,13 +3,13 @@ import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; @Repository -public interface OrderRepositoryImpl extends JpaRepository { +public interface OrderRepositoryImpl extends JpaRepository { - List findAllByUser_Id(Integer userId); + List findAllByUser_Id(Integer userId); // userId와 기준 시간 이후 행 가져오기 - List findAllByUser_IdAndCreatedAtAfter(Integer userId, String date); + List findAllByUser_IdAndCreatedAtAfter(Integer userId, String date); } From bdf49bc3b5051742a5b8fb186fcafca064740474 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 01:54:32 +0900 Subject: [PATCH 16/32] =?UTF-8?q?[FEAT]=20entity=20OrderedProduct=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 장바구니 기능의 추가로 여러 상품의 구매가 가능해지면서 주문내역(OrderHistory)와 주문한 상품(OrderedProduct)의 일대다 매핑 테이블을 생성 - 주문한 상품들의 목록 --- .../domain/order/domain/OrderedProduct.java | 48 +++++++++++++++++++ .../impl/OrderedProductRepositoryImpl.java | 9 ++++ .../server/domain/sticker/domain/Sticker.java | 9 ++-- .../impl/StickerRepositoryImpl.java | 22 ++++----- .../service/impl/StickerServiceImpl.java | 21 ++++---- 5 files changed, 81 insertions(+), 28 deletions(-) create mode 100644 server/src/main/java/org/tattour/server/domain/order/domain/OrderedProduct.java create mode 100644 server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderedProductRepositoryImpl.java diff --git a/server/src/main/java/org/tattour/server/domain/order/domain/OrderedProduct.java b/server/src/main/java/org/tattour/server/domain/order/domain/OrderedProduct.java new file mode 100644 index 00000000..63c2c1f3 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/order/domain/OrderedProduct.java @@ -0,0 +1,48 @@ +package org.tattour.server.domain.order.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.NoArgsConstructor; +import org.tattour.server.domain.sticker.domain.Sticker; + +@Entity +@Table(name = "ordered_product") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class OrderedProduct { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + private String name; + private Integer price; + private Integer count; + @Column(columnDefinition = "text") + private String mainImageUrl; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "sticker_id") + private Sticker sticker; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "order_history_id") + private OrderHistory orderHistory; + + @Builder + private OrderedProduct(String name, Integer price, Integer count, String mainImageUrl, Sticker sticker, + OrderHistory orderHistory) { + this.name = name; + this.price = price; + this.count = count; + this.mainImageUrl = mainImageUrl; + this.sticker = sticker; + this.orderHistory = orderHistory; + } +} diff --git a/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderedProductRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderedProductRepositoryImpl.java new file mode 100644 index 00000000..666c3e86 --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderedProductRepositoryImpl.java @@ -0,0 +1,9 @@ +package org.tattour.server.domain.order.repository.impl; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; +import org.tattour.server.domain.order.domain.OrderedProduct; + +@Repository +public interface OrderedProductRepositoryImpl extends JpaRepository { +} diff --git a/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java b/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java index 1ea02304..f39034d5 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java @@ -21,7 +21,7 @@ import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import org.tattour.server.domain.discount.domain.Discount; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderedProduct; import org.tattour.server.global.util.AuditingTimeEntity; @Table(name = "sticker") @@ -76,7 +76,7 @@ public class Sticker extends AuditingTimeEntity { private List stickerImages = new ArrayList<>(); @OneToMany(mappedBy = "sticker") - private List orders = new ArrayList<>(); + private List orderedProducts = new ArrayList<>(); public void applyDiscount(Discount discount) { this.discount = discount; @@ -106,7 +106,4 @@ public static Sticker of( .state(state) .build(); } -} - - - +} \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java index 3dc2d465..89d49eb8 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java @@ -1,11 +1,11 @@ package org.tattour.server.domain.sticker.repository.impl; -import static org.tattour.server.domain.order.domain.QOrder.order; -import static org.tattour.server.domain.sticker.domain.QSticker.sticker; -import static org.tattour.server.domain.sticker.domain.QStickerStyle.stickerStyle; -import static org.tattour.server.domain.sticker.domain.QStickerTheme.stickerTheme; -import static org.tattour.server.domain.style.domain.QStyle.style; -import static org.tattour.server.domain.theme.domain.QTheme.theme; +import static org.tattour.server.domain.order.domain.QOrderedProduct.*; +import static org.tattour.server.domain.sticker.domain.QSticker.*; +import static org.tattour.server.domain.sticker.domain.QStickerStyle.*; +import static org.tattour.server.domain.sticker.domain.QStickerTheme.*; +import static org.tattour.server.domain.style.domain.QStyle.*; +import static org.tattour.server.domain.theme.domain.QTheme.*; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQueryFactory; @@ -24,10 +24,10 @@ public List findAllByStateAndIsCustomInOrderOrder() { return queryFactory .select(sticker) .from(sticker) - .leftJoin(sticker.orders) + .leftJoin(sticker.orderedProducts, orderedProduct) .where(sticker.isCustom.eq(true), sticker.state.eq(true)) .groupBy(sticker.id) - .orderBy(sticker.orders.size().desc()) + .orderBy(sticker.orderedProducts.size().desc()) .fetch(); } @@ -63,7 +63,7 @@ public List findAllByThemeNameAndStyleNameAndStateInOrderOrder( .from(sticker) .leftJoin(sticker.stickerThemes, stickerTheme) .leftJoin(sticker.stickerStyles, stickerStyle) - .leftJoin(sticker.orders, order) + .leftJoin(sticker.orderedProducts, orderedProduct) .fetchJoin() .where(sticker.state.eq(true)) .where(stickerTheme.theme.in( @@ -88,7 +88,7 @@ public List findAllByThemeNameAndStyleNameAndStateInOrderPrice(String t .from(sticker) .leftJoin(sticker.stickerThemes, stickerTheme) .leftJoin(sticker.stickerStyles, stickerStyle) - .leftJoin(sticker.orders, order) + .leftJoin(sticker.orderedProducts, orderedProduct) .fetchJoin() .where(sticker.state.eq(true)) .where(stickerTheme.theme.in( @@ -114,7 +114,7 @@ public List findAllByThemeNameAndStyleNameAndStateInOrderPriceDesc(Stri .from(sticker) .leftJoin(sticker.stickerThemes, stickerTheme) .leftJoin(sticker.stickerStyles, stickerStyle) - .leftJoin(sticker.orders, order) + .leftJoin(sticker.orderedProducts, orderedProduct) .fetchJoin() .where(sticker.state.eq(true)) .where(stickerTheme.theme.in( diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerServiceImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerServiceImpl.java index 3895ce85..c4427e93 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerServiceImpl.java @@ -1,6 +1,5 @@ package org.tattour.server.domain.sticker.service.impl; -import java.util.Collections; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -12,15 +11,15 @@ @RequiredArgsConstructor public class StickerServiceImpl implements StickerService { - private final StickerRepository stickerRepository; + private final StickerRepository stickerRepository; - @Override - public Sticker save(Sticker sticker) { - return stickerRepository.save(sticker); - } + @Override + public Sticker save(Sticker sticker) { + return stickerRepository.save(sticker); + } - @Override - public void sortStickerListByNumberOfOrderDesc(List stickers) { - Collections.sort(stickers, (o1, o2) -> o2.getOrders().size() - o1.getOrders().size()); - } -} + @Override + public void sortStickerListByNumberOfOrderDesc(List stickers) { + stickers.sort((o1, o2) -> o2.getOrderedProducts().size() - o1.getOrderedProducts().size()); + } +} \ No newline at end of file From bd9388ea35bdb6351af50abc6cc66b8c0f68c440 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 02:06:41 +0900 Subject: [PATCH 17/32] =?UTF-8?q?[FEAT,=20REFACTOR]=20=EA=B2=B0=EC=A0=9C?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EA=B0=80=EC=A0=B8=EC=98=A4?= =?UTF-8?q?=EA=B8=B0,=20=EA=B2=B0=EC=A0=9C=ED=95=98=EA=B8=B0=20API?= =?UTF-8?q?=EC=97=90=20=EC=9E=A5=EB=B0=94=EA=B5=AC=EB=8B=88=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 주문내역, 주문한 상품 저장 - 장바구니 구매 이후 모든 장바구니 삭제 - 디스코드 메시지 임시 응답으로 변경: 추후 수정 예정 --- ...epository.java => CartRepositoryImpl.java} | 6 +- .../domain/cart/service/CartService.java | 4 + .../cart/service/impl/CartServiceImpl.java | 26 +++-- .../order/controller/OrderController.java | 52 +++++----- .../{PostOrderReq.java => OrderReq.java} | 17 ++-- .../domain/order/domain/PurchaseRequest.java | 36 +++++++ .../domain/order/facade/OrderFacade.java | 13 +-- .../facade/dto/request/CreateOrderReq.java | 22 +++++ .../dto/request/CreateOrderRequest.java | 45 --------- .../facade/dto/request/ReadOrderSheetReq.java | 32 ------ .../order/facade/impl/OrderFacadeImpl.java | 97 +++++++++++-------- .../domain/order/service/OrderService.java | 7 +- .../order/service/impl/OrderServiceImpl.java | 30 +++++- .../server/global/exception/ErrorType.java | 6 +- .../server/global/util/EntityDtoMapper.java | 16 +-- 15 files changed, 220 insertions(+), 189 deletions(-) rename server/src/main/java/org/tattour/server/domain/cart/repository/{CartRepository.java => CartRepositoryImpl.java} (78%) rename server/src/main/java/org/tattour/server/domain/order/controller/dto/request/{PostOrderReq.java => OrderReq.java} (81%) create mode 100644 server/src/main/java/org/tattour/server/domain/order/domain/PurchaseRequest.java create mode 100644 server/src/main/java/org/tattour/server/domain/order/facade/dto/request/CreateOrderReq.java delete mode 100644 server/src/main/java/org/tattour/server/domain/order/facade/dto/request/CreateOrderRequest.java delete mode 100644 server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java diff --git a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepositoryImpl.java similarity index 78% rename from server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java rename to server/src/main/java/org/tattour/server/domain/cart/repository/CartRepositoryImpl.java index a9a474d0..9c3840ba 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepository.java +++ b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepositoryImpl.java @@ -9,10 +9,14 @@ import org.tattour.server.domain.user.domain.User; @Repository -public interface CartRepository extends JpaRepository { +public interface CartRepositoryImpl extends JpaRepository { List findByUser_Id(int userId); + List findByUser(User user); + Optional findByIdAndUser_Id(int id, int userId); Optional findCartByUserAndSticker(User user, Sticker sticker); + + void deleteAllByUser(User user); } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java index 847ad084..2777b759 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java @@ -9,6 +9,8 @@ public interface CartService { List findByUserId(int userId); + List findByUser(User user); + Optional findByUserAndSticker(User user, Sticker sticker); Cart findByIdAndUserId(int userId, int cartId); @@ -20,4 +22,6 @@ public interface CartService { void increaseCartCount(Cart cart); void delete(Cart cart); + + void deleteAllByUserId(User user); } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java index ebc20637..7f0f729c 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java @@ -6,7 +6,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.cart.domain.Cart; -import org.tattour.server.domain.cart.repository.CartRepository; +import org.tattour.server.domain.cart.repository.CartRepositoryImpl; import org.tattour.server.domain.cart.service.CartService; import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.user.domain.User; @@ -16,21 +16,26 @@ @Service @RequiredArgsConstructor public class CartServiceImpl implements CartService { - private final CartRepository cartRepository; + private final CartRepositoryImpl cartRepositoryImpl; @Override public List findByUserId(int userId) { - return cartRepository.findByUser_Id(userId); + return cartRepositoryImpl.findByUser_Id(userId); + } + + @Override + public List findByUser(User user) { + return cartRepositoryImpl.findByUser(user); } @Override public Optional findByUserAndSticker(User user, Sticker sticker) { - return cartRepository.findCartByUserAndSticker(user, sticker); + return cartRepositoryImpl.findCartByUserAndSticker(user, sticker); } @Override public Cart findByIdAndUserId(int userId, int id) { - return cartRepository.findByIdAndUser_Id(id, userId) + return cartRepositoryImpl.findByIdAndUser_Id(id, userId) .orElseThrow(() -> new BusinessException(ErrorType.NOT_FOUND_CART_EXCEPTION)); } @@ -42,7 +47,7 @@ public void mergeOrAddToCart(User user, Sticker sticker, int count) { return cartExisting; }) .orElseGet(() -> createNewCart(user, sticker, count)); - cartRepository.save(cart); + cartRepositoryImpl.save(cart); } @Override @@ -58,11 +63,16 @@ public Cart createNewCart(User user, Sticker sticker, int count) { @Transactional public void increaseCartCount(Cart cart) { cart.increaseCount(); - cartRepository.save(cart); + cartRepositoryImpl.save(cart); } @Override public void delete(Cart cart) { - cartRepository.delete(cart); + cartRepositoryImpl.delete(cart); + } + + @Override + public void deleteAllByUserId(User user) { + cartRepositoryImpl.deleteAllByUser(user); } } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java b/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java index 3db207ec..cd1ee33f 100644 --- a/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java +++ b/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java @@ -18,10 +18,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import org.tattour.server.domain.order.controller.dto.request.PostOrderReq; +import org.tattour.server.domain.order.controller.dto.request.OrderReq; import org.tattour.server.domain.order.controller.dto.response.ReadOrderSheetRes; -import org.tattour.server.domain.order.facade.dto.request.CreateOrderRequest; -import org.tattour.server.domain.order.facade.dto.request.ReadOrderSheetReq; +import org.tattour.server.domain.order.domain.PurchaseRequest; +import org.tattour.server.domain.order.facade.dto.request.CreateOrderReq; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.facade.impl.OrderFacadeImpl; import org.tattour.server.global.config.annotations.UserId; @@ -40,8 +40,11 @@ public class OrderController { private final OrderFacadeImpl orderFacade; - @Operation(summary = "결제 페이지 불러오기", description = "제품 상세 페이지에서 받은 정보를 바탕으로 결제 시트 정보 불러오기\n" - + "stickerId, count 매개변수가 없으면 장바구니에서 불러오는 결제 페이지 제공") + // todo: 장바구니 목록이 존재하지 않을 경우 예외처리하기 + @Operation(summary = "결제 페이지 불러오기", + description = "결제 페이지 정보 불러오기" + + "\n- stickerId, count가 존재하는 경우: **단일 상품 구매**" + + "\n- stickerId, count가 존재하지 않는 경우: **장바구니 상품 구매**") @ApiResponses(value = { @ApiResponse( responseCode = "200", @@ -71,11 +74,14 @@ public ResponseEntity getOrderSheet( @Parameter(description = "상품 개수") @RequestParam(required = false) Integer count ) { return BaseResponse.success( - SuccessType.GET_SUCCESS, orderFacade.readOrderSheet(ReadOrderSheetReq.of(userId, stickerId, count))); + SuccessType.GET_SUCCESS, orderFacade.readOrderSheet(userId, PurchaseRequest.of(stickerId, count))); } - @Operation(summary = "결제하기", description = "결제 시트 페이지에서 결제하기") + @Operation(summary = "결제하기", + description = "결제 페이지에서 결제하기" + + "\n- stickerId, count가 존재하는 경우: **단일 상품 구매**" + + "\n- stickerId, count가 존재하지 않는 경우: **장바구니 상품 구매**") @ApiResponses(value = { @ApiResponse( responseCode = "201", @@ -85,10 +91,6 @@ public ResponseEntity getOrderSheet( responseCode = "400", description = "잘못된 요청입니다.", content = @Content(schema = @Schema(implementation = FailResponse.class))), - @ApiResponse( - responseCode = "403", - description = "포인트가 부족하여 결제할 수 없습니다.", - content = @Content(schema = @Schema(implementation = FailResponse.class))), @ApiResponse( responseCode = "404", description = "존재하지 않는 유저입니다.", @@ -105,19 +107,23 @@ public ResponseEntity getOrderSheet( @PostMapping public ResponseEntity order( @Parameter(hidden = true) @UserId Integer userId, - @RequestBody @Valid PostOrderReq req + @RequestBody @Valid OrderReq orderReq, + @Parameter(description = "타투 스티커 id") @RequestParam(required = false) Integer stickerId, + @Parameter(description = "상품 개수") @RequestParam(required = false) Integer count ) { - orderFacade.createOrder(CreateOrderRequest.of( - userId, - req.getStickerId(), - req.getProductCount(), - req.getShippingFee(), - req.getTotalAmount(), - req.getRecipientName(), - req.getContact(), - req.getMailingAddress(), - req.getBaseAddress(), - req.getDetailAddress())); + orderFacade.order( + PurchaseRequest.of(stickerId, count), + CreateOrderReq.builder() + .userId(userId) + .productAmount(orderReq.getProductAmount()) + .shippingFee(orderReq.getShippingFee()) + .totalAmount(orderReq.getTotalAmount()) + .recipientName(orderReq.getRecipientName()) + .contact(orderReq.getContact()) + .mailingAddress(orderReq.getMailingAddress()) + .baseAddress(orderReq.getBaseAddress()) + .detailAddress(orderReq.getDetailAddress()) + .build()); return BaseResponse.success(SuccessType.CREATE_ORDER_SUCCESS); } diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/dto/request/PostOrderReq.java b/server/src/main/java/org/tattour/server/domain/order/controller/dto/request/OrderReq.java similarity index 81% rename from server/src/main/java/org/tattour/server/domain/order/controller/dto/request/PostOrderReq.java rename to server/src/main/java/org/tattour/server/domain/order/controller/dto/request/OrderReq.java index 02c7bee6..8da4a2ad 100644 --- a/server/src/main/java/org/tattour/server/domain/order/controller/dto/request/PostOrderReq.java +++ b/server/src/main/java/org/tattour/server/domain/order/controller/dto/request/OrderReq.java @@ -10,23 +10,18 @@ @Schema(description = "결제하기 Request") @Getter -public class PostOrderReq { - - @Schema(description = "타투 스티커 Id") - @NotNull(message = "stickerId is null") - private Integer stickerId; - - @Schema(description = "상품 개수", example = "3") - @NotNull(message = "productCount is null") - @Min(value = 1) - private Integer productCount; +public class OrderReq { + @Schema(description = "상품 금액", example = "9000") + @NotNull(message = "productAmount is null") + @Min(value = 0) + private Integer productAmount; @Schema(description = "배송비", example = "3000") @NotNull(message = "shippingFee is null") @Min(value = 0) private Integer shippingFee; - @Schema(description = "총 주문금액", example = "12000") + @Schema(description = "총 주문 금액", example = "12000") @NotNull(message = "totalAmount is null") @Min(value = 0) private Integer totalAmount; diff --git a/server/src/main/java/org/tattour/server/domain/order/domain/PurchaseRequest.java b/server/src/main/java/org/tattour/server/domain/order/domain/PurchaseRequest.java new file mode 100644 index 00000000..818f43be --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/order/domain/PurchaseRequest.java @@ -0,0 +1,36 @@ +package org.tattour.server.domain.order.domain; + +import lombok.Getter; +import org.tattour.server.global.exception.BusinessException; +import org.tattour.server.global.exception.ErrorType; + +@Getter +public class PurchaseRequest { + private final Integer stickerId; + private final Integer count; + + private PurchaseRequest(Integer stickerId, Integer count) { + validate(); + this.stickerId = stickerId; + this.count = count; + } + + private void validate() { + if (!isValidRequest()) { + throw new BusinessException(ErrorType.INVALID_ORDERSHEET_ARGUMENT_EXCEPTION); + } + } + + private boolean isValidRequest() { + return (stickerId == null && count == null) || (stickerId != null && count != null); + } + + + public static PurchaseRequest of(Integer stickerId, Integer count) { + return new PurchaseRequest(stickerId, count); + } + + public boolean isCartPurchase() { + return stickerId == null && count == null; + } +} diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/OrderFacade.java b/server/src/main/java/org/tattour/server/domain/order/facade/OrderFacade.java index eb811430..8a9cb2b1 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/OrderFacade.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/OrderFacade.java @@ -1,25 +1,20 @@ package org.tattour.server.domain.order.facade; import org.tattour.server.domain.order.controller.dto.response.ReadOrderSheetRes; -import org.tattour.server.domain.order.facade.dto.request.CreateOrderRequest; -import org.tattour.server.domain.order.facade.dto.request.ReadOrderSheetReq; +import org.tattour.server.domain.order.domain.PurchaseRequest; +import org.tattour.server.domain.order.facade.dto.request.CreateOrderReq; import org.tattour.server.domain.order.facade.dto.request.UpdateOrderStatusReq; import org.tattour.server.domain.order.facade.dto.response.ReadOrderHistoryListRes; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; public interface OrderFacade { - // 결제 시트 불러오기 - ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req); + ReadOrderSheetRes readOrderSheet(int userId, PurchaseRequest purchaseRequest); - // 주문하기 - void createOrder(CreateOrderRequest req); + void order(PurchaseRequest purchaseRequest, CreateOrderReq createOrderReq); - // 유저 결제 내역 불러오기 ReadUserOrderHistoryListRes readOrderHistoryByUserId(Integer userId); - // 모든 결제내역 불러오기 ReadOrderHistoryListRes readOrderHistoryOnPage(int page); - // 주문내역 상태 변경 void updateOrderStatus(UpdateOrderStatusReq req); } diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/CreateOrderReq.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/CreateOrderReq.java new file mode 100644 index 00000000..09a473ef --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/CreateOrderReq.java @@ -0,0 +1,22 @@ +package org.tattour.server.domain.order.facade.dto.request; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class CreateOrderReq { + + private int userId; + private int productAmount; + private int shippingFee; + private int totalAmount; + private String recipientName; + private String contact; + private String mailingAddress; + private String baseAddress; + private String detailAddress; +} diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/CreateOrderRequest.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/CreateOrderRequest.java deleted file mode 100644 index af86858d..00000000 --- a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/CreateOrderRequest.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.tattour.server.domain.order.facade.dto.request; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class CreateOrderRequest { - - private Integer userId; - private Integer stickerId; - private Integer productCount; - private Integer shippingFee; - private Integer totalAmount; - private String recipientName; - private String contact; - private String mailingAddress; - private String baseAddress; - private String detailAddress; - - public static CreateOrderRequest of( - Integer userId, - Integer stickerId, - Integer productCount, - Integer shippingFee, - Integer totalAmount, - String recipientName, - String contact, - String mailingAddress, - String baseAddress, - String detailAddress) { - return new CreateOrderRequest( - userId, - stickerId, - productCount, - shippingFee, - totalAmount, - recipientName, - contact, - mailingAddress, - baseAddress, - detailAddress); - } -} diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java deleted file mode 100644 index 2ecf13f5..00000000 --- a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/ReadOrderSheetReq.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.tattour.server.domain.order.facade.dto.request; - -import javax.validation.constraints.NotNull; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class ReadOrderSheetReq { - - @NotNull(message = "userId is null") - private Integer userId; - - @NotNull(message = "stickerId is null") - private Integer stickerId; - - @NotNull(message = "count is null") - private Integer count; - - public static ReadOrderSheetReq of(Integer userId, Integer stickerId, Integer count) { - return new ReadOrderSheetReq(userId, stickerId, count); - } - - public boolean isCartOrder() { - return stickerId == null && count == null; - } - - public boolean isNotCartOrder() { - return stickerId != null && count != null; - } -} diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java index 458de587..600a74a5 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java @@ -9,11 +9,11 @@ import org.tattour.server.domain.cart.service.CartService; import org.tattour.server.domain.order.controller.dto.response.OrderSheetStickerRes; import org.tattour.server.domain.order.controller.dto.response.ReadOrderSheetRes; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; import org.tattour.server.domain.order.domain.OrderStatus; +import org.tattour.server.domain.order.domain.PurchaseRequest; import org.tattour.server.domain.order.facade.OrderFacade; -import org.tattour.server.domain.order.facade.dto.request.CreateOrderRequest; -import org.tattour.server.domain.order.facade.dto.request.ReadOrderSheetReq; +import org.tattour.server.domain.order.facade.dto.request.CreateOrderReq; import org.tattour.server.domain.order.facade.dto.request.UpdateOrderStatusReq; import org.tattour.server.domain.order.facade.dto.response.ReadOrderHistoryListRes; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; @@ -21,7 +21,6 @@ import org.tattour.server.domain.order.provider.vo.OrderAmountDetailRes; import org.tattour.server.domain.order.provider.vo.OrderHistoryPageInfo; import org.tattour.server.domain.order.service.impl.OrderServiceImpl; -import org.tattour.server.domain.sticker.domain.Sticker; import org.tattour.server.domain.sticker.provider.impl.StickerProviderImpl; import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; import org.tattour.server.domain.user.domain.User; @@ -44,12 +43,12 @@ public class OrderFacadeImpl implements OrderFacade { private final UserProviderImpl userProvider; private final DiscordMessageService discordMessageService; - //todo : 나중에 배달 지역별로 배송비 책정하기 + //todo : 배달 지역별로 배송비 책정하기? @Override @Transactional - public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { - User user = userProvider.readUserById(req.getUserId()); - StickerOrderInfo stickerOrderInfo = getStickerOrderInfo(req); + public ReadOrderSheetRes readOrderSheet(int userId, PurchaseRequest purchaseRequest) { + User user = userProvider.readUserById(userId); + StickerOrderInfo stickerOrderInfo = getStickerOrderInfo(user, purchaseRequest); UserProfileRes userProfileRes = EntityDtoMapper.INSTANCE.toUserProfileInfo(user); @@ -63,41 +62,53 @@ public ReadOrderSheetRes readOrderSheet(ReadOrderSheetReq req) { return ReadOrderSheetRes.of(userProfileRes, orderSheetStickersRes, orderAmountDetailRes); } - private StickerOrderInfo getStickerOrderInfo(ReadOrderSheetReq req) { - if (req.isCartOrder()) { - List carts = cartService.findByUserId(req.getUserId()); - return stickerProvider.getStickerOrderInfoFromCart(carts); - } else if (req.isNotCartOrder()) { - return stickerProvider.getStickerOrderInfoFromOrder(req.getStickerId(), req.getCount()); - } else { - throw new BusinessException(ErrorType.INVALID_ARGUMENT_EXCEPTION); + private StickerOrderInfo getStickerOrderInfo(User user, PurchaseRequest purchaseRequest) { + if (purchaseRequest.isCartPurchase()) { + List carts = cartService.findByUser(user); + if (carts.isEmpty()) { + throw new BusinessException(ErrorType.NOT_FOUND_CARTS_EXCEPTION); + } + return getCartStickersOrderInfo(carts); } + + return getSingleStickerOrderInfo(purchaseRequest.getStickerId(), purchaseRequest.getCount()); + } + + private StickerOrderInfo getSingleStickerOrderInfo(int stickerId, int count) { + return stickerProvider.getStickerOrderInfoFromOrder(stickerId, count); + } + + private StickerOrderInfo getCartStickersOrderInfo(List carts) { + return stickerProvider.getStickerOrderInfoFromCart(carts); } @Override @Transactional - public void createOrder(CreateOrderRequest req) { - User user = userProvider.readUserById(req.getUserId()); - Sticker sticker = stickerProvider.getById(req.getStickerId()); - - Order order = orderService.saveOrder( - Order.of( - sticker.getName(), - sticker.getSize(), - sticker.getMainImageUrl(), - sticker.getPrice(), - req.getProductCount(), - req.getShippingFee(), - req.getTotalAmount(), - req.getRecipientName(), - req.getContact(), - req.getMailingAddress(), - req.getBaseAddress(), - req.getDetailAddress(), - user, - sticker)); - - discordMessageService.sendOrderStickerMessage(order); + public void order(PurchaseRequest purchaseRequest, CreateOrderReq orderReq) { + // todo: totalAmount 비교하고 다름 감지 로직 추가하기 (vo OrderAmount) + User user = userProvider.readUserById(orderReq.getUserId()); + OrderHistory orderHistory = orderService.saveOrder( + OrderHistory.builder() + .productAmount(orderReq.getProductAmount()) + .shippingFee(orderReq.getShippingFee()) + .totalAmount(orderReq.getTotalAmount()) + .recipientName(orderReq.getRecipientName()) + .contact(orderReq.getContact()) + .mailingAddress(orderReq.getMailingAddress()) + .baseAddress(orderReq.getBaseAddress()) + .detailAddress(orderReq.getDetailAddress()) + .user(user) + .build()); + + StickerOrderInfo stickerOrderInfo = getStickerOrderInfo(user, purchaseRequest); + orderService.saveOrderedProducts(orderHistory, stickerOrderInfo); + + if (purchaseRequest.isCartPurchase()) { + cartService.deleteAllByUserId(user); + } + + // todo: 디스코드 일반 구매 메시지 형식 수정하기 + discordMessageService.sendOrderStickerMessage(orderHistory); } @Override @@ -108,7 +119,7 @@ public ReadUserOrderHistoryListRes readOrderHistoryByUserId(Integer userId) { @Override public ReadOrderHistoryListRes readOrderHistoryOnPage(int page) { - Page orderHistoryInfoPage = orderProvider.readOrderHistoryByPage(page); + Page orderHistoryInfoPage = orderProvider.readOrderHistoryByPage(page); return ReadOrderHistoryListRes.of( EntityDtoMapper.INSTANCE.toOrderHistoryInfoPage(orderHistoryInfoPage), @@ -121,16 +132,16 @@ public ReadOrderHistoryListRes readOrderHistoryOnPage(int page) { @Override @Transactional public void updateOrderStatus(UpdateOrderStatusReq req) { - Order order = orderProvider.readOrderById(req.getOrderId()); + OrderHistory orderHistory = orderProvider.readOrderHistoryById(req.getOrderId()); OrderStatus requestedStatus = req.getOrderStatus(); - if (order.getOrderStatus().equals(requestedStatus)) { + if (orderHistory.getOrderStatus().equals(requestedStatus)) { if (requestedStatus.equals(OrderStatus.CANCEL)) { throw new BusinessException(ErrorType.ALREADY_CANCELED_ORDER_HISTORY_EXCEPTION); } } - order.setOrderStatus(req.getOrderStatus()); - orderService.saveOrder(order); + orderHistory.setOrderStatus(req.getOrderStatus()); + orderService.saveOrder(orderHistory); } } diff --git a/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java b/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java index 6e542edc..e13ff1d3 100644 --- a/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java +++ b/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java @@ -1,9 +1,10 @@ package org.tattour.server.domain.order.service; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; +import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; public interface OrderService { + OrderHistory saveOrder(OrderHistory orderHistory); - // 결제하기 - Order saveOrder(Order order); + void saveOrderedProducts(OrderHistory orderHistory, StickerOrderInfo stickerOrderInfo); } diff --git a/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java b/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java index 209586ae..42f2144c 100644 --- a/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java @@ -1,21 +1,45 @@ package org.tattour.server.domain.order.service.impl; +import java.util.List; +import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; +import org.tattour.server.domain.order.domain.OrderedProduct; import org.tattour.server.domain.order.repository.impl.OrderRepositoryImpl; +import org.tattour.server.domain.order.repository.impl.OrderedProductRepositoryImpl; import org.tattour.server.domain.order.service.OrderService; +import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; @Service @RequiredArgsConstructor public class OrderServiceImpl implements OrderService { private final OrderRepositoryImpl orderRepository; + private final OrderedProductRepositoryImpl orderedProductRepository; @Override @Transactional - public Order saveOrder(Order order) { - return orderRepository.save(order); + public OrderHistory saveOrder(OrderHistory orderHistory) { + return orderRepository.save(orderHistory); + } + + @Override + public void saveOrderedProducts(OrderHistory orderHistory, StickerOrderInfo stickerOrderInfo) { + List orderedProducts = stickerOrderInfo.getStickerOrderInfos() + .entrySet() + .stream() + .map(entry -> OrderedProduct.builder() + .name(entry.getKey().getName()) + .price(entry.getKey().getPrice()) + .count(entry.getValue()) + .mainImageUrl(entry.getKey().getMainImageUrl()) + .sticker(entry.getKey()) + .orderHistory(orderHistory) + .build()) + .collect(Collectors.toUnmodifiableList()); + + orderedProductRepository.saveAll(orderedProducts); } } diff --git a/server/src/main/java/org/tattour/server/global/exception/ErrorType.java b/server/src/main/java/org/tattour/server/global/exception/ErrorType.java index ecf0b6a0..71dbf423 100644 --- a/server/src/main/java/org/tattour/server/global/exception/ErrorType.java +++ b/server/src/main/java/org/tattour/server/global/exception/ErrorType.java @@ -13,6 +13,7 @@ public enum ErrorType { VALIDATION_INPUT_EXCEPTION(HttpStatus.BAD_REQUEST, "잘못된 요청입니다."), VALIDATION_WRONG_TYPE_EXCEPTION(HttpStatus.BAD_REQUEST, "잘못된 타입이 입력되었습니다."), INVALID_ARGUMENT_EXCEPTION(HttpStatus.BAD_REQUEST, "잘못된 인자가 입력되었습니다."), + INVALID_ORDERSHEET_ARGUMENT_EXCEPTION(HttpStatus.BAD_REQUEST, "stickerId와 count를 둘 다 제공하거나 제공하지 말아야 합니다."), INVALID_IMAGE_EXCEPTION(HttpStatus.BAD_REQUEST, "잘못된 이미지 파일입니다."), INVALID_CUSTOM_IMAGE_COUNT(HttpStatus.BAD_REQUEST, "이미지 파일이 1개 이상이어야합니다."), INVALID_MULTIPART_EXTENSION_EXCEPTION(HttpStatus.BAD_REQUEST, "잘못된 파일 확장자입니다."), @@ -32,7 +33,6 @@ public enum ErrorType { /** * 403 FORBIDDEN */ - LACK_OF_POINT_EXCEPTION(HttpStatus.FORBIDDEN, "포인트가 부족하여 결제할 수 없습니다."), ACCOUNT_LOCKED_EXCEPTION(HttpStatus.FORBIDDEN, "과도한 로그인 시도 실패로 인해 계정이 잠겼습니다."), /** @@ -50,10 +50,10 @@ public enum ErrorType { NOT_FOUND_CART_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 장바구니입니다."), NOT_FOUND_VERIFICATION_CODE_EXCEPTION(HttpStatus.NOT_FOUND, "유효한 인증번호가 존재하지 않습니다."), NOT_FOUND_SAVE_IMAGE_EXCEPTION(HttpStatus.NOT_FOUND, "이미지가 존재하지 않습니다."), - NOT_FOUND_POINT_CHARGE_REQUEST_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 포인트 충전 요청입니다."), NOT_FOUND_STICKER_SORT_EXCEPTION(HttpStatus.NOT_FOUND, "스티커 정렬 기준이 존재하지 않습니다."), NOT_FOUND_HEADER_ORIGIN(HttpStatus.NOT_FOUND, "Origin을 찾을 수 없습니다."), NOT_FOUND_MAGAZINE_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않은 매거진 입니다."), + NOT_FOUND_CARTS_EXCEPTION(HttpStatus.NOT_FOUND, "장바구니에 상품이 존재하지 않습니다."), /** * 405 METHOD NOT ALLOWED @@ -65,9 +65,7 @@ public enum ErrorType { */ ALREADY_EXIST_USER_EXCEPTION(HttpStatus.CONFLICT, "이미 존재하는 유저 이름입니다."), ALREADY_EXIST_PRODUCTLIKED_EXCEPTION(HttpStatus.CONFLICT, "이미 존재하는 좋아요한 상품입니다."), - ALREADY_COMPLETED_POINT_CHARGE_REQUEST_EXCEPTION(HttpStatus.CONFLICT, "이미 처리된 포인트 충전 요청입니다."), ALREADY_CANCELED_ORDER_HISTORY_EXCEPTION(HttpStatus.CONFLICT, "이미 취소 처리된 결제 내역입니다."), - AMOUNT_MATCHED_EXCEPTION(HttpStatus.CONFLICT, "송금 금액과 충전 금액이 일치합니다. 충전 요청을 취소할 수 없습니다."), /** * 500 INTERNAL SERVER ERROR diff --git a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java index 55e2c8ab..ab702ff3 100644 --- a/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java +++ b/server/src/main/java/org/tattour/server/global/util/EntityDtoMapper.java @@ -13,7 +13,7 @@ import org.tattour.server.domain.custom.facade.dto.response.CreateCustomSummaryRes; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryRes; import org.tattour.server.domain.order.controller.dto.response.OrderSheetStickerRes; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; import org.tattour.server.domain.order.provider.vo.OrderAmountDetailRes; import org.tattour.server.domain.order.provider.vo.OrderHistoryInfo; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; @@ -53,19 +53,21 @@ public interface EntityDtoMapper { List toStickerLikedInfoList(List productLiked); // Order + // todo: OrderedProduct 변경에 맞춰 수정하기 @Mapping(target = "userId", source = "user.id") - @Mapping(target = "stickerId", source = "sticker.id") - UserOrderHistoryInfo toGetUserOrderHistoryRes(Order order); +// @Mapping(target = "stickerId", source = "sticker.id") + UserOrderHistoryInfo toGetUserOrderHistoryRes(OrderHistory orderHistory); - List toGetUserOrderHistoryListRes(List orderList); + List toGetUserOrderHistoryListRes(List orderHistoryList); + // todo: OrderedProduct 변경에 맞춰 수정하기 @Mapping(target = "userId", source = "user.id") - @Mapping(target = "stickerId", source = "sticker.id") +// @Mapping(target = "stickerId", source = "sticker.id") @Mapping(target = "orderStatus", source = "orderStatus.value") - OrderHistoryInfo toOrderHistoryInfo(Order order); + OrderHistoryInfo toOrderHistoryInfo(OrderHistory orderHistory); @IterableMapping(elementTargetType = OrderHistoryInfo.class) - List toOrderHistoryInfoPage(Page orderPage); + List toOrderHistoryInfoPage(Page orderPage); default List toOrderSheetStickerRes(StickerOrderInfo stickerOrderInfo) { return stickerOrderInfo.getStickerOrderInfos() From d5ad13c8d681571fd3dde2cee6a165d8730dec96 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 02:07:21 +0900 Subject: [PATCH 18/32] =?UTF-8?q?[FIX]=20=EC=9D=BC=EB=B0=98=20=EA=B2=B0?= =?UTF-8?q?=EC=A0=9C=20=ED=9B=84=20=EB=94=94=EC=8A=A4=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=9E=84=EC=8B=9C=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=EC=9C=BC=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 --- .../resquest/OrderStickerDiscordMessage.java | 44 +++++++++++-------- .../service/DiscordMessageService.java | 10 ++--- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/OrderStickerDiscordMessage.java b/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/OrderStickerDiscordMessage.java index 33dd3462..dca1d987 100644 --- a/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/OrderStickerDiscordMessage.java +++ b/server/src/main/java/org/tattour/server/infra/discord/dto/resquest/OrderStickerDiscordMessage.java @@ -3,7 +3,7 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; @Getter @AllArgsConstructor(access = AccessLevel.PRIVATE) @@ -13,25 +13,31 @@ public class OrderStickerDiscordMessage { String description; DiscordCustomImage image; - public static OrderStickerDiscordMessage from(Order order) { - String title = "Order Id : " + order.getId(); - String description = "\n유저 Id : " + order.getUser().getId() - + "\n수령인 : " + order.getRecipientName() - + "\n연락처 : " + order.getContact() - + "\n유저 이메일 : " + order.getMailingAddress() - + "\n상품 Id : " + order.getProductName() - + "\n상품 이름 : " + order.getProductName() - + "\n상품 크기 : " + order.getProductSize() - + "\n상품 금액 : " + order.getProductAmount() - + "\n상품 개수 : " + order.getProductCount() - + "\n총 주문 금액 : " + order.getTotalAmount() - + "\n기본 주소 : " + order.getBaseAddress() - + "\n싱세 주소 : " + order.getDetailAddress() - + "\n배송비 : " + order.getShippingFee(); + // todo: 디스코드 메시지 내용 형식 수정 + public static OrderStickerDiscordMessage from(OrderHistory orderHistory) { +// String title = "Order Id : " + orderHistory.getId(); +// String description = "\n유저 Id : " + orderHistory.getUser().getId() +// + "\n수령인 : " + orderHistory.getRecipientName() +// + "\n연락처 : " + orderHistory.getContact() +// + "\n유저 이메일 : " + orderHistory.getMailingAddress() +// + "\n상품 Id : " + orderHistory.getProductName() +// + "\n상품 이름 : " + orderHistory.getProductName() +// + "\n상품 크기 : " + orderHistory.getProductSize() +// + "\n상품 금액 : " + orderHistory.getProductAmount() +// + "\n상품 개수 : " + orderHistory.getProductCount() +// + "\n총 주문 금액 : " + orderHistory.getTotalAmount() +// + "\n기본 주소 : " + orderHistory.getBaseAddress() +// + "\n싱세 주소 : " + orderHistory.getDetailAddress() +// + "\n배송비 : " + orderHistory.getShippingFee(); +// return new OrderStickerDiscordMessage( +// title, +// description, +// new DiscordCustomImage(orderHistory.getProductImageUrl()) +// ); return new OrderStickerDiscordMessage( - title, - description, - new DiscordCustomImage(order.getProductImageUrl()) + "[임시 응답]", + "메시지 형식에 대한 추가 개발이 필요해 임시 응답을 전달합니다.", + new DiscordCustomImage(null) ); } } diff --git a/server/src/main/java/org/tattour/server/infra/discord/service/DiscordMessageService.java b/server/src/main/java/org/tattour/server/infra/discord/service/DiscordMessageService.java index 9177958c..f1580b4e 100644 --- a/server/src/main/java/org/tattour/server/infra/discord/service/DiscordMessageService.java +++ b/server/src/main/java/org/tattour/server/infra/discord/service/DiscordMessageService.java @@ -4,7 +4,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.order.domain.Order; +import org.tattour.server.domain.order.domain.OrderHistory; import org.tattour.server.domain.user.domain.User; import org.tattour.server.infra.discord.client.DiscordApiClient; import org.tattour.server.infra.discord.dto.resquest.CustomApplyDiscordMessage; @@ -42,15 +42,15 @@ public Boolean sendCustomApplyMessage(Custom custom) { } @Transactional - public Boolean sendOrderStickerMessage(Order order) { - OrderStickerDiscordMessage payload = OrderStickerDiscordMessage.from(order); + public Boolean sendOrderStickerMessage(OrderHistory orderHistory) { + OrderStickerDiscordMessage payload = OrderStickerDiscordMessage.from(orderHistory); sendDiscordMessage(orderWebhookProperty.getClientId(), orderWebhookProperty.getToken(), - order.getUser(), "님이 스티커를 주문했습니다.", payload); + orderHistory.getUser(), "님이 스티커를 주문했습니다.", payload); return true; } public void sendDiscordMessage(String clientId, String token, User user, String content, - Object payload) { + Object payload) { DiscordMessageReq request = DiscordMessageReq.from(user, content, payload); discordApiClient.sendMessage(clientId, token, request); } From 1efee11d1167773be53da4821dad82ac290d5269 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 02:08:29 +0900 Subject: [PATCH 19/32] =?UTF-8?q?[REFACTOR]=20=EC=8A=A4=ED=8B=B0=EC=BB=A4?= =?UTF-8?q?=20=EC=83=81=ED=92=88=20=EC=88=9C=EC=84=9C=20=EB=B3=B4=EC=9E=A5?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=B4=20getStickerOrderInfoFromCart?= =?UTF-8?q?=EC=97=90=EC=84=9C=20LinkedHashMap=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/sticker/provider/impl/StickerProviderImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java index 9a371afc..66c9614b 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java @@ -1,5 +1,6 @@ package org.tattour.server.domain.sticker.provider.impl; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -38,7 +39,9 @@ public StickerOrderInfo getStickerOrderInfoFromCart(List carts) { .collect(Collectors.collectingAndThen( Collectors.toMap( Cart::getSticker, - Cart::getCount), + Cart::getCount, + Integer::sum, + LinkedHashMap::new), StickerOrderInfo::of)); } From 11805713bfbf8b3cdb45106d082c968f6093f4b1 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 02:08:44 +0900 Subject: [PATCH 20/32] =?UTF-8?q?[STYLE]=20=EC=BD=94=EB=93=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A0=AC,=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/domain/custom/domain/Custom.java | 3 -- .../repository/impl/CustomRepositoryImpl.java | 34 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java b/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java index 1924e423..cea9e8fd 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java +++ b/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java @@ -85,9 +85,6 @@ public class Custom extends AuditingTimeEntity { private Integer price; - /** - * Mapped By - */ @OneToMany(mappedBy = "custom") private List customThemes = new ArrayList<>(); diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java index 6a4d697d..ce9f4586 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java @@ -11,23 +11,23 @@ @RequiredArgsConstructor public class CustomRepositoryImpl implements CustomRepositoryCustom { - private final JPAQueryFactory queryFactory; + private final JPAQueryFactory queryFactory; - @Override - public List findAllByUserIdAndIsCompleted(Integer userId) { - return queryFactory - .select(custom) - .from(custom) - .where(custom.user.id.eq(userId), custom.isCompleted.eq(true)) - .fetch(); - } + @Override + public List findAllByUserIdAndIsCompleted(Integer userId) { + return queryFactory + .select(custom) + .from(custom) + .where(custom.user.id.eq(userId), custom.isCompleted.eq(true)) + .fetch(); + } - @Override - public List findAllByUserIdAndIsCompletedFalse(Integer userId) { - return queryFactory - .select(custom) - .from(custom) - .where(custom.user.id.eq(userId), custom.isCompleted.eq(false)) - .fetch(); - } + @Override + public List findAllByUserIdAndIsCompletedFalse(Integer userId) { + return queryFactory + .select(custom) + .from(custom) + .where(custom.user.id.eq(userId), custom.isCompleted.eq(false)) + .fetch(); + } } From 082c361593fae48e75193cb92446ca612cb395aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=B0=AC=EB=AF=B8?= Date: Wed, 6 Dec 2023 02:13:54 +0900 Subject: [PATCH 21/32] =?UTF-8?q?[FIX]=20deploy.sh=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=84=B8=EC=8A=A4=20=EC=A2=85=EB=A3=8C=EA=B0=80=20=EC=95=88?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EC=97=90=EB=9F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index a3a0e551..b865709a 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -10,20 +10,19 @@ DEPLOY_PATH=/home/ubuntu/app/nonstop/jar/ cp $BUILD_PATH $DEPLOY_PATH echo "> 현재 구동중인 Set 확인" -if [ $DEPLOY_ENV == main ] -then +if [ $DEPLOY_ENV = "main" ]; then echo $DEPLOY_ENV - CURRENT_PROFILE=$(curl -s https://api.tattour.shop/profile) -elif [ $DEPLOY_ENV == dev ] -then + CURRENT_PROFILE=$(curl -s https://api.tattour.shop/profile) || { echo "Curl 요청 실패";} +elif [ $DEPLOY_ENV = "dev" ]; then echo $DEPLOY_ENV - CURRENT_PROFILE=$(curl -s https://dev.tattour.shop/profile) + CURRENT_PROFILE=$(curl -s https://dev.tattour.shop/profile) || { echo "Curl 요청 실패";} else - echo "> DEPLOY_ENV가 설정되지 않았습니. DEPLOY_ENV: $DEPLOY_ENV" + echo "> DEPLOY_ENV가 설정되지 않았습니다. DEPLOY_ENV: $DEPLOY_ENV" + exit 1 fi echo "> $CURRENT_PROFILE" -# 쉬고 있는 set 찾기: set1이 사용중이면 set2가 쉬고 있고, 반대면 set1이 쉬고 있음 +# 쉬고 있는 set 찾기 if [ $CURRENT_PROFILE == set1 ] then IDLE_PROFILE=set2 @@ -58,7 +57,7 @@ else fi echo "> $IDLE_PROFILE 배포" -# echo "> nohup java -jar -Duser.timezone=Asia/Seoul -Dspring.profiles.active=$IDLE_PROFILE $IDLE_APPLICATION_PATH >> /home/ubuntu/app/nohup.out 2>&1 & " +echo "> nohup java -jar -Duser.timezone=Asia/Seoul -Dspring.profiles.active=$IDLE_PROFILE $IDLE_APPLICATION_PATH >> /home/ubuntu/app/nohup.out 2>&1 & " nohup java -jar -Duser.timezone=Asia/Seoul -Dspring.profiles.active=$IDLE_PROFILE $IDLE_APPLICATION_PATH >> /home/ubuntu/app/nohup.out 2>&1 & echo "> $IDLE_PROFILE 10초 후 Health check 시작" From fd7755537b564b2a0b0005334f78a5d65e58c9bf Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 03:21:09 +0900 Subject: [PATCH 22/32] =?UTF-8?q?[FIX,=20FEAT]=20=EC=9E=A5=EB=B0=94?= =?UTF-8?q?=EA=B5=AC=EB=8B=88=20=EC=88=98=EB=9F=89=201=EA=B0=9C=20?= =?UTF-8?q?=EC=A6=9D=EA=B0=80=20->=20=EC=88=98=EB=9F=89=20=EC=9D=BC?= =?UTF-8?q?=EA=B4=84=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/cart/controller/CartController.java | 17 +++++++++-------- .../controller/dto/request/CartCountReq.java | 9 +++++++++ .../{SaveCartReq.java => CartItemReq.java} | 4 ++-- .../dto/request/UpdateCartCountReq.java | 9 +++++++++ .../server/domain/cart/domain/Cart.java | 4 ++-- .../server/domain/cart/facade/CartFacade.java | 7 ++++--- .../cart/facade/impl/CartFacadeImpl.java | 18 ++++++++++++------ .../domain/cart/service/CartService.java | 4 +--- .../cart/service/impl/CartServiceImpl.java | 10 +--------- 9 files changed, 49 insertions(+), 33 deletions(-) create mode 100644 server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartCountReq.java rename server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/{SaveCartReq.java => CartItemReq.java} (90%) create mode 100644 server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/UpdateCartCountReq.java diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java index 7e4f4016..665820a7 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java @@ -20,7 +20,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; +import org.tattour.server.domain.cart.controller.dto.request.CartItemReq; +import org.tattour.server.domain.cart.controller.dto.request.UpdateCartCountReq; import org.tattour.server.domain.cart.controller.dto.response.CartItemsRes; import org.tattour.server.domain.cart.facade.CartFacade; import org.tattour.server.global.config.annotations.UserId; @@ -64,9 +65,9 @@ public class CartController { @PostMapping public ResponseEntity saveCartItem( @Parameter(hidden = true) @UserId Integer userId, - @RequestBody @Valid SaveCartReq saveCartReq + @RequestBody @Valid CartItemReq cartItemReq ) { - cartFacade.saveCartItem(userId, saveCartReq); + cartFacade.saveCartItem(userId, cartItemReq); return BaseResponse.success(SuccessType.CREATE_SUCCESS); } @@ -92,7 +93,7 @@ public ResponseEntity getUserCartItem( return BaseResponse.success(SuccessType.GET_SUCCESS, cartFacade.getUserCartItems(userId)); } - @Operation(summary = "장바구니 수량 1개 더하기") + @Operation(summary = "장바구니 수량 일괄 수정") @ApiResponses(value = { @ApiResponse( responseCode = "200", @@ -111,11 +112,11 @@ public ResponseEntity getUserCartItem( description = "알 수 없는 서버 에러가 발생했습니다.", content = @Content(schema = @Schema(implementation = FailResponse.class))) }) - @PatchMapping("/{cartId}") - public ResponseEntity addCartCount( + @PatchMapping + public ResponseEntity updateCartCount( @Parameter(hidden = true) @UserId Integer userId, - @PathVariable Integer cartId) { - cartFacade.increaseCartCount(userId, cartId); + @RequestBody UpdateCartCountReq req) { + cartFacade.updateCartsCount(userId, req); return BaseResponse.success(SuccessType.UPDATE_SUCCESS); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartCountReq.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartCountReq.java new file mode 100644 index 00000000..584dbf7b --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartCountReq.java @@ -0,0 +1,9 @@ +package org.tattour.server.domain.cart.controller.dto.request; + +import lombok.Getter; + +@Getter +public class CartCountReq { + private int cartId; + private int count; +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartItemReq.java similarity index 90% rename from server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java rename to server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartItemReq.java index 4b6e1302..947c9595 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/SaveCartReq.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartItemReq.java @@ -7,10 +7,10 @@ @Getter @NoArgsConstructor -public class SaveCartReq { +public class CartItemReq { @NotNull private int stickerId; - + @NotNull @Min(1) private int count; diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/UpdateCartCountReq.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/UpdateCartCountReq.java new file mode 100644 index 00000000..0c22765f --- /dev/null +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/UpdateCartCountReq.java @@ -0,0 +1,9 @@ +package org.tattour.server.domain.cart.controller.dto.request; + +import java.util.List; +import lombok.Getter; + +@Getter +public class UpdateCartCountReq { + private List cartCountReqs; +} diff --git a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java b/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java index 489684c7..a55cc83e 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java +++ b/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java @@ -40,7 +40,7 @@ public void addCount(int count) { this.count += count; } - public void increaseCount() { - this.count += COUNT_INCREMENT; + public void updateCount(int count) { + this.count = count; } } diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java index a553d067..f5937661 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/CartFacade.java @@ -1,14 +1,15 @@ package org.tattour.server.domain.cart.facade; -import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; +import org.tattour.server.domain.cart.controller.dto.request.CartItemReq; +import org.tattour.server.domain.cart.controller.dto.request.UpdateCartCountReq; import org.tattour.server.domain.cart.controller.dto.response.CartItemsRes; public interface CartFacade { - void saveCartItem(int userId, SaveCartReq req); + void saveCartItem(int userId, CartItemReq req); CartItemsRes getUserCartItems(int userId); - void increaseCartCount(int userId, int cartId); + void updateCartsCount(int userId, UpdateCartCountReq req); void deleteCartItem(int userId, int cartId); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java index 970d543a..7478057a 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java @@ -6,7 +6,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.tattour.server.domain.cart.controller.dto.request.SaveCartReq; +import org.tattour.server.domain.cart.controller.dto.request.CartItemReq; +import org.tattour.server.domain.cart.controller.dto.request.UpdateCartCountReq; import org.tattour.server.domain.cart.controller.dto.response.CartItemsRes; import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.cart.facade.CartFacade; @@ -27,7 +28,7 @@ public class CartFacadeImpl implements CartFacade { @Override @Transactional - public void saveCartItem(int userId, SaveCartReq req) { + public void saveCartItem(int userId, CartItemReq req) { User user = userService.readUserById(userId); Sticker sticker = stickerProvider.getById(req.getStickerId()); @@ -36,6 +37,7 @@ public void saveCartItem(int userId, SaveCartReq req) { //todo : 배송 지역별 배송비 책정 @Override + @Transactional(readOnly = true) public CartItemsRes getUserCartItems(int userId) { List carts = cartService.findByUserId(userId); StickerOrderInfo stickerOrderInfo = stickerProvider.getStickerOrderInfoFromCart(carts); @@ -46,14 +48,18 @@ public CartItemsRes getUserCartItems(int userId) { } @Override - public void increaseCartCount(int userId, int cartId) { - Cart cart = cartService.findByIdAndUserId(userId, cartId); - cartService.increaseCartCount(cart); + @Transactional + public void updateCartsCount(int userId, UpdateCartCountReq updateCartCountReq) { + updateCartCountReq.getCartCountReqs() + .forEach(req -> cartService + .findByIdAndUserId(req.getCartId(), userId) + .updateCount(req.getCount())); } @Override + @Transactional public void deleteCartItem(int userId, int cartId) { - Cart cart = cartService.findByIdAndUserId(userId, cartId); + Cart cart = cartService.findByIdAndUserId(cartId, userId); cartService.delete(cart); } } \ No newline at end of file diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java index 2777b759..cd1dcd3b 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java @@ -13,14 +13,12 @@ public interface CartService { Optional findByUserAndSticker(User user, Sticker sticker); - Cart findByIdAndUserId(int userId, int cartId); + Cart findByIdAndUserId(int id, int userId); void mergeOrAddToCart(User user, Sticker sticker, int count); Cart createNewCart(User user, Sticker sticker, int count); - void increaseCartCount(Cart cart); - void delete(Cart cart); void deleteAllByUserId(User user); diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java index 7f0f729c..654fcde5 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java @@ -4,7 +4,6 @@ import java.util.Optional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.cart.repository.CartRepositoryImpl; import org.tattour.server.domain.cart.service.CartService; @@ -34,7 +33,7 @@ public Optional findByUserAndSticker(User user, Sticker sticker) { } @Override - public Cart findByIdAndUserId(int userId, int id) { + public Cart findByIdAndUserId(int id, int userId) { return cartRepositoryImpl.findByIdAndUser_Id(id, userId) .orElseThrow(() -> new BusinessException(ErrorType.NOT_FOUND_CART_EXCEPTION)); } @@ -59,13 +58,6 @@ public Cart createNewCart(User user, Sticker sticker, int count) { .build(); } - @Override - @Transactional - public void increaseCartCount(Cart cart) { - cart.increaseCount(); - cartRepositoryImpl.save(cart); - } - @Override public void delete(Cart cart) { cartRepositoryImpl.delete(cart); From 15a9b5d49ab78987931169ff026145b83ad0ffd2 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Wed, 6 Dec 2023 03:26:15 +0900 Subject: [PATCH 23/32] =?UTF-8?q?[DOCS]=20cart,=20order=20controller=20?= =?UTF-8?q?=EB=AA=85=EC=84=B8=EC=84=9C=20=EC=84=A4=EB=AA=85=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/domain/cart/controller/CartController.java | 4 ++-- .../domain/cart/controller/dto/request/CartCountReq.java | 8 ++++++++ .../domain/cart/controller/dto/request/CartItemReq.java | 3 +++ .../cart/controller/dto/request/UpdateCartCountReq.java | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java index 665820a7..1f800495 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/CartController.java @@ -115,7 +115,7 @@ public ResponseEntity getUserCartItem( @PatchMapping public ResponseEntity updateCartCount( @Parameter(hidden = true) @UserId Integer userId, - @RequestBody UpdateCartCountReq req) { + @RequestBody @Valid UpdateCartCountReq req) { cartFacade.updateCartsCount(userId, req); return BaseResponse.success(SuccessType.UPDATE_SUCCESS); } @@ -142,7 +142,7 @@ public ResponseEntity updateCartCount( @DeleteMapping("/{cartId}") public ResponseEntity deleteCartCount( @Parameter(hidden = true) @UserId Integer userId, - @PathVariable Integer cartId) { + @Parameter(description = "장바구니 Id") @PathVariable Integer cartId) { cartFacade.deleteCartItem(userId, cartId); return BaseResponse.success(SuccessType.DELETE_SUCCESS); } diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartCountReq.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartCountReq.java index 584dbf7b..1ece0057 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartCountReq.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartCountReq.java @@ -1,9 +1,17 @@ package org.tattour.server.domain.cart.controller.dto.request; +import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.NotNull; import lombok.Getter; +@Schema(description = "장바구니 수량 수정 Request") @Getter public class CartCountReq { + @Schema(description = "장바구니 Id") + @NotNull(message = "장바구니 id는 null일 수 없습니다.") private int cartId; + + @Schema(description = "장바구니 수량") + @NotNull(message = "장바구니 수량 null일 수 없습니다.") private int count; } diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartItemReq.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartItemReq.java index 947c9595..83332452 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartItemReq.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/CartItemReq.java @@ -1,5 +1,6 @@ package org.tattour.server.domain.cart.controller.dto.request; +import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import lombok.Getter; @@ -8,9 +9,11 @@ @Getter @NoArgsConstructor public class CartItemReq { + @Schema(description = "스티커 Id") @NotNull private int stickerId; + @Schema(description = "스티커 수량") @NotNull @Min(1) private int count; diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/UpdateCartCountReq.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/UpdateCartCountReq.java index 0c22765f..e11f0ad1 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/UpdateCartCountReq.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/request/UpdateCartCountReq.java @@ -1,9 +1,12 @@ package org.tattour.server.domain.cart.controller.dto.request; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import lombok.Getter; +@Schema(description = "장바구니 수량 일괄 수정 Request") @Getter public class UpdateCartCountReq { + @Schema(description = "장바구니 수량 수정 Request 목록") private List cartCountReqs; } From b68d6a49e1aa1ee2f2e96b1a6daac29eebf7c9ee Mon Sep 17 00:00:00 2001 From: 05AM Date: Wed, 6 Dec 2023 12:38:00 +0900 Subject: [PATCH 24/32] =?UTF-8?q?[FIX]=20CartItemRes=EC=97=90=20=EC=9E=A5?= =?UTF-8?q?=EB=B0=94=EA=B5=AC=EB=8B=88=20Id=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/domain/cart/controller/dto/response/CartItemRes.java | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemRes.java b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemRes.java index 36de701b..4843b68d 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemRes.java +++ b/server/src/main/java/org/tattour/server/domain/cart/controller/dto/response/CartItemRes.java @@ -6,6 +6,7 @@ @Getter @Setter public class CartItemRes { + private int id; private int stickerId; private String mainImageUrl; private String name; From 4680a3353840f199acae398e6810489150de249c Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 10 Dec 2023 18:01:32 +0900 Subject: [PATCH 25/32] =?UTF-8?q?[CHORE]=20=EA=B0=81=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=EC=9D=98=20=ED=8C=A8=ED=82=A4=EC=A7=80=20domain=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD=20->=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/util/EntityDtoMapperImpl.java | 321 +++++++++--------- .../dto/request/PatchCustomProcessReq.java | 2 +- .../admin/facade/impl/AdminFacadeImpl.java | 4 +- .../domain/admin/{domain => model}/Admin.java | 2 +- .../{domain => model}/AdminAccessLog.java | 2 +- .../repository/AdminAccessLogRepository.java | 2 +- .../admin/repository/AdminRepositoryImpl.java | 2 +- .../domain/admin/service/AdminService.java | 2 +- .../admin/service/impl/AdminServiceImpl.java | 4 +- .../banner/{domain => model}/Banner.java | 2 +- .../cart/facade/impl/CartFacadeImpl.java | 6 +- .../domain/cart/{domain => model}/Cart.java | 6 +- .../cart/repository/CartRepositoryImpl.java | 6 +- .../domain/cart/service/CartService.java | 6 +- .../cart/service/impl/CartServiceImpl.java | 6 +- .../facade/dto/request/UpdateCustomReq.java | 6 +- .../facade/dto/response/ReadCustomRes.java | 4 +- .../response/ReadCustomSummaryListRes.java | 2 +- .../dto/response/ReadCustomSummaryRes.java | 2 +- .../custom/facade/impl/CustomFacadeImpl.java | 6 +- .../custom/{domain => model}/Custom.java | 6 +- .../custom/{domain => model}/CustomImage.java | 2 +- .../{domain => model}/CustomProcess.java | 2 +- .../custom/{domain => model}/CustomSize.java | 2 +- .../custom/{domain => model}/CustomStyle.java | 4 +- .../custom/{domain => model}/CustomTheme.java | 4 +- .../custom/provider/CustomProvider.java | 2 +- .../provider/impl/CustomProviderImpl.java | 2 +- .../repository/CustomImageRepository.java | 2 +- .../custom/repository/CustomRepository.java | 2 +- .../repository/CustomStyleRepository.java | 2 +- .../repository/CustomThemeRepository.java | 2 +- .../custom/CustomRepositoryCustom.java | 2 +- .../impl/CustomImageRepositoryImpl.java | 2 +- .../repository/impl/CustomRepositoryImpl.java | 4 +- .../impl/CustomStyleRepositoryImpl.java | 2 +- .../impl/CustomThemeRepositoryImpl.java | 2 +- .../custom/service/CustomImageService.java | 2 +- .../domain/custom/service/CustomService.java | 18 +- .../custom/service/CustomStyleService.java | 4 +- .../custom/service/CustomThemeService.java | 4 +- .../service/impl/CustomImageServiceImpl.java | 2 +- .../service/impl/CustomServiceImpl.java | 182 +++++----- .../service/impl/CustomStyleServiceImpl.java | 4 +- .../service/impl/CustomThemeServiceImpl.java | 4 +- .../facade/dto/request/CreateDiscountReq.java | 1 - .../facade/impl/DiscountFacadeImpl.java | 4 +- .../discount/{domain => model}/Discount.java | 2 +- .../discount/provider/DiscountProvider.java | 2 +- .../provider/impl/DiscountProviderImpl.java | 2 +- .../repository/DiscountRepository.java | 2 +- .../impl/DiscountRepositoryImpl.java | 2 +- .../facade/dto/response/ReadMagazineRes.java | 2 +- .../dto/response/ReadMagazineUrlRes.java | 2 +- .../magazine/{domain => model}/Magazine.java | 2 +- .../magazine/provider/MagazineProvider.java | 2 +- .../provider/impl/MagazineProviderImpl.java | 2 +- .../repository/MagazineRepository.java | 2 +- .../impl/MagazineRepositoryImpl.java | 2 +- .../order/controller/OrderController.java | 2 +- .../dto/request/PatchOrderStatusReq.java | 2 +- .../domain/order/facade/OrderFacade.java | 2 +- .../dto/request/UpdateOrderStatusReq.java | 2 +- .../order/facade/impl/OrderFacadeImpl.java | 10 +- .../order/{domain => model}/OrderHistory.java | 4 +- .../order/{domain => model}/OrderStatus.java | 2 +- .../{domain => model}/OrderedProduct.java | 4 +- .../{domain => model}/PurchaseRequest.java | 2 +- .../domain/order/provider/OrderProvider.java | 2 +- .../provider/impl/OrderProviderImpl.java | 2 +- .../repository/impl/OrderRepositoryImpl.java | 2 +- .../impl/OrderedProductRepositoryImpl.java | 2 +- .../domain/order/service/OrderService.java | 2 +- .../order/service/impl/OrderServiceImpl.java | 4 +- .../search/facade/impl/SearchFacadeImpl.java | 2 +- .../dto/response/ReadStickerForUserRes.java | 2 +- .../facade/dto/response/ReadStickerRes.java | 2 +- .../response/ReadStickerSummaryListRes.java | 2 +- .../dto/response/ReadStickerSummaryRes.java | 2 +- .../facade/impl/StickerFacadeImpl.java | 10 +- .../sticker/{domain => model}/Sticker.java | 6 +- .../{domain => model}/StickerImage.java | 2 +- .../{domain => model}/StickerSort.java | 2 +- .../{domain => model}/StickerStyle.java | 4 +- .../{domain => model}/StickerTheme.java | 4 +- .../sticker/provider/StickerProvider.java | 4 +- .../provider/impl/StickerProviderImpl.java | 4 +- .../sticker/provider/vo/StickerOrderInfo.java | 2 +- .../repository/StickerImageRepository.java | 2 +- .../sticker/repository/StickerRepository.java | 2 +- .../repository/StickerStyleRepository.java | 3 +- .../repository/StickerThemeRepository.java | 3 +- .../custom/StickerRepositoryCustom.java | 2 +- .../impl/StickerImageRepositoryImpl.java | 2 +- .../impl/StickerRepositoryImpl.java | 14 +- .../impl/StickerStyleRepositoryImpl.java | 2 +- .../impl/StickerThemeRepositoryImpl.java | 2 +- .../sticker/service/StickerImageService.java | 2 +- .../sticker/service/StickerService.java | 2 +- .../sticker/service/StickerStyleService.java | 2 +- .../sticker/service/StickerThemeService.java | 2 +- .../service/impl/StickerImageServiceImpl.java | 2 +- .../service/impl/StickerServiceImpl.java | 2 +- .../service/impl/StickerStyleServiceImpl.java | 2 +- .../service/impl/StickerThemeServiceImpl.java | 2 +- .../facade/dto/response/ReadStyleListRes.java | 18 +- .../facade/dto/response/ReadStyleRes.java | 2 +- .../dto/response/ReadStyleSummaryListRes.java | 18 +- .../dto/response/ReadStyleSummaryRes.java | 2 +- .../style/facade/impl/StyleFacadeImpl.java | 4 +- .../domain/style/{domain => model}/Style.java | 7 +- .../domain/style/provider/StyleProvider.java | 6 +- .../provider/impl/StyleProviderImpl.java | 22 +- .../style/repository/StyleRepository.java | 6 +- .../repository/impl/StyleRepositoryImpl.java | 6 +- .../facade/dto/response/ReadThemeListRes.java | 18 +- .../facade/dto/response/ReadThemeRes.java | 2 +- .../dto/response/ReadThemeSummaryListRes.java | 18 +- .../dto/response/ReadThemeSummaryRes.java | 2 +- .../theme/facade/impl/ThemeFacadeImpl.java | 4 +- .../domain/theme/{domain => model}/Theme.java | 2 +- .../domain/theme/provider/ThemeProvider.java | 6 +- .../provider/impl/ThemeProviderImpl.java | 24 +- .../theme/repository/ThemeRepository.java | 6 +- .../repository/impl/ThemeRepositoryImpl.java | 2 +- .../user/facade/impl/UserFacadeImpl.java | 4 +- .../user/{domain => model}/ProductLiked.java | 4 +- .../domain/user/{domain => model}/User.java | 2 +- .../user/{domain => model}/UserRole.java | 2 +- .../UserShippingAddress.java | 10 +- .../user/provider/ProductLikedProvider.java | 2 +- .../domain/user/provider/UserProvider.java | 2 +- .../impl/ProductLikedProviderImpl.java | 2 +- .../user/provider/impl/UserProviderImpl.java | 2 +- .../impl/ProductLikedRepositoryImpl.java | 4 +- .../repository/impl/UserRepositoryImpl.java | 2 +- .../UserShippingAddressRepositoryImpl.java | 3 +- .../domain/user/service/UserService.java | 2 +- .../service/impl/ProductLikedServiceImpl.java | 50 +-- .../user/service/impl/UserServiceImpl.java | 2 +- .../impl/UserShippingAddressServiceImpl.java | 4 +- .../interceptors/AdminRoleInterceptor.java | 2 +- .../config/resolver/UserIdResolver.java | 2 +- .../server/global/util/EntityDtoMapper.java | 12 +- .../resquest/CustomApplyDiscordMessage.java | 4 +- .../dto/resquest/DiscordMessageReq.java | 2 +- .../resquest/OrderStickerDiscordMessage.java | 2 +- .../resquest/PointChargeDiscordMessage.java | 2 +- .../service/DiscordMessageService.java | 6 +- .../domain/PhoneNumberVerificationCode.java | 2 +- 150 files changed, 564 insertions(+), 568 deletions(-) rename server/src/main/java/org/tattour/server/domain/admin/{domain => model}/Admin.java (94%) rename server/src/main/java/org/tattour/server/domain/admin/{domain => model}/AdminAccessLog.java (95%) rename server/src/main/java/org/tattour/server/domain/banner/{domain => model}/Banner.java (93%) rename server/src/main/java/org/tattour/server/domain/cart/{domain => model}/Cart.java (86%) rename server/src/main/java/org/tattour/server/domain/custom/{domain => model}/Custom.java (96%) rename server/src/main/java/org/tattour/server/domain/custom/{domain => model}/CustomImage.java (95%) rename server/src/main/java/org/tattour/server/domain/custom/{domain => model}/CustomProcess.java (95%) rename server/src/main/java/org/tattour/server/domain/custom/{domain => model}/CustomSize.java (95%) rename server/src/main/java/org/tattour/server/domain/custom/{domain => model}/CustomStyle.java (91%) rename server/src/main/java/org/tattour/server/domain/custom/{domain => model}/CustomTheme.java (91%) rename server/src/main/java/org/tattour/server/domain/discount/{domain => model}/Discount.java (96%) rename server/src/main/java/org/tattour/server/domain/magazine/{domain => model}/Magazine.java (94%) rename server/src/main/java/org/tattour/server/domain/order/{domain => model}/OrderHistory.java (95%) rename server/src/main/java/org/tattour/server/domain/order/{domain => model}/OrderStatus.java (88%) rename server/src/main/java/org/tattour/server/domain/order/{domain => model}/OrderedProduct.java (92%) rename server/src/main/java/org/tattour/server/domain/order/{domain => model}/PurchaseRequest.java (95%) rename server/src/main/java/org/tattour/server/domain/sticker/{domain => model}/Sticker.java (94%) rename server/src/main/java/org/tattour/server/domain/sticker/{domain => model}/StickerImage.java (95%) rename server/src/main/java/org/tattour/server/domain/sticker/{domain => model}/StickerSort.java (93%) rename server/src/main/java/org/tattour/server/domain/sticker/{domain => model}/StickerStyle.java (91%) rename server/src/main/java/org/tattour/server/domain/sticker/{domain => model}/StickerTheme.java (91%) rename server/src/main/java/org/tattour/server/domain/style/{domain => model}/Style.java (69%) rename server/src/main/java/org/tattour/server/domain/theme/{domain => model}/Theme.java (92%) rename server/src/main/java/org/tattour/server/domain/user/{domain => model}/ProductLiked.java (92%) rename server/src/main/java/org/tattour/server/domain/user/{domain => model}/User.java (98%) rename server/src/main/java/org/tattour/server/domain/user/{domain => model}/UserRole.java (80%) rename server/src/main/java/org/tattour/server/domain/user/{domain => model}/UserShippingAddress.java (83%) diff --git a/server/src/main/generated/org/tattour/server/global/util/EntityDtoMapperImpl.java b/server/src/main/generated/org/tattour/server/global/util/EntityDtoMapperImpl.java index 927cd923..ed4f69c6 100644 --- a/server/src/main/generated/org/tattour/server/global/util/EntityDtoMapperImpl.java +++ b/server/src/main/generated/org/tattour/server/global/util/EntityDtoMapperImpl.java @@ -5,34 +5,34 @@ import javax.annotation.processing.Generated; import org.springframework.data.domain.Page; import org.springframework.stereotype.Component; -import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.model.Custom; import org.tattour.server.domain.custom.facade.dto.response.CreateCustomSummaryRes; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryRes; -import org.tattour.server.domain.order.domain.Order; -import org.tattour.server.domain.order.domain.OrderStatus; +import org.tattour.server.domain.order.model.Order; +import org.tattour.server.domain.order.model.OrderStatus; import org.tattour.server.domain.order.provider.vo.OrderHistoryInfo; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; import org.tattour.server.domain.point.domain.PointChargeRequest; import org.tattour.server.domain.point.provider.vo.PointChargeRequestInfo; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.provider.vo.StickerLikedInfo; -import org.tattour.server.domain.user.domain.ProductLiked; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.user.model.ProductLiked; +import org.tattour.server.domain.user.model.User; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; import org.tattour.server.domain.user.provider.vo.UserContactInfo; import org.tattour.server.domain.user.provider.vo.UserProfileInfo; @Generated( - value = "org.mapstruct.ap.MappingProcessor", - date = "2023-08-20T21:01:59+0900", - comments = "version: 1.5.4.Final, compiler: javac, environment: Java 17.0.6 (Amazon.com Inc.)" + value = "org.mapstruct.ap.MappingProcessor", + date = "2023-08-20T21:01:59+0900", + comments = "version: 1.5.4.Final, compiler: javac, environment: Java 17.0.6 (Amazon.com Inc.)" ) @Component public class EntityDtoMapperImpl implements EntityDtoMapper { @Override public HomeUserInfo toHomeUserInfo(User user) { - if ( user == null ) { + if (user == null) { return null; } @@ -42,46 +42,46 @@ public HomeUserInfo toHomeUserInfo(User user) { name = user.getName(); point = user.getPoint(); - HomeUserInfo homeUserInfo = new HomeUserInfo( name, point ); + HomeUserInfo homeUserInfo = new HomeUserInfo(name, point); return homeUserInfo; } @Override public UserContactInfo toUserContactInfo(User user) { - if ( user == null ) { + if (user == null) { return null; } UserContactInfo userContactInfo = new UserContactInfo(); - userContactInfo.setId( user.getId() ); - userContactInfo.setName( user.getName() ); - userContactInfo.setPhoneNumber( user.getPhoneNumber() ); + userContactInfo.setId(user.getId()); + userContactInfo.setName(user.getName()); + userContactInfo.setPhoneNumber(user.getPhoneNumber()); return userContactInfo; } @Override public UserProfileInfo toUserProfileInfo(User user) { - if ( user == null ) { + if (user == null) { return null; } UserProfileInfo.UserProfileInfoBuilder userProfileInfo = UserProfileInfo.builder(); - if ( user.getId() != null ) { - userProfileInfo.id( user.getId() ); + if (user.getId() != null) { + userProfileInfo.id(user.getId()); } - userProfileInfo.name( user.getName() ); - userProfileInfo.phoneNumber( user.getPhoneNumber() ); + userProfileInfo.name(user.getName()); + userProfileInfo.phoneNumber(user.getPhoneNumber()); return userProfileInfo.build(); } @Override public StickerLikedInfo toStickerLikedInfo(ProductLiked productLiked) { - if ( productLiked == null ) { + if (productLiked == null) { return null; } @@ -91,29 +91,33 @@ public StickerLikedInfo toStickerLikedInfo(ProductLiked productLiked) { String mainImageUrl = null; Integer id = null; - stickerId = productLikedStickerId( productLiked ); - name = productLikedStickerName( productLiked ); - price = productLikedStickerPrice( productLiked ); - mainImageUrl = productLikedStickerMainImageUrl( productLiked ); + stickerId = productLikedStickerId(productLiked); + name = productLikedStickerName(productLiked); + price = productLikedStickerPrice(productLiked); + mainImageUrl = productLikedStickerMainImageUrl(productLiked); id = productLiked.getId(); - Integer discountPrice = productLiked.getSticker().getDiscount() != null ? productLiked.getSticker().getPrice() * (100 - productLiked.getSticker().getDiscount().getDiscountRate()) / 100 : null; - Integer discountRate = productLiked.getSticker().getDiscount() != null ? productLiked.getSticker().getDiscount().getDiscountRate() : null; + Integer discountPrice = productLiked.getSticker().getDiscount() != null ? + productLiked.getSticker().getPrice() * (100 - productLiked.getSticker().getDiscount().getDiscountRate()) + / 100 : null; + Integer discountRate = productLiked.getSticker().getDiscount() != null ? productLiked.getSticker().getDiscount() + .getDiscountRate() : null; - StickerLikedInfo stickerLikedInfo = new StickerLikedInfo( id, stickerId, name, price, discountRate, discountPrice, mainImageUrl ); + StickerLikedInfo stickerLikedInfo = new StickerLikedInfo(id, stickerId, name, price, discountRate, + discountPrice, mainImageUrl); return stickerLikedInfo; } @Override public List toStickerLikedInfoList(List productLiked) { - if ( productLiked == null ) { + if (productLiked == null) { return null; } - List list = new ArrayList( productLiked.size() ); - for ( ProductLiked productLiked1 : productLiked ) { - list.add( toStickerLikedInfo( productLiked1 ) ); + List list = new ArrayList(productLiked.size()); + for (ProductLiked productLiked1 : productLiked) { + list.add(toStickerLikedInfo(productLiked1)); } return list; @@ -121,59 +125,59 @@ public List toStickerLikedInfoList(List productL @Override public UserOrderHistoryInfo toGetUserOrderHistoryRes(Order order) { - if ( order == null ) { + if (order == null) { return null; } UserOrderHistoryInfo userOrderHistoryInfo = new UserOrderHistoryInfo(); - Integer id = orderUserId( order ); - if ( id != null ) { - userOrderHistoryInfo.setUserId( id ); + Integer id = orderUserId(order); + if (id != null) { + userOrderHistoryInfo.setUserId(id); } - Integer id1 = orderStickerId( order ); - if ( id1 != null ) { - userOrderHistoryInfo.setStickerId( id1 ); + Integer id1 = orderStickerId(order); + if (id1 != null) { + userOrderHistoryInfo.setStickerId(id1); } - if ( order.getId() != null ) { - userOrderHistoryInfo.setId( order.getId() ); + if (order.getId() != null) { + userOrderHistoryInfo.setId(order.getId()); } - userOrderHistoryInfo.setProductName( order.getProductName() ); - userOrderHistoryInfo.setProductSize( order.getProductSize() ); - userOrderHistoryInfo.setProductImageUrl( order.getProductImageUrl() ); - if ( order.getProductAmount() != null ) { - userOrderHistoryInfo.setProductAmount( order.getProductAmount() ); + userOrderHistoryInfo.setProductName(order.getProductName()); + userOrderHistoryInfo.setProductSize(order.getProductSize()); + userOrderHistoryInfo.setProductImageUrl(order.getProductImageUrl()); + if (order.getProductAmount() != null) { + userOrderHistoryInfo.setProductAmount(order.getProductAmount()); } - if ( order.getProductCount() != null ) { - userOrderHistoryInfo.setProductCount( order.getProductCount() ); + if (order.getProductCount() != null) { + userOrderHistoryInfo.setProductCount(order.getProductCount()); } - if ( order.getShippingFee() != null ) { - userOrderHistoryInfo.setShippingFee( order.getShippingFee() ); + if (order.getShippingFee() != null) { + userOrderHistoryInfo.setShippingFee(order.getShippingFee()); } - if ( order.getTotalAmount() != null ) { - userOrderHistoryInfo.setTotalAmount( order.getTotalAmount() ); + if (order.getTotalAmount() != null) { + userOrderHistoryInfo.setTotalAmount(order.getTotalAmount()); } - userOrderHistoryInfo.setRecipientName( order.getRecipientName() ); - userOrderHistoryInfo.setContact( order.getContact() ); - userOrderHistoryInfo.setMailingAddress( order.getMailingAddress() ); - userOrderHistoryInfo.setBaseAddress( order.getBaseAddress() ); - userOrderHistoryInfo.setDetailAddress( order.getDetailAddress() ); - userOrderHistoryInfo.setCreatedAt( order.getCreatedAt() ); - userOrderHistoryInfo.setLastUpdatedAt( order.getLastUpdatedAt() ); - userOrderHistoryInfo.setState( order.getState() ); + userOrderHistoryInfo.setRecipientName(order.getRecipientName()); + userOrderHistoryInfo.setContact(order.getContact()); + userOrderHistoryInfo.setMailingAddress(order.getMailingAddress()); + userOrderHistoryInfo.setBaseAddress(order.getBaseAddress()); + userOrderHistoryInfo.setDetailAddress(order.getDetailAddress()); + userOrderHistoryInfo.setCreatedAt(order.getCreatedAt()); + userOrderHistoryInfo.setLastUpdatedAt(order.getLastUpdatedAt()); + userOrderHistoryInfo.setState(order.getState()); return userOrderHistoryInfo; } @Override public List toGetUserOrderHistoryListRes(List orderList) { - if ( orderList == null ) { + if (orderList == null) { return null; } - List list = new ArrayList( orderList.size() ); - for ( Order order : orderList ) { - list.add( toGetUserOrderHistoryRes( order ) ); + List list = new ArrayList(orderList.size()); + for (Order order : orderList) { + list.add(toGetUserOrderHistoryRes(order)); } return list; @@ -181,60 +185,60 @@ public List toGetUserOrderHistoryListRes(List order @Override public OrderHistoryInfo toOrderHistoryInfo(Order order) { - if ( order == null ) { + if (order == null) { return null; } OrderHistoryInfo orderHistoryInfo = new OrderHistoryInfo(); - Integer id = orderUserId( order ); - if ( id != null ) { - orderHistoryInfo.setUserId( id ); + Integer id = orderUserId(order); + if (id != null) { + orderHistoryInfo.setUserId(id); } - Integer id1 = orderStickerId( order ); - if ( id1 != null ) { - orderHistoryInfo.setStickerId( id1 ); + Integer id1 = orderStickerId(order); + if (id1 != null) { + orderHistoryInfo.setStickerId(id1); } - orderHistoryInfo.setOrderStatus( orderOrderStatusValue( order ) ); - if ( order.getId() != null ) { - orderHistoryInfo.setId( order.getId() ); + orderHistoryInfo.setOrderStatus(orderOrderStatusValue(order)); + if (order.getId() != null) { + orderHistoryInfo.setId(order.getId()); } - orderHistoryInfo.setProductName( order.getProductName() ); - orderHistoryInfo.setProductSize( order.getProductSize() ); - orderHistoryInfo.setProductImageUrl( order.getProductImageUrl() ); - if ( order.getProductAmount() != null ) { - orderHistoryInfo.setProductAmount( order.getProductAmount() ); + orderHistoryInfo.setProductName(order.getProductName()); + orderHistoryInfo.setProductSize(order.getProductSize()); + orderHistoryInfo.setProductImageUrl(order.getProductImageUrl()); + if (order.getProductAmount() != null) { + orderHistoryInfo.setProductAmount(order.getProductAmount()); } - if ( order.getProductCount() != null ) { - orderHistoryInfo.setProductCount( order.getProductCount() ); + if (order.getProductCount() != null) { + orderHistoryInfo.setProductCount(order.getProductCount()); } - if ( order.getShippingFee() != null ) { - orderHistoryInfo.setShippingFee( order.getShippingFee() ); + if (order.getShippingFee() != null) { + orderHistoryInfo.setShippingFee(order.getShippingFee()); } - if ( order.getTotalAmount() != null ) { - orderHistoryInfo.setTotalAmount( order.getTotalAmount() ); + if (order.getTotalAmount() != null) { + orderHistoryInfo.setTotalAmount(order.getTotalAmount()); } - orderHistoryInfo.setRecipientName( order.getRecipientName() ); - orderHistoryInfo.setContact( order.getContact() ); - orderHistoryInfo.setMailingAddress( order.getMailingAddress() ); - orderHistoryInfo.setBaseAddress( order.getBaseAddress() ); - orderHistoryInfo.setDetailAddress( order.getDetailAddress() ); - orderHistoryInfo.setCreatedAt( order.getCreatedAt() ); - orderHistoryInfo.setLastUpdatedAt( order.getLastUpdatedAt() ); - orderHistoryInfo.setState( order.getState() ); + orderHistoryInfo.setRecipientName(order.getRecipientName()); + orderHistoryInfo.setContact(order.getContact()); + orderHistoryInfo.setMailingAddress(order.getMailingAddress()); + orderHistoryInfo.setBaseAddress(order.getBaseAddress()); + orderHistoryInfo.setDetailAddress(order.getDetailAddress()); + orderHistoryInfo.setCreatedAt(order.getCreatedAt()); + orderHistoryInfo.setLastUpdatedAt(order.getLastUpdatedAt()); + orderHistoryInfo.setState(order.getState()); return orderHistoryInfo; } @Override public List toOrderHistoryInfoPage(Page orderPage) { - if ( orderPage == null ) { + if (orderPage == null) { return null; } List list = new ArrayList(); - for ( Order order : orderPage ) { - list.add( toOrderHistoryInfo( order ) ); + for (Order order : orderPage) { + list.add(toOrderHistoryInfo(order)); } return list; @@ -242,41 +246,42 @@ public List toOrderHistoryInfoPage(Page orderPage) { @Override public PointChargeRequestInfo toGetPointChargeRequestRes(PointChargeRequest pointChargeRequest) { - if ( pointChargeRequest == null ) { + if (pointChargeRequest == null) { return null; } PointChargeRequestInfo.PointChargeRequestInfoBuilder pointChargeRequestInfo = PointChargeRequestInfo.builder(); - Integer id = pointChargeRequestUserId( pointChargeRequest ); - if ( id != null ) { - pointChargeRequestInfo.userId( id ); + Integer id = pointChargeRequestUserId(pointChargeRequest); + if (id != null) { + pointChargeRequestInfo.userId(id); } - if ( pointChargeRequest.getId() != null ) { - pointChargeRequestInfo.id( pointChargeRequest.getId() ); + if (pointChargeRequest.getId() != null) { + pointChargeRequestInfo.id(pointChargeRequest.getId()); } - pointChargeRequestInfo.chargeAmount( pointChargeRequest.getChargeAmount() ); - pointChargeRequestInfo.transferredAmount( pointChargeRequest.getTransferredAmount() ); - pointChargeRequestInfo.isDeposited( pointChargeRequest.getIsDeposited() ); - pointChargeRequestInfo.isAmountMatched( pointChargeRequest.getIsAmountMatched() ); - pointChargeRequestInfo.isApproved( pointChargeRequest.getIsApproved() ); - pointChargeRequestInfo.isCompleted( pointChargeRequest.getIsCompleted() ); - pointChargeRequestInfo.createdAt( pointChargeRequest.getCreatedAt() ); - pointChargeRequestInfo.lastUpdatedAt( pointChargeRequest.getLastUpdatedAt() ); - pointChargeRequestInfo.state( pointChargeRequest.getState() ); + pointChargeRequestInfo.chargeAmount(pointChargeRequest.getChargeAmount()); + pointChargeRequestInfo.transferredAmount(pointChargeRequest.getTransferredAmount()); + pointChargeRequestInfo.isDeposited(pointChargeRequest.getIsDeposited()); + pointChargeRequestInfo.isAmountMatched(pointChargeRequest.getIsAmountMatched()); + pointChargeRequestInfo.isApproved(pointChargeRequest.getIsApproved()); + pointChargeRequestInfo.isCompleted(pointChargeRequest.getIsCompleted()); + pointChargeRequestInfo.createdAt(pointChargeRequest.getCreatedAt()); + pointChargeRequestInfo.lastUpdatedAt(pointChargeRequest.getLastUpdatedAt()); + pointChargeRequestInfo.state(pointChargeRequest.getState()); return pointChargeRequestInfo.build(); } @Override - public List toGetPointChargeRequestResList(List pointChargeRequestList) { - if ( pointChargeRequestList == null ) { + public List toGetPointChargeRequestResList( + List pointChargeRequestList) { + if (pointChargeRequestList == null) { return null; } - List list = new ArrayList( pointChargeRequestList.size() ); - for ( PointChargeRequest pointChargeRequest : pointChargeRequestList ) { - list.add( toGetPointChargeRequestRes( pointChargeRequest ) ); + List list = new ArrayList(pointChargeRequestList.size()); + for (PointChargeRequest pointChargeRequest : pointChargeRequestList) { + list.add(toGetPointChargeRequestRes(pointChargeRequest)); } return list; @@ -284,30 +289,30 @@ public List toGetPointChargeRequestResList(List toCustomApplySummaryInfoList(List customList) { - if ( customList == null ) { + if (customList == null) { return null; } - List list = new ArrayList( customList.size() ); - for ( Custom custom : customList ) { - list.add( toCustomApplySummaryInfo( custom ) ); + List list = new ArrayList(customList.size()); + for (Custom custom : customList) { + list.add(toCustomApplySummaryInfo(custom)); } return list; @@ -315,148 +320,148 @@ public List toCustomApplySummaryInfoList(List cu @Override public ReadCustomSummaryRes toReadCustomSummaryRes(Custom custom) { - if ( custom == null ) { + if (custom == null) { return null; } ReadCustomSummaryRes.ReadCustomSummaryResBuilder readCustomSummaryRes = ReadCustomSummaryRes.builder(); - readCustomSummaryRes.imageUrl( custom.getMainImageUrl() ); - readCustomSummaryRes.id( custom.getId() ); - readCustomSummaryRes.name( custom.getName() ); + readCustomSummaryRes.imageUrl(custom.getMainImageUrl()); + readCustomSummaryRes.id(custom.getId()); + readCustomSummaryRes.name(custom.getName()); return readCustomSummaryRes.build(); } @Override public List toReadCustomSummaryResList(List customList) { - if ( customList == null ) { + if (customList == null) { return null; } - List list = new ArrayList( customList.size() ); - for ( Custom custom : customList ) { - list.add( toReadCustomSummaryRes( custom ) ); + List list = new ArrayList(customList.size()); + for (Custom custom : customList) { + list.add(toReadCustomSummaryRes(custom)); } return list; } private Integer productLikedStickerId(ProductLiked productLiked) { - if ( productLiked == null ) { + if (productLiked == null) { return null; } Sticker sticker = productLiked.getSticker(); - if ( sticker == null ) { + if (sticker == null) { return null; } Integer id = sticker.getId(); - if ( id == null ) { + if (id == null) { return null; } return id; } private String productLikedStickerName(ProductLiked productLiked) { - if ( productLiked == null ) { + if (productLiked == null) { return null; } Sticker sticker = productLiked.getSticker(); - if ( sticker == null ) { + if (sticker == null) { return null; } String name = sticker.getName(); - if ( name == null ) { + if (name == null) { return null; } return name; } private Integer productLikedStickerPrice(ProductLiked productLiked) { - if ( productLiked == null ) { + if (productLiked == null) { return null; } Sticker sticker = productLiked.getSticker(); - if ( sticker == null ) { + if (sticker == null) { return null; } Integer price = sticker.getPrice(); - if ( price == null ) { + if (price == null) { return null; } return price; } private String productLikedStickerMainImageUrl(ProductLiked productLiked) { - if ( productLiked == null ) { + if (productLiked == null) { return null; } Sticker sticker = productLiked.getSticker(); - if ( sticker == null ) { + if (sticker == null) { return null; } String mainImageUrl = sticker.getMainImageUrl(); - if ( mainImageUrl == null ) { + if (mainImageUrl == null) { return null; } return mainImageUrl; } private Integer orderUserId(Order order) { - if ( order == null ) { + if (order == null) { return null; } User user = order.getUser(); - if ( user == null ) { + if (user == null) { return null; } Integer id = user.getId(); - if ( id == null ) { + if (id == null) { return null; } return id; } private Integer orderStickerId(Order order) { - if ( order == null ) { + if (order == null) { return null; } Sticker sticker = order.getSticker(); - if ( sticker == null ) { + if (sticker == null) { return null; } Integer id = sticker.getId(); - if ( id == null ) { + if (id == null) { return null; } return id; } private String orderOrderStatusValue(Order order) { - if ( order == null ) { + if (order == null) { return null; } OrderStatus orderStatus = order.getOrderStatus(); - if ( orderStatus == null ) { + if (orderStatus == null) { return null; } String value = orderStatus.getValue(); - if ( value == null ) { + if (value == null) { return null; } return value; } private Integer pointChargeRequestUserId(PointChargeRequest pointChargeRequest) { - if ( pointChargeRequest == null ) { + if (pointChargeRequest == null) { return null; } User user = pointChargeRequest.getUser(); - if ( user == null ) { + if (user == null) { return null; } Integer id = user.getId(); - if ( id == null ) { + if (id == null) { return null; } return id; diff --git a/server/src/main/java/org/tattour/server/domain/admin/controller/dto/request/PatchCustomProcessReq.java b/server/src/main/java/org/tattour/server/domain/admin/controller/dto/request/PatchCustomProcessReq.java index a888ff72..dc90e334 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/controller/dto/request/PatchCustomProcessReq.java +++ b/server/src/main/java/org/tattour/server/domain/admin/controller/dto/request/PatchCustomProcessReq.java @@ -4,7 +4,7 @@ import javax.validation.constraints.NotNull; import lombok.Getter; import lombok.NoArgsConstructor; -import org.tattour.server.domain.custom.domain.CustomProcess; +import org.tattour.server.domain.custom.model.CustomProcess; import org.tattour.server.domain.custom.facade.dto.request.UpdateCustomReq; @Getter diff --git a/server/src/main/java/org/tattour/server/domain/admin/facade/impl/AdminFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/admin/facade/impl/AdminFacadeImpl.java index 6b991981..113ea3a9 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/facade/impl/AdminFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/admin/facade/impl/AdminFacadeImpl.java @@ -5,10 +5,10 @@ import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.admin.controller.dto.request.AdminLoginReq; import org.tattour.server.domain.admin.controller.dto.response.AdminLoginRes; -import org.tattour.server.domain.admin.domain.Admin; import org.tattour.server.domain.admin.facade.AdminFacade; +import org.tattour.server.domain.admin.model.Admin; import org.tattour.server.domain.admin.service.AdminService; -import org.tattour.server.domain.user.domain.UserRole; +import org.tattour.server.domain.user.model.UserRole; import org.tattour.server.global.config.jwt.JwtService; import org.tattour.server.global.exception.BusinessException; import org.tattour.server.global.exception.ErrorType; diff --git a/server/src/main/java/org/tattour/server/domain/admin/domain/Admin.java b/server/src/main/java/org/tattour/server/domain/admin/model/Admin.java similarity index 94% rename from server/src/main/java/org/tattour/server/domain/admin/domain/Admin.java rename to server/src/main/java/org/tattour/server/domain/admin/model/Admin.java index 0a404774..fa501f30 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/domain/Admin.java +++ b/server/src/main/java/org/tattour/server/domain/admin/model/Admin.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.admin.domain; +package org.tattour.server.domain.admin.model; import java.sql.Timestamp; import javax.persistence.Column; diff --git a/server/src/main/java/org/tattour/server/domain/admin/domain/AdminAccessLog.java b/server/src/main/java/org/tattour/server/domain/admin/model/AdminAccessLog.java similarity index 95% rename from server/src/main/java/org/tattour/server/domain/admin/domain/AdminAccessLog.java rename to server/src/main/java/org/tattour/server/domain/admin/model/AdminAccessLog.java index ef8fa8df..123b7ecb 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/domain/AdminAccessLog.java +++ b/server/src/main/java/org/tattour/server/domain/admin/model/AdminAccessLog.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.admin.domain; +package org.tattour.server.domain.admin.model; import java.sql.Timestamp; import javax.persistence.Entity; diff --git a/server/src/main/java/org/tattour/server/domain/admin/repository/AdminAccessLogRepository.java b/server/src/main/java/org/tattour/server/domain/admin/repository/AdminAccessLogRepository.java index 42dad336..ece522a7 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/repository/AdminAccessLogRepository.java +++ b/server/src/main/java/org/tattour/server/domain/admin/repository/AdminAccessLogRepository.java @@ -2,7 +2,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import org.tattour.server.domain.admin.domain.AdminAccessLog; +import org.tattour.server.domain.admin.model.AdminAccessLog; @Repository public interface AdminAccessLogRepository extends JpaRepository { diff --git a/server/src/main/java/org/tattour/server/domain/admin/repository/AdminRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/admin/repository/AdminRepositoryImpl.java index f581f22b..f068bb59 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/repository/AdminRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/admin/repository/AdminRepositoryImpl.java @@ -3,7 +3,7 @@ import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import org.tattour.server.domain.admin.domain.Admin; +import org.tattour.server.domain.admin.model.Admin; @Repository public interface AdminRepositoryImpl extends JpaRepository { diff --git a/server/src/main/java/org/tattour/server/domain/admin/service/AdminService.java b/server/src/main/java/org/tattour/server/domain/admin/service/AdminService.java index c95f86ea..9cf2aad2 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/service/AdminService.java +++ b/server/src/main/java/org/tattour/server/domain/admin/service/AdminService.java @@ -1,6 +1,6 @@ package org.tattour.server.domain.admin.service; -import org.tattour.server.domain.admin.domain.Admin; +import org.tattour.server.domain.admin.model.Admin; public interface AdminService { diff --git a/server/src/main/java/org/tattour/server/domain/admin/service/impl/AdminServiceImpl.java b/server/src/main/java/org/tattour/server/domain/admin/service/impl/AdminServiceImpl.java index 9376d029..e60fbdda 100644 --- a/server/src/main/java/org/tattour/server/domain/admin/service/impl/AdminServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/admin/service/impl/AdminServiceImpl.java @@ -3,8 +3,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; -import org.tattour.server.domain.admin.domain.Admin; -import org.tattour.server.domain.admin.domain.AdminAccessLog; +import org.tattour.server.domain.admin.model.Admin; +import org.tattour.server.domain.admin.model.AdminAccessLog; import org.tattour.server.domain.admin.repository.AdminAccessLogRepository; import org.tattour.server.domain.admin.repository.AdminRepositoryImpl; import org.tattour.server.domain.admin.service.AdminService; diff --git a/server/src/main/java/org/tattour/server/domain/banner/domain/Banner.java b/server/src/main/java/org/tattour/server/domain/banner/model/Banner.java similarity index 93% rename from server/src/main/java/org/tattour/server/domain/banner/domain/Banner.java rename to server/src/main/java/org/tattour/server/domain/banner/model/Banner.java index cd78c834..8a947975 100644 --- a/server/src/main/java/org/tattour/server/domain/banner/domain/Banner.java +++ b/server/src/main/java/org/tattour/server/domain/banner/model/Banner.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.banner.domain; +package org.tattour.server.domain.banner.model; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java index 7478057a..a0970e06 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/facade/impl/CartFacadeImpl.java @@ -9,13 +9,13 @@ import org.tattour.server.domain.cart.controller.dto.request.CartItemReq; import org.tattour.server.domain.cart.controller.dto.request.UpdateCartCountReq; import org.tattour.server.domain.cart.controller.dto.response.CartItemsRes; -import org.tattour.server.domain.cart.domain.Cart; import org.tattour.server.domain.cart.facade.CartFacade; +import org.tattour.server.domain.cart.model.Cart; import org.tattour.server.domain.cart.service.CartService; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.provider.StickerProvider; import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.user.model.User; import org.tattour.server.domain.user.service.UserService; import org.tattour.server.global.util.EntityDtoMapper; diff --git a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java b/server/src/main/java/org/tattour/server/domain/cart/model/Cart.java similarity index 86% rename from server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java rename to server/src/main/java/org/tattour/server/domain/cart/model/Cart.java index a55cc83e..68d6150d 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/domain/Cart.java +++ b/server/src/main/java/org/tattour/server/domain/cart/model/Cart.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.cart.domain; +package org.tattour.server.domain.cart.model; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -12,8 +12,8 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.sticker.model.Sticker; +import org.tattour.server.domain.user.model.User; @Entity @Builder diff --git a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepositoryImpl.java index 9c3840ba..170df17e 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/repository/CartRepositoryImpl.java @@ -4,9 +4,9 @@ import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import org.tattour.server.domain.cart.domain.Cart; -import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.cart.model.Cart; +import org.tattour.server.domain.sticker.model.Sticker; +import org.tattour.server.domain.user.model.User; @Repository public interface CartRepositoryImpl extends JpaRepository { diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java index cd1dcd3b..b67bb46f 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/CartService.java @@ -2,9 +2,9 @@ import java.util.List; import java.util.Optional; -import org.tattour.server.domain.cart.domain.Cart; -import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.cart.model.Cart; +import org.tattour.server.domain.sticker.model.Sticker; +import org.tattour.server.domain.user.model.User; public interface CartService { List findByUserId(int userId); diff --git a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java index 654fcde5..10933b12 100644 --- a/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/cart/service/impl/CartServiceImpl.java @@ -4,11 +4,11 @@ import java.util.Optional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.tattour.server.domain.cart.domain.Cart; +import org.tattour.server.domain.cart.model.Cart; import org.tattour.server.domain.cart.repository.CartRepositoryImpl; import org.tattour.server.domain.cart.service.CartService; -import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.sticker.model.Sticker; +import org.tattour.server.domain.user.model.User; import org.tattour.server.global.exception.BusinessException; import org.tattour.server.global.exception.ErrorType; diff --git a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/request/UpdateCustomReq.java b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/request/UpdateCustomReq.java index 100dfee5..0fb23c05 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/request/UpdateCustomReq.java +++ b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/request/UpdateCustomReq.java @@ -5,9 +5,9 @@ import lombok.Builder; import lombok.Getter; import org.springframework.web.multipart.MultipartFile; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomProcess; -import org.tattour.server.domain.custom.domain.CustomSize; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomProcess; +import org.tattour.server.domain.custom.model.CustomSize; @Getter @Builder(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomRes.java b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomRes.java index f6a5fbce..42ae1b08 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomRes.java +++ b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomRes.java @@ -6,8 +6,8 @@ import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomImage; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomImage; @Getter @Builder(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomSummaryListRes.java b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomSummaryListRes.java index b225cbb1..bb8dc0f8 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomSummaryListRes.java +++ b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomSummaryListRes.java @@ -5,7 +5,7 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.model.Custom; @Getter @AllArgsConstructor(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomSummaryRes.java b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomSummaryRes.java index 78ef84ac..7e5e30b0 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomSummaryRes.java +++ b/server/src/main/java/org/tattour/server/domain/custom/facade/dto/response/ReadCustomSummaryRes.java @@ -2,7 +2,7 @@ import lombok.Builder; import lombok.Getter; -import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.model.Custom; @Getter @Builder diff --git a/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java index 55cc38d6..d46dba54 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/facade/impl/CustomFacadeImpl.java @@ -7,18 +7,18 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomImage; import org.tattour.server.domain.custom.facade.CustomFacade; import org.tattour.server.domain.custom.facade.dto.request.UpdateCustomReq; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomRes; import org.tattour.server.domain.custom.facade.dto.response.ReadCustomSummaryListRes; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomImage; import org.tattour.server.domain.custom.provider.impl.CustomProviderImpl; import org.tattour.server.domain.custom.service.CustomImageService; import org.tattour.server.domain.custom.service.CustomService; import org.tattour.server.domain.custom.service.CustomStyleService; import org.tattour.server.domain.custom.service.CustomThemeService; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.user.model.User; import org.tattour.server.domain.user.service.UserService; import org.tattour.server.infra.discord.service.DiscordMessageService; import org.tattour.server.infra.s3.S3Service; diff --git a/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java b/server/src/main/java/org/tattour/server/domain/custom/model/Custom.java similarity index 96% rename from server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java rename to server/src/main/java/org/tattour/server/domain/custom/model/Custom.java index cea9e8fd..6edc106d 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/domain/Custom.java +++ b/server/src/main/java/org/tattour/server/domain/custom/model/Custom.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.custom.domain; +package org.tattour.server.domain.custom.model; import java.util.ArrayList; import java.util.List; @@ -22,8 +22,8 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; -import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.sticker.model.Sticker; +import org.tattour.server.domain.user.model.User; import org.tattour.server.global.util.AuditingTimeEntity; @Getter diff --git a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomImage.java b/server/src/main/java/org/tattour/server/domain/custom/model/CustomImage.java similarity index 95% rename from server/src/main/java/org/tattour/server/domain/custom/domain/CustomImage.java rename to server/src/main/java/org/tattour/server/domain/custom/model/CustomImage.java index ba21288f..fcb05773 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomImage.java +++ b/server/src/main/java/org/tattour/server/domain/custom/model/CustomImage.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.custom.domain; +package org.tattour.server.domain.custom.model; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomProcess.java b/server/src/main/java/org/tattour/server/domain/custom/model/CustomProcess.java similarity index 95% rename from server/src/main/java/org/tattour/server/domain/custom/domain/CustomProcess.java rename to server/src/main/java/org/tattour/server/domain/custom/model/CustomProcess.java index 734e29d4..952b8121 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomProcess.java +++ b/server/src/main/java/org/tattour/server/domain/custom/model/CustomProcess.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.custom.domain; +package org.tattour.server.domain.custom.model; import lombok.AccessLevel; import lombok.Getter; diff --git a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomSize.java b/server/src/main/java/org/tattour/server/domain/custom/model/CustomSize.java similarity index 95% rename from server/src/main/java/org/tattour/server/domain/custom/domain/CustomSize.java rename to server/src/main/java/org/tattour/server/domain/custom/model/CustomSize.java index d9fee3dc..23f98f3f 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomSize.java +++ b/server/src/main/java/org/tattour/server/domain/custom/model/CustomSize.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.custom.domain; +package org.tattour.server.domain.custom.model; import lombok.AccessLevel; import lombok.Getter; diff --git a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomStyle.java b/server/src/main/java/org/tattour/server/domain/custom/model/CustomStyle.java similarity index 91% rename from server/src/main/java/org/tattour/server/domain/custom/domain/CustomStyle.java rename to server/src/main/java/org/tattour/server/domain/custom/model/CustomStyle.java index 6cfdfba6..feaf383b 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomStyle.java +++ b/server/src/main/java/org/tattour/server/domain/custom/model/CustomStyle.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.custom.domain; +package org.tattour.server.domain.custom.model; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -13,7 +13,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.tattour.server.domain.style.domain.Style; +import org.tattour.server.domain.style.model.Style; @Getter @Table(name = "custom_style") diff --git a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomTheme.java b/server/src/main/java/org/tattour/server/domain/custom/model/CustomTheme.java similarity index 91% rename from server/src/main/java/org/tattour/server/domain/custom/domain/CustomTheme.java rename to server/src/main/java/org/tattour/server/domain/custom/model/CustomTheme.java index 76a5092c..48db4ac9 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/domain/CustomTheme.java +++ b/server/src/main/java/org/tattour/server/domain/custom/model/CustomTheme.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.custom.domain; +package org.tattour.server.domain.custom.model; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -14,7 +14,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import org.hibernate.annotations.DynamicInsert; -import org.tattour.server.domain.theme.domain.Theme; +import org.tattour.server.domain.theme.model.Theme; @Getter @Table(name = "custom_theme") diff --git a/server/src/main/java/org/tattour/server/domain/custom/provider/CustomProvider.java b/server/src/main/java/org/tattour/server/domain/custom/provider/CustomProvider.java index e3c42c3f..59201969 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/provider/CustomProvider.java +++ b/server/src/main/java/org/tattour/server/domain/custom/provider/CustomProvider.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.custom.provider; import java.util.List; -import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.model.Custom; public interface CustomProvider { diff --git a/server/src/main/java/org/tattour/server/domain/custom/provider/impl/CustomProviderImpl.java b/server/src/main/java/org/tattour/server/domain/custom/provider/impl/CustomProviderImpl.java index db852b26..76009b25 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/provider/impl/CustomProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/provider/impl/CustomProviderImpl.java @@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.model.Custom; import org.tattour.server.domain.custom.exception.NotFoundCustomException; import org.tattour.server.domain.custom.provider.CustomProvider; import org.tattour.server.domain.custom.repository.CustomRepository; diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/CustomImageRepository.java b/server/src/main/java/org/tattour/server/domain/custom/repository/CustomImageRepository.java index e9440c80..0541ec74 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/CustomImageRepository.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/CustomImageRepository.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.custom.repository; import java.util.List; -import org.tattour.server.domain.custom.domain.CustomImage; +import org.tattour.server.domain.custom.model.CustomImage; public interface CustomImageRepository { diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/CustomRepository.java b/server/src/main/java/org/tattour/server/domain/custom/repository/CustomRepository.java index 76885e68..941c2cb5 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/CustomRepository.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/CustomRepository.java @@ -3,7 +3,7 @@ import java.util.List; import java.util.Optional; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.model.Custom; import org.tattour.server.domain.custom.repository.custom.CustomRepositoryCustom; public interface CustomRepository extends diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/CustomStyleRepository.java b/server/src/main/java/org/tattour/server/domain/custom/repository/CustomStyleRepository.java index 0b47d432..2632eb1d 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/CustomStyleRepository.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/CustomStyleRepository.java @@ -2,7 +2,7 @@ import java.util.List; import java.util.Optional; -import org.tattour.server.domain.custom.domain.CustomStyle; +import org.tattour.server.domain.custom.model.CustomStyle; public interface CustomStyleRepository { diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/CustomThemeRepository.java b/server/src/main/java/org/tattour/server/domain/custom/repository/CustomThemeRepository.java index 682fdab0..7f3dac20 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/CustomThemeRepository.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/CustomThemeRepository.java @@ -2,7 +2,7 @@ import java.util.List; import java.util.Optional; -import org.tattour.server.domain.custom.domain.CustomTheme; +import org.tattour.server.domain.custom.model.CustomTheme; public interface CustomThemeRepository { diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/custom/CustomRepositoryCustom.java b/server/src/main/java/org/tattour/server/domain/custom/repository/custom/CustomRepositoryCustom.java index 4c587772..94a8f343 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/custom/CustomRepositoryCustom.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/custom/CustomRepositoryCustom.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.custom.repository.custom; import java.util.List; -import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.model.Custom; public interface CustomRepositoryCustom { diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomImageRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomImageRepositoryImpl.java index c68df074..0e3fd38d 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomImageRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomImageRepositoryImpl.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.custom.repository.impl; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.custom.domain.CustomImage; +import org.tattour.server.domain.custom.model.CustomImage; import org.tattour.server.domain.custom.repository.CustomImageRepository; public interface CustomImageRepositoryImpl extends diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java index ce9f4586..17d6ab88 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java @@ -1,11 +1,11 @@ package org.tattour.server.domain.custom.repository.impl; -import static org.tattour.server.domain.custom.domain.QCustom.*; +import static org.tattour.server.domain.custom.model.QCustom.*; import com.querydsl.jpa.impl.JPAQueryFactory; import java.util.List; import lombok.RequiredArgsConstructor; -import org.tattour.server.domain.custom.domain.Custom; +import org.tattour.server.domain.custom.model.Custom; import org.tattour.server.domain.custom.repository.custom.CustomRepositoryCustom; @RequiredArgsConstructor diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomStyleRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomStyleRepositoryImpl.java index 645f192d..d97a215a 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomStyleRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomStyleRepositoryImpl.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.custom.repository.impl; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.custom.domain.CustomStyle; +import org.tattour.server.domain.custom.model.CustomStyle; import org.tattour.server.domain.custom.repository.CustomStyleRepository; public interface CustomStyleRepositoryImpl extends diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomThemeRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomThemeRepositoryImpl.java index 7be4175e..2f1e64f2 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomThemeRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomThemeRepositoryImpl.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.custom.repository.impl; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.custom.domain.CustomTheme; +import org.tattour.server.domain.custom.model.CustomTheme; import org.tattour.server.domain.custom.repository.CustomThemeRepository; public interface CustomThemeRepositoryImpl extends diff --git a/server/src/main/java/org/tattour/server/domain/custom/service/CustomImageService.java b/server/src/main/java/org/tattour/server/domain/custom/service/CustomImageService.java index 7ea9f1fc..ea5e4543 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/service/CustomImageService.java +++ b/server/src/main/java/org/tattour/server/domain/custom/service/CustomImageService.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.custom.service; import java.util.List; -import org.tattour.server.domain.custom.domain.CustomImage; +import org.tattour.server.domain.custom.model.CustomImage; public interface CustomImageService { diff --git a/server/src/main/java/org/tattour/server/domain/custom/service/CustomService.java b/server/src/main/java/org/tattour/server/domain/custom/service/CustomService.java index ca7f3b04..e40a2d38 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/service/CustomService.java +++ b/server/src/main/java/org/tattour/server/domain/custom/service/CustomService.java @@ -1,21 +1,21 @@ package org.tattour.server.domain.custom.service; import org.springframework.web.multipart.MultipartFile; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomProcess; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomProcess; +import org.tattour.server.domain.user.model.User; public interface CustomService { - Custom save(Custom custom); + Custom save(Custom custom); - Custom createInitCustom(User user, Boolean haveDesign); + Custom createInitCustom(User user, Boolean haveDesign); - Custom updateCustom(Custom custom, Custom updateCustomInfo); + Custom updateCustom(Custom custom, Custom updateCustomInfo); - Custom updateCustomProcess(Custom updateCustom, CustomProcess customProcess); + Custom updateCustomProcess(Custom updateCustom, CustomProcess customProcess); - void setHandDrawingImage(Custom updateCustom, MultipartFile handDrawingImage); + void setHandDrawingImage(Custom updateCustom, MultipartFile handDrawingImage); - void setMainImageUrl(Custom updateCustom, MultipartFile mainImage); + void setMainImageUrl(Custom updateCustom, MultipartFile mainImage); } diff --git a/server/src/main/java/org/tattour/server/domain/custom/service/CustomStyleService.java b/server/src/main/java/org/tattour/server/domain/custom/service/CustomStyleService.java index 3e11e4a6..385a66c5 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/service/CustomStyleService.java +++ b/server/src/main/java/org/tattour/server/domain/custom/service/CustomStyleService.java @@ -1,8 +1,8 @@ package org.tattour.server.domain.custom.service; import java.util.List; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomStyle; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomStyle; public interface CustomStyleService { diff --git a/server/src/main/java/org/tattour/server/domain/custom/service/CustomThemeService.java b/server/src/main/java/org/tattour/server/domain/custom/service/CustomThemeService.java index ebbff90c..9185de16 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/service/CustomThemeService.java +++ b/server/src/main/java/org/tattour/server/domain/custom/service/CustomThemeService.java @@ -1,8 +1,8 @@ package org.tattour.server.domain.custom.service; import java.util.List; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomTheme; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomTheme; public interface CustomThemeService { diff --git a/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomImageServiceImpl.java b/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomImageServiceImpl.java index c7579936..32865502 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomImageServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomImageServiceImpl.java @@ -3,7 +3,7 @@ import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.tattour.server.domain.custom.domain.CustomImage; +import org.tattour.server.domain.custom.model.CustomImage; import org.tattour.server.domain.custom.repository.CustomImageRepository; import org.tattour.server.domain.custom.service.CustomImageService; diff --git a/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomServiceImpl.java b/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomServiceImpl.java index 2334ed6e..5a7894d7 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomServiceImpl.java @@ -6,13 +6,13 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomProcess; import org.tattour.server.domain.custom.exception.InvalidCustomCompletedException; import org.tattour.server.domain.custom.exception.InvalidCustomPriceException; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomProcess; import org.tattour.server.domain.custom.repository.CustomRepository; import org.tattour.server.domain.custom.service.CustomService; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.user.model.User; import org.tattour.server.infra.s3.S3Service; @Slf4j @@ -20,100 +20,100 @@ @RequiredArgsConstructor public class CustomServiceImpl implements CustomService { - private final CustomRepository customRepository; - private final S3Service s3Service; + private final CustomRepository customRepository; + private final S3Service s3Service; - @Value("${image.default.custom}") - private String defaultImageUrl; - private static final String directoryPath = "custom"; + @Value("${image.default.custom}") + private String defaultImageUrl; + private static final String directoryPath = "custom"; - @Override - public Custom save(Custom custom) { - return customRepository.save(custom); - } + @Override + public Custom save(Custom custom) { + return customRepository.save(custom); + } - @Override - public Custom createInitCustom(User user, Boolean haveDesign) { - return Custom.of( - user, - haveDesign, - "임시 저장", - defaultImageUrl, - false, - 0); - } + @Override + public Custom createInitCustom(User user, Boolean haveDesign) { + return Custom.of( + user, + haveDesign, + "임시 저장", + defaultImageUrl, + false, + 0); + } - @Override - public Custom updateCustom(Custom custom, Custom updateCustom) { - if(!Objects.isNull(updateCustom.getMainImageUrl())) { - custom.setMainImageUrl(updateCustom.getMainImageUrl()); - } - if(!Objects.isNull(updateCustom.getHandDrawingImageUrl())) { - custom.setHandDrawingImageUrl(updateCustom.getHandDrawingImageUrl()); - } - if (!Objects.isNull(updateCustom.getSize())) { - custom.setSize(updateCustom.getSize()); - } - if (!Objects.isNull(updateCustom.getName())) { - custom.setName(updateCustom.getName()); - } - if (!Objects.isNull(updateCustom.getDescription())) { - custom.setDescription(updateCustom.getDescription()); - } - if (!Objects.isNull(updateCustom.getDemand())) { - custom.setDemand(updateCustom.getDemand()); - } - if (!Objects.isNull(updateCustom.getCount())) { - custom.setCount(updateCustom.getCount()); - } - if (!Objects.isNull(updateCustom.getIsColored())) { - custom.setColored(updateCustom.getIsColored()); - } - if (!Objects.isNull(updateCustom.getIsPublic())) { - custom.setPublic(updateCustom.getIsPublic()); - } - if (!Objects.isNull(updateCustom.getViewCount())) { - custom.setViewCount(updateCustom.getViewCount()); - } - if (!Objects.isNull(updateCustom.getIsCompleted())) { - if (updateCustom.getIsCompleted()) { - if (!custom.calPrice().equals(updateCustom.getPrice())) { - throw new InvalidCustomPriceException(); - } - custom.setPrice(updateCustom.getPrice()); - custom.setCompleted(updateCustom.getIsCompleted()); - custom.setCustomProcess(CustomProcess.RECEIVING); - } - } - return customRepository.save(custom); - } + @Override + public Custom updateCustom(Custom custom, Custom updateCustom) { + if (!Objects.isNull(updateCustom.getMainImageUrl())) { + custom.setMainImageUrl(updateCustom.getMainImageUrl()); + } + if (!Objects.isNull(updateCustom.getHandDrawingImageUrl())) { + custom.setHandDrawingImageUrl(updateCustom.getHandDrawingImageUrl()); + } + if (!Objects.isNull(updateCustom.getSize())) { + custom.setSize(updateCustom.getSize()); + } + if (!Objects.isNull(updateCustom.getName())) { + custom.setName(updateCustom.getName()); + } + if (!Objects.isNull(updateCustom.getDescription())) { + custom.setDescription(updateCustom.getDescription()); + } + if (!Objects.isNull(updateCustom.getDemand())) { + custom.setDemand(updateCustom.getDemand()); + } + if (!Objects.isNull(updateCustom.getCount())) { + custom.setCount(updateCustom.getCount()); + } + if (!Objects.isNull(updateCustom.getIsColored())) { + custom.setColored(updateCustom.getIsColored()); + } + if (!Objects.isNull(updateCustom.getIsPublic())) { + custom.setPublic(updateCustom.getIsPublic()); + } + if (!Objects.isNull(updateCustom.getViewCount())) { + custom.setViewCount(updateCustom.getViewCount()); + } + if (!Objects.isNull(updateCustom.getIsCompleted())) { + if (updateCustom.getIsCompleted()) { + if (!custom.calPrice().equals(updateCustom.getPrice())) { + throw new InvalidCustomPriceException(); + } + custom.setPrice(updateCustom.getPrice()); + custom.setCompleted(updateCustom.getIsCompleted()); + custom.setCustomProcess(CustomProcess.RECEIVING); + } + } + return customRepository.save(custom); + } - @Override - public Custom updateCustomProcess(Custom custom, CustomProcess customProcess) { - if(Objects.isNull(custom.getIsCompleted())) { - throw new InvalidCustomCompletedException(); - } - if (!custom.getIsCompleted()) { - throw new InvalidCustomCompletedException(); - } - custom.setCustomProcess(customProcess); - return custom; - } + @Override + public Custom updateCustomProcess(Custom custom, CustomProcess customProcess) { + if (Objects.isNull(custom.getIsCompleted())) { + throw new InvalidCustomCompletedException(); + } + if (!custom.getIsCompleted()) { + throw new InvalidCustomCompletedException(); + } + custom.setCustomProcess(customProcess); + return custom; + } - @Override - public void setHandDrawingImage(Custom updateCustom, MultipartFile handDrawingImage) { - updateCustom.setHandDrawingImageUrl( - s3Service.uploadImage( - handDrawingImage, - directoryPath)); - } + @Override + public void setHandDrawingImage(Custom updateCustom, MultipartFile handDrawingImage) { + updateCustom.setHandDrawingImageUrl( + s3Service.uploadImage( + handDrawingImage, + directoryPath)); + } - @Override - public void setMainImageUrl(Custom updateCustom, MultipartFile mainImage) { - updateCustom.setMainImageUrl( - s3Service.uploadImage( - mainImage, - directoryPath)); - } + @Override + public void setMainImageUrl(Custom updateCustom, MultipartFile mainImage) { + updateCustom.setMainImageUrl( + s3Service.uploadImage( + mainImage, + directoryPath)); + } } diff --git a/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomStyleServiceImpl.java b/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomStyleServiceImpl.java index af843b56..28edd6f3 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomStyleServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomStyleServiceImpl.java @@ -5,8 +5,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomStyle; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomStyle; import org.tattour.server.domain.custom.repository.CustomStyleRepository; import org.tattour.server.domain.custom.service.CustomStyleService; import org.tattour.server.domain.style.provider.StyleProvider; diff --git a/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomThemeServiceImpl.java b/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomThemeServiceImpl.java index fcaac305..1ed57935 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomThemeServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/service/impl/CustomThemeServiceImpl.java @@ -5,8 +5,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import org.tattour.server.domain.custom.domain.Custom; -import org.tattour.server.domain.custom.domain.CustomTheme; +import org.tattour.server.domain.custom.model.Custom; +import org.tattour.server.domain.custom.model.CustomTheme; import org.tattour.server.domain.custom.repository.CustomThemeRepository; import org.tattour.server.domain.custom.service.CustomThemeService; import org.tattour.server.domain.theme.provider.ThemeProvider; diff --git a/server/src/main/java/org/tattour/server/domain/discount/facade/dto/request/CreateDiscountReq.java b/server/src/main/java/org/tattour/server/domain/discount/facade/dto/request/CreateDiscountReq.java index 466e24b5..e5fd7b23 100644 --- a/server/src/main/java/org/tattour/server/domain/discount/facade/dto/request/CreateDiscountReq.java +++ b/server/src/main/java/org/tattour/server/domain/discount/facade/dto/request/CreateDiscountReq.java @@ -4,7 +4,6 @@ import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; -import org.tattour.server.domain.discount.domain.Discount; @Getter @Builder(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/discount/facade/impl/DiscountFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/discount/facade/impl/DiscountFacadeImpl.java index 3b24b5ff..701ac782 100644 --- a/server/src/main/java/org/tattour/server/domain/discount/facade/impl/DiscountFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/discount/facade/impl/DiscountFacadeImpl.java @@ -3,12 +3,12 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.tattour.server.domain.discount.domain.Discount; +import org.tattour.server.domain.discount.model.Discount; import org.tattour.server.domain.discount.provider.DiscountProvider; import org.tattour.server.domain.discount.repository.DiscountRepository; import org.tattour.server.domain.discount.facade.DiscountFacade; import org.tattour.server.domain.discount.facade.dto.request.CreateDiscountReq; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.facade.dto.response.ReadStickerRes; import org.tattour.server.domain.sticker.provider.StickerProvider; diff --git a/server/src/main/java/org/tattour/server/domain/discount/domain/Discount.java b/server/src/main/java/org/tattour/server/domain/discount/model/Discount.java similarity index 96% rename from server/src/main/java/org/tattour/server/domain/discount/domain/Discount.java rename to server/src/main/java/org/tattour/server/domain/discount/model/Discount.java index 6dfb8b17..f897318f 100644 --- a/server/src/main/java/org/tattour/server/domain/discount/domain/Discount.java +++ b/server/src/main/java/org/tattour/server/domain/discount/model/Discount.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.discount.domain; +package org.tattour.server.domain.discount.model; import java.time.LocalDateTime; import javax.persistence.Column; diff --git a/server/src/main/java/org/tattour/server/domain/discount/provider/DiscountProvider.java b/server/src/main/java/org/tattour/server/domain/discount/provider/DiscountProvider.java index e0352594..8d808d86 100644 --- a/server/src/main/java/org/tattour/server/domain/discount/provider/DiscountProvider.java +++ b/server/src/main/java/org/tattour/server/domain/discount/provider/DiscountProvider.java @@ -1,6 +1,6 @@ package org.tattour.server.domain.discount.provider; -import org.tattour.server.domain.discount.domain.Discount; +import org.tattour.server.domain.discount.model.Discount; public interface DiscountProvider { diff --git a/server/src/main/java/org/tattour/server/domain/discount/provider/impl/DiscountProviderImpl.java b/server/src/main/java/org/tattour/server/domain/discount/provider/impl/DiscountProviderImpl.java index 1fd5be82..0ade7ae0 100644 --- a/server/src/main/java/org/tattour/server/domain/discount/provider/impl/DiscountProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/discount/provider/impl/DiscountProviderImpl.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import org.tattour.server.domain.discount.domain.Discount; +import org.tattour.server.domain.discount.model.Discount; import org.tattour.server.domain.discount.exception.NotFoundDiscountException; import org.tattour.server.domain.discount.provider.DiscountProvider; import org.tattour.server.domain.discount.repository.DiscountRepository; diff --git a/server/src/main/java/org/tattour/server/domain/discount/repository/DiscountRepository.java b/server/src/main/java/org/tattour/server/domain/discount/repository/DiscountRepository.java index 4cbd95c5..54616691 100644 --- a/server/src/main/java/org/tattour/server/domain/discount/repository/DiscountRepository.java +++ b/server/src/main/java/org/tattour/server/domain/discount/repository/DiscountRepository.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.discount.repository; import java.util.Optional; -import org.tattour.server.domain.discount.domain.Discount; +import org.tattour.server.domain.discount.model.Discount; public interface DiscountRepository { diff --git a/server/src/main/java/org/tattour/server/domain/discount/repository/impl/DiscountRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/discount/repository/impl/DiscountRepositoryImpl.java index 133d1101..06e5a4ad 100644 --- a/server/src/main/java/org/tattour/server/domain/discount/repository/impl/DiscountRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/discount/repository/impl/DiscountRepositoryImpl.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.discount.repository.impl; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.discount.domain.Discount; +import org.tattour.server.domain.discount.model.Discount; import org.tattour.server.domain.discount.repository.DiscountRepository; public interface DiscountRepositoryImpl extends diff --git a/server/src/main/java/org/tattour/server/domain/magazine/facade/dto/response/ReadMagazineRes.java b/server/src/main/java/org/tattour/server/domain/magazine/facade/dto/response/ReadMagazineRes.java index 836e0f75..5e91fe51 100644 --- a/server/src/main/java/org/tattour/server/domain/magazine/facade/dto/response/ReadMagazineRes.java +++ b/server/src/main/java/org/tattour/server/domain/magazine/facade/dto/response/ReadMagazineRes.java @@ -3,7 +3,7 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.magazine.domain.Magazine; +import org.tattour.server.domain.magazine.model.Magazine; @Getter @AllArgsConstructor(access = AccessLevel.PACKAGE) diff --git a/server/src/main/java/org/tattour/server/domain/magazine/facade/dto/response/ReadMagazineUrlRes.java b/server/src/main/java/org/tattour/server/domain/magazine/facade/dto/response/ReadMagazineUrlRes.java index f5c726a2..e65c8da7 100644 --- a/server/src/main/java/org/tattour/server/domain/magazine/facade/dto/response/ReadMagazineUrlRes.java +++ b/server/src/main/java/org/tattour/server/domain/magazine/facade/dto/response/ReadMagazineUrlRes.java @@ -2,7 +2,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.magazine.domain.Magazine; +import org.tattour.server.domain.magazine.model.Magazine; @Getter @AllArgsConstructor diff --git a/server/src/main/java/org/tattour/server/domain/magazine/domain/Magazine.java b/server/src/main/java/org/tattour/server/domain/magazine/model/Magazine.java similarity index 94% rename from server/src/main/java/org/tattour/server/domain/magazine/domain/Magazine.java rename to server/src/main/java/org/tattour/server/domain/magazine/model/Magazine.java index 4aed715f..a2ce32ce 100644 --- a/server/src/main/java/org/tattour/server/domain/magazine/domain/Magazine.java +++ b/server/src/main/java/org/tattour/server/domain/magazine/model/Magazine.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.magazine.domain; +package org.tattour.server.domain.magazine.model; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/server/src/main/java/org/tattour/server/domain/magazine/provider/MagazineProvider.java b/server/src/main/java/org/tattour/server/domain/magazine/provider/MagazineProvider.java index 79d8e0d3..d043da87 100644 --- a/server/src/main/java/org/tattour/server/domain/magazine/provider/MagazineProvider.java +++ b/server/src/main/java/org/tattour/server/domain/magazine/provider/MagazineProvider.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.magazine.provider; import java.util.List; -import org.tattour.server.domain.magazine.domain.Magazine; +import org.tattour.server.domain.magazine.model.Magazine; public interface MagazineProvider { diff --git a/server/src/main/java/org/tattour/server/domain/magazine/provider/impl/MagazineProviderImpl.java b/server/src/main/java/org/tattour/server/domain/magazine/provider/impl/MagazineProviderImpl.java index 14cd22c1..3367b2f5 100644 --- a/server/src/main/java/org/tattour/server/domain/magazine/provider/impl/MagazineProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/magazine/provider/impl/MagazineProviderImpl.java @@ -3,7 +3,7 @@ import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import org.tattour.server.domain.magazine.domain.Magazine; +import org.tattour.server.domain.magazine.model.Magazine; import org.tattour.server.domain.magazine.exception.NotFoundMagazineException; import org.tattour.server.domain.magazine.provider.MagazineProvider; import org.tattour.server.domain.magazine.repository.MagazineRepository; diff --git a/server/src/main/java/org/tattour/server/domain/magazine/repository/MagazineRepository.java b/server/src/main/java/org/tattour/server/domain/magazine/repository/MagazineRepository.java index 222002e0..3c7b228d 100644 --- a/server/src/main/java/org/tattour/server/domain/magazine/repository/MagazineRepository.java +++ b/server/src/main/java/org/tattour/server/domain/magazine/repository/MagazineRepository.java @@ -2,7 +2,7 @@ import java.util.List; import java.util.Optional; -import org.tattour.server.domain.magazine.domain.Magazine; +import org.tattour.server.domain.magazine.model.Magazine; public interface MagazineRepository { diff --git a/server/src/main/java/org/tattour/server/domain/magazine/repository/impl/MagazineRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/magazine/repository/impl/MagazineRepositoryImpl.java index 7f01d6a1..61477459 100644 --- a/server/src/main/java/org/tattour/server/domain/magazine/repository/impl/MagazineRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/magazine/repository/impl/MagazineRepositoryImpl.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.magazine.repository.impl; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.magazine.domain.Magazine; +import org.tattour.server.domain.magazine.model.Magazine; import org.tattour.server.domain.magazine.repository.MagazineRepository; public interface MagazineRepositoryImpl extends diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java b/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java index cd1ee33f..81a3d545 100644 --- a/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java +++ b/server/src/main/java/org/tattour/server/domain/order/controller/OrderController.java @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController; import org.tattour.server.domain.order.controller.dto.request.OrderReq; import org.tattour.server.domain.order.controller.dto.response.ReadOrderSheetRes; -import org.tattour.server.domain.order.domain.PurchaseRequest; +import org.tattour.server.domain.order.model.PurchaseRequest; import org.tattour.server.domain.order.facade.dto.request.CreateOrderReq; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.facade.impl.OrderFacadeImpl; diff --git a/server/src/main/java/org/tattour/server/domain/order/controller/dto/request/PatchOrderStatusReq.java b/server/src/main/java/org/tattour/server/domain/order/controller/dto/request/PatchOrderStatusReq.java index 1e231095..5bd5e82d 100644 --- a/server/src/main/java/org/tattour/server/domain/order/controller/dto/request/PatchOrderStatusReq.java +++ b/server/src/main/java/org/tattour/server/domain/order/controller/dto/request/PatchOrderStatusReq.java @@ -3,7 +3,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.constraints.NotNull; import lombok.Getter; -import org.tattour.server.domain.order.domain.OrderStatus; +import org.tattour.server.domain.order.model.OrderStatus; @Schema(description = "주문상태 갱신 Request (PREPARATION / CANCEL / ACCEPT / DELIVERING / DELIVERED)") @Getter diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/OrderFacade.java b/server/src/main/java/org/tattour/server/domain/order/facade/OrderFacade.java index 8a9cb2b1..e29f156d 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/OrderFacade.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/OrderFacade.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.order.facade; import org.tattour.server.domain.order.controller.dto.response.ReadOrderSheetRes; -import org.tattour.server.domain.order.domain.PurchaseRequest; +import org.tattour.server.domain.order.model.PurchaseRequest; import org.tattour.server.domain.order.facade.dto.request.CreateOrderReq; import org.tattour.server.domain.order.facade.dto.request.UpdateOrderStatusReq; import org.tattour.server.domain.order.facade.dto.response.ReadOrderHistoryListRes; diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/UpdateOrderStatusReq.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/UpdateOrderStatusReq.java index d0830c07..31159825 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/UpdateOrderStatusReq.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/dto/request/UpdateOrderStatusReq.java @@ -3,7 +3,7 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.order.domain.OrderStatus; +import org.tattour.server.domain.order.model.OrderStatus; @Getter @AllArgsConstructor(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java index 600a74a5..dcbeb863 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/impl/OrderFacadeImpl.java @@ -5,25 +5,25 @@ import org.springframework.data.domain.Page; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.tattour.server.domain.cart.domain.Cart; +import org.tattour.server.domain.cart.model.Cart; import org.tattour.server.domain.cart.service.CartService; import org.tattour.server.domain.order.controller.dto.response.OrderSheetStickerRes; import org.tattour.server.domain.order.controller.dto.response.ReadOrderSheetRes; -import org.tattour.server.domain.order.domain.OrderHistory; -import org.tattour.server.domain.order.domain.OrderStatus; -import org.tattour.server.domain.order.domain.PurchaseRequest; import org.tattour.server.domain.order.facade.OrderFacade; import org.tattour.server.domain.order.facade.dto.request.CreateOrderReq; import org.tattour.server.domain.order.facade.dto.request.UpdateOrderStatusReq; import org.tattour.server.domain.order.facade.dto.response.ReadOrderHistoryListRes; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; +import org.tattour.server.domain.order.model.OrderHistory; +import org.tattour.server.domain.order.model.OrderStatus; +import org.tattour.server.domain.order.model.PurchaseRequest; import org.tattour.server.domain.order.provider.impl.OrderProviderImpl; import org.tattour.server.domain.order.provider.vo.OrderAmountDetailRes; import org.tattour.server.domain.order.provider.vo.OrderHistoryPageInfo; import org.tattour.server.domain.order.service.impl.OrderServiceImpl; import org.tattour.server.domain.sticker.provider.impl.StickerProviderImpl; import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.user.model.User; import org.tattour.server.domain.user.provider.impl.UserProviderImpl; import org.tattour.server.domain.user.provider.vo.UserProfileRes; import org.tattour.server.global.exception.BusinessException; diff --git a/server/src/main/java/org/tattour/server/domain/order/domain/OrderHistory.java b/server/src/main/java/org/tattour/server/domain/order/model/OrderHistory.java similarity index 95% rename from server/src/main/java/org/tattour/server/domain/order/domain/OrderHistory.java rename to server/src/main/java/org/tattour/server/domain/order/model/OrderHistory.java index 825cb2c5..7972e0d6 100644 --- a/server/src/main/java/org/tattour/server/domain/order/domain/OrderHistory.java +++ b/server/src/main/java/org/tattour/server/domain/order/model/OrderHistory.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.order.domain; +package org.tattour.server.domain.order.model; import javax.persistence.Column; import javax.persistence.Entity; @@ -16,7 +16,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import org.hibernate.annotations.DynamicInsert; -import org.tattour.server.domain.user.domain.User; +import org.tattour.server.domain.user.model.User; @Entity @Table(name = "order_history") diff --git a/server/src/main/java/org/tattour/server/domain/order/domain/OrderStatus.java b/server/src/main/java/org/tattour/server/domain/order/model/OrderStatus.java similarity index 88% rename from server/src/main/java/org/tattour/server/domain/order/domain/OrderStatus.java rename to server/src/main/java/org/tattour/server/domain/order/model/OrderStatus.java index 615f9236..2a84a7f2 100644 --- a/server/src/main/java/org/tattour/server/domain/order/domain/OrderStatus.java +++ b/server/src/main/java/org/tattour/server/domain/order/model/OrderStatus.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.order.domain; +package org.tattour.server.domain.order.model; import lombok.AccessLevel; import lombok.Getter; diff --git a/server/src/main/java/org/tattour/server/domain/order/domain/OrderedProduct.java b/server/src/main/java/org/tattour/server/domain/order/model/OrderedProduct.java similarity index 92% rename from server/src/main/java/org/tattour/server/domain/order/domain/OrderedProduct.java rename to server/src/main/java/org/tattour/server/domain/order/model/OrderedProduct.java index 63c2c1f3..7c1ec309 100644 --- a/server/src/main/java/org/tattour/server/domain/order/domain/OrderedProduct.java +++ b/server/src/main/java/org/tattour/server/domain/order/model/OrderedProduct.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.order.domain; +package org.tattour.server.domain.order.model; import javax.persistence.Column; import javax.persistence.Entity; @@ -12,7 +12,7 @@ import lombok.AccessLevel; import lombok.Builder; import lombok.NoArgsConstructor; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; @Entity @Table(name = "ordered_product") diff --git a/server/src/main/java/org/tattour/server/domain/order/domain/PurchaseRequest.java b/server/src/main/java/org/tattour/server/domain/order/model/PurchaseRequest.java similarity index 95% rename from server/src/main/java/org/tattour/server/domain/order/domain/PurchaseRequest.java rename to server/src/main/java/org/tattour/server/domain/order/model/PurchaseRequest.java index 818f43be..dce93639 100644 --- a/server/src/main/java/org/tattour/server/domain/order/domain/PurchaseRequest.java +++ b/server/src/main/java/org/tattour/server/domain/order/model/PurchaseRequest.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.order.domain; +package org.tattour.server.domain.order.model; import lombok.Getter; import org.tattour.server.global.exception.BusinessException; diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java b/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java index 1a217f91..d46eb26a 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/OrderProvider.java @@ -2,7 +2,7 @@ import java.util.List; import org.springframework.data.domain.Page; -import org.tattour.server.domain.order.domain.OrderHistory; +import org.tattour.server.domain.order.model.OrderHistory; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java b/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java index 5ce64abf..bbc81237 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/impl/OrderProviderImpl.java @@ -6,7 +6,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; -import org.tattour.server.domain.order.domain.OrderHistory; +import org.tattour.server.domain.order.model.OrderHistory; import org.tattour.server.domain.order.facade.dto.response.ReadUserOrderHistoryListRes; import org.tattour.server.domain.order.provider.OrderProvider; import org.tattour.server.domain.order.provider.vo.UserOrderHistoryInfo; diff --git a/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderRepositoryImpl.java index 4a94b61e..b0ffc789 100644 --- a/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderRepositoryImpl.java @@ -3,7 +3,7 @@ import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import org.tattour.server.domain.order.domain.OrderHistory; +import org.tattour.server.domain.order.model.OrderHistory; @Repository public interface OrderRepositoryImpl extends JpaRepository { diff --git a/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderedProductRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderedProductRepositoryImpl.java index 666c3e86..38d2d77d 100644 --- a/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderedProductRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/repository/impl/OrderedProductRepositoryImpl.java @@ -2,7 +2,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import org.tattour.server.domain.order.domain.OrderedProduct; +import org.tattour.server.domain.order.model.OrderedProduct; @Repository public interface OrderedProductRepositoryImpl extends JpaRepository { diff --git a/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java b/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java index e13ff1d3..1e13428a 100644 --- a/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java +++ b/server/src/main/java/org/tattour/server/domain/order/service/OrderService.java @@ -1,6 +1,6 @@ package org.tattour.server.domain.order.service; -import org.tattour.server.domain.order.domain.OrderHistory; +import org.tattour.server.domain.order.model.OrderHistory; import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; public interface OrderService { diff --git a/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java b/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java index 42f2144c..9b972c03 100644 --- a/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/order/service/impl/OrderServiceImpl.java @@ -5,8 +5,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.tattour.server.domain.order.domain.OrderHistory; -import org.tattour.server.domain.order.domain.OrderedProduct; +import org.tattour.server.domain.order.model.OrderHistory; +import org.tattour.server.domain.order.model.OrderedProduct; import org.tattour.server.domain.order.repository.impl.OrderRepositoryImpl; import org.tattour.server.domain.order.repository.impl.OrderedProductRepositoryImpl; import org.tattour.server.domain.order.service.OrderService; diff --git a/server/src/main/java/org/tattour/server/domain/search/facade/impl/SearchFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/search/facade/impl/SearchFacadeImpl.java index 3466d811..2fee11dc 100644 --- a/server/src/main/java/org/tattour/server/domain/search/facade/impl/SearchFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/search/facade/impl/SearchFacadeImpl.java @@ -6,7 +6,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.tattour.server.domain.search.facade.SearchFacade; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.provider.StickerProvider; import org.tattour.server.domain.sticker.facade.dto.response.ReadStickerSummaryListRes; diff --git a/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerForUserRes.java b/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerForUserRes.java index b07acc2d..8ac70681 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerForUserRes.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerForUserRes.java @@ -7,7 +7,7 @@ import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; @Getter @Builder(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerRes.java b/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerRes.java index 2f57ee57..cb568041 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerRes.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerRes.java @@ -7,7 +7,7 @@ import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; @Getter @Builder(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerSummaryListRes.java b/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerSummaryListRes.java index ba92c1cb..fc245f6e 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerSummaryListRes.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerSummaryListRes.java @@ -5,7 +5,7 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; @Getter @AllArgsConstructor(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerSummaryRes.java b/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerSummaryRes.java index 98855bdd..a4c6fcdd 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerSummaryRes.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/facade/dto/response/ReadStickerSummaryRes.java @@ -4,7 +4,7 @@ import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; @Getter @Builder(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/sticker/facade/impl/StickerFacadeImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/facade/impl/StickerFacadeImpl.java index f381e2fe..e4777695 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/facade/impl/StickerFacadeImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/facade/impl/StickerFacadeImpl.java @@ -9,11 +9,11 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; -import org.tattour.server.domain.sticker.domain.Sticker; -import org.tattour.server.domain.sticker.domain.StickerImage; -import org.tattour.server.domain.sticker.domain.StickerSort; -import org.tattour.server.domain.sticker.domain.StickerStyle; -import org.tattour.server.domain.sticker.domain.StickerTheme; +import org.tattour.server.domain.sticker.model.Sticker; +import org.tattour.server.domain.sticker.model.StickerImage; +import org.tattour.server.domain.sticker.model.StickerSort; +import org.tattour.server.domain.sticker.model.StickerStyle; +import org.tattour.server.domain.sticker.model.StickerTheme; import org.tattour.server.domain.sticker.exception.NotFoundStickerSortException; import org.tattour.server.domain.sticker.facade.StickerFacade; import org.tattour.server.domain.sticker.facade.dto.request.CreateStickerReq; diff --git a/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java b/server/src/main/java/org/tattour/server/domain/sticker/model/Sticker.java similarity index 94% rename from server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java rename to server/src/main/java/org/tattour/server/domain/sticker/model/Sticker.java index f39034d5..af8f8736 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/model/Sticker.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.sticker.domain; +package org.tattour.server.domain.sticker.model; import java.util.ArrayList; import java.util.List; @@ -20,8 +20,8 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; -import org.tattour.server.domain.discount.domain.Discount; -import org.tattour.server.domain.order.domain.OrderedProduct; +import org.tattour.server.domain.discount.model.Discount; +import org.tattour.server.domain.order.model.OrderedProduct; import org.tattour.server.global.util.AuditingTimeEntity; @Table(name = "sticker") diff --git a/server/src/main/java/org/tattour/server/domain/sticker/domain/StickerImage.java b/server/src/main/java/org/tattour/server/domain/sticker/model/StickerImage.java similarity index 95% rename from server/src/main/java/org/tattour/server/domain/sticker/domain/StickerImage.java rename to server/src/main/java/org/tattour/server/domain/sticker/model/StickerImage.java index e2d21d06..2a1da7c0 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/domain/StickerImage.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/model/StickerImage.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.sticker.domain; +package org.tattour.server.domain.sticker.model; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/server/src/main/java/org/tattour/server/domain/sticker/domain/StickerSort.java b/server/src/main/java/org/tattour/server/domain/sticker/model/StickerSort.java similarity index 93% rename from server/src/main/java/org/tattour/server/domain/sticker/domain/StickerSort.java rename to server/src/main/java/org/tattour/server/domain/sticker/model/StickerSort.java index 81333ce4..306983d1 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/domain/StickerSort.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/model/StickerSort.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.sticker.domain; +package org.tattour.server.domain.sticker.model; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/server/src/main/java/org/tattour/server/domain/sticker/domain/StickerStyle.java b/server/src/main/java/org/tattour/server/domain/sticker/model/StickerStyle.java similarity index 91% rename from server/src/main/java/org/tattour/server/domain/sticker/domain/StickerStyle.java rename to server/src/main/java/org/tattour/server/domain/sticker/model/StickerStyle.java index c1163dff..5d7d21be 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/domain/StickerStyle.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/model/StickerStyle.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.sticker.domain; +package org.tattour.server.domain.sticker.model; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -13,7 +13,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.tattour.server.domain.style.domain.Style; +import org.tattour.server.domain.style.model.Style; @Getter @Table(name = "sticker_style") diff --git a/server/src/main/java/org/tattour/server/domain/sticker/domain/StickerTheme.java b/server/src/main/java/org/tattour/server/domain/sticker/model/StickerTheme.java similarity index 91% rename from server/src/main/java/org/tattour/server/domain/sticker/domain/StickerTheme.java rename to server/src/main/java/org/tattour/server/domain/sticker/model/StickerTheme.java index 596945b3..b7ec70bf 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/domain/StickerTheme.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/model/StickerTheme.java @@ -1,4 +1,4 @@ -package org.tattour.server.domain.sticker.domain; +package org.tattour.server.domain.sticker.model; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -13,7 +13,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.tattour.server.domain.theme.domain.Theme; +import org.tattour.server.domain.theme.model.Theme; @Getter @Table(name = "sticker_theme") diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java index 57c16d79..5973ddaa 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/StickerProvider.java @@ -1,8 +1,8 @@ package org.tattour.server.domain.sticker.provider; import java.util.List; -import org.tattour.server.domain.cart.domain.Cart; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.cart.model.Cart; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; public interface StickerProvider { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java index 66c9614b..4160e08e 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/impl/StickerProviderImpl.java @@ -8,8 +8,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import org.tattour.server.domain.cart.domain.Cart; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.cart.model.Cart; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.exception.NotFoundStickerException; import org.tattour.server.domain.sticker.provider.StickerProvider; import org.tattour.server.domain.sticker.provider.vo.StickerOrderInfo; diff --git a/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/StickerOrderInfo.java b/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/StickerOrderInfo.java index 30c1d85e..dd1d3e74 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/StickerOrderInfo.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/provider/vo/StickerOrderInfo.java @@ -4,7 +4,7 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; @Getter @AllArgsConstructor(access = AccessLevel.PRIVATE) diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerImageRepository.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerImageRepository.java index 157ffc00..4d154881 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerImageRepository.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerImageRepository.java @@ -1,6 +1,6 @@ package org.tattour.server.domain.sticker.repository; -import org.tattour.server.domain.sticker.domain.StickerImage; +import org.tattour.server.domain.sticker.model.StickerImage; public interface StickerImageRepository { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerRepository.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerRepository.java index b44cf359..0c80798e 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerRepository.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerRepository.java @@ -2,7 +2,7 @@ import java.util.Optional; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.repository.custom.StickerRepositoryCustom; public interface StickerRepository extends diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerStyleRepository.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerStyleRepository.java index 6e8dd0f9..9ea548de 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerStyleRepository.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerStyleRepository.java @@ -1,7 +1,6 @@ package org.tattour.server.domain.sticker.repository; -import java.util.List; -import org.tattour.server.domain.sticker.domain.StickerStyle; +import org.tattour.server.domain.sticker.model.StickerStyle; public interface StickerStyleRepository { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerThemeRepository.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerThemeRepository.java index 1c857180..98215cc0 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerThemeRepository.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/StickerThemeRepository.java @@ -1,7 +1,6 @@ package org.tattour.server.domain.sticker.repository; -import java.util.List; -import org.tattour.server.domain.sticker.domain.StickerTheme; +import org.tattour.server.domain.sticker.model.StickerTheme; public interface StickerThemeRepository { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/custom/StickerRepositoryCustom.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/custom/StickerRepositoryCustom.java index 90704a93..7ac78d36 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/custom/StickerRepositoryCustom.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/custom/StickerRepositoryCustom.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.sticker.repository.custom; import java.util.List; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; public interface StickerRepositoryCustom { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerImageRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerImageRepositoryImpl.java index da66c7ec..a3440d5a 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerImageRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerImageRepositoryImpl.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.sticker.repository.impl; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.sticker.domain.StickerImage; +import org.tattour.server.domain.sticker.model.StickerImage; import org.tattour.server.domain.sticker.repository.StickerImageRepository; public interface StickerImageRepositoryImpl extends diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java index 89d49eb8..e953958f 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java @@ -1,17 +1,17 @@ package org.tattour.server.domain.sticker.repository.impl; -import static org.tattour.server.domain.order.domain.QOrderedProduct.*; -import static org.tattour.server.domain.sticker.domain.QSticker.*; -import static org.tattour.server.domain.sticker.domain.QStickerStyle.*; -import static org.tattour.server.domain.sticker.domain.QStickerTheme.*; -import static org.tattour.server.domain.style.domain.QStyle.*; -import static org.tattour.server.domain.theme.domain.QTheme.*; +import static org.tattour.server.domain.order.model.QOrderedProduct.orderedProduct; +import static org.tattour.server.domain.sticker.model.QSticker.sticker; +import static org.tattour.server.domain.sticker.model.QStickerStyle.stickerStyle; +import static org.tattour.server.domain.sticker.model.QStickerTheme.stickerTheme; +import static org.tattour.server.domain.style.model.QStyle.style; +import static org.tattour.server.domain.theme.model.QTheme.theme; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import java.util.List; import lombok.RequiredArgsConstructor; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.repository.custom.StickerRepositoryCustom; @RequiredArgsConstructor diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerStyleRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerStyleRepositoryImpl.java index 5542751f..526c0993 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerStyleRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerStyleRepositoryImpl.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.sticker.repository.impl; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.sticker.domain.StickerStyle; +import org.tattour.server.domain.sticker.model.StickerStyle; import org.tattour.server.domain.sticker.repository.StickerStyleRepository; public interface StickerStyleRepositoryImpl extends diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerThemeRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerThemeRepositoryImpl.java index 1560af94..66fe47a5 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerThemeRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerThemeRepositoryImpl.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.sticker.repository.impl; import org.springframework.data.repository.Repository; -import org.tattour.server.domain.sticker.domain.StickerTheme; +import org.tattour.server.domain.sticker.model.StickerTheme; import org.tattour.server.domain.sticker.repository.StickerThemeRepository; public interface StickerThemeRepositoryImpl extends diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/StickerImageService.java b/server/src/main/java/org/tattour/server/domain/sticker/service/StickerImageService.java index 739bb223..d5f2d217 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/StickerImageService.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/StickerImageService.java @@ -1,6 +1,6 @@ package org.tattour.server.domain.sticker.service; -import org.tattour.server.domain.sticker.domain.StickerImage; +import org.tattour.server.domain.sticker.model.StickerImage; public interface StickerImageService { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/StickerService.java b/server/src/main/java/org/tattour/server/domain/sticker/service/StickerService.java index 7e4d2f69..07ae0e64 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/StickerService.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/StickerService.java @@ -1,7 +1,7 @@ package org.tattour.server.domain.sticker.service; import java.util.List; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; public interface StickerService { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/StickerStyleService.java b/server/src/main/java/org/tattour/server/domain/sticker/service/StickerStyleService.java index 39558d93..2226df7b 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/StickerStyleService.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/StickerStyleService.java @@ -1,6 +1,6 @@ package org.tattour.server.domain.sticker.service; -import org.tattour.server.domain.sticker.domain.StickerStyle; +import org.tattour.server.domain.sticker.model.StickerStyle; public interface StickerStyleService { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/StickerThemeService.java b/server/src/main/java/org/tattour/server/domain/sticker/service/StickerThemeService.java index b8644275..089cac79 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/StickerThemeService.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/StickerThemeService.java @@ -1,6 +1,6 @@ package org.tattour.server.domain.sticker.service; -import org.tattour.server.domain.sticker.domain.StickerTheme; +import org.tattour.server.domain.sticker.model.StickerTheme; public interface StickerThemeService { diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerImageServiceImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerImageServiceImpl.java index 790e96de..f3f7fadf 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerImageServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerImageServiceImpl.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.tattour.server.domain.sticker.domain.StickerImage; +import org.tattour.server.domain.sticker.model.StickerImage; import org.tattour.server.domain.sticker.repository.StickerImageRepository; import org.tattour.server.domain.sticker.service.StickerImageService; diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerServiceImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerServiceImpl.java index c4427e93..ad434f62 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerServiceImpl.java @@ -3,7 +3,7 @@ import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.tattour.server.domain.sticker.domain.Sticker; +import org.tattour.server.domain.sticker.model.Sticker; import org.tattour.server.domain.sticker.repository.StickerRepository; import org.tattour.server.domain.sticker.service.StickerService; diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerStyleServiceImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerStyleServiceImpl.java index 136bad13..54c3772f 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerStyleServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerStyleServiceImpl.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.tattour.server.domain.sticker.domain.StickerStyle; +import org.tattour.server.domain.sticker.model.StickerStyle; import org.tattour.server.domain.sticker.repository.StickerStyleRepository; import org.tattour.server.domain.sticker.service.StickerStyleService; diff --git a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerThemeServiceImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerThemeServiceImpl.java index 4c23306d..5b81e34b 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerThemeServiceImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/service/impl/StickerThemeServiceImpl.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.tattour.server.domain.sticker.domain.StickerTheme; +import org.tattour.server.domain.sticker.model.StickerTheme; import org.tattour.server.domain.sticker.repository.StickerThemeRepository; import org.tattour.server.domain.sticker.service.StickerThemeService; diff --git a/server/src/main/java/org/tattour/server/domain/style/facade/dto/response/ReadStyleListRes.java b/server/src/main/java/org/tattour/server/domain/style/facade/dto/response/ReadStyleListRes.java index 6e923425..f80d0881 100644 --- a/server/src/main/java/org/tattour/server/domain/style/facade/dto/response/ReadStyleListRes.java +++ b/server/src/main/java/org/tattour/server/domain/style/facade/dto/response/ReadStyleListRes.java @@ -5,20 +5,20 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import org.tattour.server.domain.style.domain.Style; +import org.tattour.server.domain.style.model.Style; @Getter @AllArgsConstructor(access = AccessLevel.PRIVATE) public class ReadStyleListRes { - List readStyleRes; + List readStyleRes; - public static ReadStyleListRes from(List