timestamps bei summary optional und server.port konfigurierbar

This commit is contained in:
tobias 2025-03-13 23:08:13 +01:00
parent ffd280cfdb
commit a8feeef1c1
2 changed files with 12 additions and 4 deletions

View File

@ -214,15 +214,22 @@ class VzRestController {
}
@GetMapping("/data/summary2")
String getSummary2(@RequestParam("timestampStart")final long timestampStart,
@RequestParam("timestampEnd")final long timestampEnd,
String getSummary2(@RequestParam(name = "timestampStart", defaultValue = "-1")long timestampStart,
@RequestParam(name = "timestampEnd", defaultValue = "-1")long timestampEnd,
@RequestParam("houseId")final int houseId) {
if (timestampStart == -1) {
timestampStart = jdbcTemplate.queryForObject("SELECT MIN(timestamp_start) AS ts FROM tobias_aggregate2 WHERE house_id=?;", Long.class, houseId);
}
if (timestampEnd == -1) {
timestampEnd = jdbcTemplate.queryForObject("SELECT MAX(timestamp_end) AS ts FROM tobias_aggregate2 WHERE house_id=?;", Long.class, houseId);
}
final NumberFormat formatCurrency = new DecimalFormat("#,##0.00", new DecimalFormatSymbols(Locale.GERMAN));
final NumberFormat formatPercent = new DecimalFormat("#,##0.00", new DecimalFormatSymbols(Locale.GERMAN));
final NumberFormat formatEnergy = new DecimalFormat("#,##0", new DecimalFormatSymbols(Locale.GERMAN));
final List<EnergyPrice> prices = this.getPrices(timestampStart, timestampEnd, houseId);
float savedMoney = 0;
long totalProduced = 0;
long totalObtained = 0;

View File

@ -3,3 +3,4 @@ spring.datasource.url=jdbc:mariadb://mariadb.fritz.box:3306/volkszaehler
spring.datasource.username=vz
spring.datasource.password=<password>
spring.jpa.show-sql: true
server.port=8080