PayedMoney hinzugefügt
This commit is contained in:
parent
f6eb147b5e
commit
cbc519db60
@ -113,6 +113,7 @@ class VzRestController {
|
|||||||
final List<EnergyPrice> prices = this.getPrices(timestampStart, timestampEnd, houseId);
|
final List<EnergyPrice> prices = this.getPrices(timestampStart, timestampEnd, houseId);
|
||||||
|
|
||||||
float savedMoney = 0;
|
float savedMoney = 0;
|
||||||
|
float payedMoney = 0;
|
||||||
long totalProduced = 0;
|
long totalProduced = 0;
|
||||||
long totalObtained = 0;
|
long totalObtained = 0;
|
||||||
long totalInjected = 0;
|
long totalInjected = 0;
|
||||||
@ -122,6 +123,7 @@ class VzRestController {
|
|||||||
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 Aggregate aggregate = getData(tsStart, tsEnd, houseId, solarFactor);
|
final Aggregate aggregate = getData(tsStart, tsEnd, houseId, solarFactor);
|
||||||
|
payedMoney += (float)(aggregate.getObtainedEnergy()/1000000 * price.getPrice());
|
||||||
savedMoney += (float)(aggregate.getProducedEnergy() - aggregate.getInjectedEnergy())/1000000 * price.getPrice();
|
savedMoney += (float)(aggregate.getProducedEnergy() - aggregate.getInjectedEnergy())/1000000 * price.getPrice();
|
||||||
totalProduced += aggregate.getProducedEnergy();
|
totalProduced += aggregate.getProducedEnergy();
|
||||||
totalObtained += aggregate.getObtainedEnergy();
|
totalObtained += aggregate.getObtainedEnergy();
|
||||||
@ -133,7 +135,8 @@ class VzRestController {
|
|||||||
timestampMax = aggregate.getTimestampEnd();
|
timestampMax = aggregate.getTimestampEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Statistics(timestampMin, timestampMax, totalProduced, totalInjected, totalObtained, (long)(savedMoney*100));
|
return new Statistics(timestampMin, timestampMax, totalProduced, totalInjected, totalObtained,
|
||||||
|
(long)(savedMoney*100), (long)(payedMoney*100));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value="/rest-vz/summary", produces = {"text/plain"})
|
@GetMapping(value="/rest-vz/summary", produces = {"text/plain"})
|
||||||
|
|||||||
@ -6,10 +6,11 @@ public class Statistics {
|
|||||||
private final long producedEnergy;
|
private final long producedEnergy;
|
||||||
private final long injectedEnergy;
|
private final long injectedEnergy;
|
||||||
private final long obtainedEnergy;
|
private final long obtainedEnergy;
|
||||||
|
private final long payedMoney;
|
||||||
private final long savedMoney;
|
private final long savedMoney;
|
||||||
|
|
||||||
public Statistics(long timestampStart, long timestampEnd, long producedEnergy, long injectedEnergy,
|
public Statistics(long timestampStart, long timestampEnd, long producedEnergy, long injectedEnergy,
|
||||||
long obtainedEnergy, long savedMoney) {
|
long obtainedEnergy, long savedMoney, long payedMoney) {
|
||||||
super();
|
super();
|
||||||
this.timestampStart = timestampStart;
|
this.timestampStart = timestampStart;
|
||||||
this.timestampEnd = timestampEnd;
|
this.timestampEnd = timestampEnd;
|
||||||
@ -17,6 +18,7 @@ public class Statistics {
|
|||||||
this.injectedEnergy = injectedEnergy;
|
this.injectedEnergy = injectedEnergy;
|
||||||
this.obtainedEnergy = obtainedEnergy;
|
this.obtainedEnergy = obtainedEnergy;
|
||||||
this.savedMoney = savedMoney;
|
this.savedMoney = savedMoney;
|
||||||
|
this.payedMoney = payedMoney;
|
||||||
}
|
}
|
||||||
public long getTimestampStart() {
|
public long getTimestampStart() {
|
||||||
return timestampStart;
|
return timestampStart;
|
||||||
@ -36,5 +38,7 @@ public class Statistics {
|
|||||||
public long getSavedMoney() {
|
public long getSavedMoney() {
|
||||||
return savedMoney;
|
return savedMoney;
|
||||||
}
|
}
|
||||||
|
public long getPayedMoney() {
|
||||||
|
return payedMoney;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user