From 2ca2425ac8ee937d7751e21509aeb4f64d2efe2c Mon Sep 17 00:00:00 2001 From: viktorKhan Date: Wed, 23 Oct 2024 23:37:27 +0200 Subject: [PATCH] [conluz-83] Fixed some namings --- .../shelly/get/GetShellyConsumptionRepository.java | 4 ++-- .../shelly/get/GetShellyConsumptionRepositoryInflux.java | 6 +++--- ...ellyMqttPowerMessagesToInstantConsumptionsProcessor.java | 4 ++-- ...yMqttPowerMessagesToInstantConsumptionsProcessorJob.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/lucoenergia/conluz/domain/consumption/shelly/get/GetShellyConsumptionRepository.java b/src/main/java/org/lucoenergia/conluz/domain/consumption/shelly/get/GetShellyConsumptionRepository.java index 3eb15f7..fbc6e79 100644 --- a/src/main/java/org/lucoenergia/conluz/domain/consumption/shelly/get/GetShellyConsumptionRepository.java +++ b/src/main/java/org/lucoenergia/conluz/domain/consumption/shelly/get/GetShellyConsumptionRepository.java @@ -17,6 +17,6 @@ List getHourlyConsumptionsByRangeOfDatesAndSupply(@Not List getAllConsumptions(); - List getShellyMqttPowerMessagesByRangeOfDates(OffsetDateTime periodBefore, - OffsetDateTime now); + List getShellyMqttPowerMessagesByRangeOfDates(OffsetDateTime startDate, + OffsetDateTime endDate); } diff --git a/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/get/GetShellyConsumptionRepositoryInflux.java b/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/get/GetShellyConsumptionRepositoryInflux.java index 97daca8..85e23d7 100644 --- a/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/get/GetShellyConsumptionRepositoryInflux.java +++ b/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/get/GetShellyConsumptionRepositoryInflux.java @@ -86,9 +86,9 @@ public List getAllConsumptions() { } @Override - public List getShellyMqttPowerMessagesByRangeOfDates(OffsetDateTime periodBefore, OffsetDateTime now) { - String startDateAsString = dateConverter.convertToString(periodBefore); - String endDateAsString = dateConverter.convertToString(now); + public List getShellyMqttPowerMessagesByRangeOfDates(OffsetDateTime startDate, OffsetDateTime endDate) { + String startDateAsString = dateConverter.convertToString(startDate); + String endDateAsString = dateConverter.convertToString(endDate); try (InfluxDB connection = influxDbConnectionManager.getConnection()) { diff --git a/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessor.java b/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessor.java index 57a5b17..5b36171 100644 --- a/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessor.java +++ b/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessor.java @@ -21,10 +21,10 @@ public ShellyMqttPowerMessagesToInstantConsumptionsProcessor( this.persistShellyConsumptionRepository = persistShellyConsumptionRepository; } - public void parse(OffsetDateTime periodBefore, OffsetDateTime now) { + public void process(OffsetDateTime startDate, OffsetDateTime endDate) { List instantConsumptions = getShellyConsumptionRepository.getShellyMqttPowerMessagesByRangeOfDates( - periodBefore, now); + startDate, endDate); persistShellyConsumptionRepository.persistInstantConsumptions(instantConsumptions); } diff --git a/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessorJob.java b/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessorJob.java index 3c140ec..51ad863 100644 --- a/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessorJob.java +++ b/src/main/java/org/lucoenergia/conluz/infrastructure/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessorJob.java @@ -42,7 +42,7 @@ public void run() { OffsetDateTime now = timeConfiguration.now(); OffsetDateTime periodBefore = now.minusMinutes(5); - processor.parse(periodBefore, now); + processor.process(periodBefore, now); LOGGER.info("...finished Shelly MQTT power message to instant consumption processor."); }