-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#61 slot generator #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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fb4dc84
feat: ์์ฝ ์ฌ๋กฏ ์๋ ์์ฑ ์ค์ผ์ค๋ฌ ์ถ๊ฐ
johe00123 b003526
fix: ReservationService ์ถฉ๋ ํด๊ฒฐ ์ ๋๋ฝ๋ import ๋ฐ ๋ณ์ ์ถ๊ฐ
johe00123 bc6812f
Merge branch 'develop' of https://github.com/catchtable-clone/backendโฆ
johe00123 6b0a97b
Merge branch 'develop' of https://github.com/catchtable-clone/backendโฆ
johe00123 bb9f8ab
Merge remote-tracking branch 'origin/develop' into feat/#61-slot-geneโฆ
johe00123 584a79d
fix: ์ฌ๋กฏ ์๋ ์์ฑ ์ ๋ถ๋ถ ์์ฑ๋ ์ฌ๋กฏ ๋๋ฝ ๋ฌธ์ ํด๊ฒฐ
johe00123 44f49e6
refactor: ์ค์ผ์ค๋ฌ๋ฅผ ๋จ์ผ ๋ ์ง์์ 30์ผ ๋ฒ์ ๋ฃจํ๋ก ๋ณ๊ฒฝ
johe00123 0e6d093
fix: ์ฌ๋กฏ ์๋ ์์ฑ ์ ๋ถ๋ถ ์์ฑ๋ ์ฌ๋กฏ ๋๋ฝ ๋ฌธ์ ํด๊ฒฐ
johe00123 c1e9328
chore: ์ค์ผ์ค๋ฌ ๋์
ํ ๋ฏธ์ฌ์ฉ ์๋ ์๋ํฌ์ธํธ ์ฃผ์ ์ฒ๋ฆฌ
johe00123 222b5e6
refactor: PR #64 ์ฝ๋ ๋ฆฌ๋ทฐ ๋ฐ์
johe00123 770140f
refactor: PR #65 ์ฝ๋ ๋ฆฌ๋ทฐ ๋ฐ์ - ๋ฉ๋ชจ๋ฆฌ ์์ ์ฑ, ํ์
์์ ์ฑ, ๋ฐ๋ณต ์ฐ์ฐ ์ ๊ฑฐ
johe00123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/catchtable/remain/dto/projection/StoreRemainTimeView.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.catchtable.remain.dto.projection; | ||
|
|
||
| import java.time.LocalTime; | ||
|
|
||
| /** | ||
| * ๋งค์ฅ๋ณ ์ฌ๋กฏ ์๊ฐ ์กฐํ์ฉ Interface Projection. | ||
| * (storeId, remainTime) ํ์ด๋ฅผ ํ์ ์์ ํ๊ฒ ๋ฐํํ๋ค. | ||
| */ | ||
| public interface StoreRemainTimeView { | ||
|
|
||
| Long getStoreId(); | ||
|
|
||
| LocalTime getRemainTime(); | ||
| } |
This file contains hidden or 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 hidden or 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
51 changes: 51 additions & 0 deletions
51
src/main/java/com/catchtable/remain/scheduler/StoreRemainGenerationScheduler.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package com.catchtable.remain.scheduler; | ||
|
|
||
| import com.catchtable.remain.service.StoreRemainService; | ||
| import com.catchtable.remain.service.StoreSlotPlan; | ||
| import com.catchtable.store.entity.Store; | ||
| import com.catchtable.store.repository.StoreRepository; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.scheduling.annotation.Scheduled; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.time.Clock; | ||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * ๋งค์ผ ์๋ฒฝ 4์์ "์ค๋ ํฌํจ 30์ผ" ๋ฒ์์ ์์ฝ ์ฌ๋กฏ์ ์๋ ์์ฑํ๋ค. | ||
| * ํญ์ ์ค๋๋ถํฐ 30์ผ์น ์ฌ๋กฏ์ด DB์ ์กด์ฌํ๋๋ก ๋ณด์ถฉ (์ฐจ์งํฉ ๊ธฐ๋ฐ์ด๋ผ ์ด๋ฏธ ์๋ ๋ ์ง๋ ์คํต). | ||
| * ๋งค์ฅ ๋ชฉ๋ก ์กฐํ์ ์์ ์๊ฐ ํ์ฑ์ ๋ฒ์ ๋ฃจํ ์์ ์ ๋จ ํ ๋ฒ๋ง ์ํํด | ||
| * 30ํ ๋ฐ๋ณต ์กฐํ/ํ์ฑ ๋น์ฉ์ ์ ๊ฑฐํ๋ค. | ||
| */ | ||
| @Slf4j | ||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class StoreRemainGenerationScheduler { | ||
|
|
||
| private static final int RANGE_DAYS = 30; | ||
|
|
||
| private final StoreRemainService storeRemainService; | ||
| private final StoreRepository storeRepository; | ||
| private final Clock clock; | ||
|
|
||
| @Scheduled(cron = "0 0 4 * * *") | ||
| public void generateFutureSlots() { | ||
| List<Store> stores = storeRepository.findAllByIsDeletedFalse(); | ||
| List<StoreSlotPlan> plans = storeRemainService.buildSlotPlans(stores); | ||
|
|
||
| LocalDate startDate = LocalDate.now(clock); | ||
| LocalDate endDate = startDate.plusDays(RANGE_DAYS - 1); | ||
|
|
||
| int totalFilledStores = 0; | ||
| for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) { | ||
| totalFilledStores += storeRemainService.generateDailySlotsForPlans(plans, date); | ||
| } | ||
|
|
||
| if (totalFilledStores > 0) { | ||
| log.info("[์ฌ๋กฏ ์๋ ์์ฑ] ๋ฒ์: {} ~ {}, ๋ณด์ถฉ ๋ฐ์ ๋งค์ฅ-์ผ ํฉ๊ณ: {}", | ||
| startDate, endDate, totalFilledStores); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
์ฃผ์ ์ฒ๋ฆฌ๋ ์ฝ๋๋ ๊ฐ๋ ์ฑ์ ์ ํดํ๊ณ ์ ์ง๋ณด์ ๋น์ฉ์ ๋์ ๋๋ค. ์ค์ผ์ค๋ฌ ๋์ ์ผ๋ก ๋ ์ด์ ์ฌ์ฉํ์ง ์๋ ๊ธฐ๋ฅ์ด๋ผ๋ฉด ์ฝ๋๋ฅผ ์ฃผ์์ผ๋ก ๋จ๊ฒจ๋๊ธฐ๋ณด๋ค ์ญ์ ํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ํ์ํ ๊ฒฝ์ฐ Git ํ์คํ ๋ฆฌ๋ฅผ ํตํด ์ธ์ ๋ ์ง ํ์ธํ๊ฑฐ๋ ๋ณต๊ตฌํ ์ ์์ต๋๋ค.