contractId -> houseId
This commit is contained in:
parent
00153ed90b
commit
ffd280cfdb
@ -165,25 +165,25 @@ class VzRestController {
|
|||||||
@GetMapping("/data/prices")
|
@GetMapping("/data/prices")
|
||||||
List<EnergyPrice> getPrices(@RequestParam("timestampStart")final long timestampStart,
|
List<EnergyPrice> getPrices(@RequestParam("timestampStart")final long timestampStart,
|
||||||
@RequestParam("timestampEnd")final long timestampEnd,
|
@RequestParam("timestampEnd")final long timestampEnd,
|
||||||
@RequestParam("contractId")final int contractId) {
|
@RequestParam("houseId")final int houseId) {
|
||||||
final List<EnergyPrice> prices = jdbcTemplate.query(
|
final List<EnergyPrice> prices = jdbcTemplate.query(
|
||||||
"SELECT * FROM tobias_energy_price WHERE contract_id=? AND timestamp_start < ? AND timestamp_end >= ? ORDER BY timestamp_start;",
|
"SELECT * FROM tobias_energy_price WHERE house_id=? AND timestamp_start < ? AND timestamp_end >= ? ORDER BY timestamp_start;",
|
||||||
(rs, rowNum) -> new EnergyPrice(rs.getInt("contract_id"), rs.getLong("timestamp_start"), rs.getLong("timestamp_end"),
|
(rs, rowNum) -> new EnergyPrice(rs.getInt("house_id"), rs.getLong("timestamp_start"), rs.getLong("timestamp_end"),
|
||||||
rs.getFloat("price")),
|
rs.getFloat("price")),
|
||||||
contractId ,timestampEnd, timestampStart);
|
houseId ,timestampEnd, timestampStart);
|
||||||
return prices;
|
return prices;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/data/summary")
|
@GetMapping("/data/summary")
|
||||||
String getSummary(@RequestParam("timestampStart")final long timestampStart,
|
String getSummary(@RequestParam("timestampStart")final long timestampStart,
|
||||||
@RequestParam("timestampEnd")final long timestampEnd,
|
@RequestParam("timestampEnd")final long timestampEnd,
|
||||||
@RequestParam("contractId")final int contractId,
|
@RequestParam("houseId")final int houseId,
|
||||||
@RequestParam("channelIdMeter")final int channelIdMeter,
|
@RequestParam("channelIdMeter")final int channelIdMeter,
|
||||||
@RequestParam("channelIdSolar")final int channelIdSolar) {
|
@RequestParam("channelIdSolar")final int channelIdSolar) {
|
||||||
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, contractId);
|
final List<EnergyPrice> prices = this.getPrices(timestampStart, timestampEnd, houseId);
|
||||||
final List<Sums> partsMeter = new LinkedList<Sums>();
|
final List<Sums> partsMeter = new LinkedList<Sums>();
|
||||||
final List<Sums> partsSolar = new LinkedList<Sums>();
|
final List<Sums> partsSolar = new LinkedList<Sums>();
|
||||||
float savedMoney = 0;
|
float savedMoney = 0;
|
||||||
@ -216,11 +216,11 @@ class VzRestController {
|
|||||||
@GetMapping("/data/summary2")
|
@GetMapping("/data/summary2")
|
||||||
String getSummary2(@RequestParam("timestampStart")final long timestampStart,
|
String getSummary2(@RequestParam("timestampStart")final long timestampStart,
|
||||||
@RequestParam("timestampEnd")final long timestampEnd,
|
@RequestParam("timestampEnd")final long timestampEnd,
|
||||||
@RequestParam("contractId")final int contractId) {
|
@RequestParam("houseId")final int 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, contractId);
|
final List<EnergyPrice> prices = this.getPrices(timestampStart, timestampEnd, houseId);
|
||||||
|
|
||||||
|
|
||||||
float savedMoney = 0;
|
float savedMoney = 0;
|
||||||
@ -230,7 +230,7 @@ class VzRestController {
|
|||||||
for (EnergyPrice price : prices) {
|
for (EnergyPrice price : prices) {
|
||||||
final long tsStart = Math.max(price.getTimestampStart(), timestampStart);
|
final long tsStart = Math.max(price.getTimestampStart(), timestampStart);
|
||||||
final long tsEnd = Math.min(price.getTimestampEnd(), timestampEnd);
|
final long tsEnd = Math.min(price.getTimestampEnd(), timestampEnd);
|
||||||
final Sums2 sums = getData2(tsStart, tsEnd, contractId);
|
final Sums2 sums = getData2(tsStart, tsEnd, houseId);
|
||||||
savedMoney += (float)(sums.getProduced() - sums.getInjected())/1000000 * price.getPrice();
|
savedMoney += (float)(sums.getProduced() - sums.getInjected())/1000000 * price.getPrice();
|
||||||
totalProduced += sums.getProduced();
|
totalProduced += sums.getProduced();
|
||||||
totalObtained += sums.getObtained();
|
totalObtained += sums.getObtained();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user