Compare commits
No commits in common. "aspir" and "master" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,7 +6,6 @@
|
|||||||
.gradle
|
.gradle
|
||||||
out
|
out
|
||||||
build
|
build
|
||||||
data
|
|
||||||
|
|
||||||
# Log file
|
# Log file
|
||||||
*.log
|
*.log
|
||||||
|
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "java",
|
|
||||||
"name": "SeminarApplication",
|
|
||||||
"request": "launch",
|
|
||||||
"mainClass": "ru.ulstu.SeminarApplication",
|
|
||||||
"projectName": "seminar"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"java.compile.nullAnalysis.mode": "automatic"
|
|
||||||
}
|
|
21
README.md
21
README.md
@ -1,20 +1,9 @@
|
|||||||
# Портал для аспирантов
|
# seminar
|
||||||
|
|
||||||
Порядок развертывания проекта разработчиками:
|
JDK: https://download.oracle.com/java/17/archive/jdk-17.0.6_windows-x64_bin.exe
|
||||||
|
|
||||||
1. Скачать и установить JDK (используется 21 LTS
|
IDE: IntelliJIDEA community version https://www.jetbrains.com/ru-ru/idea/download/#section=windows
|
||||||
JDK): https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.exe
|
|
||||||
|
|
||||||
2. Проверить установку, набрав в консоли команду "java -version"
|
To run: run project and open http://localhost:8080/
|
||||||
|
|
||||||
3. Скачать и установить IDE: IntelliJIDEA Сommunity
|
Demo: http://seminar.athene.tech
|
||||||
version https://www.jetbrains.com/ru-ru/idea/download/#section=windows
|
|
||||||
|
|
||||||
4. Скачать и открыть проект в IDE:
|
|
||||||
|
|
||||||

|
|
||||||
5. Сформировать конфигурацию для запуска:
|
|
||||||

|
|
||||||
6. Запустить проект.
|
|
||||||
7. Открыть страницу в браузере http://localhost:8080/
|
|
||||||
8. Enjoy.
|
|
13
build.gradle
13
build.gradle
@ -14,9 +14,11 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
maven {
|
||||||
|
url = uri("http://repo.athene.tech/repository/maven-central/")
|
||||||
|
allowInsecureProtocol(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.springframework.boot:spring-boot-starter'
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
@ -31,8 +33,8 @@ dependencies {
|
|||||||
implementation group: 'com.h2database', name:'h2'
|
implementation group: 'com.h2database', name:'h2'
|
||||||
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '4.0.2'
|
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '4.0.2'
|
||||||
implementation group: 'org.javassist', name: 'javassist', version: '3.30.2-GA'
|
implementation group: 'org.javassist', name: 'javassist', version: '3.30.2-GA'
|
||||||
|
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-blackbird'
|
||||||
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.4'
|
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.13.2'
|
||||||
|
|
||||||
implementation group: 'org.eclipse.jetty', name: 'jetty-servlets', version: '11.0.24'
|
implementation group: 'org.eclipse.jetty', name: 'jetty-servlets', version: '11.0.24'
|
||||||
|
|
||||||
@ -45,11 +47,10 @@ dependencies {
|
|||||||
implementation group: 'org.webjars', name: 'bootstrap-glyphicons', version: 'bdd2cbfba0'
|
implementation group: 'org.webjars', name: 'bootstrap-glyphicons', version: 'bdd2cbfba0'
|
||||||
|
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
testImplementation("org.springframework.security:spring-security-test")
|
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
tasks.named('test') {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,5 @@ public class SeminarApplication {
|
|||||||
public void doSomethingAfterStartup() {
|
public void doSomethingAfterStartup() {
|
||||||
System.out.println("hello world, I have just started up");
|
System.out.println("hello world, I have just started up");
|
||||||
userService.initDefaultAdmin();
|
userService.initDefaultAdmin();
|
||||||
userService.initDefaultAspirant();
|
|
||||||
userService.initDefaultHead();
|
|
||||||
userService.initDefaultManager();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
package ru.ulstu.admin.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.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import ru.ulstu.admin.model.AspirantForm;
|
|
||||||
import ru.ulstu.admin.service.AdminAspirantService;
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
import ru.ulstu.indicator.model.Course;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("admin")
|
|
||||||
public class AdminAspirantController {
|
|
||||||
private final AdminAspirantService adminAspirantService;
|
|
||||||
|
|
||||||
public AdminAspirantController(AdminAspirantService adminAspirantService) {
|
|
||||||
this.adminAspirantService = adminAspirantService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("aspirants")
|
|
||||||
public String getListOfAspirants(Model model) {
|
|
||||||
model.addAttribute("aspirants", adminAspirantService.getAspirants());
|
|
||||||
return "admin/aspirantsList";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/editAspirant/{aspirantId}")
|
|
||||||
public String editAspirant(@PathVariable(value = "aspirantId") Integer id, Model model) {
|
|
||||||
model.addAttribute("aspirant",
|
|
||||||
new AspirantForm((id != null && id != 0)
|
|
||||||
? adminAspirantService.getAspirantById(id)
|
|
||||||
: new Aspirant()));
|
|
||||||
model.addAttribute("courses", Course.values());
|
|
||||||
model.addAttribute("managers", adminAspirantService.getManagers());
|
|
||||||
return "admin/editAspirant";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "saveAspirant", params = "save")
|
|
||||||
public String saveAspirant(AspirantForm aspirantForm, Model model) {
|
|
||||||
adminAspirantService.saveAspirant(aspirantForm);
|
|
||||||
return "redirect:/admin/aspirants";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "saveAspirant", params = "delete")
|
|
||||||
public String deleteIndicator(AspirantForm aspirantForm, Model model) {
|
|
||||||
adminAspirantService.deleteAspirant(aspirantForm);
|
|
||||||
return "redirect:/admin/aspirants";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
package ru.ulstu.admin.controller;
|
|
||||||
|
|
||||||
import org.springframework.security.access.annotation.Secured;
|
|
||||||
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.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import ru.ulstu.admin.model.IndicatorForm;
|
|
||||||
import ru.ulstu.admin.service.AdminIndicatorService;
|
|
||||||
import ru.ulstu.indicator.model.Course;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.model.UserRoleConstants;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/admin")
|
|
||||||
@Secured({UserRoleConstants.ADMIN})
|
|
||||||
public class AdminIndicatorController {
|
|
||||||
private final AdminIndicatorService adminIndicatorService;
|
|
||||||
|
|
||||||
public AdminIndicatorController(AdminIndicatorService adminIndicatorService) {
|
|
||||||
this.adminIndicatorService = adminIndicatorService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("indicators")
|
|
||||||
public String getListOfIndicators(Model model) {
|
|
||||||
model.addAttribute("indicators", adminIndicatorService.getIndicators());
|
|
||||||
return "admin/indicatorsList";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/editIndicator/{indicatorId}")
|
|
||||||
public String editIndicator(@PathVariable(value = "indicatorId") Integer id, Model model) {
|
|
||||||
model.addAttribute("indicator",
|
|
||||||
(id != null && id != 0)
|
|
||||||
? adminIndicatorService.getIndicatorById(id)
|
|
||||||
: new Indicator());
|
|
||||||
model.addAttribute("courses", Course.values());
|
|
||||||
return "admin/editIndicator";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "saveIndicator", params = "save")
|
|
||||||
public String saveIndicator(IndicatorForm indicatorForm, Model model) {
|
|
||||||
adminIndicatorService.saveIndicator(indicatorForm);
|
|
||||||
return "redirect:/admin/indicators";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "saveIndicator", params = "delete")
|
|
||||||
public String deleteIndicator(IndicatorForm indicatorForm, Model model) {
|
|
||||||
adminIndicatorService.deleteIndicator(indicatorForm);
|
|
||||||
return "redirect:/admin/indicators";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package ru.ulstu.admin.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.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import ru.ulstu.admin.model.ManagerForm;
|
|
||||||
import ru.ulstu.admin.service.AdminManagerService;
|
|
||||||
import ru.ulstu.manager.model.Manager;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("admin")
|
|
||||||
public class AdminManagerController {
|
|
||||||
private final AdminManagerService adminManagerService;
|
|
||||||
|
|
||||||
public AdminManagerController(AdminManagerService adminManagerService) {
|
|
||||||
this.adminManagerService = adminManagerService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("managers")
|
|
||||||
public String getListOfManagers(Model model) {
|
|
||||||
model.addAttribute("managers", adminManagerService.getManagers());
|
|
||||||
return "admin/managersList";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/editManager/{managerId}")
|
|
||||||
public String editManager(@PathVariable(value = "managerId") Integer id, Model model) {
|
|
||||||
model.addAttribute("manager",
|
|
||||||
(id != null && id != 0)
|
|
||||||
? adminManagerService.getManagerById(id)
|
|
||||||
: new Manager());
|
|
||||||
return "admin/editManager";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "saveManager", params = "save")
|
|
||||||
public String saveManager(ManagerForm managerForm, Model model) {
|
|
||||||
adminManagerService.saveManager(managerForm);
|
|
||||||
return "redirect:/admin/managers";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "saveManager", params = "delete")
|
|
||||||
public String deleteIndicator(ManagerForm managerForm, Model model) {
|
|
||||||
adminManagerService.deleteManager(managerForm);
|
|
||||||
return "redirect:/admin/managers";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,137 +0,0 @@
|
|||||||
package ru.ulstu.admin.model;
|
|
||||||
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
import ru.ulstu.aspirant.model.Base;
|
|
||||||
import ru.ulstu.aspirant.model.Speciality;
|
|
||||||
import ru.ulstu.indicator.model.Course;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class AspirantForm {
|
|
||||||
private Integer id;
|
|
||||||
private String surname;
|
|
||||||
private String name;
|
|
||||||
private String patronymic;
|
|
||||||
private Course course;
|
|
||||||
private Integer managerId;
|
|
||||||
private Date birthDate;
|
|
||||||
private Speciality speciality;
|
|
||||||
private String theme;
|
|
||||||
private Base base;
|
|
||||||
private Integer userId;
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
public AspirantForm() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspirantForm(Aspirant aspirant) {
|
|
||||||
this.id = aspirant.getId();
|
|
||||||
this.name = aspirant.getName();
|
|
||||||
this.surname = aspirant.getSurname();
|
|
||||||
this.patronymic = aspirant.getPatronymic();
|
|
||||||
this.base = aspirant.getBase();
|
|
||||||
this.course = aspirant.getCourse();
|
|
||||||
this.managerId = aspirant.getManager() == null ? null : aspirant.getManager().getId();
|
|
||||||
this.birthDate = aspirant.getBirthDate();
|
|
||||||
this.speciality = aspirant.getSpeciality();
|
|
||||||
this.theme = aspirant.getTheme();
|
|
||||||
this.userId = aspirant.getUser() == null ? null : aspirant.getUser().getId();
|
|
||||||
this.email = aspirant.getUser() == null ? null : aspirant.getUser().getLogin();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSurname() {
|
|
||||||
return surname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSurname(String surname) {
|
|
||||||
this.surname = surname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPatronymic() {
|
|
||||||
return patronymic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPatronymic(String patronymic) {
|
|
||||||
this.patronymic = patronymic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Course getCourse() {
|
|
||||||
return course;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourse(Course course) {
|
|
||||||
this.course = course;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getManagerId() {
|
|
||||||
return managerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManagerId(Integer managerId) {
|
|
||||||
this.managerId = managerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getBirthDate() {
|
|
||||||
return birthDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBirthDate(Date birthDate) {
|
|
||||||
this.birthDate = birthDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Speciality getSpeciality() {
|
|
||||||
return speciality;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpeciality(Speciality speciality) {
|
|
||||||
this.speciality = speciality;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTheme() {
|
|
||||||
return theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTheme(String theme) {
|
|
||||||
this.theme = theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Base getBase() {
|
|
||||||
return base;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBase(Base base) {
|
|
||||||
this.base = base;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(Integer userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
package ru.ulstu.admin.model;
|
|
||||||
|
|
||||||
import ru.ulstu.indicator.model.Course;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class IndicatorForm {
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private int max;
|
|
||||||
|
|
||||||
private String proofDocuments;
|
|
||||||
|
|
||||||
private List<Course> courses = new ArrayList<>();
|
|
||||||
|
|
||||||
public IndicatorForm() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public IndicatorForm(Indicator indicator) {
|
|
||||||
this.name = indicator.getName();
|
|
||||||
this.max = indicator.getMax();
|
|
||||||
this.proofDocuments = indicator.getProofDocuments();
|
|
||||||
this.courses = indicator.getCourses();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMax() {
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMax(int max) {
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProofDocuments() {
|
|
||||||
return proofDocuments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProofDocuments(String proofDocuments) {
|
|
||||||
this.proofDocuments = proofDocuments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Course> getCourses() {
|
|
||||||
return courses;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourses(List<Course> courses) {
|
|
||||||
this.courses = courses;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package ru.ulstu.admin.model;
|
|
||||||
|
|
||||||
import ru.ulstu.manager.model.Manager;
|
|
||||||
|
|
||||||
public class ManagerForm {
|
|
||||||
private Integer id;
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public ManagerForm() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ManagerForm(Manager manager) {
|
|
||||||
this.id = manager.getId();
|
|
||||||
this.name = manager.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
package ru.ulstu.admin.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.admin.model.AspirantForm;
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
import ru.ulstu.aspirant.service.AspirantService;
|
|
||||||
import ru.ulstu.manager.model.Manager;
|
|
||||||
import ru.ulstu.manager.service.ManagerService;
|
|
||||||
import ru.ulstu.model.User;
|
|
||||||
import ru.ulstu.model.UserRole;
|
|
||||||
import ru.ulstu.model.UserRoleConstants;
|
|
||||||
import ru.ulstu.user.UserRoleRepository;
|
|
||||||
import ru.ulstu.user.UserService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class AdminAspirantService {
|
|
||||||
private final AspirantService aspirantService;
|
|
||||||
private final ManagerService managerService;
|
|
||||||
private final UserService userService;
|
|
||||||
private final UserRoleRepository userRoleRepository;
|
|
||||||
|
|
||||||
public AdminAspirantService(AspirantService aspirantService,
|
|
||||||
ManagerService managerService,
|
|
||||||
UserService userService,
|
|
||||||
UserRoleRepository userRoleRepository) {
|
|
||||||
this.aspirantService = aspirantService;
|
|
||||||
this.managerService = managerService;
|
|
||||||
this.userService = userService;
|
|
||||||
this.userRoleRepository = userRoleRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Aspirant> getAspirants() {
|
|
||||||
return aspirantService.getAspirants();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Aspirant getAspirantById(Integer id) {
|
|
||||||
return aspirantService.getAspirantById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveAspirant(AspirantForm aspirantForm) {
|
|
||||||
Aspirant aspirant = aspirantForm.getId() == null
|
|
||||||
? new Aspirant()
|
|
||||||
: aspirantService.getAspirantById(aspirantForm.getId());
|
|
||||||
aspirant.setName(aspirantForm.getName());
|
|
||||||
aspirant.setSurname(aspirantForm.getSurname());
|
|
||||||
aspirant.setPatronymic(aspirantForm.getPatronymic());
|
|
||||||
aspirant.setBase(aspirantForm.getBase());
|
|
||||||
aspirant.setCourse(aspirantForm.getCourse());
|
|
||||||
aspirant.setManager(managerService.getManagerById(aspirantForm.getManagerId()));
|
|
||||||
aspirant.setBirthDate(aspirantForm.getBirthDate());
|
|
||||||
aspirant.setSpeciality(aspirantForm.getSpeciality());
|
|
||||||
aspirant.setTheme(aspirantForm.getTheme());
|
|
||||||
User user;
|
|
||||||
if (aspirantForm.getUserId() != null) {
|
|
||||||
user = userService.getUserById(aspirantForm.getUserId());
|
|
||||||
if (!user.getLogin().equals(aspirantForm.getEmail())) {
|
|
||||||
user.setLogin(aspirantForm.getEmail());
|
|
||||||
if (user.getRoles().stream().anyMatch(r -> !r.getName().equals(UserRoleConstants.ASPIRANT))) {
|
|
||||||
user.getRoles().add(userRoleRepository.save(new UserRole(UserRoleConstants.ASPIRANT)));
|
|
||||||
}
|
|
||||||
userService.createUser(user);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
user = userService.createAspirant(aspirantForm.getEmail());
|
|
||||||
}
|
|
||||||
aspirant.setUser(user);
|
|
||||||
|
|
||||||
aspirantService.save(aspirant);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteAspirant(AspirantForm aspirantForm) {
|
|
||||||
aspirantService.deleteAspirant(aspirantForm);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Manager> getManagers() {
|
|
||||||
return managerService.getManagers();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package ru.ulstu.admin.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.admin.model.IndicatorForm;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.indicator.service.IndicatorService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class AdminIndicatorService {
|
|
||||||
private final IndicatorService indicatorService;
|
|
||||||
|
|
||||||
public AdminIndicatorService(IndicatorService indicatorService) {
|
|
||||||
this.indicatorService = indicatorService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Indicator> getIndicators() {
|
|
||||||
return indicatorService.getIndicatorList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveIndicator(IndicatorForm indicatorForm) {
|
|
||||||
Indicator indicator = indicatorForm.getId() == null
|
|
||||||
? new Indicator()
|
|
||||||
: indicatorService.getIndicatorById(indicatorForm.getId());
|
|
||||||
indicator.setName(indicatorForm.getName());
|
|
||||||
indicator.setMax(indicatorForm.getMax());
|
|
||||||
indicator.setProofDocuments(indicatorForm.getProofDocuments());
|
|
||||||
indicator.setCourses(indicatorForm.getCourses());
|
|
||||||
indicatorService.save(indicator);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Indicator getIndicatorById(Integer id) {
|
|
||||||
return indicatorService.getIndicatorById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteIndicator(IndicatorForm indicatorForm) {
|
|
||||||
indicatorService.deleteIndicator(indicatorForm);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package ru.ulstu.admin.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.admin.model.ManagerForm;
|
|
||||||
import ru.ulstu.manager.model.Manager;
|
|
||||||
import ru.ulstu.manager.service.ManagerService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class AdminManagerService {
|
|
||||||
private final ManagerService managerService;
|
|
||||||
|
|
||||||
public AdminManagerService(ManagerService managerService) {
|
|
||||||
this.managerService = managerService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Manager> getManagers() {
|
|
||||||
return managerService.getManagers();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Manager getManagerById(Integer id) {
|
|
||||||
return managerService.getManagerById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveManager(ManagerForm managerForm) {
|
|
||||||
Manager manager = managerForm.getId() == null
|
|
||||||
? new Manager(managerForm)
|
|
||||||
: managerService.getManagerById(managerForm.getId());
|
|
||||||
manager.setName(managerForm.getName());
|
|
||||||
managerService.save(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteManager(ManagerForm managerForm) {
|
|
||||||
managerService.deleteManager(managerForm);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,135 +0,0 @@
|
|||||||
package ru.ulstu.aspirant.model;
|
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.EnumType;
|
|
||||||
import jakarta.persistence.Enumerated;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import jakarta.persistence.Temporal;
|
|
||||||
import jakarta.persistence.TemporalType;
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import ru.ulstu.indicator.model.Course;
|
|
||||||
import ru.ulstu.manager.model.Manager;
|
|
||||||
import ru.ulstu.model.BaseEntity;
|
|
||||||
import ru.ulstu.model.User;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Aspirant extends BaseEntity {
|
|
||||||
@NotEmpty
|
|
||||||
private String surname;
|
|
||||||
|
|
||||||
@NotEmpty
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private String patronymic;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private Course course;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private Manager manager;
|
|
||||||
|
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
private Date birthDate;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Speciality speciality;
|
|
||||||
|
|
||||||
private String theme;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Base base;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
public Aspirant() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Aspirant(String name, Course course) {
|
|
||||||
this.name = name;
|
|
||||||
this.course = course;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSurname() {
|
|
||||||
return surname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSurname(String surname) {
|
|
||||||
this.surname = surname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPatronymic() {
|
|
||||||
return patronymic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPatronymic(String patronymic) {
|
|
||||||
this.patronymic = patronymic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Course getCourse() {
|
|
||||||
return course;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourse(Course course) {
|
|
||||||
this.course = course;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Manager getManager() {
|
|
||||||
return manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManager(Manager manager) {
|
|
||||||
this.manager = manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getBirthDate() {
|
|
||||||
return birthDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBirthDate(Date birthDate) {
|
|
||||||
this.birthDate = birthDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Speciality getSpeciality() {
|
|
||||||
return speciality;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpeciality(Speciality speciality) {
|
|
||||||
this.speciality = speciality;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTheme() {
|
|
||||||
return theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTheme(String theme) {
|
|
||||||
this.theme = theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Base getBase() {
|
|
||||||
return base;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBase(Base base) {
|
|
||||||
this.base = base;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getUser() {
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUser(User user) {
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package ru.ulstu.aspirant.model;
|
|
||||||
|
|
||||||
public enum Base {
|
|
||||||
BUDGET("бюджет"), COMMERCE("коммерческая");
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
Base(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package ru.ulstu.aspirant.model;
|
|
||||||
|
|
||||||
public enum Speciality {
|
|
||||||
S_2_3_7("2.3.7", "Системный анализ"),
|
|
||||||
S_2_3_1("2.3.1", "Автоматизация проектирования");
|
|
||||||
|
|
||||||
private final String code;
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
Speciality(String code, String name) {
|
|
||||||
this.code = code;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package ru.ulstu.aspirant.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
import ru.ulstu.model.User;
|
|
||||||
|
|
||||||
public interface AspirantRepository extends JpaRepository<Aspirant, Integer> {
|
|
||||||
Aspirant findByUser(User user);
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
package ru.ulstu.aspirant.service;
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.admin.model.AspirantForm;
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
import ru.ulstu.aspirant.repository.AspirantRepository;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.indicator.service.IndicatorService;
|
|
||||||
import ru.ulstu.model.User;
|
|
||||||
import ru.ulstu.user.UserService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class AspirantService {
|
|
||||||
private final AspirantRepository aspirantRepository;
|
|
||||||
private final IndicatorService indicatorService;
|
|
||||||
private final UserService userService;
|
|
||||||
|
|
||||||
public AspirantService(AspirantRepository aspirantRepository,
|
|
||||||
IndicatorService indicatorService,
|
|
||||||
UserService userService) {
|
|
||||||
this.aspirantRepository = aspirantRepository;
|
|
||||||
this.indicatorService = indicatorService;
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Aspirant> getAspirants() {
|
|
||||||
return aspirantRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Aspirant getAspirantById(Integer id) {
|
|
||||||
return aspirantRepository.findById(id).orElseThrow(() -> new RuntimeException("Aspirant not found by id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save(Aspirant aspirant) {
|
|
||||||
aspirantRepository.save(aspirant);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteAspirant(AspirantForm aspirantForm) {
|
|
||||||
aspirantRepository.deleteById(aspirantForm.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Aspirant getAspirantByUser(User user) {
|
|
||||||
return aspirantRepository.findByUser(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Indicator> getCurrentAspirantIndicators() {
|
|
||||||
Aspirant aspirant = getAspirantByUser(userService.getCurrentUser());
|
|
||||||
return indicatorService.getIndicatorsByCourse(aspirant.getCourse());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Page<Indicator> getIndicatorsByCourse(Pageable pageable) {
|
|
||||||
return indicatorService.getIndicatorsByCourse(pageable);
|
|
||||||
}
|
|
||||||
}
|
|
@ -30,12 +30,12 @@ public class SecurityConfiguration {
|
|||||||
log.debug("Security enabled");
|
log.debug("Security enabled");
|
||||||
|
|
||||||
http
|
http
|
||||||
.headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin))
|
.headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
|
||||||
.csrf(AbstractHttpConfigurer::disable)
|
.csrf(AbstractHttpConfigurer::disable)
|
||||||
.authorizeHttpRequests(auth ->
|
.authorizeHttpRequests(auth ->
|
||||||
auth.requestMatchers("/").permitAll()
|
auth.requestMatchers("/").permitAll()
|
||||||
.requestMatchers(permittedUrls).permitAll()
|
.requestMatchers(permittedUrls).permitAll()
|
||||||
.requestMatchers("/swagger-ui/*").hasAuthority(UserRoleConstants.ADMIN)
|
.requestMatchers("/swagger-ui.html").hasAuthority(UserRoleConstants.ADMIN)
|
||||||
.anyRequest().authenticated())
|
.anyRequest().authenticated())
|
||||||
.formLogin(form ->
|
.formLogin(form ->
|
||||||
form.loginPage("/login")
|
form.loginPage("/login")
|
||||||
|
@ -9,7 +9,7 @@ package ru.ulstu.controller;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import ru.ulstu.news.service.NewsService;
|
import ru.ulstu.news.NewsService;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
package ru.ulstu.file.controller;
|
|
||||||
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import ru.ulstu.file.model.FileData;
|
|
||||||
import ru.ulstu.file.model.FileDataDto;
|
|
||||||
import ru.ulstu.file.service.FileService;
|
|
||||||
import ru.ulstu.model.response.Response;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("files")
|
|
||||||
public class FileController {
|
|
||||||
private final FileService fileService;
|
|
||||||
|
|
||||||
public FileController(FileService fileService) {
|
|
||||||
this.fileService = fileService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/download-tmp/{tmp-file-name}")
|
|
||||||
public ResponseEntity<byte[]> getFile(@PathVariable("tmp-file-name") String tmpFileName) throws IOException {
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
|
||||||
headers.add("Content-Disposition", "attachment; filename='"
|
|
||||||
+ URLEncoder.encode(fileService.getTmpFileName(tmpFileName), UTF_8.toString()) + "'");
|
|
||||||
return new ResponseEntity<>(fileService.getTmpFile(tmpFileName), headers, HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/download/{file-id}")
|
|
||||||
public ResponseEntity<byte[]> getFile(@PathVariable("file-id") Integer fileId) throws UnsupportedEncodingException {
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
|
||||||
FileData fileData = fileService.getFile(fileId);
|
|
||||||
headers.add("Content-Disposition", "attachment; filename='" +
|
|
||||||
URLEncoder.encode(fileData.getName(), UTF_8.toString()) + "'");
|
|
||||||
return new ResponseEntity<>(fileData.getData(), headers, HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/uploadTmpFile")
|
|
||||||
public Response<FileDataDto> upload(@RequestParam("file") MultipartFile multipartFile) throws IOException {
|
|
||||||
return new Response<>(fileService.createFromMultipartFile(multipartFile));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
package ru.ulstu.file.model;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.Lob;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import ru.ulstu.model.BaseEntity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "file")
|
|
||||||
public class FileData extends BaseEntity {
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private long size;
|
|
||||||
|
|
||||||
@Column(name = "create_date")
|
|
||||||
private Date createDate;
|
|
||||||
|
|
||||||
@Lob
|
|
||||||
private byte[] data;
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getSize() {
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSize(long size) {
|
|
||||||
this.size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateDate(Date createDate) {
|
|
||||||
this.createDate = createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(byte[] data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
package ru.ulstu.file.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
public class FileDataDto {
|
|
||||||
private Integer id;
|
|
||||||
private String name;
|
|
||||||
private String fileName;
|
|
||||||
private String tmpFileName;
|
|
||||||
private boolean deleted;
|
|
||||||
|
|
||||||
public FileDataDto() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
|
||||||
public FileDataDto(@JsonProperty("id") Integer id,
|
|
||||||
@JsonProperty("name") String name,
|
|
||||||
@JsonProperty("fileName") String fileName,
|
|
||||||
@JsonProperty("tmpFileName") String tmpFileName) {
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
this.fileName = fileName;
|
|
||||||
this.tmpFileName = tmpFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileDataDto(FileData fileData) {
|
|
||||||
this.id = fileData.getId();
|
|
||||||
this.name = fileData.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileDataDto(String fileName, String tmpFileName) {
|
|
||||||
this.fileName = fileName;
|
|
||||||
this.tmpFileName = tmpFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileName() {
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileName(String fileName) {
|
|
||||||
this.fileName = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTmpFileName() {
|
|
||||||
return tmpFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTmpFileName(String tmpFileName) {
|
|
||||||
this.tmpFileName = tmpFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDeleted() {
|
|
||||||
return deleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeleted(boolean deleted) {
|
|
||||||
this.deleted = deleted;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package ru.ulstu.file.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import ru.ulstu.file.model.FileData;
|
|
||||||
|
|
||||||
public interface FileRepository extends JpaRepository<FileData, Integer> {
|
|
||||||
}
|
|
@ -1,122 +0,0 @@
|
|||||||
package ru.ulstu.file.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import ru.ulstu.file.model.FileData;
|
|
||||||
import ru.ulstu.file.model.FileDataDto;
|
|
||||||
import ru.ulstu.file.repository.FileRepository;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class FileService {
|
|
||||||
private final static int META_FILE_NAME_INDEX = 0;
|
|
||||||
private final static int META_FILE_SIZE_INDEX = 1;
|
|
||||||
|
|
||||||
private final String tmpDir;
|
|
||||||
private final FileRepository fileRepository;
|
|
||||||
|
|
||||||
public FileService(FileRepository fileRepository) {
|
|
||||||
tmpDir = System.getProperty("java.io.tmpdir");
|
|
||||||
this.fileRepository = fileRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
private FileData createFileFromTmp(String tmpFileName) throws IOException {
|
|
||||||
FileData fileData = new FileData();
|
|
||||||
fileData.setData(getTmpFile(tmpFileName));
|
|
||||||
fileData.setSize(getTmpFileSize(tmpFileName));
|
|
||||||
fileData.setCreateDate(new Date());
|
|
||||||
return fileRepository.save(fileData);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String uploadToTmpDir(MultipartFile multipartFile) throws IOException {
|
|
||||||
String tmpFileName = String.valueOf(System.currentTimeMillis()) + UUID.randomUUID();
|
|
||||||
Files.write(getTmpFilePath(tmpFileName), multipartFile.getBytes());
|
|
||||||
String meta = multipartFile.getOriginalFilename() + "\n" + multipartFile.getSize();
|
|
||||||
Files.write(getTmpFileMetaPath(tmpFileName), meta.getBytes(UTF_8));
|
|
||||||
return tmpFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String[] getMeta(String tmpFileName) throws IOException {
|
|
||||||
return new String(Files.readAllBytes(getTmpFileMetaPath(tmpFileName)), UTF_8)
|
|
||||||
.split("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
private long getTmpFileSize(String tmpFileName) throws IOException {
|
|
||||||
return Long.valueOf(getMeta(tmpFileName)[META_FILE_SIZE_INDEX]).longValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTmpFileName(String tmpFileName) throws IOException {
|
|
||||||
return getMeta(tmpFileName)[META_FILE_NAME_INDEX];
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getTmpFile(String tmpFileName) throws IOException {
|
|
||||||
return Files.readAllBytes(getTmpFilePath(tmpFileName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileData getFile(Integer fileId) {
|
|
||||||
return fileRepository.getOne(fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteTmpFile(String tmpFileName) throws IOException {
|
|
||||||
Files.delete(getTmpFilePath(tmpFileName));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Path getTmpFilePath(String tmpFileName) {
|
|
||||||
return Paths.get(tmpDir, tmpFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Path getTmpFileMetaPath(String tmpFileName) {
|
|
||||||
return Paths.get(getTmpFilePath(tmpFileName) + ".meta");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteFile(FileData fileData) {
|
|
||||||
fileRepository.delete(fileData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FileData> saveOrCreate(List<FileDataDto> fileDtos) throws IOException {
|
|
||||||
List<FileData> files = new ArrayList<>();
|
|
||||||
for (FileDataDto file : fileDtos) {
|
|
||||||
files.add(file.getId() != null ? update(file) : create(file));
|
|
||||||
}
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
private FileData update(FileDataDto fileDataDto) {
|
|
||||||
return fileRepository.findById(fileDataDto.getId())
|
|
||||||
.orElseThrow(() -> new RuntimeException("File not found by id"));
|
|
||||||
//return fileRepository.save(copyFromDto(file, fileDataDto));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
private FileData create(FileDataDto fileDataDto) throws IOException {
|
|
||||||
FileData newFile = createFileFromTmp(fileDataDto.getTmpFileName());
|
|
||||||
copyFromDto(newFile, fileDataDto);
|
|
||||||
return fileRepository.save(newFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
private FileData copyFromDto(FileData fileData, FileDataDto fileDataDto) {
|
|
||||||
fileData.setName(fileDataDto.getName());
|
|
||||||
return fileData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void delete(Integer fileId) {
|
|
||||||
fileRepository.deleteById(fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileDataDto createFromMultipartFile(MultipartFile multipartFile) throws IOException {
|
|
||||||
return new FileDataDto(multipartFile.getOriginalFilename(), uploadToTmpDir(multipartFile));
|
|
||||||
}
|
|
||||||
}
|
|
80
src/main/java/ru/ulstu/files/FileSystemStorageService.java
Normal file
80
src/main/java/ru/ulstu/files/FileSystemStorageService.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package ru.ulstu.files;
|
||||||
|
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.core.io.UrlResource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.FileSystemUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FileSystemStorageService implements StorageService {
|
||||||
|
public static final String UPLOAD_DIR = "upload";
|
||||||
|
|
||||||
|
private final Path rootLocation = Paths.get(UPLOAD_DIR);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void store(MultipartFile file) {
|
||||||
|
try {
|
||||||
|
if (file.isEmpty()) {
|
||||||
|
throw new StorageException("Failed to store empty file " + file.getOriginalFilename());
|
||||||
|
}
|
||||||
|
Files.copy(file.getInputStream(), this.rootLocation.resolve(file.getOriginalFilename()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new StorageException("Failed to store file " + file.getOriginalFilename(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<Path> loadAll() {
|
||||||
|
try {
|
||||||
|
return Files.walk(this.rootLocation, 1)
|
||||||
|
.filter(path -> !path.equals(this.rootLocation))
|
||||||
|
.map(path -> this.rootLocation.relativize(path));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new StorageException("Failed to read stored files", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path load(String filename) {
|
||||||
|
return rootLocation.resolve(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Resource loadAsResource(String filename) {
|
||||||
|
try {
|
||||||
|
Path file = load(filename);
|
||||||
|
Resource resource = new UrlResource(file.toUri());
|
||||||
|
if (resource.exists() || resource.isReadable()) {
|
||||||
|
return resource;
|
||||||
|
} else {
|
||||||
|
throw new StorageFileNotFoundException("Could not read file: " + filename);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
throw new StorageFileNotFoundException("Could not read file: " + filename, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll() {
|
||||||
|
FileSystemUtils.deleteRecursively(rootLocation.toFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
try {
|
||||||
|
Files.createDirectory(rootLocation);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new StorageException("Could not initialize storage", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
src/main/java/ru/ulstu/files/FileUtil.java
Normal file
29
src/main/java/ru/ulstu/files/FileUtil.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package ru.ulstu.files;
|
||||||
|
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
|
||||||
|
public class FileUtil {
|
||||||
|
|
||||||
|
public static void saveFile(String uploadDir, String fileName,
|
||||||
|
MultipartFile multipartFile) throws IOException {
|
||||||
|
Path uploadPath = Paths.get(uploadDir);
|
||||||
|
|
||||||
|
if (!Files.exists(uploadPath)) {
|
||||||
|
Files.createDirectories(uploadPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
try (InputStream inputStream = multipartFile.getInputStream()) {
|
||||||
|
Path filePath = uploadPath.resolve(fileName);
|
||||||
|
Files.copy(inputStream, filePath, StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new IOException("Could not save image file: " + fileName, ioe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
src/main/java/ru/ulstu/files/FilesController.java
Normal file
28
src/main/java/ru/ulstu/files/FilesController.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package ru.ulstu.files;
|
||||||
|
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class FilesController {
|
||||||
|
private final StorageService storageService;
|
||||||
|
|
||||||
|
public FilesController(StorageService storageService) {
|
||||||
|
this.storageService = storageService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/files/{filename:.+}")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<Resource> serveFile(@PathVariable String filename) {
|
||||||
|
Resource file = storageService.loadAsResource((filename == null || filename.equals("null") || filename.isEmpty())
|
||||||
|
? "logo.png"
|
||||||
|
: filename);
|
||||||
|
return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
|
||||||
|
"filename=\"" + file.getFilename() + "\"").body(file);
|
||||||
|
}
|
||||||
|
}
|
12
src/main/java/ru/ulstu/files/StorageException.java
Normal file
12
src/main/java/ru/ulstu/files/StorageException.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package ru.ulstu.files;
|
||||||
|
|
||||||
|
public class StorageException extends RuntimeException {
|
||||||
|
|
||||||
|
public StorageException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StorageException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package ru.ulstu.files;
|
||||||
|
|
||||||
|
public class StorageFileNotFoundException extends StorageException {
|
||||||
|
|
||||||
|
public StorageFileNotFoundException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StorageFileNotFoundException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
23
src/main/java/ru/ulstu/files/StorageService.java
Normal file
23
src/main/java/ru/ulstu/files/StorageService.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package ru.ulstu.files;
|
||||||
|
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public interface StorageService {
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
void store(MultipartFile file);
|
||||||
|
|
||||||
|
Stream<Path> loadAll();
|
||||||
|
|
||||||
|
Path load(String filename);
|
||||||
|
|
||||||
|
Resource loadAsResource(String filename);
|
||||||
|
|
||||||
|
void deleteAll();
|
||||||
|
|
||||||
|
}
|
@ -1,18 +0,0 @@
|
|||||||
package ru.ulstu.indicator.model;
|
|
||||||
|
|
||||||
public enum Course {
|
|
||||||
FIRST("первый"),
|
|
||||||
SECOND("второй"),
|
|
||||||
THIRD("третий"),
|
|
||||||
FOURTH("четвертый");
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
Course(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
package ru.ulstu.indicator.model;
|
|
||||||
|
|
||||||
import jakarta.persistence.CollectionTable;
|
|
||||||
import jakarta.persistence.ElementCollection;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.EnumType;
|
|
||||||
import jakarta.persistence.Enumerated;
|
|
||||||
import jakarta.persistence.Lob;
|
|
||||||
import jakarta.validation.constraints.Max;
|
|
||||||
import jakarta.validation.constraints.Min;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import ru.ulstu.model.BaseEntity;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Indicator extends BaseEntity {
|
|
||||||
|
|
||||||
@NotBlank
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Min(0)
|
|
||||||
@Max(30)
|
|
||||||
private int max;
|
|
||||||
|
|
||||||
@NotBlank
|
|
||||||
@Lob
|
|
||||||
private String proofDocuments;
|
|
||||||
|
|
||||||
@ElementCollection(targetClass = Course.class)
|
|
||||||
@CollectionTable
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private List<Course> courses = new ArrayList<>();
|
|
||||||
|
|
||||||
public Indicator() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMax() {
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMax(int max) {
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProofDocuments() {
|
|
||||||
return proofDocuments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProofDocuments(String proofDocuments) {
|
|
||||||
this.proofDocuments = proofDocuments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Course> getCourses() {
|
|
||||||
return courses;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourses(List<Course> courses) {
|
|
||||||
this.courses = courses;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package ru.ulstu.indicator.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
import ru.ulstu.indicator.model.Course;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface IndicatorRepository extends JpaRepository<Indicator, Integer> {
|
|
||||||
Indicator findByName(String name);
|
|
||||||
|
|
||||||
@Query("select i from Indicator i WHERE :course member of i.courses")
|
|
||||||
List<Indicator> findAllByCourse(@Param("course") Course course);
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package ru.ulstu.indicator.service;
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.admin.model.IndicatorForm;
|
|
||||||
import ru.ulstu.indicator.model.Course;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.indicator.repository.IndicatorRepository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class IndicatorService {
|
|
||||||
private final IndicatorRepository indicatorRepository;
|
|
||||||
|
|
||||||
public IndicatorService(IndicatorRepository indicatorRepository) {
|
|
||||||
this.indicatorRepository = indicatorRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Indicator> getIndicatorList() {
|
|
||||||
return indicatorRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save(Indicator indicator) {
|
|
||||||
indicatorRepository.save(indicator);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Indicator findByName(String name) {
|
|
||||||
return indicatorRepository.findByName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Indicator getIndicatorById(Integer id) {
|
|
||||||
return indicatorRepository.findById(id).orElseThrow(() -> new RuntimeException("Indicator not found"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteIndicator(IndicatorForm indicatorForm) {
|
|
||||||
indicatorRepository.deleteById(indicatorForm.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Indicator> getIndicatorsByCourse(Course course) {
|
|
||||||
return indicatorRepository.findAllByCourse(course);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Page<Indicator> getIndicatorsByCourse(Pageable pageable) {
|
|
||||||
return indicatorRepository.findAll(pageable);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package ru.ulstu.manager.model;
|
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import ru.ulstu.admin.model.ManagerForm;
|
|
||||||
import ru.ulstu.model.BaseEntity;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Manager extends BaseEntity {
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public Manager() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Manager(ManagerForm managerForm) {
|
|
||||||
this.name = managerForm.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package ru.ulstu.manager.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import ru.ulstu.manager.model.Manager;
|
|
||||||
|
|
||||||
public interface ManagerRepository extends JpaRepository<Manager, Integer> {
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package ru.ulstu.manager.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.admin.model.ManagerForm;
|
|
||||||
import ru.ulstu.manager.model.Manager;
|
|
||||||
import ru.ulstu.manager.repository.ManagerRepository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ManagerService {
|
|
||||||
private final ManagerRepository managerRepository;
|
|
||||||
|
|
||||||
public ManagerService(ManagerRepository managerRepository) {
|
|
||||||
this.managerRepository = managerRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Manager> getManagers() {
|
|
||||||
return managerRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Manager getManagerById(Integer id) {
|
|
||||||
return managerRepository.findById(id).orElseThrow(() -> new RuntimeException("Manager not found by id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save(Manager manager) {
|
|
||||||
managerRepository.save(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteManager(ManagerForm managerForm) {
|
|
||||||
managerRepository.deleteById(managerForm.getId());
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,7 +9,7 @@ import jakarta.persistence.Transient;
|
|||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import ru.ulstu.model.BaseEntity;
|
import ru.ulstu.model.BaseEntity;
|
||||||
import ru.ulstu.news.model.News;
|
import ru.ulstu.news.News;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.news.model.News;
|
import ru.ulstu.news.News;
|
||||||
import ru.ulstu.news.service.NewsService;
|
import ru.ulstu.news.NewsService;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MeetingService {
|
public class MeetingService {
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
package ru.ulstu.model;
|
|
||||||
|
|
||||||
public enum ErrorConstants {
|
|
||||||
UNKNOWN(0, "Unknown error"),
|
|
||||||
ID_IS_NULL(1, "Id of entity has null value"),
|
|
||||||
VALIDATION_ERROR(2, "Validation error"),
|
|
||||||
USER_ID_EXISTS(100, "New user can't have id"),
|
|
||||||
USER_ACTIVATION_ERROR(101, "Invalid activation key"),
|
|
||||||
USER_EMAIL_EXISTS(102, "Пользователь с таким почтовым ящиком уже существует"),
|
|
||||||
USER_LOGIN_EXISTS(103, "Пользователь с таким логином уже существует"),
|
|
||||||
USER_PASSWORDS_NOT_VALID_OR_NOT_MATCH(104, "Пароли введены неверно"),
|
|
||||||
USER_NOT_FOUND(105, "Аккаунт не найден"),
|
|
||||||
USER_NOT_ACTIVATED(106, "User is not activated"),
|
|
||||||
USER_RESET_ERROR(107, "Некорректный ключ подтверждения"),
|
|
||||||
USER_UNDEAD_ERROR(108, "Can't edit/delete that user"),
|
|
||||||
FILE_UPLOAD_ERROR(110, "File upload error"),
|
|
||||||
USER_SENDING_MAIL_EXCEPTION(111, "Во время отправки приглашения пользователю произошла ошибка");
|
|
||||||
|
|
||||||
private final int code;
|
|
||||||
private final String message;
|
|
||||||
|
|
||||||
ErrorConstants(int code, String message) {
|
|
||||||
this.code = code;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format("%d: %s", code, message);
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,5 @@ package ru.ulstu.model;
|
|||||||
|
|
||||||
public class UserRoleConstants {
|
public class UserRoleConstants {
|
||||||
public static final String ADMIN = "ROLE_ADMIN";
|
public static final String ADMIN = "ROLE_ADMIN";
|
||||||
public static final String ASPIRANT = "ROLE_ASPIRANT";
|
public static final String USER = "ROLE_USER";
|
||||||
public static final String MANAGER = "ROLE_MANAGER";
|
|
||||||
public static final String HEAD = "ROLE_HEAD";
|
|
||||||
}
|
}
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
package ru.ulstu.model.response;
|
|
||||||
|
|
||||||
class ControllerResponse<D, E> {
|
|
||||||
private final D data;
|
|
||||||
private final ControllerResponseError<E> error;
|
|
||||||
|
|
||||||
ControllerResponse(D data) {
|
|
||||||
this.data = data;
|
|
||||||
this.error = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ControllerResponse(ControllerResponseError<E> error) {
|
|
||||||
this.data = null;
|
|
||||||
this.error = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
public D getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ControllerResponseError<E> getError() {
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package ru.ulstu.model.response;
|
|
||||||
|
|
||||||
|
|
||||||
import ru.ulstu.model.ErrorConstants;
|
|
||||||
|
|
||||||
class ControllerResponseError<D> {
|
|
||||||
private final ErrorConstants description;
|
|
||||||
private final D data;
|
|
||||||
|
|
||||||
ControllerResponseError(ErrorConstants description, D data) {
|
|
||||||
this.description = description;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return description.getCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return description.getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public D getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package ru.ulstu.model.response;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class PageableItems<T> {
|
|
||||||
private final long count;
|
|
||||||
private final Collection<T> items;
|
|
||||||
|
|
||||||
public PageableItems(long count, Collection<T> items) {
|
|
||||||
this.count = count;
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCount() {
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<T> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package ru.ulstu.model.response;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import ru.ulstu.model.ErrorConstants;
|
|
||||||
|
|
||||||
public class Response<D> extends ResponseEntity<Object> {
|
|
||||||
|
|
||||||
public Response(D data) {
|
|
||||||
super(new ControllerResponse<D, Void>(data), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Response(ErrorConstants error) {
|
|
||||||
super(new ControllerResponse<Void, Void>(new ControllerResponseError<>(error, null)), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package ru.ulstu.model.response;
|
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import ru.ulstu.model.ErrorConstants;
|
|
||||||
|
|
||||||
|
|
||||||
public class ResponseExtended<E> extends ResponseEntity<Object> {
|
|
||||||
|
|
||||||
public ResponseExtended(ErrorConstants error, E errorData) {
|
|
||||||
super(new ControllerResponse<Void, E>(new ControllerResponseError<E>(error, errorData)), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package ru.ulstu.news.model;
|
package ru.ulstu.news;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Lob;
|
import jakarta.persistence.Lob;
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ru.ulstu.news.controller;
|
package ru.ulstu.news;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@ -20,8 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import ru.ulstu.model.OffsetablePageRequest;
|
import ru.ulstu.model.OffsetablePageRequest;
|
||||||
import ru.ulstu.model.UserRoleConstants;
|
import ru.ulstu.model.UserRoleConstants;
|
||||||
import ru.ulstu.news.model.News;
|
|
||||||
import ru.ulstu.news.service.NewsService;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
@ -1,9 +1,8 @@
|
|||||||
package ru.ulstu.news.repository;
|
package ru.ulstu.news;
|
||||||
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import ru.ulstu.news.model.News;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package ru.ulstu.news.service;
|
package ru.ulstu.news;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@ -6,8 +6,6 @@ import org.springframework.data.domain.Page;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.meeting.Meeting;
|
import ru.ulstu.meeting.Meeting;
|
||||||
import ru.ulstu.news.model.News;
|
|
||||||
import ru.ulstu.news.repository.NewsRepository;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,85 +0,0 @@
|
|||||||
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.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import ru.ulstu.aspirant.service.AspirantService;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.indicator.service.IndicatorService;
|
|
||||||
import ru.ulstu.report.model.ReportListForm;
|
|
||||||
import ru.ulstu.report.model.ReportPeriod;
|
|
||||||
import ru.ulstu.report.model.dto.ReportDto;
|
|
||||||
import ru.ulstu.report.service.ReportPeriodService;
|
|
||||||
import ru.ulstu.report.service.ReportService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("report")
|
|
||||||
public class ReportController {
|
|
||||||
private final IndicatorService indicatorService;
|
|
||||||
private final AspirantService aspirantService;
|
|
||||||
private final ReportService reportService;
|
|
||||||
private final ReportPeriodService reportPeriodService;
|
|
||||||
|
|
||||||
public ReportController(IndicatorService indicatorService,
|
|
||||||
AspirantService aspirantService,
|
|
||||||
ReportService reportService,
|
|
||||||
ReportPeriodService reportPeriodService) {
|
|
||||||
this.indicatorService = indicatorService;
|
|
||||||
this.aspirantService = aspirantService;
|
|
||||||
this.reportService = reportService;
|
|
||||||
this.reportPeriodService = reportPeriodService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("reportList")
|
|
||||||
public String getReportPeriods(Model model) {
|
|
||||||
List<ReportPeriod> periods = reportPeriodService.getReportPeriods();
|
|
||||||
model.addAttribute("reportPeriods", periods);
|
|
||||||
model.addAttribute("reportListForm", new ReportListForm(periods.isEmpty() ? null : periods.getFirst()));
|
|
||||||
model.addAttribute("reports", reportService.getReports(periods.isEmpty() ? null : periods.getFirst()));
|
|
||||||
model.addAttribute("canCreate", !periods.isEmpty() && reportService.canCreateReport(periods.getFirst()));
|
|
||||||
return "report/reportList";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("reportList")
|
|
||||||
public String getReportPeriods(ReportListForm reportListForm, Model model) {
|
|
||||||
model.addAttribute("reportListForm", reportListForm);
|
|
||||||
model.addAttribute("reports", reportService.getReports(reportListForm.getReportPeriod()));
|
|
||||||
List<ReportPeriod> periods = reportPeriodService.getReportPeriods();
|
|
||||||
model.addAttribute("reportPeriods", periods);
|
|
||||||
model.addAttribute("canCreate", !periods.isEmpty() && reportService.canCreateReport(reportListForm.getReportPeriod()));
|
|
||||||
return "report/reportList";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("new-report/{reportPeriodId}")
|
|
||||||
public String createReport(@PathVariable("reportPeriodId") Integer reportPeriodId,
|
|
||||||
Model model) {
|
|
||||||
List<Indicator> indicators = aspirantService.getCurrentAspirantIndicators();
|
|
||||||
model.addAttribute("report", new ReportDto(reportPeriodId, indicators));
|
|
||||||
return "report/editReport";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("edit-report/{reportId}")
|
|
||||||
public String editReportWithoutReportPeriod(@PathVariable("reportId") Integer reportId, Model model) {
|
|
||||||
List<Indicator> indicators = reportService.getIndicators(reportId);
|
|
||||||
model.addAttribute("report", new ReportDto(reportService.getReportById(reportId), indicators));
|
|
||||||
return "report/editReport";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "save-report", params = "save")
|
|
||||||
public String saveReport(@ModelAttribute("report") ReportDto reportDto, Model model) {
|
|
||||||
reportService.saveReport(reportDto);
|
|
||||||
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,47 +0,0 @@
|
|||||||
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.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import ru.ulstu.report.model.ReportPeriod;
|
|
||||||
import ru.ulstu.report.service.ReportPeriodService;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("admin")
|
|
||||||
public class ReportPeriodController {
|
|
||||||
private final ReportPeriodService reportPeriodService;
|
|
||||||
|
|
||||||
public ReportPeriodController(ReportPeriodService reportPeriodService) {
|
|
||||||
this.reportPeriodService = reportPeriodService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("reportPeriodList")
|
|
||||||
public String getReportPeriods(Model model) {
|
|
||||||
model.addAttribute("reportPeriods", reportPeriodService.getReportPeriods());
|
|
||||||
return "admin/reportPeriodList";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("editReportPeriod/{reportPeriodId}")
|
|
||||||
public String getReportPeriods(@PathVariable(value = "reportPeriodId") Integer reportPeriodId, Model model) {
|
|
||||||
model.addAttribute("reportPeriod",
|
|
||||||
reportPeriodId == 0
|
|
||||||
? new ReportPeriod()
|
|
||||||
: reportPeriodService.getById(reportPeriodId));
|
|
||||||
return "admin/editReportPeriod";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "saveReportPeriod", params = "save")
|
|
||||||
public String saveReportPeriods(ReportPeriod reportPeriod) {
|
|
||||||
reportPeriodService.save(reportPeriod);
|
|
||||||
return "redirect:/admin/reportPeriodList";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "saveReportPeriod", params = "delete")
|
|
||||||
public String delete(ReportPeriod reportPeriod) {
|
|
||||||
reportPeriodService.delete(reportPeriod);
|
|
||||||
return "redirect:/admin/reportPeriodList";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package ru.ulstu.report.controller;
|
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
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.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import ru.ulstu.report.model.dto.ReportValueDto;
|
|
||||||
import ru.ulstu.report.service.ReportValueService;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("report-value")
|
|
||||||
public class ReportValueController {
|
|
||||||
private final ReportValueService reportValueService;
|
|
||||||
|
|
||||||
public ReportValueController(ReportValueService reportValueService) {
|
|
||||||
this.reportValueService = reportValueService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("edit-report-value/{reportId}/{indicatorId}")
|
|
||||||
public String getReportValue(@PathVariable("reportId") Integer reportId,
|
|
||||||
@PathVariable("indicatorId") Integer indicatorId,
|
|
||||||
Model model) {
|
|
||||||
model.addAttribute("reportValue", reportValueService.getByIndicatorId(reportId, indicatorId));
|
|
||||||
model.addAttribute("canEdit", reportValueService.canEdit(reportId));
|
|
||||||
model.addAttribute("status", reportValueService.getStatus(reportId));
|
|
||||||
return "report/editReportValue";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("save-report-value")
|
|
||||||
public String saveReportValue(@Valid ReportValueDto reportValueDto, Model model) throws IOException {
|
|
||||||
reportValueService.saveReportValue(reportValueDto);
|
|
||||||
return "redirect:/report/edit-report/" + reportValueDto.getReportId();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package ru.ulstu.report.model;
|
|
||||||
|
|
||||||
import jakarta.persistence.CascadeType;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.EnumType;
|
|
||||||
import jakarta.persistence.Enumerated;
|
|
||||||
import jakarta.persistence.FetchType;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import jakarta.persistence.OneToMany;
|
|
||||||
import jakarta.persistence.Temporal;
|
|
||||||
import jakarta.persistence.TemporalType;
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
import ru.ulstu.model.BaseEntity;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Report extends BaseEntity {
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
|
||||||
private Date createDate = new Date();
|
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
|
||||||
private List<ReportValue> values = new ArrayList<>();
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private ReportPeriod reportPeriod;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private Aspirant aspirant;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private ReportStatus status = ReportStatus.NEW;
|
|
||||||
|
|
||||||
public Report() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Report(Integer id) {
|
|
||||||
setId(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReportValue> getValues() {
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValues(List<ReportValue> values) {
|
|
||||||
this.values = values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateDate(Date createDate) {
|
|
||||||
this.createDate = createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportPeriod getReportPeriod() {
|
|
||||||
return reportPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReportPeriod(ReportPeriod reportPeriod) {
|
|
||||||
this.reportPeriod = reportPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Aspirant getAspirant() {
|
|
||||||
return aspirant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAspirant(Aspirant aspirant) {
|
|
||||||
this.aspirant = aspirant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportStatus getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(ReportStatus status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package ru.ulstu.report.model;
|
|
||||||
|
|
||||||
public class ReportListForm {
|
|
||||||
private ReportPeriod reportPeriod;
|
|
||||||
|
|
||||||
public ReportListForm() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportListForm(ReportPeriod reportPeriod) {
|
|
||||||
this.reportPeriod = reportPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportPeriod getReportPeriod() {
|
|
||||||
return reportPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReportPeriod(ReportPeriod reportPeriod) {
|
|
||||||
this.reportPeriod = reportPeriod;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package ru.ulstu.report.model;
|
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.Temporal;
|
|
||||||
import jakarta.persistence.TemporalType;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import ru.ulstu.model.BaseEntity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class ReportPeriod extends BaseEntity {
|
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private Date startDate = new Date();
|
|
||||||
|
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private Date endDate = new Date();
|
|
||||||
|
|
||||||
public Date getStartDate() {
|
|
||||||
return startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStartDate(Date startDate) {
|
|
||||||
this.startDate = startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getEndDate() {
|
|
||||||
return endDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEndDate(Date endDate) {
|
|
||||||
this.endDate = endDate;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package ru.ulstu.report.model;
|
|
||||||
|
|
||||||
public enum ReportStatus {
|
|
||||||
NEW("новый"),
|
|
||||||
REVIEW("проверка руководителем"),
|
|
||||||
CHECKING("проверка в отделе аспирантуры"),
|
|
||||||
APPROVED("подтвержден");
|
|
||||||
|
|
||||||
private final String title;
|
|
||||||
|
|
||||||
ReportStatus(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
package ru.ulstu.report.model;
|
|
||||||
|
|
||||||
import jakarta.persistence.CascadeType;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.FetchType;
|
|
||||||
import jakarta.persistence.JoinColumn;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import jakarta.persistence.OneToMany;
|
|
||||||
import org.hibernate.annotations.Fetch;
|
|
||||||
import org.hibernate.annotations.FetchMode;
|
|
||||||
import ru.ulstu.file.model.FileData;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.model.BaseEntity;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class ReportValue extends BaseEntity {
|
|
||||||
@ManyToOne
|
|
||||||
private Indicator indicator;
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
|
||||||
@JoinColumn(name = "report_value_id")
|
|
||||||
@Fetch(FetchMode.SUBSELECT)
|
|
||||||
private List<FileData> files = new ArrayList<>();
|
|
||||||
private int indicatorValue;
|
|
||||||
private String comment;
|
|
||||||
|
|
||||||
public Indicator getIndicator() {
|
|
||||||
return indicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndicator(Indicator indicator) {
|
|
||||||
this.indicator = indicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIndicatorValue() {
|
|
||||||
return indicatorValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndicatorValue(int indicatorValue) {
|
|
||||||
this.indicatorValue = indicatorValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FileData> getFiles() {
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFiles(List<FileData> files) {
|
|
||||||
this.files = files;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
package ru.ulstu.report.model.dto;
|
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.report.model.Report;
|
|
||||||
import ru.ulstu.report.model.ReportStatus;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ReportDto {
|
|
||||||
private Integer id;
|
|
||||||
private Integer reportPeriodId;
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
|
||||||
private Date createDate = new Date();
|
|
||||||
private List<ReportValueDto> reportValues = new ArrayList<>();
|
|
||||||
private ReportStatus status;
|
|
||||||
|
|
||||||
public ReportDto() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportDto(Integer reportPeriodId, List<Indicator> indicators) {
|
|
||||||
this.reportPeriodId = reportPeriodId;
|
|
||||||
this.reportValues = indicators.stream().map(ReportValueDto::new).toList();
|
|
||||||
this.status = ReportStatus.NEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportDto(Report report, List<Indicator> indicators) {
|
|
||||||
this.id = report.getId();
|
|
||||||
this.reportPeriodId = report.getReportPeriod().getId();
|
|
||||||
this.createDate = report.getCreateDate();
|
|
||||||
this.reportValues = indicators.stream().map(ReportValueDto::new).toList();
|
|
||||||
this.status = report.getStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReportValueDto> getReportValues() {
|
|
||||||
return reportValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReportValues(List<ReportValueDto> reportValues) {
|
|
||||||
this.reportValues = reportValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getReportPeriodId() {
|
|
||||||
return reportPeriodId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReportPeriodId(Integer reportPeriodId) {
|
|
||||||
this.reportPeriodId = reportPeriodId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateDate(Date createDate) {
|
|
||||||
this.createDate = createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportStatus getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(ReportStatus status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
package ru.ulstu.report.model.dto;
|
|
||||||
|
|
||||||
import ru.ulstu.file.model.FileDataDto;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.report.model.ReportValue;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class ReportValueDto {
|
|
||||||
private Integer id = 0;
|
|
||||||
private Integer reportId;
|
|
||||||
private Indicator indicator;
|
|
||||||
private int indicatorValue;
|
|
||||||
private List<FileDataDto> files = new ArrayList<>();
|
|
||||||
private String comment;
|
|
||||||
|
|
||||||
public ReportValueDto() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportValueDto(Integer reportId, Indicator indicator) {
|
|
||||||
this.reportId = reportId;
|
|
||||||
this.indicator = indicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportValueDto(Indicator indicator) {
|
|
||||||
this.indicator = indicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportValueDto(ReportValue reportValue, Integer reportId) {
|
|
||||||
this.id = reportValue.getId();
|
|
||||||
this.reportId = reportId;
|
|
||||||
this.indicator = reportValue.getIndicator();
|
|
||||||
this.files = reportValue.getFiles().stream().map(FileDataDto::new).collect(Collectors.toList());
|
|
||||||
this.indicatorValue = reportValue.getIndicatorValue();
|
|
||||||
this.comment = reportValue.getComment();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Indicator getIndicator() {
|
|
||||||
return indicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndicator(Indicator indicator) {
|
|
||||||
this.indicator = indicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIndicatorValue() {
|
|
||||||
return indicatorValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndicatorValue(int indicatorValue) {
|
|
||||||
this.indicatorValue = indicatorValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FileDataDto> getFiles() {
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFiles(List<FileDataDto> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package ru.ulstu.report.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import ru.ulstu.report.model.ReportPeriod;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ReportPeriodRepository extends JpaRepository<ReportPeriod, Integer> {
|
|
||||||
List<ReportPeriod> findAllByOrderByStartDateDesc();
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package ru.ulstu.report.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.report.model.Report;
|
|
||||||
import ru.ulstu.report.model.ReportPeriod;
|
|
||||||
import ru.ulstu.statistic.model.RatingItem;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ReportRepository extends JpaRepository<Report, Integer> {
|
|
||||||
|
|
||||||
List<Report> findAllByReportPeriod(ReportPeriod reportPeriod);
|
|
||||||
|
|
||||||
Report findByReportPeriodAndAspirant(ReportPeriod reportPeriod, Aspirant aspirant);
|
|
||||||
|
|
||||||
@Query("SELECT new ru.ulstu.statistic.model.RatingItem(r.aspirant, (SELECT cast(sum(rv.indicatorValue) AS Integer) FROM ReportValue rv WHERE rv MEMBER OF r.values)) FROM Report r JOIN r.reportPeriod rp WHERE rp.id = :reportPeriodId")
|
|
||||||
List<RatingItem> getRating(@Param("reportPeriodId") Integer reportPeriodId);
|
|
||||||
|
|
||||||
@Query("SELECT DISTINCT v.indicator FROM Report r JOIN r.values v WHERE r.id = :reportId")
|
|
||||||
List<Indicator> getIndicatorsById(@Param("reportId") Integer reportId);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package ru.ulstu.report.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
import ru.ulstu.report.model.ReportValue;
|
|
||||||
|
|
||||||
public interface ReportValueRepository extends JpaRepository<ReportValue, Integer> {
|
|
||||||
@Query("SELECT rv FROM Report r JOIN r.values rv WHERE r.id = :reportId AND rv.indicator.id = :indicatorId")
|
|
||||||
ReportValue findByReportIdAndIndicatorId(@Param("reportId") Integer reportId, @Param("indicatorId") Integer indicatorId);
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package ru.ulstu.report.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.report.model.ReportPeriod;
|
|
||||||
import ru.ulstu.report.repository.ReportPeriodRepository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ReportPeriodService {
|
|
||||||
private final ReportPeriodRepository reportPeriodRepository;
|
|
||||||
|
|
||||||
public ReportPeriodService(ReportPeriodRepository reportPeriodRepository) {
|
|
||||||
this.reportPeriodRepository = reportPeriodRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReportPeriod> getReportPeriods() {
|
|
||||||
return reportPeriodRepository.findAllByOrderByStartDateDesc();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportPeriod save(ReportPeriod reportPeriod) {
|
|
||||||
ReportPeriod dbReportPeriod;
|
|
||||||
if (reportPeriod.getId() != null) {
|
|
||||||
dbReportPeriod = getById(reportPeriod.getId());
|
|
||||||
dbReportPeriod.setStartDate(reportPeriod.getStartDate());
|
|
||||||
dbReportPeriod.setEndDate(reportPeriod.getEndDate());
|
|
||||||
} else {
|
|
||||||
dbReportPeriod = reportPeriod;
|
|
||||||
}
|
|
||||||
return reportPeriodRepository.save(dbReportPeriod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete(ReportPeriod reportPeriod) {
|
|
||||||
reportPeriodRepository.deleteById(reportPeriod.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportPeriod getById(Integer reportPeriodId) {
|
|
||||||
return reportPeriodRepository
|
|
||||||
.findById(reportPeriodId)
|
|
||||||
.orElseThrow(() -> new RuntimeException("Report period not found by id"));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package ru.ulstu.report.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
import ru.ulstu.aspirant.service.AspirantService;
|
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
|
||||||
import ru.ulstu.report.model.Report;
|
|
||||||
import ru.ulstu.report.model.ReportPeriod;
|
|
||||||
import ru.ulstu.report.model.ReportValue;
|
|
||||||
import ru.ulstu.report.model.dto.ReportDto;
|
|
||||||
import ru.ulstu.report.repository.ReportRepository;
|
|
||||||
import ru.ulstu.user.UserService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ReportService {
|
|
||||||
private final ReportRepository reportRepository;
|
|
||||||
private final UserService userService;
|
|
||||||
private final AspirantService aspirantService;
|
|
||||||
private final ReportPeriodService reportPeriodService;
|
|
||||||
|
|
||||||
public ReportService(ReportRepository reportRepository,
|
|
||||||
UserService userService,
|
|
||||||
AspirantService aspirantService, ReportPeriodService reportPeriodService) {
|
|
||||||
this.reportRepository = reportRepository;
|
|
||||||
this.userService = userService;
|
|
||||||
this.aspirantService = aspirantService;
|
|
||||||
this.reportPeriodService = reportPeriodService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Report> getReports(ReportPeriod reportPeriod) {
|
|
||||||
return reportRepository.findAllByReportPeriod(reportPeriod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canCreateReport(ReportPeriod reportPeriod) {
|
|
||||||
Aspirant currentAspirant = aspirantService.getAspirantByUser(userService.getCurrentUser());
|
|
||||||
return currentAspirant != null && reportRepository.findByReportPeriodAndAspirant(reportPeriod, currentAspirant) == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Report saveReport(ReportDto reportDto) {
|
|
||||||
Report report;
|
|
||||||
if (reportDto.getId() == null || reportDto.getId() == 0) {
|
|
||||||
report = new Report();
|
|
||||||
report.setValues(aspirantService.getCurrentAspirantIndicators().stream().map(i -> {
|
|
||||||
ReportValue rv = new ReportValue();
|
|
||||||
rv.setIndicator(i);
|
|
||||||
return rv;
|
|
||||||
}).toList());
|
|
||||||
} else {
|
|
||||||
report = getReportById(reportDto.getId());
|
|
||||||
}
|
|
||||||
if (reportDto.getReportPeriodId() != null) {
|
|
||||||
report.setReportPeriod(reportPeriodService.getById(reportDto.getReportPeriodId()));
|
|
||||||
}
|
|
||||||
report.setAspirant(aspirantService.getAspirantByUser(userService.getCurrentUser()));
|
|
||||||
report.setCreateDate(reportDto.getCreateDate());
|
|
||||||
report.setStatus(reportDto.getStatus());
|
|
||||||
return reportRepository.save(report);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Report getReportById(Integer reportId) {
|
|
||||||
return reportRepository
|
|
||||||
.findById(reportId)
|
|
||||||
.orElseThrow(() -> new RuntimeException("Report not found by id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteReport(Integer id) {
|
|
||||||
reportRepository.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addReportValue(Integer reportId, ReportValue reportValue) {
|
|
||||||
Report report = getReportById(reportId);
|
|
||||||
report.getValues().remove(reportValue);
|
|
||||||
report.getValues().add(reportValue);
|
|
||||||
reportRepository.save(report);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Indicator> getIndicators(Integer reportId) {
|
|
||||||
return reportRepository.getIndicatorsById(reportId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
package ru.ulstu.report.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.file.model.FileData;
|
|
||||||
import ru.ulstu.file.service.FileService;
|
|
||||||
import ru.ulstu.indicator.service.IndicatorService;
|
|
||||||
import ru.ulstu.report.model.ReportStatus;
|
|
||||||
import ru.ulstu.report.model.ReportValue;
|
|
||||||
import ru.ulstu.report.model.dto.ReportValueDto;
|
|
||||||
import ru.ulstu.report.repository.ReportValueRepository;
|
|
||||||
import ru.ulstu.user.UserService;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ReportValueService {
|
|
||||||
private final ReportValueRepository reportValueRepository;
|
|
||||||
private final IndicatorService indicatorService;
|
|
||||||
private final FileService fileService;
|
|
||||||
private final ReportService reportService;
|
|
||||||
private final UserService userService;
|
|
||||||
|
|
||||||
public ReportValueService(ReportValueRepository reportValueRepository,
|
|
||||||
IndicatorService indicatorService,
|
|
||||||
FileService fileService,
|
|
||||||
ReportService reportService, UserService userService) {
|
|
||||||
this.reportValueRepository = reportValueRepository;
|
|
||||||
this.indicatorService = indicatorService;
|
|
||||||
this.fileService = fileService;
|
|
||||||
this.reportService = reportService;
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportValue saveReportValue(ReportValueDto reportValueDto) throws IOException {
|
|
||||||
ReportValue reportValue;
|
|
||||||
if (reportValueDto.getId() == null || reportValueDto.getId() == 0) {
|
|
||||||
reportValue = new ReportValue();
|
|
||||||
} else {
|
|
||||||
reportValue = getReportValueById(reportValueDto.getId());
|
|
||||||
}
|
|
||||||
reportValue.setIndicatorValue(reportValueDto.getIndicatorValue());
|
|
||||||
reportValue.setIndicator(indicatorService.getIndicatorById(reportValueDto.getIndicator().getId()));
|
|
||||||
List<FileData> files = fileService.saveOrCreate(reportValueDto.getFiles().stream()
|
|
||||||
.filter(f -> !f.isDeleted())
|
|
||||||
.toList());
|
|
||||||
reportValue.getFiles().removeAll(files);
|
|
||||||
reportValue.setFiles(files);
|
|
||||||
reportValue.setComment(reportValueDto.getComment());
|
|
||||||
reportValue = reportValueRepository.save(reportValue);
|
|
||||||
reportService.addReportValue(reportValueDto.getReportId(), reportValue);
|
|
||||||
|
|
||||||
return reportValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportValue getReportValueById(Integer reportValueId) {
|
|
||||||
return reportValueRepository
|
|
||||||
.findById(reportValueId)
|
|
||||||
.orElseThrow(() -> new RuntimeException("Report value not found by id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteReportValue(Integer id) {
|
|
||||||
reportValueRepository.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportValueDto getByIndicatorId(Integer reportId, Integer indicatorId) {
|
|
||||||
ReportValue reportValue = reportValueRepository.findByReportIdAndIndicatorId(reportId, indicatorId);
|
|
||||||
if (reportValue == null) {
|
|
||||||
return new ReportValueDto(reportId, indicatorService.getIndicatorById(indicatorId));
|
|
||||||
}
|
|
||||||
return new ReportValueDto(reportValue, reportId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canEdit(Integer reportId) {
|
|
||||||
return reportService.getReportById(reportId).getAspirant().getUser().equals(userService.getCurrentUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReportStatus getStatus(Integer reportId) {
|
|
||||||
return reportService.getReportById(reportId).getStatus();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
package ru.ulstu.statistic.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.RequestMapping;
|
|
||||||
import ru.ulstu.report.service.ReportPeriodService;
|
|
||||||
import ru.ulstu.statistic.model.StatisticForm;
|
|
||||||
import ru.ulstu.statistic.service.StatisticService;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("statistic")
|
|
||||||
public class StatisticController {
|
|
||||||
private final ReportPeriodService reportPeriodService;
|
|
||||||
private final StatisticService statisticService;
|
|
||||||
|
|
||||||
public StatisticController(ReportPeriodService reportPeriodService,
|
|
||||||
StatisticService statisticService) {
|
|
||||||
this.reportPeriodService = reportPeriodService;
|
|
||||||
this.statisticService = statisticService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("statistic")
|
|
||||||
public String getStatistic(Model model) {
|
|
||||||
model.addAttribute("statisticForm", new StatisticForm());
|
|
||||||
model.addAttribute("reportPeriods", reportPeriodService.getReportPeriods());
|
|
||||||
return "statistic/statistic";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("statistic")
|
|
||||||
public String getStatistic(StatisticForm form, Model model) {
|
|
||||||
model.addAttribute("rating", statisticService.getRating(form.getReportPeriod().getId()));
|
|
||||||
model.addAttribute("statisticForm", form);
|
|
||||||
model.addAttribute("reportPeriods", reportPeriodService.getReportPeriods());
|
|
||||||
return "statistic/statistic";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package ru.ulstu.statistic.model;
|
|
||||||
|
|
||||||
import ru.ulstu.aspirant.model.Aspirant;
|
|
||||||
|
|
||||||
public class RatingItem {
|
|
||||||
private Aspirant aspirant;
|
|
||||||
private Integer score;
|
|
||||||
|
|
||||||
public RatingItem() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public RatingItem(Aspirant aspirant, Integer score) {
|
|
||||||
this.aspirant = aspirant;
|
|
||||||
this.score = score;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Aspirant getAspirant() {
|
|
||||||
return aspirant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAspirant(Aspirant aspirant) {
|
|
||||||
this.aspirant = aspirant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getScore() {
|
|
||||||
return score;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScore(Integer score) {
|
|
||||||
this.score = score;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package ru.ulstu.statistic.model;
|
|
||||||
|
|
||||||
import ru.ulstu.report.model.ReportPeriod;
|
|
||||||
|
|
||||||
public class StatisticForm {
|
|
||||||
private ReportPeriod reportPeriod;
|
|
||||||
|
|
||||||
public ReportPeriod getReportPeriod() {
|
|
||||||
return reportPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReportPeriod(ReportPeriod reportPeriod) {
|
|
||||||
this.reportPeriod = reportPeriod;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package ru.ulstu.statistic.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import ru.ulstu.report.repository.ReportRepository;
|
|
||||||
import ru.ulstu.statistic.model.RatingItem;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class StatisticService {
|
|
||||||
private final ReportRepository reportRepository;
|
|
||||||
|
|
||||||
public StatisticService(ReportRepository reportRepository) {
|
|
||||||
this.reportRepository = reportRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<RatingItem> getRating(Integer reportPeriodId) {
|
|
||||||
return reportRepository.getRating(reportPeriodId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -57,50 +57,18 @@ public class UserService implements UserDetailsService {
|
|||||||
if (getUserByLogin(user.getLogin()) != null) {
|
if (getUserByLogin(user.getLogin()) != null) {
|
||||||
throw new RuntimeException(user.getLogin());
|
throw new RuntimeException(user.getLogin());
|
||||||
}
|
}
|
||||||
User dbUser = (user.getId() == null)
|
|
||||||
? user
|
|
||||||
: getUserById(user.getId());
|
|
||||||
//user.setRoles(Collections.singleton(new UserRole(UserRoleConstants.USER)));
|
//user.setRoles(Collections.singleton(new UserRole(UserRoleConstants.USER)));
|
||||||
dbUser.setPassword(passwordEncoder.encode(user.getPassword()));
|
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||||
dbUser.setLogin(user.getLogin());
|
user = userRepository.save(user);
|
||||||
dbUser = userRepository.save(dbUser);
|
log.debug("Created Information for User: {}", user.getLogin());
|
||||||
log.debug("Created Information for User: {}", dbUser.getLogin());
|
return user;
|
||||||
return dbUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getUserById(Integer id) {
|
|
||||||
return userRepository.findById(id).orElseThrow(() -> new RuntimeException("User not found by id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private User createDefaultUser(String login, String userRole) {
|
|
||||||
if (getUserByLogin(login) == null) {
|
|
||||||
UserRole role = userRoleRepository.save(new UserRole(userRole.toString()));
|
|
||||||
return createUser(new User(login, login.equals("admin") ? adminPassword : login, Set.of(role)));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User createAspirant(String login) {
|
|
||||||
return createDefaultUser(login, UserRoleConstants.ASPIRANT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initDefaultAdmin() {
|
public void initDefaultAdmin() {
|
||||||
createDefaultUser("admin", UserRoleConstants.ADMIN);
|
String adminLogin = "admin";
|
||||||
|
if (getUserByLogin(adminLogin) == null) {
|
||||||
|
UserRole adminRole = userRoleRepository.save(new UserRole(UserRoleConstants.ADMIN));
|
||||||
|
createUser(new User(adminLogin, adminPassword, Set.of(adminRole)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initDefaultAspirant() {
|
|
||||||
createDefaultUser("aspirant", UserRoleConstants.ASPIRANT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initDefaultManager() {
|
|
||||||
createDefaultUser("manager", UserRoleConstants.MANAGER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initDefaultHead() {
|
|
||||||
createDefaultUser("head", UserRoleConstants.HEAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getCurrentUser() {
|
|
||||||
return getUserByLogin(UserUtils.getCurrentUserLogin());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
# You may use, distribute and modify this code, please write to: romanov73@gmail.com.
|
# You may use, distribute and modify this code, please write to: romanov73@gmail.com.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
messages.app-name=БРС аспиранта УлГТУ
|
messages.app-name=Cеминар «Анализ данных и процессов». УлГТУ
|
||||||
messages.logo-title=БРС аспиранта УлГТУ
|
messages.logo-title=Cеминар «Анализ данных и процессов»
|
||||||
messages.menu.home=На главную
|
messages.menu.home=На главную
|
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
(function($) {
|
|
||||||
$.fn.bootstrapFileInput = function(loadDirectory = false) {
|
|
||||||
var fileInput = $('<input type="file" class="input-ghost" ' + (loadDirectory ? 'webkitdirectory' : '') +' style="visibility:hidden; height:0">');
|
|
||||||
fileInput.change(function() {
|
|
||||||
$('#file-input-list').html('');
|
|
||||||
const files = $(this).prop('files');
|
|
||||||
if (files.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var filesList = '';
|
|
||||||
$.each(files, function(index, file){
|
|
||||||
filesList += '<div style="overflow: hidden"><span id="file-' + index + '"><i class="fa fa-circle-o"></i> ' + file.name + '</span></div>';
|
|
||||||
});
|
|
||||||
$('#file-input-list').html(filesList);
|
|
||||||
});
|
|
||||||
$(this).find('button.btn-choose').click(function() {
|
|
||||||
fileInput.click();
|
|
||||||
});
|
|
||||||
$(this).find('input').mousedown(function() {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$(this).append(fileInput);
|
|
||||||
};
|
|
||||||
})(jQuery);
|
|
@ -1,236 +0,0 @@
|
|||||||
// from config.js
|
|
||||||
/* global urlVersions */
|
|
||||||
|
|
||||||
var urlFileUpload = "/files/uploadTmpFile";
|
|
||||||
var urlFileDownload = "/files/download/";
|
|
||||||
var urlFileDownloadTmp = "/files/download-tmp/";
|
|
||||||
|
|
||||||
/* exported MessageTypesEnum */
|
|
||||||
var MessageTypesEnum = {
|
|
||||||
INFO: "info",
|
|
||||||
SUCCESS: "success",
|
|
||||||
WARNING: "warning",
|
|
||||||
DANGER: "danger"
|
|
||||||
};
|
|
||||||
Object.freeze(MessageTypesEnum);
|
|
||||||
|
|
||||||
function isEmpty(value) {
|
|
||||||
if (typeof value === "function") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (value == null || value.length === 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported showFeedbackMessage */
|
|
||||||
function showFeedbackMessage(message, type) {
|
|
||||||
var drawMessage = function (message, type) {
|
|
||||||
var li = $(
|
|
||||||
"<li class=\"alert alert-" + type + "\">" +
|
|
||||||
"<span>" + message + "</span>" +
|
|
||||||
"</li>"
|
|
||||||
);
|
|
||||||
li.click(function () {
|
|
||||||
$(this).remove();
|
|
||||||
});
|
|
||||||
messageDiv.append(li);
|
|
||||||
};
|
|
||||||
|
|
||||||
var liveTimeMs = 15000;
|
|
||||||
var messageDiv = $("#messages");
|
|
||||||
if (isEmpty(message)) {
|
|
||||||
messageDiv.html("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
drawMessage(message, (isEmpty(type) || isEmpty(MessageTypesEnum[type.toUpperCase()]) ?
|
|
||||||
MessageTypesEnum.INFO : type));
|
|
||||||
setTimeout(function () {
|
|
||||||
messageDiv.find("li").first().remove();
|
|
||||||
}, liveTimeMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported errorHandler */
|
|
||||||
function errorHandler(response, callBack, errorCallBack) {
|
|
||||||
if (isEmpty(response)) {
|
|
||||||
showFeedbackMessage("Empty response", MessageTypesEnum.DANGER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!isEmpty(response.error)) {
|
|
||||||
// TODO: add l10n
|
|
||||||
// showFeedbackMessage(response.error.code + ": " + response.error.message, MessageTypesEnum.DANGER);
|
|
||||||
if (!isEmpty(errorCallBack)) {
|
|
||||||
errorCallBack(response.data);
|
|
||||||
}
|
|
||||||
throw response.error.code + ": " + response.error.message +
|
|
||||||
" / Details: " + response.error.data;
|
|
||||||
}
|
|
||||||
if (!isEmpty(callBack)) {
|
|
||||||
if (isLoginPageResponse(response)) {
|
|
||||||
window.location.href = "/";
|
|
||||||
} else {
|
|
||||||
callBack(response.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isLoginPageResponse(response) {
|
|
||||||
return (typeof response) === 'string' && response.indexOf("<!DOCTYPE html>") >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported getFromRest */
|
|
||||||
function getFromRest(url, callBack, errorCallBack) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
cache: false,
|
|
||||||
success: function (response) {
|
|
||||||
errorHandler(response, callBack, errorCallBack);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported getFromRestWithVersionAndParams */
|
|
||||||
function getFromRestWithParams(url, params, callBack, errorCallBack) {
|
|
||||||
$.ajax({
|
|
||||||
url: url + "?" + params,
|
|
||||||
cache: false,
|
|
||||||
success: function (response) {
|
|
||||||
errorHandler(response, callBack, errorCallBack);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported postToRest */
|
|
||||||
function postToRest(url, postData, callBack, completeCallback, errorCallBack) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
cache: false,
|
|
||||||
dataType: "json",
|
|
||||||
data: postData,
|
|
||||||
contentType: "application/json; charset=utf-8",
|
|
||||||
processData: false,
|
|
||||||
method: "POST",
|
|
||||||
success: function (response) {
|
|
||||||
errorHandler(response, callBack, errorCallBack);
|
|
||||||
},
|
|
||||||
complete: function () {
|
|
||||||
if (isEmpty(completeCallback)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completeCallback();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported postToRestWithVersion */
|
|
||||||
function postToRestWithVersion(url, postData, callBack, errorCallBack) {
|
|
||||||
postToRestWithVersionAndParams(url, postData, "", callBack, errorCallBack);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported postToRestWithVersionAndParams */
|
|
||||||
function postToRestWithVersionAndParams(url, postData, params, callBack, errorCallBack) {
|
|
||||||
getCurrentVersion(function (version) {
|
|
||||||
$.ajax({
|
|
||||||
url: url + "?versionId=" + version + params,
|
|
||||||
cache: false,
|
|
||||||
dataType: "json",
|
|
||||||
data: postData,
|
|
||||||
contentType: "application/json; charset=utf-8",
|
|
||||||
processData: false,
|
|
||||||
method: "POST",
|
|
||||||
success: function (response) {
|
|
||||||
errorHandler(response, callBack, errorCallBack);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported putToRestWithVersion */
|
|
||||||
function putToRestWithVersion(url, putData, callBack, errorCallBack) {
|
|
||||||
putToRestWithVersionAndParams(url, putData, "", callBack, errorCallBack);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported putToRestWithVersionAndParams */
|
|
||||||
function putToRestWithVersionAndParams(url, putData, params, callBack, errorCallBack) {
|
|
||||||
getCurrentVersion(function (version) {
|
|
||||||
$.ajax({
|
|
||||||
url: url + "?versionId=" + version + params,
|
|
||||||
cache: false,
|
|
||||||
dataType: "json",
|
|
||||||
data: putData,
|
|
||||||
contentType: "application/json; charset=utf-8",
|
|
||||||
processData: false,
|
|
||||||
method: "PUT",
|
|
||||||
success: function (response) {
|
|
||||||
errorHandler(response, callBack, errorCallBack);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported deleteFromRest */
|
|
||||||
function deleteFromRest(url, callBack, completeCallback, errorCallBack) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
cache: false,
|
|
||||||
method: "DELETE",
|
|
||||||
success: function (response) {
|
|
||||||
errorHandler(response, callBack, errorCallBack);
|
|
||||||
},
|
|
||||||
complete: function () {
|
|
||||||
if (isEmpty(completeCallback)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completeCallback();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported fillSelect */
|
|
||||||
function fillSelect(selectElement, values) {
|
|
||||||
$(selectElement).html("");
|
|
||||||
$.each(values, function (key, value) {
|
|
||||||
$(selectElement).append(
|
|
||||||
"<option value=\"" + value.id + "\">" + value.name + "</option>"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported isUrlVarExists */
|
|
||||||
function isUrlVarExists(key) {
|
|
||||||
var URL = window.location.href;
|
|
||||||
if (URL.indexOf("?" + key + "=") !== -1) {
|
|
||||||
return true;
|
|
||||||
} else if (URL.indexOf("&" + key + "=") !== -1) {
|
|
||||||
return true;
|
|
||||||
} else if (URL.indexOf("?" + key + "&") !== -1) {
|
|
||||||
return true;
|
|
||||||
} else if (URL.indexOf("&" + key + "&") !== -1) {
|
|
||||||
return true;
|
|
||||||
} else if (URL.endsWith("?" + key)) {
|
|
||||||
return true;
|
|
||||||
} else if (URL.endsWith("&" + key)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported getUrlVar */
|
|
||||||
function getUrlVar(key) {
|
|
||||||
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
|
|
||||||
return result && decodeURIComponent(result[1]) || "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendPing(field, url) {
|
|
||||||
id = document.getElementById(field).value
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: url + `?${field}=` + id,
|
|
||||||
contentType: "application/json; charset=utf-8",
|
|
||||||
method: "POST",
|
|
||||||
success: function () {
|
|
||||||
showFeedbackMessage("Ping был отправлен", MessageTypesEnum.SUCCESS)
|
|
||||||
},
|
|
||||||
error: function (errorData) {
|
|
||||||
showFeedbackMessage(errorData.responseJSON.error.message, MessageTypesEnum.WARNING)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,134 +0,0 @@
|
|||||||
// form core.js
|
|
||||||
/* global isEmpty, errorHandler, showFeedbackMessage, MessageTypesEnum */
|
|
||||||
|
|
||||||
/* exported FileLoader */
|
|
||||||
function FileLoader(args) {
|
|
||||||
var MAX_FILE_SIZE_MB = 20;
|
|
||||||
var SIZE_TO_MB = 1048576;
|
|
||||||
var CHOOSE_FILE_TEXT = "Выберите файл";
|
|
||||||
var ALERT_CHOOSE_FILE = "Необходимо выбрать файл";
|
|
||||||
var ALERT_UNKNOWN_FILE_EXT = "Неизвестный тип файлов";
|
|
||||||
var ALERT_MAX_FILE = "Файл превышает разрешенный размер";
|
|
||||||
var ALERT_EMPTY_FILE = "Файл пуст";
|
|
||||||
var ERROR = "Ошибка загрузки файла";
|
|
||||||
|
|
||||||
if (isEmpty(args)) {
|
|
||||||
throw "Empty arguments";
|
|
||||||
}
|
|
||||||
var divId = args.div;
|
|
||||||
if (isEmpty(divId)) {
|
|
||||||
throw "Div id parameter is not set";
|
|
||||||
}
|
|
||||||
var url = args.url;
|
|
||||||
if (isEmpty(url)) {
|
|
||||||
throw "URL parameter is not set";
|
|
||||||
}
|
|
||||||
var callback = args.callback;
|
|
||||||
var maxFileSize = args.maxSize;
|
|
||||||
MAX_FILE_SIZE_MB = Math.min((isEmpty(maxFileSize) ? MAX_FILE_SIZE_MB : maxFileSize), MAX_FILE_SIZE_MB);
|
|
||||||
var fileExtensions = args.extensions;
|
|
||||||
fileExtensions = isEmpty(fileExtensions) ? [] : fileExtensions;
|
|
||||||
|
|
||||||
var div = $("#" + divId).addClass("input-group");
|
|
||||||
if (isEmpty(div)) {
|
|
||||||
throw "Div with id " + divId + " is not found";
|
|
||||||
}
|
|
||||||
|
|
||||||
var fileLabel = $("<input>")
|
|
||||||
.attr("type", "text")
|
|
||||||
.attr("placeholder", CHOOSE_FILE_TEXT)
|
|
||||||
.attr("disabled", true)
|
|
||||||
.addClass("form-control");
|
|
||||||
div.append(fileLabel);
|
|
||||||
var fileInput = $("<input>")
|
|
||||||
.attr("type", "file")
|
|
||||||
.attr("multiple", '')
|
|
||||||
.hide();
|
|
||||||
fileInput.change(function () {
|
|
||||||
var files = $(this).prop("files");
|
|
||||||
if (isEmpty(files)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fileLabel.val(files[0].name);
|
|
||||||
});
|
|
||||||
div.append(fileInput);
|
|
||||||
|
|
||||||
var buttonGroup = $("<div>")
|
|
||||||
.addClass("input-group-btn");
|
|
||||||
div.append(buttonGroup);
|
|
||||||
|
|
||||||
var chooseButton = $("<button>")
|
|
||||||
.attr("type", "button")
|
|
||||||
.addClass("btn btn-default")
|
|
||||||
.append($("<i>").addClass("fa fa-ellipsis-h"));
|
|
||||||
chooseButton.click(function () {
|
|
||||||
fileInput.click();
|
|
||||||
});
|
|
||||||
buttonGroup.append(chooseButton);
|
|
||||||
|
|
||||||
var uploadButton = $("<button>")
|
|
||||||
.attr("type", "button")
|
|
||||||
.addClass("btn btn-default")
|
|
||||||
.append($("<i>").addClass("fa fa-upload"));
|
|
||||||
uploadButton.click(function () {
|
|
||||||
var files = fileInput.prop("files");
|
|
||||||
if (isEmpty(files)) {
|
|
||||||
showFeedbackMessage(ALERT_CHOOSE_FILE, MessageTypesEnum.DANGER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (var i = 0; i < files.length; i++) {
|
|
||||||
var currentFile = files[i];
|
|
||||||
if (!isEmpty(fileExtensions) && fileExtensions.indexOf(getFileExt(currentFile)) === -1) {
|
|
||||||
showFeedbackMessage(ALERT_UNKNOWN_FILE_EXT, MessageTypesEnum.DANGER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (currentFile.size === 0) {
|
|
||||||
showFeedbackMessage(ALERT_EMPTY_FILE, MessageTypesEnum.DANGER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (MAX_FILE_SIZE_MB != -1 && currentFile.size / SIZE_TO_MB > MAX_FILE_SIZE_MB) {
|
|
||||||
showFeedbackMessage(ALERT_MAX_FILE + " " + MAX_FILE_SIZE_MB + "Mb", MessageTypesEnum.DANGER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
upload(currentFile);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
buttonGroup.append(uploadButton);
|
|
||||||
|
|
||||||
var progressDiv = $("<div>")
|
|
||||||
.addClass("progress margined-top-10")
|
|
||||||
.css("background-color", "#FFFFFF");
|
|
||||||
progressDiv.insertAfter(div);
|
|
||||||
var progressBar = $("<div>")
|
|
||||||
.addClass("progress-bar")
|
|
||||||
.attr("role", "progressbar")
|
|
||||||
.css("width", "0%");
|
|
||||||
progressDiv.append(progressBar);
|
|
||||||
|
|
||||||
function getFileExt(file) {
|
|
||||||
return file.name.slice((Math.max(0, file.name.lastIndexOf(".")) || Infinity) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function upload(file) {
|
|
||||||
progressBar.css("width", "0%");
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.upload.onprogress = function (event) {
|
|
||||||
var curProgress = Math.floor(event.loaded / event.total * 100) + "%";
|
|
||||||
progressBar
|
|
||||||
.css("width", curProgress)
|
|
||||||
.text(curProgress);
|
|
||||||
};
|
|
||||||
xhr.onload = xhr.onerror = function () {
|
|
||||||
if (this.status === 200) {
|
|
||||||
errorHandler(JSON.parse(this.responseText), callback);
|
|
||||||
} else {
|
|
||||||
showFeedbackMessage(ERROR, MessageTypesEnum.DANGER);
|
|
||||||
console.error("error " + this.status);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
xhr.open("POST", url, true);
|
|
||||||
var formData = new FormData();
|
|
||||||
formData.append("file", file);
|
|
||||||
xhr.send(formData);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
<!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>
|
|
@ -1,42 +0,0 @@
|
|||||||
<!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">
|
|
||||||
<a href="/admin/editAspirant/0" class="btn btn-outline-dark">
|
|
||||||
<i class="fa fa-plus-square" aria-hidden="true"> Добавить аспиранта</i>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Таблица аспирантов -->
|
|
||||||
<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:if="${a.course != null}" th:text="${a.course.name}"></td>
|
|
||||||
<td th:if="${a.course == null}"></td>
|
|
||||||
<td th:text="${a.theme}"></td>
|
|
||||||
<td th:if="${a.manager != null}" th:text="${a.manager.name}"></td>
|
|
||||||
<td th:if="${a.manager == null}"></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>
|
|
@ -1,112 +0,0 @@
|
|||||||
<!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/saveAspirant}"
|
|
||||||
th:object="${aspirant}"
|
|
||||||
method="post">
|
|
||||||
<input type="hidden" th:field="*{id}">
|
|
||||||
<input type="hidden" th:field="*{userId}">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="surname">Фамилия</label>
|
|
||||||
<input th:field="*{surname}"
|
|
||||||
id="surname"
|
|
||||||
type="text"
|
|
||||||
required
|
|
||||||
class="form-control"
|
|
||||||
placeholder="Фамилия">
|
|
||||||
<p th:if="${#fields.hasErrors('surname')}"
|
|
||||||
th:class="${#fields.hasErrors('surname')}? error">
|
|
||||||
Не может быть пустым
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="name">Имя</label>
|
|
||||||
<input th:field="*{name}"
|
|
||||||
id="name"
|
|
||||||
type="text"
|
|
||||||
required
|
|
||||||
class="form-control"
|
|
||||||
placeholder="Имя">
|
|
||||||
<p th:if="${#fields.hasErrors('name')}"
|
|
||||||
th:class="${#fields.hasErrors('name')}? error">
|
|
||||||
Не может быть пустым
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="patronymic">Отчество</label>
|
|
||||||
<input th:field="*{patronymic}"
|
|
||||||
id="patronymic"
|
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
placeholder="Отчество">
|
|
||||||
<p th:if="${#fields.hasErrors('patronymic')}"
|
|
||||||
th:class="${#fields.hasErrors('patronymic')}? error">
|
|
||||||
Не может быть пустым
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="email">Email</label>
|
|
||||||
<input th:field="*{email}"
|
|
||||||
id="email"
|
|
||||||
required
|
|
||||||
type="email"
|
|
||||||
class="form-control"
|
|
||||||
placeholder="Email">
|
|
||||||
<p th:if="${#fields.hasErrors('email')}"
|
|
||||||
th:class="${#fields.hasErrors('email')}? error">
|
|
||||||
Не может быть пустым
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="course">Курс</label>
|
|
||||||
<select class="form-select form-control"
|
|
||||||
id="course" aria-label="multiple select example"
|
|
||||||
th:field="*{course}">
|
|
||||||
<option th:each="c : ${courses}"
|
|
||||||
th:value="${c}"
|
|
||||||
th:text="${c.name}">
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="theme">Тема</label>
|
|
||||||
<input th:field="*{theme}"
|
|
||||||
id="theme"
|
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
placeholder="Тема">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="manager">Научный руководитель</label>
|
|
||||||
<select class="form-select form-control"
|
|
||||||
id="manager" aria-label="select example"
|
|
||||||
th:field="*{managerId}">
|
|
||||||
<option th:each="m : ${managers}"
|
|
||||||
th:value="${m.id}"
|
|
||||||
th:text="${m.name}">
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
|
|
||||||
<button name="delete"
|
|
||||||
type="submit"
|
|
||||||
class="btn btn-outline-dark"
|
|
||||||
onclick="return confirm('Удалить запись?')">
|
|
||||||
Удалить
|
|
||||||
</button>
|
|
||||||
<a href="/admin/aspirants" class="btn btn-outline-dark">Отмена</a>
|
|
||||||
</form>
|
|
||||||
<link rel="stylesheet" href="/webjars/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
||||||
<link rel="stylesheet" href="/webjars/bootstrap-glyphicons/bdd2cbfba0/css/bootstrap-glyphicons.css"/>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
@ -1,76 +0,0 @@
|
|||||||
<!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/saveIndicator}"
|
|
||||||
th:object="${indicator}"
|
|
||||||
method="post"
|
|
||||||
enctype="multipart/form-data">
|
|
||||||
<input type="hidden" th:field="*{id}">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="name">Название</label>
|
|
||||||
<input th:field="*{name}"
|
|
||||||
id="name"
|
|
||||||
type="text"
|
|
||||||
required
|
|
||||||
class="form-control"
|
|
||||||
placeholder="Название показателя">
|
|
||||||
<p th:if="${#fields.hasErrors('name')}"
|
|
||||||
th:class="${#fields.hasErrors('name')}? error">
|
|
||||||
Не может быть пустым
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="name">Максимальная сумма баллов</label>
|
|
||||||
<input th:field="*{max}"
|
|
||||||
required
|
|
||||||
id="max"
|
|
||||||
type="number"
|
|
||||||
class="form-control"
|
|
||||||
min="0"
|
|
||||||
max="30">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="name">Описание подтверждающих документов</label>
|
|
||||||
<textarea th:field="*{proofDocuments}"
|
|
||||||
required
|
|
||||||
id="proofDocuments"
|
|
||||||
class="form-control"
|
|
||||||
placeholder="Описание подтверждающих документов"
|
|
||||||
style="height: 100px">
|
|
||||||
</textarea>
|
|
||||||
<p th:if="${#fields.hasErrors('proofDocuments')}"
|
|
||||||
th:class="${#fields.hasErrors('proofDocuments')}? error">
|
|
||||||
Не может быть пустым
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="courses">Для каких курсов применяется</label>
|
|
||||||
|
|
||||||
<select class="form-select form-control" id="courses" multiple aria-label="multiple select example"
|
|
||||||
th:field="*{courses}"
|
|
||||||
>
|
|
||||||
<option th:each="c : ${courses}"
|
|
||||||
th:value="${c}"
|
|
||||||
th:text="${c.name}">
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
|
|
||||||
<button name="delete"
|
|
||||||
type="submit"
|
|
||||||
class="btn btn-outline-dark"
|
|
||||||
onclick="return confirm('Удалить показатель?')">
|
|
||||||
Удалить
|
|
||||||
</button>
|
|
||||||
<a href="/admin/indicators" class="btn btn-outline-dark">Отмена</a>
|
|
||||||
</form>
|
|
||||||
<link rel="stylesheet" href="/webjars/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
||||||
<link rel="stylesheet" href="/webjars/bootstrap-glyphicons/bdd2cbfba0/css/bootstrap-glyphicons.css"/>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
@ -1,37 +0,0 @@
|
|||||||
<!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/saveManager}"
|
|
||||||
th:object="${manager}"
|
|
||||||
method="post">
|
|
||||||
<input type="hidden" th:field="*{id}">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="name">ФИО</label>
|
|
||||||
<input th:field="*{name}"
|
|
||||||
id="name"
|
|
||||||
type="text"
|
|
||||||
required
|
|
||||||
class="form-control"
|
|
||||||
placeholder="ФИО">
|
|
||||||
<p th:if="${#fields.hasErrors('name')}"
|
|
||||||
th:class="${#fields.hasErrors('name')}? error">
|
|
||||||
Не может быть пустым
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
|
|
||||||
<button name="delete"
|
|
||||||
type="submit"
|
|
||||||
class="btn btn-outline-dark"
|
|
||||||
onclick="return confirm('Удалить запись?')">
|
|
||||||
Удалить
|
|
||||||
</button>
|
|
||||||
<a href="/admin/aspirants" class="btn btn-outline-dark">Отмена</a>
|
|
||||||
</form>
|
|
||||||
<link rel="stylesheet" href="/webjars/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
||||||
<link rel="stylesheet" href="/webjars/bootstrap-glyphicons/bdd2cbfba0/css/bootstrap-glyphicons.css"/>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
@ -1,49 +0,0 @@
|
|||||||
<!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/saveReportPeriod}"
|
|
||||||
th:object="${reportPeriod}"
|
|
||||||
method="post">
|
|
||||||
<input type="hidden" th:field="*{id}">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="startDate">Дата начала</label>
|
|
||||||
<input th:field="*{startDate}"
|
|
||||||
id="startDate"
|
|
||||||
type="date"
|
|
||||||
required
|
|
||||||
class="form-control">
|
|
||||||
<p th:if="${#fields.hasErrors('startDate')}"
|
|
||||||
th:class="${#fields.hasErrors('startDate')}? error">
|
|
||||||
Ошибка
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="endDate">Дата окончания</label>
|
|
||||||
<input th:field="*{endDate}"
|
|
||||||
id="endDate"
|
|
||||||
type="date"
|
|
||||||
required
|
|
||||||
class="form-control">
|
|
||||||
<p th:if="${#fields.hasErrors('endDate')}"
|
|
||||||
th:class="${#fields.hasErrors('endDate')}? error">
|
|
||||||
Ошибка
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
|
|
||||||
<button name="delete"
|
|
||||||
type="submit"
|
|
||||||
class="btn btn-outline-dark"
|
|
||||||
onclick="return confirm('Удалить запись?')">
|
|
||||||
Удалить
|
|
||||||
</button>
|
|
||||||
<a href="/admin/reportPeriodList" class="btn btn-outline-dark">Отмена</a>
|
|
||||||
</form>
|
|
||||||
<link rel="stylesheet" href="/webjars/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
||||||
<link rel="stylesheet" href="/webjars/bootstrap-glyphicons/bdd2cbfba0/css/bootstrap-glyphicons.css"/>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||||||
<!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">
|
|
||||||
<a href="/admin/editIndicator/0" class="btn btn-outline-dark">
|
|
||||||
<i class="fa fa-plus-square" aria-hidden="true"> Добавить показатель</i>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li th:each="i : ${indicators}">
|
|
||||||
<a th:href="@{'/admin/editIndicator/' + ${i.id}}"><span th:text="${i.name}"></span></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
@ -1,43 +0,0 @@
|
|||||||
<!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">
|
|
||||||
<!-- Кнопка добавления нового научного руководителя -->
|
|
||||||
<a href="/admin/editManager/0" class="btn btn-outline-dark mb-3">
|
|
||||||
<i class="fa fa-plus-square" aria-hidden="true"> Добавить научного руководителя</i>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Таблица научных руководителей -->
|
|
||||||
<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>
|
|
@ -1,32 +0,0 @@
|
|||||||
<!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">
|
|
||||||
<a href="/admin/editReportPeriod/0" class="btn btn-outline-dark">
|
|
||||||
<i class="fa fa-plus-square" aria-hidden="true"> Добавить отчетный период</i>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Таблица периодов отчетности -->
|
|
||||||
<table class="table table-bordered table-striped mt-3">
|
|
||||||
<thead class="table-dark">
|
|
||||||
<tr>
|
|
||||||
<th scope="col">Дата начала</th>
|
|
||||||
<th scope="col">Дата окончания</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr th:each="r : ${reportPeriods}">
|
|
||||||
<td th:text="${#calendars.format(r.startDate, 'dd.MM.yyyy')}"></td>
|
|
||||||
<td th:text="${#calendars.format(r.endDate, 'dd.MM.yyyy')}"></td>
|
|
||||||
<td>
|
|
||||||
<!-- Ссылка на редактирование -->
|
|
||||||
<a th:href="@{'/admin/editReportPeriod/' + ${r.id}}" class="btn btn-sm btn-primary">
|
|
||||||
<i class="fa fa-edit" aria-hidden="true"></i> Редактировать
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
@ -1,33 +0,0 @@
|
|||||||
<!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>
|
|
@ -1,26 +0,0 @@
|
|||||||
<!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>
|
|
@ -1,40 +0,0 @@
|
|||||||
<!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>
|
|
@ -1,34 +0,0 @@
|
|||||||
<!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>
|
|
@ -1,25 +0,0 @@
|
|||||||
<!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>
|
|
@ -1,31 +0,0 @@
|
|||||||
<!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>
|
|
@ -7,7 +7,6 @@
|
|||||||
<title th:text="#{messages.app-name}">app-name</title>
|
<title th:text="#{messages.app-name}">app-name</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script>
|
<script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script>
|
||||||
<script type="text/javascript" src="/js/core.js"></script>
|
|
||||||
<script type="text/javascript" src="/webjars/bootstrap/4.3.0/js/bootstrap.bundle.min.js"></script>
|
<script type="text/javascript" src="/webjars/bootstrap/4.3.0/js/bootstrap.bundle.min.js"></script>
|
||||||
<link rel="stylesheet" href="/webjars/bootstrap/4.3.0/css/bootstrap.min.css"/>
|
<link rel="stylesheet" href="/webjars/bootstrap/4.3.0/css/bootstrap.min.css"/>
|
||||||
<link rel="stylesheet" href="/webjars/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
<link rel="stylesheet" href="/webjars/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
||||||
@ -31,64 +30,25 @@
|
|||||||
<a class="nav-link" href="/news/news">Новости</a>
|
<a class="nav-link" href="/news/news">Новости</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/docs">Документы</a>
|
<a class="nav-link" href="/meetings/meetings">Заседания</a>
|
||||||
</li>
|
|
||||||
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_ASPIRANT')">
|
|
||||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
|
|
||||||
aria-haspopup="true" aria-expanded="false">Аспиранту</a>
|
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
|
||||||
<a class="dropdown-item" href="/report/reportList">Список отчетов</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_MANAGER')">
|
|
||||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
|
|
||||||
aria-haspopup="true" aria-expanded="false">Руководителю</a>
|
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
|
||||||
<a class="dropdown-item" href="/aspirantList">Список аспирантов</a>
|
|
||||||
<a class="dropdown-item" href="/report/reportList">Список отчетов</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_HEAD')">
|
|
||||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
|
|
||||||
aria-haspopup="true" aria-expanded="false">Аспирантура</a>
|
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
|
||||||
<a class="dropdown-item" href="/admin/reportPeriodList">Список периодов отчетности</a>
|
|
||||||
<a class="dropdown-item" href="/report/reportList">Список отчетов</a>
|
|
||||||
<a class="dropdown-item" href="/statistic/statistic">Статистика по баллам</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_ADMIN')">
|
|
||||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
|
|
||||||
aria-haspopup="true" aria-expanded="false">Администратору</a>
|
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
|
||||||
<a class="dropdown-item" href="/admin/indicators">Список показателей</a>
|
|
||||||
<a class="dropdown-item" href="/admin/managers">Список научных руководителей</a>
|
|
||||||
<a class="dropdown-item" href="/admin/aspirants">Список аспирантов</a>
|
|
||||||
<a class="dropdown-item" href="/admin/reportPeriodList">Список периодов отчетности</a>
|
|
||||||
<a class="dropdown-item" href="/admin/rules">Правила БРС</a>
|
|
||||||
<a class="dropdown-item" href="/admin/confirmation">Подтверждение БРС</a>
|
|
||||||
<a class="dropdown-item" href="/report/reportList">Список отчетов</a>
|
|
||||||
<a class="dropdown-item" href="/statistic/statistic">Статистика по баллам</a>
|
|
||||||
<a class="dropdown-item" href="/admin">Новости и заседания</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link disabled" href="#" sec:authorize="hasRole('ROLE_ADMIN')">Личный кабинет
|
<a class="nav-link" href="/organizers">Организаторы</a>
|
||||||
администратора</a>
|
</li>
|
||||||
<a class="nav-link disabled" href="#" sec:authorize="hasRole('ROLE_ASPIRANT')">Личный кабинет
|
<li class="nav-item">
|
||||||
аспиранта</a>
|
<a class="nav-link" href="/docs">Документы</a>
|
||||||
<a class="nav-link disabled" href="#" sec:authorize="hasRole('ROLE_MANAGER')">Личный кабинет
|
</li>
|
||||||
руководителя аспиранта</a>
|
<li class="nav-item">
|
||||||
<a class="nav-link disabled" href="#" sec:authorize="hasRole('ROLE_HEAD')">Личный кабинет
|
<a class="nav-link" href="/reports">Отчеты</a>
|
||||||
представителя аспирантуры</a>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/admin">Администратору</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div sec:authorize="isAuthenticated()">
|
<div sec:authorize="isAuthenticated()">
|
||||||
<a class="nav-link" href="/logout">Выход</a>
|
<a class="nav-link" href="/logout">Выход</a>
|
||||||
</div>
|
</div>
|
||||||
<div sec:authorize="!isAuthenticated()">
|
|
||||||
<a class="nav-link" href="/login">Личный кабинет</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -131,7 +91,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
2025
|
2022
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -3,8 +3,13 @@
|
|||||||
<div class="container" layout:fragment="content">
|
<div class="container" layout:fragment="content">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a class="link-dark" target="_blank" href="/docs/polozh.pdf">
|
<a class="link-dark" href="/docs/polozh.docx">
|
||||||
Положение о балльно-рейтинговой системе оценки успеваемости аспирантов
|
Положение
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<a class="link-dark" href="/docs/plan2022.docx">
|
||||||
|
План заседаний на 2022 год.
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user