diff --git a/src/main/java/ru/ulstu/extractor/core/Route.java b/src/main/java/ru/ulstu/extractor/core/Route.java index be9cb53..e1605e7 100644 --- a/src/main/java/ru/ulstu/extractor/core/Route.java +++ b/src/main/java/ru/ulstu/extractor/core/Route.java @@ -21,6 +21,7 @@ public class Route { public static final String ADD_RULE = "addRule"; public static final String ASSESSMENTS = "assessments"; public static final String DELETE_RULE = "deleteRule"; + public static final String ADD_MARKUP = "addMarkup"; public static String getLIST_INDEXED_REPOSITORIES() { return LIST_INDEXED_REPOSITORIES; @@ -45,4 +46,8 @@ public class Route { public static String getASSESSMENTS() { return ASSESSMENTS; } + + public static String getADD_MARKUP() { + return ADD_MARKUP; + } } diff --git a/src/main/java/ru/ulstu/extractor/markup/controller/TimeSeriesMarkupController.java b/src/main/java/ru/ulstu/extractor/markup/controller/TimeSeriesMarkupController.java index d9571a8..c816987 100644 --- a/src/main/java/ru/ulstu/extractor/markup/controller/TimeSeriesMarkupController.java +++ b/src/main/java/ru/ulstu/extractor/markup/controller/TimeSeriesMarkupController.java @@ -3,11 +3,16 @@ package ru.ulstu.extractor.markup.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import ru.ulstu.extractor.markup.model.MarkupForm; +import ru.ulstu.extractor.markup.model.MarkupRow; import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.service.TimeSeriesService; import springfox.documentation.annotations.ApiIgnore; import java.util.List; +import java.util.stream.Collectors; @Controller @ApiIgnore @@ -20,9 +25,13 @@ public class TimeSeriesMarkupController { @GetMapping("time-series-markup") public String markupTs(Model model) { - List ts = timeSeriesService.getAllTimeSeries(); - model.addAttribute("ts", ts); - model.addAttribute("groupedTs", timeSeriesService.getGroupedTendencies(ts)); + List tss = timeSeriesService.getAllTimeSeries(); + model.addAttribute("markupForm", new MarkupForm(tss.stream().map(MarkupRow::new).collect(Collectors.toList()))); + return "markup"; + } + + @PostMapping("addMarkups") + public String addMarkups(@RequestBody MarkupForm markupForm) { return "markup"; } } diff --git a/src/main/java/ru/ulstu/extractor/markup/model/MarkupForm.java b/src/main/java/ru/ulstu/extractor/markup/model/MarkupForm.java new file mode 100644 index 0000000..987103a --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/markup/model/MarkupForm.java @@ -0,0 +1,15 @@ +package ru.ulstu.extractor.markup.model; + +import java.util.List; + +public class MarkupForm { + private List markupRows; + + public MarkupForm(List markupRows) { + this.markupRows = markupRows; + } + + public List getMarkupRows() { + return markupRows; + } +} diff --git a/src/main/java/ru/ulstu/extractor/markup/model/MarkupRow.java b/src/main/java/ru/ulstu/extractor/markup/model/MarkupRow.java new file mode 100644 index 0000000..f62640e --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/markup/model/MarkupRow.java @@ -0,0 +1,28 @@ +package ru.ulstu.extractor.markup.model; + +import ru.ulstu.extractor.ts.model.TimeSeries; + +public class MarkupRow { + private TimeSeries timeSeries; + private String markup; + + public MarkupRow(TimeSeries ts) { + this.timeSeries = ts; + } + + public TimeSeries getTimeSeries() { + return timeSeries; + } + + public void setTimeSeries(TimeSeries timeSeries) { + this.timeSeries = timeSeries; + } + + public String getMarkup() { + return markup; + } + + public void setMarkup(String markup) { + this.markup = markup; + } +} diff --git a/src/main/resources/templates/markup.html b/src/main/resources/templates/markup.html index 533e30a..3579887 100644 --- a/src/main/resources/templates/markup.html +++ b/src/main/resources/templates/markup.html @@ -7,18 +7,20 @@
- - - - - - - - - - - - -
Разметка временных рядов
+
+ + + + + + + + + + + + +
Разметка временных рядов
+