#59 -- sort time series values
This commit is contained in:
parent
cfe1197a3f
commit
fd001da317
@ -3,6 +3,7 @@ package ru.ulstu.extractor.ts;
|
||||
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -35,6 +36,13 @@ public abstract class AbstractTimeSeriesCreator {
|
||||
|
||||
// сгруппированные по временным интервалам точки временных рядов
|
||||
timeSeriesValues.replaceAll((k, v) -> mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(), v));
|
||||
getTimeSeriesService().save(timeSeriesValues);
|
||||
getTimeSeriesService().save(sortTimeSeriesValues(timeSeriesValues));
|
||||
}
|
||||
|
||||
private Map<String, List<TimeSeriesValue>> sortTimeSeriesValues(Map<String, List<TimeSeriesValue>> timeSeriesValues) {
|
||||
for (Map.Entry<String, List<TimeSeriesValue>> entry : timeSeriesValues.entrySet()) {
|
||||
entry.getValue().sort(Comparator.comparing(TimeSeriesValue::getDate));
|
||||
}
|
||||
return timeSeriesValues;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user