timestamps bei summary optional und server.port konfigurierbar
This commit is contained in:
parent
ffd280cfdb
commit
a8feeef1c1
@ -214,15 +214,22 @@ class VzRestController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/data/summary2")
|
@GetMapping("/data/summary2")
|
||||||
String getSummary2(@RequestParam("timestampStart")final long timestampStart,
|
String getSummary2(@RequestParam(name = "timestampStart", defaultValue = "-1")long timestampStart,
|
||||||
@RequestParam("timestampEnd")final long timestampEnd,
|
@RequestParam(name = "timestampEnd", defaultValue = "-1")long timestampEnd,
|
||||||
@RequestParam("houseId")final int houseId) {
|
@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 formatCurrency = new DecimalFormat("#,##0.00", new DecimalFormatSymbols(Locale.GERMAN));
|
||||||
final NumberFormat formatPercent = 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 NumberFormat formatEnergy = new DecimalFormat("#,##0", new DecimalFormatSymbols(Locale.GERMAN));
|
||||||
final List<EnergyPrice> prices = this.getPrices(timestampStart, timestampEnd, houseId);
|
final List<EnergyPrice> prices = this.getPrices(timestampStart, timestampEnd, houseId);
|
||||||
|
|
||||||
|
|
||||||
float savedMoney = 0;
|
float savedMoney = 0;
|
||||||
long totalProduced = 0;
|
long totalProduced = 0;
|
||||||
long totalObtained = 0;
|
long totalObtained = 0;
|
||||||
|
|||||||
@ -2,4 +2,5 @@ spring.jpa.hibernate.ddl-auto=update
|
|||||||
spring.datasource.url=jdbc:mariadb://mariadb.fritz.box:3306/volkszaehler
|
spring.datasource.url=jdbc:mariadb://mariadb.fritz.box:3306/volkszaehler
|
||||||
spring.datasource.username=vz
|
spring.datasource.username=vz
|
||||||
spring.datasource.password=<password>
|
spring.datasource.password=<password>
|
||||||
spring.jpa.show-sql: true
|
spring.jpa.show-sql: true
|
||||||
|
server.port=8080
|
||||||
Loading…
Reference in New Issue
Block a user