Skip to content
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

Refactor Steuerinformationen für Optionsmenü #190

Draft
wants to merge 43 commits into
base: sprint
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0ebd30d
add new table for options menu settings
boal Dec 19, 2024
c00c0d7
change attribute names in sql unique specification
boal Dec 20, 2024
f8efe6d
add not null to sql attributes
boal Dec 20, 2024
192369f
add controller
boal Dec 20, 2024
c55eb6e
rename attribute in optionsmenukey class
boal Dec 20, 2024
721f96d
remove unused annotation
boal Dec 20, 2024
c6cf841
change table for settings optionsmenÃue
boal Jan 9, 2025
6a39ff5
adapt entitiy class for optionsmenu
boal Jan 9, 2025
9267175
remove verfügbarkeit
boal Jan 9, 2025
5188c2a
remove verfügbarkeit
boal Jan 9, 2025
6d3f495
add unit test
boal Jan 9, 2025
71ac115
add unit test
boal Jan 9, 2025
d4b9fb7
adapt optionsmenue settings
boal Jan 9, 2025
d8e7572
add default value if no specific value ist found
boal Jan 10, 2025
dbd8e45
adapt unit test
boal Jan 10, 2025
d0674ff
add and adapt unit tests
boal Jan 10, 2025
1cd4c93
add and adapt unit tests
boal Jan 10, 2025
712d5c8
add new repo method
boal Jan 10, 2025
47e0aa4
refactor to save settings in sotre
boal Jan 13, 2025
8bc3380
refactor to save settings in sotre
boal Jan 13, 2025
e262195
adapt api to geo eai
boal Jan 14, 2025
e77e4b5
remove mapper annotation to ignreo attribute
boal Jan 15, 2025
d5a1497
change spring boot version
boal Jan 15, 2025
1a9f149
reset to spring boot 3.4.0
boal Jan 15, 2025
cc09b40
Merge branch 'main-ls2' into refactor/optionsmenu-information
boal Jan 27, 2025
c229488
Merge branch 'main-ls2' into refactor/optionsmenu-information
boal Jan 28, 2025
ae4c0cf
Merge branch 'sprint' into refactor/optionsmenu-information
boal Feb 4, 2025
4a579d5
renumber migration script
boal Feb 4, 2025
64618ec
Merge branch 'sprint' into refactor/optionsmenu-information
boal Feb 4, 2025
f88e168
adapt unit test
boal Feb 4, 2025
22525cd
reformat code
boal Feb 4, 2025
e68e549
Merge branch 'sprint' into refactor/optionsmenu-information
boal Feb 10, 2025
4ff113a
rename sql script for flyway
boal Feb 10, 2025
5dde7e6
remove excel
boal Feb 12, 2025
cd63f58
Merge branch 'sprint' into refactor/optionsmenu-information
boal Feb 12, 2025
9d662b7
rename sql script
boal Feb 12, 2025
2ed1c12
add remarks for review
boal Feb 27, 2025
2f14cfd
change spring boot version
boal Feb 27, 2025
933e00f
Merge branch 'sprint' into refactor/optionsmenu-information
boal Feb 28, 2025
4bd1862
resolve merge conflicts
boal Mar 10, 2025
4363135
remove logfile
boal Mar 10, 2025
e29d3bd
rename sql script
boal Mar 10, 2025
644dd22
add column name to entity column annotation
boal Mar 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.boot.version>3.4.0</spring.boot.version>
<spring.boot.version>3.4.2</spring.boot.version>
<spring.cloud.version>2024.0.0</spring.cloud.version>
<logstash.encoder>7.4</logstash.encoder>
<logstash.encoder>8.0</logstash.encoder>
<apache.commons.collections4>4.4</apache.commons.collections4>
<apache.commons.csv>1.12.0</apache.commons.csv>
<apache.commons.csv>1.13.0</apache.commons.csv>
<apache.commons.io>2.18.0</apache.commons.io>
<apache.commons.lang3>3.17.0</apache.commons.lang3>
<apache.commons.email>1.6.0</apache.commons.email>
<apache.commons.exec>1.4.0</apache.commons.exec>
<apache.poi>5.3.0</apache.poi>
<guava>33.3.1-jre</guava>
<apache.poi>5.4.0</apache.poi>
<guava>33.4.0-jre</guava>
<org.mapstruct.version>1.6.3</org.mapstruct.version>
<openhtmltopdf.version>1.0.10</openhtmltopdf.version>
<spullara.mustache.java.version>0.9.14</spullara.mustache.java.version>
<apache.sis.version>1.4</apache.sis.version>
<org.jsoup.version>1.18.1</org.jsoup.version>
<org.jsoup.version>1.18.3</org.jsoup.version>
<!-- Plugins -->
<maven-scm-plugin.version>2.1.0</maven-scm-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
Expand All @@ -38,8 +38,8 @@
<!-- Version muss mit der in den spring-boot-dependencies bereitgestellten Lombok-Version übereinstimmen -->
<org.projectlombok.lombok.version>1.18.36</org.projectlombok.lombok.version>
<org.projectlombok.mapstructbinding.version>0.2.0</org.projectlombok.mapstructbinding.version>
<shedlock.version>6.0.2</shedlock.version>
<openapi-generator-version>7.10.0</openapi-generator-version>
<shedlock.version>6.2.0</shedlock.version>
<openapi-generator-version>7.11.0</openapi-generator-version>
<openapi.jackson-databind-nullable>0.2.6</openapi.jackson-databind-nullable>
<ai.onnxruntime>1.20.0</ai.onnxruntime>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
package de.muenchen.dave.controller;

import de.muenchen.dave.domain.dtos.OptionsDTO;
import de.muenchen.dave.domain.dtos.laden.LadeBelastungsplanDTO;
import de.muenchen.dave.domain.dtos.laden.LadeProcessedZaehldatenDTO;
import de.muenchen.dave.domain.dtos.laden.LadeZaehldatenZeitreiheDTO;
import de.muenchen.dave.exceptions.DataNotFoundException;
import de.muenchen.dave.services.processzaehldaten.ProcessZaehldatenBelastungsplanService;
import de.muenchen.dave.services.processzaehldaten.ProcessZaehldatenService;
import de.muenchen.dave.services.processzaehldaten.ProcessZaehldatenZeitreiheService;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand All @@ -30,6 +27,7 @@

@RestController
@Slf4j
@RequiredArgsConstructor
@Validated
@PreAuthorize(
"hasAnyRole(T(de.muenchen.dave.security.AuthoritiesEnum).ANWENDER.name(), " +
Expand All @@ -39,25 +37,10 @@ public class LadeZaehldatenController {

private static final String REQUEST_PARAMETER_ZAEHLUNG_ID = "zaehlung_id";

private static final String REQUEST_PARAMETER_ZAEHLSTELLE_ID = "zaehlstelle_id";

private final ProcessZaehldatenBelastungsplanService processZaehldatenBelastungsplanService;

private final ProcessZaehldatenService processZaehldatenService;

private final ProcessZaehldatenZeitreiheService processZaehldatenZeitreiheService;

public LadeZaehldatenController(final ProcessZaehldatenBelastungsplanService processZaehldatenBelastungsplanService,
final ProcessZaehldatenService processZaehldatenService,
final ProcessZaehldatenZeitreiheService processZaehldatenZeitreiheService) {
this.processZaehldatenBelastungsplanService = processZaehldatenBelastungsplanService;
this.processZaehldatenService = processZaehldatenService;
this.processZaehldatenZeitreiheService = processZaehldatenZeitreiheService;
}

/**
* Rest-Endpunkt zur Bereitstellung der Daten einer Zaehlung für das Gangliniendiagramm, die
* Listenausgabe und für die Heatmap.
* Rest-Endpunkt zur Bereitstellung der Daten einer Zaehlung für alle Grafiken.
*
* @param zaehlungId Die Id der Zaehlung.
* @param options Die im Frontend gewählten Optionen.
Expand All @@ -80,57 +63,4 @@ public ResponseEntity<LadeProcessedZaehldatenDTO> ladeZaehldatenProcessed(
throw new ResponseStatusException(HttpStatus.NOT_FOUND, exception.getMessage());
}
}

/**
* Rest-Endpunkt zur Bereitstellung der Daten einer Zaehlung für den Belastungsplan.
*
* @param zaehlungId Die Id der Zaehlung.
* @param options Die im Frontend gewählten Optionen.
* @return Die aufbereiteten Daten einer Zaehlung für den Belastungsplan im Frontend.
*/
@PostMapping(value = "/lade-belastungsplan", produces = MediaType.APPLICATION_JSON_VALUE)
@Transactional(readOnly = true)
public ResponseEntity<LadeBelastungsplanDTO> ladeBelastungsplan(@RequestParam(value = REQUEST_PARAMETER_ZAEHLUNG_ID) @NotEmpty final String zaehlungId,
@Valid @RequestBody @NotNull final OptionsDTO options) {
try {
log.info("ladeBelastungsplan für Zaehlung {} aufgerufen", zaehlungId);
final LadeBelastungsplanDTO ladeBelastungsplanDTO = processZaehldatenBelastungsplanService.getBelastungsplanDTO(
zaehlungId,
options);
log.info("laden der Daten abgeschlossen.");
log.debug("Belastungsplandaten: {}", ladeBelastungsplanDTO);
return ResponseEntity.ok(ladeBelastungsplanDTO);
} catch (final DataNotFoundException exception) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, exception.getMessage());
}
}

/**
* Rest-Endpunkt zur Bereitstellung der Daten einer Zählstelle für die Zeitreihe
*
* @param zaehlstelleId Die Id der Zaehlstelle.
* @param zaehlungId Die Id der im Frontend ausgewaehlten Zaehlung.
* @param options Die im Frontend gewählten Optionen.
* @return Die aufbereiteten Daten aller Zählungen einer Zählstelle innerhalb eines bestimmten
* Zeitintervalls.
*/
@PostMapping(value = "/lade-zeitreihe", produces = MediaType.APPLICATION_JSON_VALUE)
@Transactional(readOnly = true)
public ResponseEntity<LadeZaehldatenZeitreiheDTO> ladeZeitreihe(
@RequestParam(value = REQUEST_PARAMETER_ZAEHLSTELLE_ID) @NotEmpty final String zaehlstelleId,
@RequestParam(value = REQUEST_PARAMETER_ZAEHLUNG_ID) @NotEmpty final String zaehlungId,
@Valid @RequestBody @NotNull final OptionsDTO options) {
log.info("ladeZeitreihe für Zaehlstelle {} aufgerufen", zaehlstelleId);
try {
final LadeZaehldatenZeitreiheDTO ladeZaehldatenZeitreiheDTO = processZaehldatenZeitreiheService.getZeitreiheDTO(
zaehlstelleId,
zaehlungId,
options);
log.info("laden der Zeitreihedaten abgeschlossen.");
log.debug("Zeitreihedaten: {}", ladeZaehldatenZeitreiheDTO);
return ResponseEntity.ok(ladeZaehldatenZeitreiheDTO);
} catch (final DataNotFoundException exception) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, exception.getMessage());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package de.muenchen.dave.controller;

import de.muenchen.dave.domain.dtos.OptionsmenueSettingsDTO;
import de.muenchen.dave.services.OptionsmenueSettingsService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/settings-optionsmenue")
@RequiredArgsConstructor
public class OptionsmenueSettingsController {

private final OptionsmenueSettingsService optionsmenueSettingsService;

@GetMapping(value = "/all", produces = MediaType.APPLICATION_JSON_VALUE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Könnten wir hier gleich noch in der URL einfließen lassen, dass es sich nur um die Messstellen handelt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angepasst nach /messstelle/all

public ResponseEntity<List<OptionsmenueSettingsDTO>> getAllOptionsmenueSettings() {
final var settings = optionsmenueSettingsService.getAllOptionsmenueSettings();
return ResponseEntity.ok(settings);
}

}
106 changes: 106 additions & 0 deletions src/main/java/de/muenchen/dave/domain/OptionsmenueSettings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package de.muenchen.dave.domain;

import de.muenchen.dave.domain.enums.Fahrzeugklasse;
import de.muenchen.dave.domain.enums.ZaehldatenIntervall;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;

import java.util.List;

@Entity
@Table(
uniqueConstraints = {
@UniqueConstraint(
name = "unique_optionsmenuesettings_fahrzeugklasse_intervall",
columnNames = { "fahrzeugklasse", "intervall" }
)
}
)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OptionsmenueSettings extends BaseEntity {

@Column
@Enumerated(EnumType.STRING)
private Fahrzeugklasse fahrzeugklasse;

@Column
@Enumerated(EnumType.STRING)
private ZaehldatenIntervall intervall;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> kraftfahrzeugverkehrChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> schwerverkehrChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> gueterverkehrChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> schwerverkehrsanteilProzentChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> gueterverkehrsanteilProzentChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> radverkehrChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> fussverkehrChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> lastkraftwagenChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> lastzuegeChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> busseChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> kraftraederChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> personenkraftwagenChoosableIntervals;

@Column
@JdbcTypeCode(SqlTypes.JSON)
@Enumerated(EnumType.STRING)
private List<ZaehldatenIntervall> lieferwagenChoosableIntervals;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package de.muenchen.dave.domain.dtos;

import de.muenchen.dave.domain.enums.Fahrzeugklasse;
import de.muenchen.dave.domain.enums.ZaehldatenIntervall;
import lombok.Data;

import java.util.List;

@Data
public class OptionsmenueSettingsDTO {

private Fahrzeugklasse fahrzeugklasse;

private ZaehldatenIntervall intervall;

private List<ZaehldatenIntervall> kraftfahrzeugverkehrChoosableIntervals;

private List<ZaehldatenIntervall> schwerverkehrChoosableIntervals;

private List<ZaehldatenIntervall> gueterverkehrChoosableIntervals;

private List<ZaehldatenIntervall> schwerverkehrsanteilProzentChoosableIntervals;

private List<ZaehldatenIntervall> gueterverkehrsanteilProzentChoosableIntervals;

private List<ZaehldatenIntervall> radverkehrChoosableIntervals;

private List<ZaehldatenIntervall> fussverkehrChoosableIntervals;

private List<ZaehldatenIntervall> lastkraftwagenChoosableIntervals;

private List<ZaehldatenIntervall> lastzuegeChoosableIntervals;

private List<ZaehldatenIntervall> busseChoosableIntervals;

private List<ZaehldatenIntervall> kraftraederChoosableIntervals;

private List<ZaehldatenIntervall> personenkraftwagenChoosableIntervals;

private List<ZaehldatenIntervall> lieferwagenChoosableIntervals;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
public class LadeProcessedZaehldatenDTO implements Serializable {

LadeZaehldatenTableDTO zaehldatenTable;

LadeZaehldatenSteplineDTO zaehldatenStepline;

LadeZaehldatenHeatmapDTO zaehldatenHeatmap;
LadeBelastungsplanDTO zaehldatenBelastungsplan;
LadeZaehldatenZeitreiheDTO zaehldatenZeitreihe;

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ public class LadeZaehldatumDTO implements Serializable {

private Integer pkwEinheiten;

@JsonGetter
public BigDecimal getGesamt() {
return CalculationUtil.getGesamt(this);
}

@JsonGetter
public BigDecimal getKfz() {
return CalculationUtil.getKfz(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.muenchen.dave.domain.dtos.messstelle;

import de.muenchen.dave.domain.enums.Fahrzeugklasse;
import de.muenchen.dave.domain.enums.ZaehldatenIntervall;
import lombok.Data;
import lombok.NoArgsConstructor;

Expand All @@ -11,6 +13,6 @@ public class EditMessfaehigkeitDTO implements Serializable {

private String gueltigBis;
private String gueltigAb;
private String fahrzeugklassen;
private String intervall;
private Fahrzeugklasse fahrzeugklassen;
private ZaehldatenIntervall intervall;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.muenchen.dave.domain.dtos.messstelle;

import de.muenchen.dave.domain.enums.Fahrzeugklasse;
import lombok.Data;

import java.io.Serializable;
Expand All @@ -21,7 +22,7 @@ public class EditMessstelleDTO implements Serializable {
private String abbaudatum;
private String datumLetztePlausibleMessung;

private String fahrzeugKlassen;
private Fahrzeugklasse fahrzeugKlassen;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im Singular benennen

private String detektierteVerkehrsarten;
private String hersteller;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.muenchen.dave.domain.dtos.messstelle;

import de.muenchen.dave.domain.enums.Fahrzeugklasse;
import de.muenchen.dave.domain.enums.ZaehldatenIntervall;
import lombok.Data;
import lombok.NoArgsConstructor;
Expand All @@ -12,6 +13,6 @@ public class ReadMessfaehigkeitDTO implements Serializable {

private String gueltigBis;
private String gueltigAb;
private String fahrzeugklassen;
private Fahrzeugklasse fahrzeugklassen;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im Singular benennen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

private ZaehldatenIntervall intervall;
}
Loading
Loading