Skip to content

Commit

Permalink
merge [FIX] 포인트 정책 제거
Browse files Browse the repository at this point in the history
[FIX] 포인트 정책 제거
  • Loading branch information
05AM authored Dec 2, 2023
2 parents dbc7886 + 70968b9 commit a8a60b4
Show file tree
Hide file tree
Showing 50 changed files with 646 additions and 1,860 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 = "잘못된 요청입니다.",
Expand Down Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 : <receiving, receiptComplete, receiptFailed, shipping, shipped> "
+ " / 테마, 스타일 타입은 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<MultipartFile> 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 : <receiving, receiptComplete, receiptFailed, shipping, shipped> "
+ " / 테마, 스타일 타입은 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<MultipartFile> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading

0 comments on commit a8a60b4

Please sign in to comment.