Skip to content

Commit

Permalink
Api-v1.0.3-1
Browse files Browse the repository at this point in the history
Api-v1.0.3-1
  • Loading branch information
ImNM authored Mar 22, 2023
2 parents 8a1b39c + 20ad7e5 commit a99e4b5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<IssuedTicketStatus> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a99e4b5

Please sign in to comment.