Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,13 @@ public int getOcrPrice() {

return pageCount * additionalPriceForOcr;
}

public int getEstimatedOcrPrice() {
return pageCount * additionalPriceForOcr;
}

public int getEstimatedOneDayScanPrice() {
return pageCount * order.getAdditionalPriceForOneDayScan();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ public void updateRecoveryOptionPrice(Document document, Integer recoveryOptionP

private int calculateRecoveryOptionPrice(int pageCount, ERecoveryOption recoveryOption) {
if (recoveryOption == ERecoveryOption.SPRING) {
int basePrice = 3000; // 300νŽ˜μ΄μ§€κΉŒμ§€ κΈ°λ³Έ 3,000원
if (pageCount <= 300) {
int basePrice = 3000; // 400νŽ˜μ΄μ§€κΉŒμ§€ κΈ°λ³Έ 3,000원
if (pageCount <= 400) {
return basePrice;
}
int extraPages = pageCount - 300;
int increments = (int) Math.ceil(extraPages / 100.0); // 100νŽ˜μ΄μ§€λ‹Ή 1,000원 (올림)
return basePrice + (increments * 1000);
// 이후 300νŽ˜μ΄μ§€ λ‹¨μœ„λ‘œ 3,000원씩 μΆ”κ°€
int extraPages = pageCount - 400;
int increments = (int) Math.ceil(extraPages / 300.0); // 300νŽ˜μ΄μ§€λ‹Ή 3,000원 (올림)
return basePrice + (increments * 3000);
}
// 기타 μ˜΅μ…˜μ€ κ³ μ •κ°€(ν˜„μž¬ 0원)
return recoveryOption.getPrice();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public class EstimateUserOrderPriceResponseDto extends SelfValidating<EstimateUs
@JsonProperty("payment_total")
private final Integer paymentTotal;

@JsonProperty("estimated_ocr_price")
private final Integer estimatedOcrPrice;

@JsonProperty("estimated_one_day_scan_price")
private final Integer estimatedOneDayScanPrice;

@Getter
@Valid
public static class DocumentInfoDto extends SelfValidating<DocumentInfoDto> {
Expand Down Expand Up @@ -88,6 +94,14 @@ public static class DocumentInfoDto extends SelfValidating<DocumentInfoDto> {
@NotNull
private final Integer cuttingPrice;

@JsonProperty("estimated_ocr_price")
@NotNull
private final Integer estimatedOcrPrice;

@JsonProperty("estimated_one_day_scan_price")
@NotNull
private final Integer estimatedOneDayScanPrice;

@Builder
public DocumentInfoDto(String name,
Integer pageCount,
Expand All @@ -97,7 +111,9 @@ public DocumentInfoDto(String name,
Integer recoveryPrice,
Integer oneDayScanPrice,
Integer cuttingPrice,
Integer ocrPrice) {
Integer ocrPrice,
Integer estimatedOcrPrice,
Integer estimatedOneDayScanPrice) {
this.name = name;
this.pageCount = pageCount;
this.pagePrice = pagePrice;
Expand All @@ -107,6 +123,8 @@ public DocumentInfoDto(String name,
this.oneDayScanPrice = oneDayScanPrice;
this.ocrPrice = ocrPrice;
this.cuttingPrice = cuttingPrice;
this.estimatedOcrPrice = estimatedOcrPrice;
this.estimatedOneDayScanPrice = estimatedOneDayScanPrice;
this.validateSelf();
}

Expand All @@ -121,6 +139,8 @@ public static DocumentInfoDto fromEntity(Document document) {
.oneDayScanPrice(document.getOneDayScanPrice())
.ocrPrice(document.getOcrPrice())
.cuttingPrice(document.getCuttingPrice())
.estimatedOcrPrice(document.getEstimatedOcrPrice())
.estimatedOneDayScanPrice(document.getEstimatedOneDayScanPrice())
.build();
}
}
Expand All @@ -137,7 +157,9 @@ public EstimateUserOrderPriceResponseDto(
Integer couponPrice,
Integer couponPercentage,
Integer paymentTotal,
Integer ocrPrice
Integer ocrPrice,
Integer estimatedOcrPrice,
Integer estimatedOneDayScanPrice
) {
this.documents = documents;
this.documentsPrice = documentsPrice;
Expand All @@ -150,6 +172,8 @@ public EstimateUserOrderPriceResponseDto(
this.couponPercentage = couponPercentage;
this.paymentTotal = paymentTotal;
this.ocrPrice = ocrPrice;
this.estimatedOcrPrice = estimatedOcrPrice;
this.estimatedOneDayScanPrice = estimatedOneDayScanPrice;
this.validateSelf();
}

Expand Down Expand Up @@ -182,6 +206,12 @@ public static EstimateUserOrderPriceResponseDto of(Order order,
int recoveryPriceSum = checkedDocs.stream()
.mapToInt(DocumentInfoDto::getRecoveryPrice)
.sum();
int estimatedOcrPriceSum = checkedDocs.stream()
.mapToInt(DocumentInfoDto::getEstimatedOcrPrice)
.sum();
int estimatedOneDayScanPriceSum = checkedDocs.stream()
.mapToInt(DocumentInfoDto::getEstimatedOneDayScanPrice)
.sum();

return EstimateUserOrderPriceResponseDto.builder()
.documents(allDocs)
Expand All @@ -193,6 +223,8 @@ public static EstimateUserOrderPriceResponseDto of(Order order,
.deliveryPrice(order.getDelivery().getDeliveryPrice())
.recoveryPrice(recoveryPriceSum)
.cuttingPrice(cuttingPriceSum)
.estimatedOcrPrice(estimatedOcrPriceSum)
.estimatedOneDayScanPrice(estimatedOneDayScanPriceSum)
.couponPrice(order.getUsedCoupon() != null ? order.getUsedCoupon().getIssuedCoupon().getDiscountPrice(order.getDocumentsTotalAmount(), ocrPriceSum, order.getDelivery().getDeliveryPrice()) : 0)
.paymentTotal(order.getTotalAmount())
.build();
Expand Down