21-rating #22
@ -71,9 +71,15 @@ public class ReportController {
|
|||||||
return "report/editReport";
|
return "report/editReport";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("save-report")
|
@PostMapping(value = "save-report", params = "save")
|
||||||
public String saveReport(@ModelAttribute("report") ReportDto reportDto, Model model) {
|
public String saveReport(@ModelAttribute("report") ReportDto reportDto, Model model) {
|
||||||
reportService.saveReport(reportDto);
|
reportService.saveReport(reportDto);
|
||||||
return "redirect:/report/reportList";
|
return "redirect:/report/reportList";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "save-report", params = "delete")
|
||||||
|
public String deleteReport(@ModelAttribute("report") ReportDto reportDto) {
|
||||||
|
reportService.deleteReport(reportDto.getId());
|
||||||
|
return "redirect:/report/reportList";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package ru.ulstu.report.model;
|
package ru.ulstu.report.model;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.Temporal;
|
import jakarta.persistence.Temporal;
|
||||||
@ -26,6 +28,9 @@ public class Report extends BaseEntity {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Aspirant aspirant;
|
private Aspirant aspirant;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private ReportStatus status;
|
||||||
|
|
||||||
public Report() {
|
public Report() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,4 +69,12 @@ public class Report extends BaseEntity {
|
|||||||
public void setAspirant(Aspirant aspirant) {
|
public void setAspirant(Aspirant aspirant) {
|
||||||
this.aspirant = aspirant;
|
this.aspirant = aspirant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReportStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(ReportStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
5
src/main/java/ru/ulstu/report/model/ReportStatus.java
Normal file
5
src/main/java/ru/ulstu/report/model/ReportStatus.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package ru.ulstu.report.model;
|
||||||
|
|
||||||
|
public enum ReportStatus {
|
||||||
|
NEW, REVIEW, CHECKING, APPROVED
|
||||||
|
}
|
@ -3,6 +3,7 @@ package ru.ulstu.report.model.dto;
|
|||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
import ru.ulstu.indicator.model.Indicator;
|
||||||
import ru.ulstu.report.model.Report;
|
import ru.ulstu.report.model.Report;
|
||||||
|
import ru.ulstu.report.model.ReportStatus;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -14,6 +15,7 @@ public class ReportDto {
|
|||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||||
private Date createDate = new Date();
|
private Date createDate = new Date();
|
||||||
private List<ReportValueDto> reportValues = new ArrayList<>();
|
private List<ReportValueDto> reportValues = new ArrayList<>();
|
||||||
|
private ReportStatus status;
|
||||||
|
|
||||||
public ReportDto() {
|
public ReportDto() {
|
||||||
}
|
}
|
||||||
@ -21,6 +23,7 @@ public class ReportDto {
|
|||||||
public ReportDto(Integer reportPeriodId, List<Indicator> indicators) {
|
public ReportDto(Integer reportPeriodId, List<Indicator> indicators) {
|
||||||
this.reportPeriodId = reportPeriodId;
|
this.reportPeriodId = reportPeriodId;
|
||||||
this.reportValues = indicators.stream().map(ReportValueDto::new).toList();
|
this.reportValues = indicators.stream().map(ReportValueDto::new).toList();
|
||||||
|
this.status = ReportStatus.NEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReportDto(Report report, List<Indicator> indicators) {
|
public ReportDto(Report report, List<Indicator> indicators) {
|
||||||
@ -28,6 +31,7 @@ public class ReportDto {
|
|||||||
this.reportPeriodId = report.getReportPeriod().getId();
|
this.reportPeriodId = report.getReportPeriod().getId();
|
||||||
this.createDate = report.getCreateDate();
|
this.createDate = report.getCreateDate();
|
||||||
this.reportValues = indicators.stream().map(ReportValueDto::new).toList();
|
this.reportValues = indicators.stream().map(ReportValueDto::new).toList();
|
||||||
|
this.status = report.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReportValueDto> getReportValues() {
|
public List<ReportValueDto> getReportValues() {
|
||||||
@ -61,4 +65,12 @@ public class ReportDto {
|
|||||||
public void setCreateDate(Date createDate) {
|
public void setCreateDate(Date createDate) {
|
||||||
this.createDate = createDate;
|
this.createDate = createDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReportStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(ReportStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,4 +57,8 @@ public class ReportService {
|
|||||||
.findById(reportId)
|
.findById(reportId)
|
||||||
.orElseThrow(() -> new RuntimeException("Report not found by id"));
|
.orElseThrow(() -> new RuntimeException("Report not found by id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteReport(Integer id) {
|
||||||
|
reportRepository.deleteById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
<input type="hidden" th:field="*{id}">
|
<input type="hidden" th:field="*{id}">
|
||||||
<input type="hidden" th:field="*{reportPeriodId}">
|
<input type="hidden" th:field="*{reportPeriodId}">
|
||||||
<input type="hidden" th:field="*{createDate}">
|
<input type="hidden" th:field="*{createDate}">
|
||||||
|
<input type="hidden" th:field="*{status}">
|
||||||
|
|
||||||
<div class="form-group" th:each="rv, ind : *{reportValues}">
|
<div class="form-group" th:each="rv, ind : *{reportValues}">
|
||||||
<a th:href="${'/edit-indicator/' + rv.indicator.id}"
|
<a th:href="${'/edit-indicator-value/' + rv.indicator.id}"
|
||||||
th:text="${rv.indicator.name}"></a>
|
th:text="${rv.indicator.name}"></a>
|
||||||
<p th:text="${rv.indicator.proofDocuments}"></p>
|
<p th:text="${rv.indicator.proofDocuments}"></p>
|
||||||
<p th:text="'Максимальное количество баллов за показатель: '+ ${rv.indicator.max}"></p>
|
<p th:text="'Максимальное количество баллов за показатель: '+ ${rv.indicator.max}"></p>
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
<td th:text="${#calendars.format(r.reportPeriod.startDate, 'dd.MM.yyyy') + ' - ' + #calendars.format(r.reportPeriod.endDate, 'dd.MM.yyyy')}"></td>
|
<td th:text="${#calendars.format(r.reportPeriod.startDate, 'dd.MM.yyyy') + ' - ' + #calendars.format(r.reportPeriod.endDate, 'dd.MM.yyyy')}"></td>
|
||||||
<td th:text="${r.aspirant.surname + ' '+ r.aspirant.name + ' '+ r.aspirant.patronymic }"></td>
|
<td th:text="${r.aspirant.surname + ' '+ r.aspirant.name + ' '+ r.aspirant.patronymic }"></td>
|
||||||
<td th:text="${#calendars.format(r.createDate, 'dd.MM.yyyy HH:mm')}"></td>
|
<td th:text="${#calendars.format(r.createDate, 'dd.MM.yyyy HH:mm')}"></td>
|
||||||
<!-- <td th:text="${r.status}"></td>-->
|
<td th:text="${r.status}"></td>
|
||||||
<td>
|
<td>
|
||||||
<!-- Ссылка на редактирование -->
|
<!-- Ссылка на редактирование -->
|
||||||
<a th:href="@{'/report/edit-report/' + ${r.id}}" class="btn btn-sm btn-primary">
|
<a th:href="@{'/report/edit-report/' + ${r.id}}" class="btn btn-sm btn-primary">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user