diff --git a/src/main/java/ru/ulstu/admin/controller/AdminAspirantController.java b/src/main/java/ru/ulstu/admin/controller/AdminAspirantController.java index fe32327..d10ec23 100644 --- a/src/main/java/ru/ulstu/admin/controller/AdminAspirantController.java +++ b/src/main/java/ru/ulstu/admin/controller/AdminAspirantController.java @@ -8,8 +8,8 @@ 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; -import ru.ulstu.indicator.model.Indicator; @Controller @RequestMapping("admin") @@ -31,8 +31,9 @@ public class AdminAspirantController { model.addAttribute("aspirant", (id != null && id != 0) ? adminAspirantService.getAspirantById(id) - : new Indicator()); + : new Aspirant()); model.addAttribute("courses", Course.values()); + model.addAttribute("managers", adminAspirantService.getManagers()); return "admin/editAspirant"; } diff --git a/src/main/java/ru/ulstu/admin/controller/AdminIndicatorController.java b/src/main/java/ru/ulstu/admin/controller/AdminIndicatorController.java index d188d44..91b7f89 100644 --- a/src/main/java/ru/ulstu/admin/controller/AdminIndicatorController.java +++ b/src/main/java/ru/ulstu/admin/controller/AdminIndicatorController.java @@ -30,7 +30,6 @@ public class AdminIndicatorController { } @GetMapping("/editIndicator/{indicatorId}") - @Secured({UserRoleConstants.ADMIN}) public String editIndicator(@PathVariable(value = "indicatorId") Integer id, Model model) { model.addAttribute("indicator", (id != null && id != 0) diff --git a/src/main/java/ru/ulstu/admin/service/AdminAspirantService.java b/src/main/java/ru/ulstu/admin/service/AdminAspirantService.java index 2765a8e..cdbfde9 100644 --- a/src/main/java/ru/ulstu/admin/service/AdminAspirantService.java +++ b/src/main/java/ru/ulstu/admin/service/AdminAspirantService.java @@ -4,15 +4,20 @@ 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 java.util.List; @Service public class AdminAspirantService { private final AspirantService aspirantService; + private final ManagerService managerService; - public AdminAspirantService(AspirantService aspirantService) { + public AdminAspirantService(AspirantService aspirantService, + ManagerService managerService) { this.aspirantService = aspirantService; + this.managerService = managerService; } public List getAspirants() { @@ -42,4 +47,8 @@ public class AdminAspirantService { public void deleteAspirant(AspirantForm aspirantForm) { aspirantService.deleteAspirant(aspirantForm); } + + public List getManagers() { + return managerService.getManagers(); + } } diff --git a/src/main/java/ru/ulstu/aspirant/model/Aspirant.java b/src/main/java/ru/ulstu/aspirant/model/Aspirant.java index 7a43c0a..5393e1f 100644 --- a/src/main/java/ru/ulstu/aspirant/model/Aspirant.java +++ b/src/main/java/ru/ulstu/aspirant/model/Aspirant.java @@ -44,6 +44,16 @@ public class Aspirant extends BaseEntity { public Aspirant(AspirantForm aspirantForm) { this.name = aspirantForm.getName(); + this.surname = aspirantForm.getSurname(); + this.patronymic = aspirantForm.getPatronymic(); + this.theme = aspirantForm.getTheme(); + this.manager = aspirantForm.getManager(); + this.speciality = aspirantForm.getSpeciality(); + this.base = aspirantForm.getBase(); + this.birthDate = aspirantForm.getBirthDate(); + } + + public Aspirant() { }