diff --git a/src/main/java/site/gachontable/gachontablebe/domain/admin/usecase/CallUser.java b/src/main/java/site/gachontable/gachontablebe/domain/admin/usecase/CallUser.java index 21fd09b..1f9c262 100644 --- a/src/main/java/site/gachontable/gachontablebe/domain/admin/usecase/CallUser.java +++ b/src/main/java/site/gachontable/gachontablebe/domain/admin/usecase/CallUser.java @@ -58,7 +58,7 @@ public String execute(AuthDetails authDetails, CallUserRequest request, String l private void scheduleAutoCancel(UUID waitingId, HashMap variables) { executorService.schedule(() -> - autoCancelUser.execute(waitingId, variables, "자동 취소"), 5, TimeUnit.MINUTES); + autoCancelUser.execute(waitingId, variables, "자동 취소"), 7, TimeUnit.MINUTES); } private void checkPubMatches(AuthDetails authDetails, Pub pub) { diff --git a/src/main/java/site/gachontable/gachontablebe/domain/admin/usecase/EnterUser.java b/src/main/java/site/gachontable/gachontablebe/domain/admin/usecase/EnterUser.java index 7ab4a82..648b594 100644 --- a/src/main/java/site/gachontable/gachontablebe/domain/admin/usecase/EnterUser.java +++ b/src/main/java/site/gachontable/gachontablebe/domain/admin/usecase/EnterUser.java @@ -61,7 +61,7 @@ private void createSeating(Pub pub, Waiting waiting, Integer seatingNum) { Seating seating = Seating.create( seatingNum, waiting.getTableType(), - LocalDateTime.now().plusHours(pub.getHours()), + LocalDateTime.now().plusMinutes(pub.getMinutes()), pub, waiting, waiting.getUser()); diff --git a/src/main/java/site/gachontable/gachontablebe/domain/pub/domain/Pub.java b/src/main/java/site/gachontable/gachontablebe/domain/pub/domain/Pub.java index 6ae20ac..848eeab 100644 --- a/src/main/java/site/gachontable/gachontablebe/domain/pub/domain/Pub.java +++ b/src/main/java/site/gachontable/gachontablebe/domain/pub/domain/Pub.java @@ -10,7 +10,7 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Pub { - private static final Integer MAX_WAITING_COUNT = 30; + private static final Integer MAX_WAITING_COUNT = 50; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -26,7 +26,7 @@ public class Pub { private String instagramUrl; @Column(nullable = false) - private Integer hours; + private Integer minutes; @Column(nullable = false) private String menuUrl; @@ -40,10 +40,13 @@ public class Pub { @Column(nullable = false) private Integer waitingCount; + @Column(nullable = false) + private Boolean autoDisabled; + public static Pub create(String pubName, String oneLiner, String instagramUrl, - Integer hours, + Integer minutes, String menuUrl, Boolean openStatus, Boolean waitingStatus, @@ -52,7 +55,7 @@ public static Pub create(String pubName, .pubName(pubName) .oneLiner(oneLiner) .instagramUrl(instagramUrl) - .hours(hours) + .minutes(minutes) .menuUrl(menuUrl) .openStatus(openStatus) .waitingStatus(waitingStatus) @@ -64,7 +67,7 @@ public static Pub create(String pubName, private Pub(String pubName, String oneLiner, String instagramUrl, - Integer hours, + Integer minutes, String menuUrl, Boolean openStatus, Boolean waitingStatus, @@ -72,7 +75,7 @@ private Pub(String pubName, this.pubName = pubName; this.oneLiner = oneLiner; this.instagramUrl = instagramUrl; - this.hours = hours; + this.minutes = minutes; this.menuUrl = menuUrl; this.openStatus = openStatus; this.waitingStatus = waitingStatus; @@ -87,15 +90,20 @@ public void increaseWaitingCount() { private void checkMaxWaitingCount() { if (this.waitingCount >= MAX_WAITING_COUNT) { this.waitingStatus = false; - return; + this.autoDisabled = true; } - this.waitingStatus = true; } public void decreaseWaitingCount() { validateWaitingCount(); + validateCanUpdateWaitingStatusToTrue(); this.waitingCount -= 1; - checkMaxWaitingCount(); + } + + private void validateCanUpdateWaitingStatusToTrue() { + if (this.autoDisabled && !this.waitingStatus && this.waitingCount <= MAX_WAITING_COUNT) { + this.waitingStatus = true; + } } private void validateWaitingCount() { @@ -112,6 +120,7 @@ public void updateOpenStatus(Boolean openStatus) { public void updateWaitingStatus(Boolean waitingStatus) { this.waitingStatus = waitingStatus; + this.autoDisabled = false; } public void checkStatus() { diff --git a/src/main/java/site/gachontable/gachontablebe/domain/pub/presentation/dto/request/PubRegisterRequest.java b/src/main/java/site/gachontable/gachontablebe/domain/pub/presentation/dto/request/PubRegisterRequest.java index 254ef83..e35668a 100644 --- a/src/main/java/site/gachontable/gachontablebe/domain/pub/presentation/dto/request/PubRegisterRequest.java +++ b/src/main/java/site/gachontable/gachontablebe/domain/pub/presentation/dto/request/PubRegisterRequest.java @@ -3,7 +3,7 @@ public record PubRegisterRequest(String pubName, String oneLiner, String instagramUrl, - Integer hours, + Integer minutes, String menuUrl, Boolean openStatus, Boolean waitingStatus) { diff --git a/src/main/java/site/gachontable/gachontablebe/domain/pub/usecase/PubService.java b/src/main/java/site/gachontable/gachontablebe/domain/pub/usecase/PubService.java index 719e583..3fd5ca3 100644 --- a/src/main/java/site/gachontable/gachontablebe/domain/pub/usecase/PubService.java +++ b/src/main/java/site/gachontable/gachontablebe/domain/pub/usecase/PubService.java @@ -59,7 +59,7 @@ public Pub createPub(PubRegisterRequest request) { return Pub.create(request.pubName(), request.oneLiner(), request.instagramUrl(), - request.hours(), + request.minutes(), request.menuUrl(), request.openStatus(), request.waitingStatus(),