diff --git a/src/main/java/info/peper/vz/rest/VzRestController.java b/src/main/java/info/peper/vz/rest/VzRestController.java index ba0a065..97d8066 100644 --- a/src/main/java/info/peper/vz/rest/VzRestController.java +++ b/src/main/java/info/peper/vz/rest/VzRestController.java @@ -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 prices = this.getPrices(timestampStart, timestampEnd, houseId); - float savedMoney = 0; long totalProduced = 0; long totalObtained = 0; diff --git a/src/main/resources/application.properties.template b/src/main/resources/application.properties.template index a745a56..4ba809f 100644 --- a/src/main/resources/application.properties.template +++ b/src/main/resources/application.properties.template @@ -2,4 +2,5 @@ spring.jpa.hibernate.ddl-auto=update spring.datasource.url=jdbc:mariadb://mariadb.fritz.box:3306/volkszaehler spring.datasource.username=vz spring.datasource.password= -spring.jpa.show-sql: true \ No newline at end of file +spring.jpa.show-sql: true +server.port=8080 \ No newline at end of file