WIP: страницы для правил #62
@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import ru.ulstu.extractor.branch.model.Branch;
|
import ru.ulstu.extractor.branch.model.Branch;
|
||||||
import ru.ulstu.extractor.http.HttpService;
|
import ru.ulstu.extractor.http.HttpService;
|
||||||
import ru.ulstu.extractor.http.JsonTimeSeries;
|
import ru.ulstu.extractor.http.JsonTimeSeries;
|
||||||
import ru.ulstu.extractor.http.SmoothingTimeSeries;
|
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeries;
|
import ru.ulstu.extractor.ts.model.TimeSeries;
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
|
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
|
||||||
@ -35,7 +34,7 @@ public class TimeSeriesService {
|
|||||||
private final TimeSeriesDateMapper.TimeSeriesInterval timeSeriesInterval = TimeSeriesDateMapper.TimeSeriesInterval.HOUR;
|
private final TimeSeriesDateMapper.TimeSeriesInterval timeSeriesInterval = TimeSeriesDateMapper.TimeSeriesInterval.HOUR;
|
||||||
private final HttpService httpService;
|
private final HttpService httpService;
|
||||||
private final static String TIME_SERIES_SAVE_SERVICE_URL = "http://time-series.athene.tech/api/1.0/add-time-series?setKey=git-extractor";
|
private final static String TIME_SERIES_SAVE_SERVICE_URL = "http://time-series.athene.tech/api/1.0/add-time-series?setKey=git-extractor";
|
||||||
private final static String TIME_SERIES_TENDENCY_URL = "http://time-series.athene.tech/api/1.0/getSpecificMethodSmoothed";
|
private final static String TIME_SERIES_TENDENCY_URL = "http://time-series.athene.tech/api/1.0/getMaxSmoothing";
|
||||||
private final static String TIME_SERIES_GROUPED_TENDENCIES_URL = "http://time-series.athene.tech/api/1.0/getGroupedTendencies";
|
private final static String TIME_SERIES_GROUPED_TENDENCIES_URL = "http://time-series.athene.tech/api/1.0/getGroupedTendencies";
|
||||||
|
|
||||||
public TimeSeriesService(TimeSeriesRepository timeSeriesRepository,
|
public TimeSeriesService(TimeSeriesRepository timeSeriesRepository,
|
||||||
@ -127,7 +126,7 @@ public class TimeSeriesService {
|
|||||||
|
|
||||||
public double getLastTimeSeriesTendency(TimeSeries ts) {
|
public double getLastTimeSeriesTendency(TimeSeries ts) {
|
||||||
if (ts != null && ts.getValues().size() > MIN_TIME_SERIES_LENGTH) {
|
if (ts != null && ts.getValues().size() > MIN_TIME_SERIES_LENGTH) {
|
||||||
JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new SmoothingTimeSeries(normalizeTimeSeries(ts))));
|
JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new JsonTimeSeries(normalizeTimeSeries(ts))));
|
||||||
LOG.debug("Успешно отправлен на сервис сглаживания");
|
LOG.debug("Успешно отправлен на сервис сглаживания");
|
||||||
if (response.has("response") && response.getString("response").equals("empty")) {
|
if (response.has("response") && response.getString("response").equals("empty")) {
|
||||||
return DEFAULT_TIME_SERIES_TENDENCY;
|
return DEFAULT_TIME_SERIES_TENDENCY;
|
||||||
|
Loading…
Reference in New Issue
Block a user