From dab6c030e57596d06dbd78848e80239bc660b491 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 15 Apr 2025 00:26:35 +0400 Subject: [PATCH] #21 -- Add files upload --- .../controller/ReportValueController.java | 39 +++++ .../report/model/dto/ReportValueDto.java | 23 +++ .../templates/report/editReport.html | 2 +- .../templates/report/editReportValue.html | 163 ++++++++++++++++++ .../templates/report/reportList.html | 3 +- 5 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 src/main/java/ru/ulstu/report/controller/ReportValueController.java create mode 100644 src/main/resources/templates/report/editReportValue.html diff --git a/src/main/java/ru/ulstu/report/controller/ReportValueController.java b/src/main/java/ru/ulstu/report/controller/ReportValueController.java new file mode 100644 index 0000000..b508f4b --- /dev/null +++ b/src/main/java/ru/ulstu/report/controller/ReportValueController.java @@ -0,0 +1,39 @@ +package ru.ulstu.report.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import ru.ulstu.aspirant.service.AspirantService; +import ru.ulstu.indicator.service.IndicatorService; +import ru.ulstu.report.model.dto.ReportValueDto; +import ru.ulstu.report.service.ReportPeriodService; +import ru.ulstu.report.service.ReportService; + +@Controller +@RequestMapping("report-value") +public class ReportValueController { + private final IndicatorService indicatorService; + private final AspirantService aspirantService; + private final ReportService reportService; + private final ReportPeriodService reportPeriodService; + + public ReportValueController(IndicatorService indicatorService, + AspirantService aspirantService, + ReportService reportService, + ReportPeriodService reportPeriodService) { + this.indicatorService = indicatorService; + this.aspirantService = aspirantService; + this.reportService = reportService; + this.reportPeriodService = reportPeriodService; + } + + @GetMapping("edit-report-value/{reportId}/{indicatorId}") + public String getReportPeriods(@PathVariable("reportId") Integer reportId, + @PathVariable("indicatorId") Integer indicatorId, + Model model) { + model.addAttribute("reportValue", new ReportValueDto(reportId, indicatorService.getIndicatorById(indicatorId))); + return "report/editReportValue"; + } +} diff --git a/src/main/java/ru/ulstu/report/model/dto/ReportValueDto.java b/src/main/java/ru/ulstu/report/model/dto/ReportValueDto.java index 5411ef7..19304af 100644 --- a/src/main/java/ru/ulstu/report/model/dto/ReportValueDto.java +++ b/src/main/java/ru/ulstu/report/model/dto/ReportValueDto.java @@ -7,6 +7,8 @@ import java.util.ArrayList; import java.util.List; public class ReportValueDto { + private Integer id = 0; + private Integer reportId; private Indicator indicator; private int indicatorValue; private List files = new ArrayList<>(); @@ -14,6 +16,11 @@ public class ReportValueDto { public ReportValueDto() { } + public ReportValueDto(Integer reportId, Indicator indicator) { + this.reportId = reportId; + this.indicator = indicator; + } + public ReportValueDto(Indicator indicator) { this.indicator = indicator; } @@ -41,4 +48,20 @@ public class ReportValueDto { public void setFiles(List files) { this.files = files; } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getReportId() { + return reportId; + } + + public void setReportId(Integer reportId) { + this.reportId = reportId; + } } diff --git a/src/main/resources/templates/report/editReport.html b/src/main/resources/templates/report/editReport.html index a7c4ba8..20080eb 100644 --- a/src/main/resources/templates/report/editReport.html +++ b/src/main/resources/templates/report/editReport.html @@ -12,7 +12,7 @@
-

diff --git a/src/main/resources/templates/report/editReportValue.html b/src/main/resources/templates/report/editReportValue.html new file mode 100644 index 0000000..0d3ebfa --- /dev/null +++ b/src/main/resources/templates/report/editReportValue.html @@ -0,0 +1,163 @@ + +
+

+
+ + + + + + Отмена +
+ +
+ +
+ + + + +
+ + + +
+
+ + +
+
+
+
+ +
+ +
+
+
+ + + + +
+ diff --git a/src/main/resources/templates/report/reportList.html b/src/main/resources/templates/report/reportList.html index e17a76a..791cdb6 100644 --- a/src/main/resources/templates/report/reportList.html +++ b/src/main/resources/templates/report/reportList.html @@ -50,7 +50,8 @@ - + + не определен