Skip to content

Commit

Permalink
Merge pull request #197 from Upjuyanolja/refacotr/pointTime
Browse files Browse the repository at this point in the history
fix: 포인트 내역 조회에서 날짜를 String 형식으로 통일해서 다룸
  • Loading branch information
JeongUijeong authored Jan 27, 2024
2 parents ef41f58 + 87d4768 commit 230b0ef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.backoffice.upjuyanolja.domain.point.dto.response;

import com.backoffice.upjuyanolja.domain.point.entity.PointCharges;
import java.time.format.DateTimeFormatter;
import lombok.Builder;

@Builder
Expand All @@ -16,7 +17,7 @@ public static PointChargeResponse of(
) {
return PointChargeResponse.builder()
.orderId(pointCharges.getOrderName())
.tradeAt(pointCharges.getChargeDate().toString())
.tradeAt(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format(pointCharges.getChargeDate()))
.orderName(pointCharges.getChargePoint()+"원")
.amount(pointCharges.getChargePoint())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public record PointTotalDetailResponse(
String description,
long trade,
long amount,
LocalDateTime date,
String date,
Object receipt

) {

public static PointTotalDetailResponse of(
String category, String type, String status,
String name, String description, long trade,
long amount, LocalDateTime date, Object receipt
long amount, String date, Object receipt
) {
return PointTotalDetailResponse.builder()
.category(category)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Comparator;
Expand Down Expand Up @@ -202,7 +203,7 @@ public PointTotalPageResponse getTotalPointPageResponse(Long memberId, Pageable
"",
charge.trade(),
charge.amount(),
LocalDateTime.parse(charge.receipt().tradeAt()),
charge.receipt().tradeAt(),
charge.receipt()
));
}
Expand All @@ -215,7 +216,7 @@ public PointTotalPageResponse getTotalPointPageResponse(Long memberId, Pageable
usage.description(),
usage.trade(),
usage.amount(),
LocalDateTime.parse(usage.receipt().tradeAt()),
usage.receipt().tradeAt(),
usage.receipt()
));
}
Expand Down Expand Up @@ -416,14 +417,14 @@ private PointChargeReceiptResponse getPointChargeReceiptResponse(
case REMAINED:
return PointChargeReceiptResponse.of(
pointCharges.getOrderName(),
pointCharges.getChargeDate().toString(),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format(pointCharges.getChargeDate()),
pointCharges.getChargePoint()
);
case CANCELED:
PointRefunds pointRefund = pointRefundsRepository.findByPointCharges(pointCharges);
return PointChargeReceiptResponse.of(
pointCharges.getOrderName(),
pointRefund.getRefundDate().toString(),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format(pointRefund.getRefundDate()),
pointCharges.getChargePoint()
);
default:
Expand Down Expand Up @@ -500,7 +501,8 @@ private PointUsageReceiptResponse getPointUsageReceiptResponse(
Map<Room, List<Coupon>> couponIssuancesMap, List<CouponIssuance> couponIssuances
) {
return PointUsageReceiptResponse.of(
getPointUsageReceiptOrderId(), pointUsages.getOrderDate().toString(),
getPointUsageReceiptOrderId(),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format(pointUsages.getOrderDate()),
accommodationName,
getPointUsageDetailReceiptResponse(couponIssuancesMap, couponIssuances)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Content-Type: application/json

###

GET http://localhost:8080/api/points/total
GET http://localhost:8080/api/points/total-balance
Accept: application/json
Authorization: Bearer {{access_token}}

0 comments on commit 230b0ef

Please sign in to comment.