From 20ad7e5efad9f0f2c02a8cc7372e2dbde9cf6ce7 Mon Sep 17 00:00:00 2001 From: Chan Jin Date: Wed, 22 Mar 2023 16:25:26 +0900 Subject: [PATCH] =?UTF-8?q?refactor=20:=20=ED=8B=B0=EC=BC=93=20=EC=8A=A4?= =?UTF-8?q?=ED=83=9C=EC=9D=B4=EC=A7=80=20=EC=A7=80=EB=82=9C=20=EA=B3=B5?= =?UTF-8?q?=EC=97=B0=20=EC=83=81=ED=83=9C=20=EC=B2=98=EB=A6=AC=20(#549)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/order/model/dto/response/OrderBriefElement.java | 2 +- .../band/gosrock/domain/domains/event/domain/Event.java | 4 ++++ .../domain/domains/issuedTicket/domain/IssuedTickets.java | 8 +++++++- .../domains/issuedTicket/domain/IssuedTicketsStage.java | 4 +++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/order/model/dto/response/OrderBriefElement.java b/DuDoong-Api/src/main/java/band/gosrock/api/order/model/dto/response/OrderBriefElement.java index 1c7bb20d..f4c492b0 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/order/model/dto/response/OrderBriefElement.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/order/model/dto/response/OrderBriefElement.java @@ -42,7 +42,7 @@ public class OrderBriefElement { public static OrderBriefElement of(Order order, Event event, IssuedTickets issuedTickets) { return OrderBriefElement.builder() .refundInfo(event.toRefundInfoVoWithOrderStatus(order.getOrderStatus())) - .stage(issuedTickets.getIssuedTicketsStage()) + .stage(issuedTickets.getIssuedTicketsStage(event)) .orderUuid(order.getUuid()) .orderNo(order.getOrderNo()) .orderStatus(order.getOrderStatus()) diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/event/domain/Event.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/event/domain/Event.java index fa3bc13d..9935516b 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/event/domain/Event.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/event/domain/Event.java @@ -69,6 +69,10 @@ public Boolean isPreparing() { return this.status == PREPARING; } + public Boolean isClosed() { + return this.status == CLOSED; + } + public void setEventBasic(EventBasic eventBasic) { this.validateOpenStatus(); this.eventBasic = eventBasic; diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/domain/IssuedTickets.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/domain/IssuedTickets.java index e6e236ce..ea423906 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/domain/IssuedTickets.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/domain/IssuedTickets.java @@ -2,6 +2,7 @@ import band.gosrock.domain.common.vo.IssuedTicketInfoVo; +import band.gosrock.domain.domains.event.domain.Event; import java.util.List; import lombok.Getter; @@ -35,12 +36,17 @@ public String getTicketNoName() { else return String.format("%s ~ %s (%d매)", nos.get(0), nos.get(size - 1), size); } - public IssuedTicketsStage getIssuedTicketsStage() { + public IssuedTicketsStage getIssuedTicketsStage(Event event) { if (getTotalQuantity() == 0) return IssuedTicketsStage.APPROVE_WAITING; List issuedTicketStatuses = getIssuedTicketStatuses(); if (isCanceled(issuedTicketStatuses)) { return IssuedTicketsStage.CANCELED; } + // 정상 발급된 티켓이 . 지난 공연이라면 지난 공연으로 통일. + if (event.isClosed()) { + return IssuedTicketsStage.PASSED_EVENT; + } + if (isBeforeEntrance(issuedTicketStatuses)) return IssuedTicketsStage.BEFORE_ENTRANCE; if (isAfterEntrance(issuedTicketStatuses)) return IssuedTicketsStage.AFTER_ENTRANCE; return IssuedTicketsStage.ENTERING; diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/domain/IssuedTicketsStage.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/domain/IssuedTicketsStage.java index 2fad0cee..835d12f1 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/domain/IssuedTicketsStage.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/domains/issuedTicket/domain/IssuedTicketsStage.java @@ -16,7 +16,9 @@ public enum IssuedTicketsStage { // 입장중 ENTERING("ENTERING", "입장중"), // 취소됨 - CANCELED("CANCELED", "취소됨"); + CANCELED("CANCELED", "취소됨"), + + PASSED_EVENT("PASSED_EVENT", "지난공연"); private final String value; @JsonValue private final String kr;