#15 -- Add some pages

This commit is contained in:
Arklightning 2025-03-18 17:50:06 +04:00
parent 04b3b311a9
commit 10b6835a31
13 changed files with 422 additions and 17 deletions

View File

@ -0,0 +1,46 @@
package ru.ulstu.admin.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import ru.ulstu.admin.model.ReportForm;
import ru.ulstu.admin.service.AdminReportService;
import java.util.List;
@Controller
@RequestMapping("/admin")
public class AdminReportController {
private final AdminReportService adminReportService;
public AdminReportController(AdminReportService adminReportService) {
this.adminReportService = adminReportService;
}
@GetMapping("/report/{aspirantId}")
public String getReportForm(@PathVariable(value = "aspirantId") Integer aspirantId, Model model) {
ReportForm reportForm = new ReportForm();
reportForm.setAspirantId(aspirantId); // Устанавливаем ID аспиранта
model.addAttribute("report", reportForm);
return "admin/aspirantReport"; // Возвращает шаблон report.html
}
@PostMapping("/saveReport")
public String saveReport(@ModelAttribute ReportForm reportForm,
@RequestParam("file") List<MultipartFile> files) {
// Сохраняем отчет
adminReportService.saveReport(reportForm);
// Обработка загруженных файлов
if (!files.isEmpty()) {
for (MultipartFile file : files) {
System.out.println("Файл: " + file.getOriginalFilename());
// Здесь можно добавить логику сохранения файла на сервере
}
}
return "redirect:/admin/aspirants"; // Перенаправление на список аспирантов
}
}

View File

@ -0,0 +1,51 @@
package ru.ulstu.admin.model;
public class ReportForm {
private Integer id; // ID отчета
private Integer aspirantId; // ID аспиранта
private Integer courseWorkScore; // Баллы за курсовую работу
private Integer researchScore; // Баллы за научные исследования
private Integer publicationsScore; // Баллы за публикации
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
// Геттер и сеттер для aspirantId
public Integer getAspirantId() {
return aspirantId;
}
public void setAspirantId(Integer aspirantId) {
this.aspirantId = aspirantId;
}
// Геттеры и сеттеры для других полей (если их нет)
public Integer getCourseWorkScore() {
return courseWorkScore;
}
public void setCourseWorkScore(Integer courseWorkScore) {
this.courseWorkScore = courseWorkScore;
}
public Integer getResearchScore() {
return researchScore;
}
public void setResearchScore(Integer researchScore) {
this.researchScore = researchScore;
}
public Integer getPublicationsScore() {
return publicationsScore;
}
public void setPublicationsScore(Integer publicationsScore) {
this.publicationsScore = publicationsScore;
}
}

View File

@ -0,0 +1,17 @@
package ru.ulstu.admin.service;
import org.springframework.stereotype.Service;
import ru.ulstu.admin.model.ReportForm;
@Service
public class AdminReportService {
// Здесь можно добавить дополнительную логику для работы с отчетами
public void saveReport(ReportForm reportForm) {
// Логика сохранения отчета
System.out.println("Аспирант ID: " + reportForm.getAspirantId());
System.out.println("Курсовая работа: " + reportForm.getCourseWorkScore());
System.out.println("Научные исследования: " + reportForm.getResearchScore());
System.out.println("Публикации: " + reportForm.getPublicationsScore());
}
}

View File

@ -0,0 +1,49 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml"
layout:decorate="~{default}">
<div class="container" layout:fragment="content">
<h3>Отчетность аспиранта</h3>
<!-- Форма для отправки данных -->
<form action="#" th:action="@{/admin/saveReport}" th:object="${report}" method="post" enctype="multipart/form-data">
<input type="hidden" th:field="*{aspirantId}">
<div class="form-group">
<label for="courseWork">Курсовая работа (баллы)</label>
<input th:field="*{courseWorkScore}" id="courseWork" type="number" required class="form-control"
placeholder="Введите баллы">
<p th:if="${#fields.hasErrors('courseWorkScore')}"
th:class="${#fields.hasErrors('courseWorkScore')}? error">
Поле обязательно для заполнения
</p>
</div>
<div class="form-group">
<label for="research">Научные исследования (баллы)</label>
<input th:field="*{researchScore}" id="research" type="number" required class="form-control"
placeholder="Введите баллы">
<p th:if="${#fields.hasErrors('researchScore')}" th:class="${#fields.hasErrors('researchScore')}? error">
Поле обязательно для заполнения
</p>
</div>
<div class="form-group">
<label for="publications">Публикации (баллы)</label>
<input th:field="*{publicationsScore}" id="publications" type="number" required class="form-control"
placeholder="Введите баллы">
<p th:if="${#fields.hasErrors('publicationsScore')}"
th:class="${#fields.hasErrors('publicationsScore')}? error">
Поле обязательно для заполнения
</p>
</div>
<div class="form-group">
<label for="fileUpload">Прикрепить файл</label>
<input id="fileUpload" type="file" name="file" multiple class="form-control-file">
</div>
<button type="submit" class="btn btn-outline-dark">Отправить отчет</button>
<a href="/admin/reports" class="btn btn-outline-dark">Отмена</a>
</form>
</div>
</html>

View File

@ -6,12 +6,35 @@
<i class="fa fa-plus-square" aria-hidden="true"> Добавить аспиранта</i>
</a>
<ul>
<li th:each="a : ${aspirants}">
<a th:href="@{'/admin/editAspirant/' + ${a.id}}">
<span th:text="${a.surname} + ' '+ ${a.name} + ' ' + ${a.patronymic}"></span>
</a>
</li>
</ul>
<!-- Таблица аспирантов -->
<table class="table table-bordered table-striped mt-3">
<thead class="table-dark">
<tr>
<th scope="col">Фамилия</th>
<th scope="col">Имя</th>
<th scope="col">Отчество</th>
<th scope="col">Курс</th>
<th scope="col">Тема диссертации</th>
<th scope="col">Научный руководитель</th>
<th scope="col">Действия</th>
</tr>
</thead>
<tbody>
<tr th:each="a : ${aspirants}">
<td th:text="${a.surname}"></td>
<td th:text="${a.name}"></td>
<td th:text="${a.patronymic}"></td>
<td th:text="${a.course.name}"></td>
<td th:text="${a.theme}"></td>
<td th:text="${a.manager.name}"></td>
<td>
<!-- Ссылка на редактирование -->
<a th:href="@{'/admin/editAspirant/' + ${a.id}}" class="btn btn-sm btn-primary">
<i class="fa fa-edit" aria-hidden="true"></i> Редактировать
</a>
</td>
</tr>
</tbody>
</table>
</div>
</html>
</html>

View File

@ -2,16 +2,42 @@
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml"
layout:decorate="~{default}">
<div class="container" layout:fragment="content">
<a href="/admin/editManager/0" class="btn btn-outline-dark">
<!-- Кнопка добавления нового научного руководителя -->
<a href="/admin/editManager/0" class="btn btn-outline-dark mb-3">
<i class="fa fa-plus-square" aria-hidden="true"> Добавить научного руководителя</i>
</a>
<ul>
<li th:each="m : ${managers}">
<a th:href="@{'/admin/editManager/' + ${m.id}}">
<span th:text="${m.name}"></span>
</a>
</li>
</ul>
<!-- Таблица научных руководителей -->
<table class="table table-bordered table-striped mt-3">
<thead class="table-dark">
<tr>
<th scope="col">ФИО</th>
<th scope="col">Должность</th>
<th scope="col">Степень</th>
<th scope="col">Звание</th>
<th scope="col">Научные интересы</th>
<th scope="col">Действия</th>
</tr>
</thead>
<tbody>
<tr th:each="m : ${managers}">
<td th:text="${m.name}"></td>
<td th:text="${m.position}"></td>
<td th:text="${m.degree}"></td>
<td th:text="${m.title}"></td>
<td>
<ul>
<li th:each="interest : ${m.interests}" th:text="${interest}"></li>
</ul>
</td>
<td>
<!-- Ссылка на редактирование -->
<a th:href="@{'/admin/editManager/' + ${m.id}}" class="btn btn-sm btn-primary">
<i class="fa fa-edit" aria-hidden="true"></i> Редактировать
</a>
</td>
</tr>
</tbody>
</table>
</div>
</html>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns:th="http://www.thymeleaf.org" lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Правила расчета БРС</title>
<link th:href="@{/webjars/bootstrap/5.3.0-alpha1/css/bootstrap.min.css}" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h2 class="mb-4">Правила расчета БРС</h2>
<form action="#" method="post">
<div class="mb-3">
<label for="courseWorkWeight" class="form-label">Вес курсовой работы (%)</label>
<input type="number" class="form-control" id="courseWorkWeight" name="courseWorkWeight"
th:value="${courseWorkWeight}">
</div>
<div class="mb-3">
<label for="researchWeight" class="form-label">Вес научных исследований (%)</label>
<input type="number" class="form-control" id="researchWeight" name="researchWeight"
th:value="${researchWeight}">
</div>
<div class="mb-3">
<label for="publicationsWeight" class="form-label">Вес публикаций (%)</label>
<input type="number" class="form-control" id="publicationsWeight" name="publicationsWeight"
th:value="${publicationsWeight}">
</div>
<button type="submit" class="btn btn-primary">Сохранить правила</button>
</form>
</div>
<script th:src="@{/webjars/bootstrap/5.3.0-alpha1/js/bootstrap.bundle.min.js}"></script>
</body>
</html>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns:th="http://www.thymeleaf.org" lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Подтверждение отчета</title>
<link th:href="@{/webjars/bootstrap/5.3.0-alpha1/css/bootstrap.min.css}" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h2 class="mb-4">Подтверждение отчета аспиранта</h2>
<div class="card mb-3">
<div class="card-header" th:text="'Отчет аспиранта: ' + ${aspirantName}">Отчет аспиранта: Иванов Иван Иванович
</div>
<div class="card-body">
<p><strong>Курсовая работа:</strong> <span th:text="${courseWorkScore}">80</span> баллов</p>
<p><strong>Научные исследования:</strong> <span th:text="${researchScore}">70</span> баллов</p>
<p><strong>Публикации:</strong> <span th:text="${publicationsScore}">60</span> баллов</p>
<button type="button" class="btn btn-success">Подтвердить</button>
<button type="button" class="btn btn-danger">Отклонить</button>
</div>
</div>
</div>
<script th:src="@{/webjars/bootstrap/5.3.0-alpha1/js/bootstrap.bundle.min.js}"></script>
</body>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns:th="http://www.thymeleaf.org" lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Список аспирантов</title>
<link th:href="@{/webjars/bootstrap/5.3.0-alpha1/css/bootstrap.min.css}" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h2 class="mb-4">Список аспирантов</h2>
<table class="table table-bordered table-striped">
<thead class="table-dark">
<tr>
<th scope="col">ФИО</th>
<th scope="col">Курс</th>
<th scope="col">Форма обучения</th>
<th scope="col">Основа</th>
<th scope="col">Тема диссертации</th>
<th scope="col">Руководитель</th>
<th scope="col">Активное обучение</th>
</tr>
</thead>
<tbody>
<tr th:each="aspirant : ${aspirants}">
<td th:text="${aspirant.fio}">Иванов Иван Иванович</td>
<td th:text="${aspirant.course}">1</td>
<td th:text="${aspirant.formOfEducation}">Очная</td>
<td th:text="${aspirant.basis}">Бюджет</td>
<td th:text="${aspirant.dissertationTopic}">Методы машинного обучения</td>
<td th:text="${aspirant.supervisor}">Петров Петр Петрович</td>
<td th:if="${aspirant.isActive}" th:text="'Да'">Да</td>
<td th:unless="${aspirant.isActive}" th:text="'Нет'">Нет</td>
</tr>
</tbody>
</table>
</div>
<script th:src="@{/webjars/bootstrap/5.3.0-alpha1/js/bootstrap.bundle.min.js}"></script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns:th="http://www.thymeleaf.org" lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Отчетность аспиранта</title>
<link th:href="@{/webjars/bootstrap/5.3.0-alpha1/css/bootstrap.min.css}" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h2 class="mb-4">Отчетность аспиранта</h2>
<form action="#" method="post">
<div class="mb-3">
<label for="courseWork" class="form-label">Курсовая работа (баллы)</label>
<input type="number" class="form-control" id="courseWork" name="courseWork" placeholder="Введите баллы">
</div>
<div class="mb-3">
<label for="research" class="form-label">Научные исследования (баллы)</label>
<input type="number" class="form-control" id="research" name="research" placeholder="Введите баллы">
</div>
<div class="mb-3">
<label for="publications" class="form-label">Публикации (баллы)</label>
<input type="number" class="form-control" id="publications" name="publications" placeholder="Введите баллы">
</div>
<div class="mb-3">
<label for="fileUpload" class="form-label">Прикрепить файл</label>
<input class="form-control" type="file" id="fileUpload" name="fileUpload">
</div>
<button type="submit" class="btn btn-primary">Отправить отчет</button>
</form>
</div>
<script th:src="@{/webjars/bootstrap/5.3.0-alpha1/js/bootstrap.bundle.min.js}"></script>
</body>
</html>

View File

@ -0,0 +1,25 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns:th="http://www.thymeleaf.org" lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Список руководителей</title>
<link th:href="@{/webjars/bootstrap/5.3.0-alpha1/css/bootstrap.min.css}" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h2 class="mb-4">Список руководителей</h2>
<div th:each="supervisor : ${supervisors}" class="card mb-3">
<div class="card-header" th:text="${supervisor.fio}">Петров Петр Петрович</div>
<div class="card-body">
<p><strong>Должность:</strong> <span th:text="${supervisor.position}">Доцент</span></p>
<p><strong>Степень:</strong> <span th:text="${supervisor.degree}">Кандидат технических наук</span></p>
<p><strong>Звание:</strong> <span th:text="${supervisor.title}">Доцент</span></p>
<p><strong>Научные интересы:</strong> <span th:each="interest : ${supervisor.interests}"
th:text="${interest} + ', '"></span></p>
</div>
</div>
</div>
<script th:src="@{/webjars/bootstrap/5.3.0-alpha1/js/bootstrap.bundle.min.js}"></script>
</body>
</html>

View File

@ -0,0 +1,31 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns:th="http://www.thymeleaf.org" lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Статистика по семестрам</title>
<link th:href="@{/webjars/bootstrap/5.3.0-alpha1/css/bootstrap.min.css}" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h2 class="mb-4">Статистика по семестрам</h2>
<table class="table table-bordered table-striped">
<thead class="table-dark">
<tr>
<th scope="col">Семестр</th>
<th scope="col">Аспирант</th>
<th scope="col">Общий балл</th>
</tr>
</thead>
<tbody>
<tr th:each="stat : ${stats}">
<td th:text="${stat.semester}">1</td>
<td th:text="${stat.aspirantName}">Иванов Иван Иванович</td>
<td th:text="${stat.totalScore}">210</td>
</tr>
</tbody>
</table>
</div>
<script th:src="@{/webjars/bootstrap/5.3.0-alpha1/js/bootstrap.bundle.min.js}"></script>
</body>
</html>

View File

@ -63,6 +63,10 @@
<a class="dropdown-item" href="/admin/managers">Список научных руководителей</a>
<a class="dropdown-item" href="/admin/aspirants">Список аспирантов</a>
<a class="dropdown-item" href="/admin">Новости и заседания</a>
<a class="dropdown-item" href="/admin/reports">Отчетность аспирантов</a>
<a class="dropdown-item" href="/admin/rules">Правила БРС</a>
<a class="dropdown-item" href="/admin/confirmation">Подтверждение БРС</a>
<a class="dropdown-item" href="/admin/stats">Статистика по баллам</a>
</div>
</li>
<li class="nav-item">