Aktueller Stand
This commit is contained in:
parent
8b547d9798
commit
7695e3ebe4
@ -1,3 +1,6 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//src/main/java=UTF-8
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding//src/test/resources=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
|||||||
@ -27,13 +27,14 @@ public class FillAggregateTableMain {
|
|||||||
"vz",
|
"vz",
|
||||||
getPassword())) {
|
getPassword())) {
|
||||||
long startTimeStamp = getTimestamp("2022-06-01T00:00:00");
|
long startTimeStamp = getTimestamp("2022-06-01T00:00:00");
|
||||||
long endTimeStamp = startTimeStamp + (24*60*60*1000);
|
|
||||||
final long finalEndTimeStamp = getTimestamp("2025-02-24T00:00:00");
|
final long finalEndTimeStamp = getTimestamp("2025-02-24T00:00:00");
|
||||||
|
|
||||||
|
long endTimeStamp = startTimeStamp + (24*60*60*1000);
|
||||||
while (endTimeStamp < finalEndTimeStamp) {
|
while (endTimeStamp < finalEndTimeStamp) {
|
||||||
for (int channelId : CHANNELS_TO_USE) {
|
for (int channelId : CHANNELS_TO_USE) {
|
||||||
|
System.out.print(DTF.format(Instant.ofEpochMilli(startTimeStamp)) + ": " + channelId + ": ");
|
||||||
final long[] values = getValues(con, startTimeStamp, endTimeStamp, channelId);
|
final long[] values = getValues(con, startTimeStamp, endTimeStamp, channelId);
|
||||||
saveValues(con, startTimeStamp, endTimeStamp, channelId, values);
|
saveValues(con, startTimeStamp, endTimeStamp, channelId, values);
|
||||||
System.out.println(DTF.format(Instant.ofEpochMilli(startTimeStamp)) + ": " + channelId);
|
|
||||||
}
|
}
|
||||||
startTimeStamp += 24*60*60*1000;
|
startTimeStamp += 24*60*60*1000;
|
||||||
endTimeStamp += 24*60*60*1000;
|
endTimeStamp += 24*60*60*1000;
|
||||||
@ -77,13 +78,17 @@ public class FillAggregateTableMain {
|
|||||||
long wattMillisecondsPos = 0;
|
long wattMillisecondsPos = 0;
|
||||||
long wattMillisecondsNeg = 0;
|
long wattMillisecondsNeg = 0;
|
||||||
|
|
||||||
|
int numberOfRows = 0;
|
||||||
while (currentTimestamp < endTimestamp) {
|
while (currentTimestamp < endTimestamp) {
|
||||||
try (final PreparedStatement stmt = con.prepareStatement("SELECT * FROM volkszaehler.data WHERE channel_id=? AND timestamp>? ORDER BY timestamp;")) {
|
try (final PreparedStatement stmt = con.prepareStatement("SELECT * FROM volkszaehler.data WHERE channel_id=? AND timestamp>? AND timestamp<=? ORDER BY timestamp;")) {
|
||||||
stmt.setMaxRows(10000);
|
System.out.print("#");
|
||||||
|
stmt.setMaxRows(5000);
|
||||||
stmt.setInt(1, channelId);
|
stmt.setInt(1, channelId);
|
||||||
stmt.setLong(2, currentTimestamp);
|
stmt.setLong(2, currentTimestamp);
|
||||||
|
stmt.setLong(3, currentTimestamp + (864000000));
|
||||||
try (final ResultSet rs = stmt.executeQuery()) {
|
try (final ResultSet rs = stmt.executeQuery()) {
|
||||||
while (rs.next() && currentTimestamp <= endTimestamp) {
|
while (rs.next() && currentTimestamp <= endTimestamp) {
|
||||||
|
numberOfRows++;
|
||||||
final long rsTimestamp = rs.getLong("timestamp");
|
final long rsTimestamp = rs.getLong("timestamp");
|
||||||
final long rsValue = rs.getLong("value");
|
final long rsValue = rs.getLong("value");
|
||||||
final long tsDiff = Math.min(rsTimestamp - currentTimestamp, endTimestamp - currentTimestamp);
|
final long tsDiff = Math.min(rsTimestamp - currentTimestamp, endTimestamp - currentTimestamp);
|
||||||
@ -97,6 +102,7 @@ public class FillAggregateTableMain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println(" " + numberOfRows);
|
||||||
return new long[] {wattMillisecondsPos/3600, wattMillisecondsNeg/3600};
|
return new long[] {wattMillisecondsPos/3600, wattMillisecondsNeg/3600};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user