89-time-series-by-cron #90
@ -22,13 +22,13 @@ public class ScheduledTimeSeriesService {
|
||||
this.branchService = branchService;
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 */5 * * * *", zone = "Europe/Samara")
|
||||
@Scheduled(cron = "0 0 * * * *", zone = "Europe/Samara")
|
||||
public void addTimeSeriesPoints() {
|
||||
log.debug("ConferenceScheduler.checkDeadlineBeforeWeek started");
|
||||
log.debug("Старт добавления новых точек временного ряда");
|
||||
List<Branch> branches = branchService.findAll();
|
||||
branches.forEach(branch -> {
|
||||
scheduledTimeSeriesCreators.forEach(creator -> creator.addTimeSeriesValue(branch));
|
||||
});
|
||||
log.debug("ConferenceScheduler.checkDeadlineBeforeWeek finished");
|
||||
log.debug("Завершение добавления новых точек временного ряда");
|
||||
}
|
||||
}
|
||||
|
@ -47,13 +47,13 @@ public class TimeSeriesService {
|
||||
|
||||
@Transactional
|
||||
public TimeSeries save(String timeSeriesName, Branch branch, TimeSeriesType timeSeriesType, List<TimeSeriesValue> timeSeriesValues) {
|
||||
LOG.debug("Start save {} time series with {} time series values ", timeSeriesName, timeSeriesValues.size());
|
||||
LOG.debug("Начало сохранения временного ряда {} с {} значениями", timeSeriesName, timeSeriesValues.size());
|
||||
final TimeSeries timeSeries = findOrCreate(timeSeriesName, branch, timeSeriesType);
|
||||
List<TimeSeriesValue> timeSeriesValuesToRemove = timeSeries.getValues();
|
||||
timeSeries.setValues(timeSeriesValues);
|
||||
LOG.debug("Save time series {} ", timeSeries.getName());
|
||||
LOG.debug("Сохранение временного ряда {} ", timeSeries.getName());
|
||||
TimeSeries savedTimeSeries = timeSeriesRepository.save(timeSeries);
|
||||
LOG.debug("Clear {} time series values ", timeSeriesValuesToRemove.size());
|
||||
LOG.debug("Очистить {} точек временного ряда", timeSeriesValuesToRemove.size());
|
||||
timeSeriesValueRepository.deleteAll(timeSeriesValuesToRemove);
|
||||
sendToTimeSeriesService(savedTimeSeries);
|
||||
return savedTimeSeries;
|
||||
@ -100,7 +100,7 @@ public class TimeSeriesService {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
httpService.post(TIME_SERIES_SAVE_SERVICE_URL, new JSONObject(new JsonTimeSeries(timeSeries)));
|
||||
LOG.debug("Успешно отправлен на сервис");
|
||||
LOG.debug("{} успешно отправлен на сервис временных рядов", timeSeries.getName());
|
||||
} catch (Exception ex) {
|
||||
LOG.debug(ex.getMessage());
|
||||
}
|
||||
@ -113,7 +113,7 @@ public class TimeSeriesService {
|
||||
|
||||
public TimeSeries getById(Integer tsId) {
|
||||
return timeSeriesRepository.findById(tsId)
|
||||
.orElseThrow(() -> new RuntimeException("Time series not found by id " + tsId));
|
||||
.orElseThrow(() -> new RuntimeException("Временной ряд не найден по идентификатору " + tsId));
|
||||
}
|
||||
|
||||
public List<TimeSeriesType> getAllTimeSeriesTypes() {
|
||||
|
Loading…
Reference in New Issue
Block a user