feat: ab#2225: added public holidays as kalendertage#27
Open
witchpou wants to merge 12 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an automated import of public holidays from a configurable external API into Kalendertag, and adapts weekday-average calculations to include/exclude public holidays accordingly.
Changes:
- Add public-holiday import pipeline (API client + service) with scheduled and startup execution, plus a secured manual REST trigger.
- Extend Zeitintervall weekday-average queries to treat public holidays differently for Sunday/holiday vs weekday aggregations.
- Add default DB configuration entry and runtime scheduling configuration for the new import job.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/de/muenchen/dave/services/kalendertag/PublicHolidaysImportServiceTest.java | Adds unit tests for holiday import behavior and URL templating. |
| src/main/resources/db/migration/V18__add_public_holidays_configuration.sql | Inserts default configuration for the public holidays API URL. |
| src/main/resources/application.yml | Adds cron + ShedLock settings for the new public-holidays job. |
| src/main/java/de/muenchen/dave/services/ladezaehldaten/LadeZaehldatenService.java | Switches weekday-average repository query based on TagesTyp to account for public holidays. |
| src/main/java/de/muenchen/dave/services/kalendertag/PublicHolidaysReceiver.java | Adds startup + scheduled execution for importing public holidays. |
| src/main/java/de/muenchen/dave/services/kalendertag/PublicHolidaysImportService.java | Implements public-holiday import/upsert logic and configurable source URL resolution. |
| src/main/java/de/muenchen/dave/services/kalendertag/OpenHolidaysApiClient.java | Adds RestTemplate-based client to fetch public holidays. |
| src/main/java/de/muenchen/dave/repositories/relationaldb/ZeitintervallRepository.java | Adds new native-query methods for weekday-average calculations with/without public holidays. |
| src/main/java/de/muenchen/dave/repositories/relationaldb/KalendertagRepository.java | Adds bulk lookup by dates and an existence check for date ranges. |
| src/main/java/de/muenchen/dave/domain/Zeitintervall.java | Renames/creates native queries used for weekday-average calculations and adds public-holiday logic. |
| src/main/java/de/muenchen/dave/domain/dtos/PublicHolidaysDTO.java | Adds DTO record for the public-holidays API response. |
| src/main/java/de/muenchen/dave/controller/PublicHolidaysController.java | Adds secured endpoint to trigger manual import. |
| application.yml | Adds a root-level Spring config forcing local + no-security profiles. |
| application-local.yml | Changes Flyway locations and switches report logo config to a remote URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
69
to
+71
| reports: | ||
| logo-icon: classpath:/pdf/images/kindl.jpg | ||
| logo-subtitle: "Landeshauptstadt<br/>München<br/><b>Mobilitätsreferat</b>" | ||
| logo-icon: https://www.wolfsburg.de/-/media/wolfsburg/images/alle-bilder/logos/stadt_wob_okt_2025/wolfsburg-version-a-weiss-schwarz-k.webp | ||
| logo-subtitle: "<br/>Wolfsburg<br/><b>Straßenbau und Projektkoordination (07)</b>" |
Comment on lines
+28
to
+31
| public ResponseEntity<Integer> loadPublicHolidaysForYear() { | ||
| try { | ||
| int result = publicHolidaysImportService.importForCurrentAndNextYear(); | ||
| return new ResponseEntity<>(result, HttpStatus.OK); |
Comment on lines
+87
to
+96
| public int importForCurrentAndNextYear() { | ||
| final int currentYear = LocalDate.now().getYear(); | ||
| int totalImported = 0; | ||
| for (int year = currentYear; year <= currentYear + 1; year++) { | ||
| try { | ||
| totalImported += loadAndSavePublicHolidaysForYear(year); | ||
| } catch (final Exception exception) { | ||
| log.error("Error while loading public holidays for year {}", year, exception); | ||
| } | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
121
to
123
| try { | ||
| return ResponseEntity.ok(this.externalZaehlungPersistierungsService.getZaehlungenForExternal(SecurityContextInformationExtractor.getUserName(), | ||
| return ResponseEntity.ok(this.externalZaehlungPersistierungsService.getZaehlungenForExternal("starwit", | ||
| SecurityContextInformationExtractor.isFachadmin())); |
Comment on lines
+51
to
+54
| } else if (dataExistsForYear) { | ||
| log.info("{} for year {} already exist, overriding existing data", tagesTyp.getBeschreibung(), year); | ||
| kalendertagRepository.deleteAllByDatumBetweenAndTagestyp(validFrom, validTo, tagesTyp); | ||
| } |
Comment on lines
69
to
+71
| reports: | ||
| logo-icon: classpath:/pdf/images/kindl.jpg | ||
| logo-subtitle: "Landeshauptstadt<br/>München<br/><b>Mobilitätsreferat</b>" | ||
| logo-icon: https://www.wolfsburg.de/-/media/wolfsburg/images/alle-bilder/logos/stadt_wob_okt_2025/wolfsburg-version-a-weiss-schwarz-k.webp | ||
| logo-subtitle: "<br/>Wolfsburg<br/><b>Straßenbau und Projektkoordination (07)</b>" |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Issue References
Feature AB#2225: added public holidays from configurable API. In Default, https://openholidaysapi.org is used, but can be configured in database table configuration or Admin Portal -> Anwenderkonfiguration.
Definition of Done