-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] 최신 접수 주문 번호 중복 제거 및 상태 추가
- Loading branch information
Showing
4 changed files
with
40 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 23 additions & 4 deletions
27
src/main/java/com/rootandfruit/server/api/dto/RecentOrderResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
package com.rootandfruit.server.api.dto; | ||
|
||
import com.rootandfruit.server.api.domain.DeliveryStatus; | ||
|
||
public record RecentOrderResponseDto( | ||
Integer orderNumber, | ||
String senderName | ||
String senderName, | ||
String deliveryStatus | ||
) { | ||
// 생성자 추가 | ||
public RecentOrderResponseDto(Integer orderNumber, String senderName, DeliveryStatus deliveryStatus) { | ||
this(orderNumber, senderName, convertStatusToKorean(deliveryStatus)); | ||
} | ||
|
||
public static RecentOrderResponseDto of( | ||
final Integer orderNumber, | ||
final String senderName | ||
final String senderName, | ||
final DeliveryStatus deliveryStatus | ||
) { | ||
return new RecentOrderResponseDto( | ||
orderNumber, senderName | ||
orderNumber, senderName, convertStatusToKorean(deliveryStatus) | ||
); | ||
} | ||
} | ||
|
||
private static String convertStatusToKorean(DeliveryStatus deliveryStatus) { | ||
return switch (deliveryStatus) { | ||
case ORDER_ACCEPTED -> "접수완료"; | ||
case PAYMENT_COMPLETED -> "결제완료"; | ||
case PAYMENT_CANCELED -> "결제취소"; | ||
case ORDER_SHIPPED -> "발송완료"; | ||
default -> "알 수 없음"; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters