-
Notifications
You must be signed in to change notification settings - Fork 2
[BE] SISC1-89 게임 종료 및 결과 정산 #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "SISC1-89-BE-\uAC8C\uC784-\uC885\uB8CC-\uBC0F-\uACB0\uACFC-\uC815\uC0B0"
Changes from all commits
2b6fef7
b9c452c
9f91b17
10b7cca
a34311e
cdb1990
b4c0733
1899271
2d7ff9d
a6d30bf
df9d017
5fa19b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,6 @@ | |
|
|
||
| public enum BetStatus { | ||
| ACTIVE, | ||
| DELETED | ||
| DELETED, // 삭제 | ||
| CLOSED // 정산 완료 | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,49 @@ | ||
| package org.sejongisc.backend.betting.service; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.sejongisc.backend.betting.entity.Scope; | ||
| import org.springframework.scheduling.annotation.Scheduled; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| @Component | ||
| @Slf4j | ||
| @RequiredArgsConstructor | ||
| public class BettingScheduler { | ||
|
|
||
| private final BettingService bettingService; | ||
|
|
||
| @Scheduled(cron = "0 0 9 * * MON-FRI") | ||
| @Scheduled(cron = "0 0 9 * * MON-FRI", zone = "Asia/Seoul") | ||
| public void dailyOpenScheduler() { | ||
| bettingService.createBetRound(Scope.DAILY); | ||
| // log.info("✅ 스케줄러 정상 작동 중: {}", LocalDateTime.now()); | ||
| } | ||
|
|
||
| @Scheduled(cron = "0 0 9 * * MON") | ||
| @Scheduled(cron = "0 0 9 * * MON", zone = "Asia/Seoul") | ||
| public void weeklyOpenScheduler() { | ||
| bettingService.createBetRound(Scope.WEEKLY); | ||
| } | ||
|
|
||
| @Scheduled(cron = "0 0 22 * * MON-FRI") | ||
| @Scheduled(cron = "0 0 22 * * MON-FRI", zone = "Asia/Seoul") | ||
| public void dailyCloseScheduler() { | ||
| bettingService.closeBetRound(); | ||
| } | ||
|
|
||
| @Scheduled(cron = "0 0 22 * * FRI") | ||
| @Scheduled(cron = "0 0 22 * * FRI", zone = "Asia/Seoul") | ||
| public void weeklyCloseScheduler() { | ||
| bettingService.closeBetRound(); | ||
| } | ||
|
|
||
| @Scheduled(cron = "0 5 22 * * MON-FRI", zone = "Asia/Seoul") | ||
| public void dailySettleScheduler() { | ||
| bettingService.settleUserBets(); | ||
| } | ||
|
|
||
| @Scheduled(cron = "0 5 22 * * FRI", zone = "Asia/Seoul") | ||
| public void weeklySettleScheduler() { | ||
| bettingService.settleUserBets(); | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -66,10 +66,10 @@ public enum ErrorCode { | |||||
| STOCK_NOT_FOUND(HttpStatus.NOT_FOUND, "주식 종목이 존재하지 않습니다."), | ||||||
| BET_ROUND_NOT_FOUND(HttpStatus.NOT_FOUND, "존재하지 않는 라운드입니다."), | ||||||
| BET_DUPLICATE(HttpStatus.CONFLICT, "이미 이 라운드에 베팅했습니다."), | ||||||
| BET_TIME_INVALID(HttpStatus.CONFLICT, "베팅 가능 시간이 아닙니다."), | ||||||
| BET_ROUND_CLOSED(HttpStatus.CONFLICT, "베팅 가능 시간이 아닙니다."), | ||||||
| BET_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 베팅을 찾을 수 없습니다."), | ||||||
| BET_ROUND_CLOSED(HttpStatus.CONFLICT, "이미 마감된 라운드입니다."), | ||||||
| BET_POINT_TOO_LOW(HttpStatus.CONFLICT, "베팅 포인트는 10 이상이어야 합니다."); | ||||||
| BET_POINT_TOO_LOW(HttpStatus.CONFLICT, "베팅 포인트는 10 이상이어야 합니다."), | ||||||
| BET_ROUND_NOT_CLOSED(HttpStatus.CONFLICT, "닫히지 않은 배팅입니다."); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 용어 일관성 문제가 있습니다. 에러 코드명은 정산 작업은 개별 배팅이 아닌 라운드 단위로 수행되므로, 메시지를 "닫히지 않은 라운드입니다." 또는 "배팅 라운드가 아직 종료되지 않았습니다."로 수정하는 것이 더 명확합니다. 다음 diff를 적용하여 용어를 일관되게 수정하세요: - BET_ROUND_NOT_CLOSED(HttpStatus.CONFLICT, "닫히지 않은 배팅입니다.");
+ BET_ROUND_NOT_CLOSED(HttpStatus.CONFLICT, "닫히지 않은 라운드입니다.");📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| private final HttpStatus status; | ||||||
| private final String message; | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lockAt와 동일 시각 베팅 허용되는 경계 오류
LocalDateTime.now().isAfter(lockAt)만 검사하면 현재 시각이lockAt과 정확히 같을 때는 베팅이 허용됩니다. 잠금 시간을 초 단위로 맞춰 두었다면 동일 시각에도 베팅이 들어올 수 있어 의도와 달리 마감 후 베팅이 수락되는 문제가 발생합니다.isEqual까지 포함하거나!now.isBefore(lockAt)로 비교하여lockAt에 도달한 순간부터는 차단되도록 보완해 주세요.🤖 Prompt for AI Agents