Browse Source

refactor

master
esoe 1 week ago
parent
commit
007d71cd38
  1. 4
      main/src/main/java/gsp/technologies/main/api/account/AccountEntity.java
  2. 2
      main/src/main/java/gsp/technologies/main/api/account/AccountRepository.java
  3. 2
      main/src/main/java/gsp/technologies/main/api/account/AccountService.java
  4. 2
      main/src/main/java/gsp/technologies/main/api/course/CourseEntity.java
  5. 2
      main/src/main/java/gsp/technologies/main/api/course/CourseRepository.java
  6. 2
      main/src/main/java/gsp/technologies/main/api/course/CourseService.java
  7. 2
      main/src/main/java/gsp/technologies/main/api/organization/OrganizationApiController.java
  8. 2
      main/src/main/java/gsp/technologies/main/api/organization/OrganizationEntity.java
  9. 2
      main/src/main/java/gsp/technologies/main/api/organization/OrganizationRepository.java
  10. 2
      main/src/main/java/gsp/technologies/main/api/organization/OrganizationService.java
  11. 10
      main/src/main/java/gsp/technologies/main/api/position/PositionApiController.java
  12. 4
      main/src/main/java/gsp/technologies/main/api/position/PositionEntity.java
  13. 2
      main/src/main/java/gsp/technologies/main/api/position/PositionRepository.java
  14. 2
      main/src/main/java/gsp/technologies/main/api/position/PositionService.java
  15. 6
      main/src/main/java/gsp/technologies/main/api/target/TargetEntity.java
  16. 2
      main/src/main/java/gsp/technologies/main/api/target/TargetRepository.java
  17. 5
      main/src/main/java/gsp/technologies/main/api/target/TargetService.java
  18. 104
      main/src/main/java/gsp/technologies/main/face/reviewer/ReviewController.java
  19. 47
      main/src/main/java/gsp/technologies/main/face/supplier/SupCourseController.java
  20. 42
      main/src/main/java/gsp/technologies/main/face/supplier/SupOrganizationController.java
  21. 30
      main/src/main/java/gsp/technologies/main/face/supplier/SupPositionController.java
  22. 37
      main/src/main/java/gsp/technologies/main/face/supplier/SupTargetFaceController.java
  23. 114
      main/src/main/java/gsp/technologies/main/face/user/UserAccountController.java
  24. 90
      main/src/main/java/gsp/technologies/main/face/user/UserCourseController.java
  25. 18
      main/src/main/java/gsp/technologies/main/face/user/UserLoginController.java
  26. 6
      main/src/main/java/gsp/technologies/main/face/user/UserLogoutController.java
  27. 6
      main/src/main/java/gsp/technologies/main/face/user/UserQuizController.java
  28. 149
      main/src/main/java/gsp/technologies/main/user/account/AccountFaceController.java
  29. 21
      main/src/main/resources/static/content/courses/52/main.md
  30. 0
      main/src/main/resources/templates/pages/reviewer/login.html
  31. 2
      main/src/main/resources/templates/pages/user/course.html
  32. 6
      main/src/main/resources/templates/shards/accounts.html
  33. 6
      main/src/main/resources/templates/shards/courses.html
  34. 4
      main/src/main/resources/templates/shards/navi.html
  35. 12
      main/src/main/resources/templates/shards/organizations.html
  36. 14
      main/src/main/resources/templates/shards/positions.html
  37. 59
      main/src/main/resources/templates/shards/targets.html

4
main/src/main/java/gsp/technologies/main/user/account/AccountEntity.java → main/src/main/java/gsp/technologies/main/api/account/AccountEntity.java

@ -1,9 +1,9 @@
package gsp.technologies.main.user.account; package gsp.technologies.main.api.account;
import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction; import org.hibernate.annotations.OnDeleteAction;
import gsp.technologies.main.supplier.position.PositionEntity; import gsp.technologies.main.api.position.PositionEntity;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;

2
main/src/main/java/gsp/technologies/main/user/account/AccountRepository.java → main/src/main/java/gsp/technologies/main/api/account/AccountRepository.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.account; package gsp.technologies.main.api.account;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

2
main/src/main/java/gsp/technologies/main/user/account/AccountService.java → main/src/main/java/gsp/technologies/main/api/account/AccountService.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.account; package gsp.technologies.main.api.account;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

2
main/src/main/java/gsp/technologies/main/user/course/CourseEntity.java → main/src/main/java/gsp/technologies/main/api/course/CourseEntity.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.course; package gsp.technologies.main.api.course;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;

2
main/src/main/java/gsp/technologies/main/user/course/CourseRepository.java → main/src/main/java/gsp/technologies/main/api/course/CourseRepository.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.course; package gsp.technologies.main.api.course;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

2
main/src/main/java/gsp/technologies/main/user/course/CourseService.java → main/src/main/java/gsp/technologies/main/api/course/CourseService.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.course; package gsp.technologies.main.api.course;
import java.util.Collection; import java.util.Collection;

2
main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationApiController.java → main/src/main/java/gsp/technologies/main/api/organization/OrganizationApiController.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.organization; package gsp.technologies.main.api.organization;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

2
main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationEntity.java → main/src/main/java/gsp/technologies/main/api/organization/OrganizationEntity.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.organization; package gsp.technologies.main.api.organization;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;

2
main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationRepository.java → main/src/main/java/gsp/technologies/main/api/organization/OrganizationRepository.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.organization; package gsp.technologies.main.api.organization;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

2
main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationService.java → main/src/main/java/gsp/technologies/main/api/organization/OrganizationService.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.organization; package gsp.technologies.main.api.organization;
import java.util.Collection; import java.util.Collection;

10
main/src/main/java/gsp/technologies/main/supplier/position/PositionApiController.java → main/src/main/java/gsp/technologies/main/api/position/PositionApiController.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.position; package gsp.technologies.main.api.position;
import java.util.Collection; import java.util.Collection;
@ -45,13 +45,13 @@ public class PositionApiController {
@RequestParam(name = "number", required = false, defaultValue = "0") int number, @RequestParam(name = "number", required = false, defaultValue = "0") int number,
@RequestParam(name = "size", required = false, defaultValue = "10") int size, @RequestParam(name = "size", required = false, defaultValue = "10") int size,
@RequestParam(name = "sortBy", required = false, defaultValue = "name") String sortBy) { @RequestParam(name = "sortBy", required = false, defaultValue = "name") String sortBy) {
log.info("GET /positions"); log.info("GET /api/v1/positions");
Sort sort = Sort.by(sortBy); Sort sort = Sort.by(sortBy);
Pageable of = PageRequest.of(number, size, sort); Pageable of = PageRequest.of(number, size, sort);
if (id != 0) { if (id != 0) {
log.info("GET /positions, organizationId: {}", id); log.info("GET /api/v1/positions, organizationId: {}", id);
Page<PositionEntity> page = positionService.findByOrganizationId(of, id); Page<PositionEntity> page = positionService.findByOrganizationId(of, id);
return new ResponseEntity<>(page, HttpStatus.OK); return new ResponseEntity<>(page, HttpStatus.OK);
// return new ResponseEntity<PagedModel<EntityModel<PositionEntity>>>(assembler.toModel(page), HttpStatus.OK); // return new ResponseEntity<PagedModel<EntityModel<PositionEntity>>>(assembler.toModel(page), HttpStatus.OK);
@ -71,11 +71,11 @@ public class PositionApiController {
consumes = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> savePosition(@RequestBody PositionEntity position) { public ResponseEntity<?> savePosition(@RequestBody PositionEntity position) {
log.info("POST /positions, position: {}", position); log.info("POST /api/v1/positions, position: {}", position);
try { try {
positionService.save(position); positionService.save(position);
} catch (Exception e) { } catch (Exception e) {
log.error("POST /positions", e.getMessage()); log.error("POST /api/v1/positions", e.getMessage());
return new ResponseEntity<>(e.getMessage(), HttpStatus.OK); return new ResponseEntity<>(e.getMessage(), HttpStatus.OK);
} }
return new ResponseEntity<>(position, HttpStatus.CREATED); return new ResponseEntity<>(position, HttpStatus.CREATED);

4
main/src/main/java/gsp/technologies/main/supplier/position/PositionEntity.java → main/src/main/java/gsp/technologies/main/api/position/PositionEntity.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.position; package gsp.technologies.main.api.position;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
@ -15,7 +15,7 @@ import lombok.NoArgsConstructor;
import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction; import org.hibernate.annotations.OnDeleteAction;
import gsp.technologies.main.supplier.organization.OrganizationEntity; import gsp.technologies.main.api.organization.OrganizationEntity;
@Data @Data
@AllArgsConstructor @AllArgsConstructor

2
main/src/main/java/gsp/technologies/main/supplier/position/PositionRepository.java → main/src/main/java/gsp/technologies/main/api/position/PositionRepository.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.position; package gsp.technologies.main.api.position;
import java.util.Collection; import java.util.Collection;

2
main/src/main/java/gsp/technologies/main/supplier/position/PositionService.java → main/src/main/java/gsp/technologies/main/api/position/PositionService.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.position; package gsp.technologies.main.api.position;
import java.util.Collection; import java.util.Collection;

6
main/src/main/java/gsp/technologies/main/supplier/target/TargetEntity.java → main/src/main/java/gsp/technologies/main/api/target/TargetEntity.java

@ -1,10 +1,10 @@
package gsp.technologies.main.supplier.target; package gsp.technologies.main.api.target;
import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction; import org.hibernate.annotations.OnDeleteAction;
import gsp.technologies.main.supplier.position.PositionEntity; import gsp.technologies.main.api.course.CourseEntity;
import gsp.technologies.main.user.course.CourseEntity; import gsp.technologies.main.api.position.PositionEntity;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;

2
main/src/main/java/gsp/technologies/main/supplier/target/TargetRepository.java → main/src/main/java/gsp/technologies/main/api/target/TargetRepository.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.target; package gsp.technologies.main.api.target;
import java.util.Collection; import java.util.Collection;

5
main/src/main/java/gsp/technologies/main/supplier/target/TargetService.java → main/src/main/java/gsp/technologies/main/api/target/TargetService.java

@ -1,12 +1,9 @@
package gsp.technologies.main.supplier.target; package gsp.technologies.main.api.target;
import java.util.Collection; import java.util.Collection;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import gsp.technologies.main.supplier.position.PositionEntity;
import gsp.technologies.main.user.course.CourseEntity;
@Service @Service
public class TargetService { public class TargetService {
private final TargetRepository repo; private final TargetRepository repo;

104
main/src/main/java/gsp/technologies/main/face/reviewer/ReviewController.java

@ -0,0 +1,104 @@
package gsp.technologies.main.face.reviewer;
import java.util.Collection;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import gsp.technologies.main.api.account.AccountEntity;
import gsp.technologies.main.api.account.AccountService;
import gsp.technologies.main.api.course.CourseEntity;
import gsp.technologies.main.api.organization.OrganizationService;
import gsp.technologies.main.api.position.PositionEntity;
import gsp.technologies.main.api.position.PositionService;
import gsp.technologies.main.api.target.TargetEntity;
import gsp.technologies.main.api.target.TargetService;
import gsp.technologies.main.common.code.Code;
/**
* Контроллер формы аккаунта
* возвращает thymeleaf шаблон
*/
@Controller
@RequestMapping(path = "/reviewer")
public class ReviewController {
private static final Logger log = LoggerFactory.getLogger(ReviewController.class);
@Autowired
private OrganizationService organizationService;
@Autowired
private PositionService positionService;
@Autowired
private AccountService accountService;
@Autowired
private TargetService targetService;
public ReviewController(
PositionService positionService
, OrganizationService organizationService
, AccountService accountService
, TargetService targetService
) {
this.positionService = positionService;
this.organizationService = organizationService;
this.accountService = accountService;
this.targetService = targetService;
}
@GetMapping("/login")
public String login(Model model) {
log.info("GET /reviewer");
return "pages/reviewer/login";
}
/**
* Форма аккаунта:
* - данные аккаунта (id, organization, position)
* - список курсов аккаунта
*
* @param model
* @param accountid
* @param positionid
* @return
*/
@GetMapping("/account")
public String account(Model model,
@RequestParam(name = "accountid", required = true) String accountid
) {
log.info("GET /user/account");
log.info("accountid: " + accountid);
try{
//передаем в модель данные аккаунта
AccountEntity account = accountService.findById(Long.valueOf(accountid));
model.addAttribute("account", account);
//передаем в модель перечень доступных курсов
Collection<TargetEntity> targets = targetService.findAllByPositionId(account.getPosition().getId());
Collection<CourseEntity> courses = targets.stream()
.map(TargetEntity::getCourse)
.distinct()
.collect(Collectors.toList());
model.addAttribute("courses", courses);
//передаем в модель статусы прохождения курсов
return "pages/user/account";
} catch (Exception e) {
StringBuilder msg = new StringBuilder();
msg.append("Не удалось получить данные аккаунта: " + e.getMessage());
log.error(msg.toString());
model.addAttribute("error", msg.toString());
return "pages/debuger/error";
}
}
}

47
main/src/main/java/gsp/technologies/main/user/course/CourseFaceController.java → main/src/main/java/gsp/technologies/main/face/supplier/SupCourseController.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.course; package gsp.technologies.main.face.supplier;
import java.util.Collection; import java.util.Collection;
@ -11,15 +11,17 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import gsp.technologies.main.user.account.AccountService; import gsp.technologies.main.api.account.AccountService;
import gsp.technologies.main.api.course.CourseEntity;
import gsp.technologies.main.api.course.CourseService;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@Controller @Controller
@RequestMapping(path = "/courses") @RequestMapping(path = "/supplier")
public class CourseFaceController { public class SupCourseController {
private static final Logger log = LoggerFactory.getLogger(CourseFaceController.class); private static final Logger log = LoggerFactory.getLogger(SupCourseController.class);
@Autowired @Autowired
private CourseService courseService; private CourseService courseService;
@ -27,45 +29,38 @@ public class CourseFaceController {
@Autowired @Autowired
private AccountService accountService; private AccountService accountService;
public CourseFaceController(CourseService courseService, AccountService accountService) { public SupCourseController(CourseService courseService, AccountService accountService) {
this.courseService = courseService; this.courseService = courseService;
this.accountService = accountService; this.accountService = accountService;
} }
@GetMapping("") /**
* Перечень курсов размещенных на сервере
* - перенести в контроллер supplier
* @param model
* @return
*/
@GetMapping("/courses")
public String course(Model model) { public String course(Model model) {
log.info("GET /courses"); log.info("GET /supplier/courses");
Collection <CourseEntity> courses = courseService.findAll(); Collection <CourseEntity> courses = courseService.findAll();
model.addAttribute("courses", courses); model.addAttribute("courses", courses);
return "courses/main"; return "/pages/supplier/courses";
} }
/** /**
* Создание нового курса * Создание нового курса
* - перенести в контроллер supplier
*/ */
@PostMapping("") @PostMapping("/courses")
public String create(@RequestParam(name = "name", required = true) String name) { public String create(@RequestParam(name = "name", required = true) String name) {
log.info("POST /courses"); log.info("POST /supplier/courses");
CourseEntity entity = new CourseEntity(); CourseEntity entity = new CourseEntity();
entity.setName(name); entity.setName(name);
courseService.save(entity); courseService.save(entity);
return "redirect:/courses"; return "redirect:/supplier/courses";
}
@GetMapping("/view")
public String view(
Model model,
@RequestParam(name = "courseid", required = true) Long courseid,
@RequestParam(name = "accountid", required = true) String accountid
){
model.addAttribute("account", accountService.findById(Long.valueOf(accountid)));
model.addAttribute("courseid", courseid);
return "course";
} }
} }

42
main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationFaceController.java → main/src/main/java/gsp/technologies/main/face/supplier/SupOrganizationController.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.organization; package gsp.technologies.main.face.supplier;
import java.util.Collection; import java.util.Collection;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -12,18 +12,22 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import gsp.technologies.main.api.organization.OrganizationEntity;
import gsp.technologies.main.api.organization.OrganizationService;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@Controller @Controller
@RequestMapping(path = "/organizations") @RequestMapping(path = "/supplier")
public class OrganizationFaceController { public class SupOrganizationController {
private static final Logger log = LoggerFactory.getLogger(OrganizationFaceController.class); private static final Logger log = LoggerFactory.getLogger(SupOrganizationController.class);
@Autowired @Autowired
private OrganizationService service; private OrganizationService service;
public OrganizationFaceController(OrganizationService organizationService) { public SupOrganizationController(OrganizationService organizationService) {
this.service = organizationService; this.service = organizationService;
} }
@ -32,9 +36,9 @@ public class OrganizationFaceController {
* Главная страница для работы с перечнем организаций * Главная страница для работы с перечнем организаций
* @return * @return
*/ */
@GetMapping("") @GetMapping("/organizations")
public String organizations(Model model) { public String organizations(Model model) {
log.info("GET /organizations"); log.info("GET /supplier/organizations");
// получаем список организаций // получаем список организаций
Collection<OrganizationEntity> organizations = service.findAll(); Collection<OrganizationEntity> organizations = service.findAll();
// сортируем по названию // сортируем по названию
@ -42,54 +46,54 @@ public class OrganizationFaceController {
// передаем список организаций в шаблон // передаем список организаций в шаблон
model.addAttribute("organizations", organizations); model.addAttribute("organizations", organizations);
model.addAttribute("organizationService", service); model.addAttribute("organizationService", service);
return "organizations/main"; return "pages/supplier/organizations";
} }
/** /**
* Добавление новой организации * Добавление новой организации
*/ */
@PostMapping("") @PostMapping("/organizations")
public String create(@RequestParam(name = "name", required = true) String name) { public String create(@RequestParam(name = "name", required = true) String name) {
log.info("POST /organizations"); log.info("POST /supplier/organizations");
OrganizationEntity entity = new OrganizationEntity(); OrganizationEntity entity = new OrganizationEntity();
entity.setName(name); entity.setName(name);
service.save(entity); service.save(entity);
return "redirect:/organizations"; return "redirect:/supplier/organizations";
} }
/** /**
* Удаление организации * Удаление организации
* @param id * @param id
*/ */
@GetMapping("/{id}/delete") @GetMapping("/organizations/{id}/delete")
public String delete(@PathVariable(name = "id", required = true) Long id) { public String delete(@PathVariable(name = "id", required = true) Long id) {
log.info("GET /organizations/{id}/delete"); log.info("GET /supplier/organizations/{id}/delete");
service.deleteById(id); service.deleteById(id);
return "redirect:/organizations"; return "redirect:/supplier/organizations";
} }
/** /**
* Переход к форме редактирования организации * Переход к форме редактирования организации
*/ */
@GetMapping("/{id}/edit") @GetMapping("/organizations/{id}/edit")
public String edit(@PathVariable(name = "id", required = true) Long id, Model model) { public String edit(@PathVariable(name = "id", required = true) Long id, Model model) {
log.info("GET /organizations/{id}/edit"); log.info("GET /organizations/{id}/edit");
OrganizationEntity entity = service.findById(id); OrganizationEntity entity = service.findById(id);
model.addAttribute("organization", entity); model.addAttribute("organization", entity);
return "organizations/edit"; return "pages/supplier/organizations-edit";
} }
/** /**
* Редакрирование организации * Редакрирование организации
*/ */
@PostMapping("/{id}/edit") @PostMapping("/organizations/{id}/edit")
public String update(@PathVariable(name = "id", required = true) Long id, @RequestParam(name = "name", required = true) String name) { public String update(@PathVariable(name = "id", required = true) Long id, @RequestParam(name = "name", required = true) String name) {
log.info("POST /organizations/{id}/edit"); log.info("POST /supplier/organizations/{id}/edit");
OrganizationEntity entity = new OrganizationEntity(); OrganizationEntity entity = new OrganizationEntity();
entity.setName(name); entity.setName(name);
entity.setId(id); entity.setId(id);
service.save(entity); service.save(entity);
return "redirect:/organizations"; return "redirect:/supplier/organizations";
} }

30
main/src/main/java/gsp/technologies/main/supplier/position/PositionFaceController.java → main/src/main/java/gsp/technologies/main/face/supplier/SupPositionController.java

@ -1,4 +1,4 @@
package gsp.technologies.main.supplier.position; package gsp.technologies.main.face.supplier;
import java.util.Collection; import java.util.Collection;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -16,13 +16,15 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import gsp.technologies.main.supplier.organization.OrganizationEntity; import gsp.technologies.main.api.organization.OrganizationEntity;
import gsp.technologies.main.supplier.organization.OrganizationService; import gsp.technologies.main.api.organization.OrganizationService;
import gsp.technologies.main.api.position.PositionEntity;
import gsp.technologies.main.api.position.PositionService;
@Controller @Controller
@RequestMapping(path = "/positions") @RequestMapping(path = "/supplier")
public class PositionFaceController { public class SupPositionController {
private static final Logger log = LoggerFactory.getLogger(PositionFaceController.class); private static final Logger log = LoggerFactory.getLogger(SupPositionController.class);
@Autowired @Autowired
private OrganizationService organizationService; private OrganizationService organizationService;
@ -30,7 +32,7 @@ public class PositionFaceController {
@Autowired @Autowired
private PositionService positionService; private PositionService positionService;
public PositionFaceController(PositionService positionService, OrganizationService organizationService) { public SupPositionController(PositionService positionService, OrganizationService organizationService) {
this.positionService = positionService; this.positionService = positionService;
this.organizationService = organizationService; this.organizationService = organizationService;
} }
@ -38,9 +40,9 @@ public class PositionFaceController {
/** /**
* Главная страница работы с должностями * Главная страница работы с должностями
*/ */
@GetMapping("") @GetMapping("/positions")
public String positions(Model model) { public String positions(Model model) {
log.info("GET /positions"); log.info("GET /supplier/positions");
// получаем список организаций // получаем список организаций
Collection<OrganizationEntity> organizations = organizationService.findAll() Collection<OrganizationEntity> organizations = organizationService.findAll()
@ -51,29 +53,29 @@ public class PositionFaceController {
//получаем список должностей //получаем список должностей
int number = 0; int number = 0;
int size = 100; int size = 100;
String sortBy = "name"; String sortBy = "organization.name";
Sort sort = Sort.by(sortBy); Sort sort = Sort.by(sortBy);
Pageable of = PageRequest.of(number, size, sort); Pageable of = PageRequest.of(number, size, sort);
Collection<PositionEntity> positions = positionService.findAll(of).getContent(); Collection<PositionEntity> positions = positionService.findAll(of).getContent();
model.addAttribute("positions", positions); model.addAttribute("positions", positions);
return "positions/main"; return "pages/supplier/positions";
} }
/** /**
* Добавление должности * Добавление должности
*/ */
@PostMapping("") @PostMapping("/positions")
public String create( public String create(
@RequestParam(name = "name", required = true) String name, @RequestParam(name = "name", required = true) String name,
@RequestParam(name = "organizationId", required = true) Long organizationId) { @RequestParam(name = "organizationId", required = true) Long organizationId) {
log.info("POST /positions"); log.info("POST /supplier/positions");
PositionEntity entity = new PositionEntity(); PositionEntity entity = new PositionEntity();
entity.setName(name); entity.setName(name);
entity.setOrganization(organizationService.findById(organizationId)); entity.setOrganization(organizationService.findById(organizationId));
positionService.save(entity); positionService.save(entity);
return "redirect:/positions"; return "redirect:/supplier/positions";
} }
} }

37
main/src/main/java/gsp/technologies/main/supplier/target/TargetFaceController.java → main/src/main/java/gsp/technologies/main/face/supplier/SupTargetFaceController.java

@ -1,7 +1,6 @@
package gsp.technologies.main.supplier.target; package gsp.technologies.main.face.supplier;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -13,17 +12,19 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import gsp.technologies.main.supplier.organization.OrganizationEntity; import gsp.technologies.main.api.course.CourseEntity;
import gsp.technologies.main.supplier.organization.OrganizationService; import gsp.technologies.main.api.course.CourseService;
import gsp.technologies.main.supplier.position.PositionEntity; import gsp.technologies.main.api.organization.OrganizationEntity;
import gsp.technologies.main.supplier.position.PositionService; import gsp.technologies.main.api.organization.OrganizationService;
import gsp.technologies.main.user.course.CourseEntity; import gsp.technologies.main.api.position.PositionEntity;
import gsp.technologies.main.user.course.CourseService; import gsp.technologies.main.api.position.PositionService;
import gsp.technologies.main.api.target.TargetEntity;
import gsp.technologies.main.api.target.TargetService;
@Controller @Controller
@RequestMapping(path = "/targets") @RequestMapping(path = "/supplier")
public class TargetFaceController { public class SupTargetFaceController {
private static final Logger log = LoggerFactory.getLogger(TargetFaceController.class); private static final Logger log = LoggerFactory.getLogger(SupTargetFaceController.class);
@Autowired @Autowired
private TargetService targetService; private TargetService targetService;
@ -37,16 +38,16 @@ public class TargetFaceController {
@Autowired @Autowired
private CourseService courseService; private CourseService courseService;
public TargetFaceController(TargetService targetService, OrganizationService organizationService, PositionService positionService, CourseService courseService) { public SupTargetFaceController(TargetService targetService, OrganizationService organizationService, PositionService positionService, CourseService courseService) {
this.targetService = targetService; this.targetService = targetService;
this.organizationService = organizationService; this.organizationService = organizationService;
this.positionService = positionService; this.positionService = positionService;
this.courseService = courseService; this.courseService = courseService;
} }
@GetMapping("") @GetMapping("/targets")
public String targets(Model model) { public String targets(Model model) {
log.info("GET /targets"); log.info("GET /supplier/targets");
//передаем в шаблон перечень организаций //передаем в шаблон перечень организаций
Collection <OrganizationEntity> organizations = organizationService.findAll(); Collection <OrganizationEntity> organizations = organizationService.findAll();
model.addAttribute("organizations", organizations); model.addAttribute("organizations", organizations);
@ -63,17 +64,17 @@ public class TargetFaceController {
Collection <TargetEntity> targets = targetService.findAll(); Collection <TargetEntity> targets = targetService.findAll();
model.addAttribute("targets", targets); model.addAttribute("targets", targets);
return "targets/main"; return "pages/supplier/targets";
} }
@PostMapping("") @PostMapping("/targets")
public String create( public String create(
@RequestParam(name = "courseid", required = true) Long courseid, @RequestParam(name = "courseid", required = true) Long courseid,
@RequestParam(name = "positionid", required = true) Long positionid, @RequestParam(name = "positionid", required = true) Long positionid,
@RequestParam(name = "questions-count", required = true) Integer questionsCount, @RequestParam(name = "questions-count", required = true) Integer questionsCount,
@RequestParam(name = "questions-limit", required = true) Integer questionsLimit @RequestParam(name = "questions-limit", required = true) Integer questionsLimit
){ ){
log.info("POST /targets"); log.info("POST /supplier/targets");
TargetEntity entity = TargetEntity.builder() TargetEntity entity = TargetEntity.builder()
.course(courseService.findById(courseid)) .course(courseService.findById(courseid))
.position(positionService.findById(positionid)) .position(positionService.findById(positionid))
@ -82,7 +83,7 @@ public class TargetFaceController {
.build(); .build();
targetService.save(entity); targetService.save(entity);
return "redirect:/targets"; return "redirect:/supplier/targets";
} }

114
main/src/main/java/gsp/technologies/main/face/user/UserAccountController.java

@ -0,0 +1,114 @@
package gsp.technologies.main.face.user;
import java.util.Collection;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import gsp.technologies.main.api.account.AccountEntity;
import gsp.technologies.main.api.account.AccountService;
import gsp.technologies.main.api.course.CourseEntity;
import gsp.technologies.main.api.organization.OrganizationService;
import gsp.technologies.main.api.position.PositionEntity;
import gsp.technologies.main.api.position.PositionService;
import gsp.technologies.main.api.target.TargetEntity;
import gsp.technologies.main.api.target.TargetService;
import gsp.technologies.main.common.code.Code;
/**
* Контроллер формы аккаунта
* возвращает thymeleaf шаблон
*/
@Controller
@RequestMapping(path = "/user/account")
public class UserAccountController {
private static final Logger log = LoggerFactory.getLogger(UserAccountController.class);
@Autowired
private OrganizationService organizationService;
@Autowired
private PositionService positionService;
@Autowired
private AccountService accountService;
@Autowired
private TargetService targetService;
public UserAccountController(
PositionService positionService
, OrganizationService organizationService
, AccountService accountService
, TargetService targetService
) {
this.positionService = positionService;
this.organizationService = organizationService;
this.accountService = accountService;
this.targetService = targetService;
}
/**
* Форма аккаунта:
* - данные аккаунта (id, organization, position)
* - список курсов аккаунта
*
* @param model
* @param accountid
* @param positionid
* @return
*/
@GetMapping("")
public String account(Model model,
@RequestParam(name = "positionid", required = true) String positionid
) {
log.info("GET /user/account");
//данные аккаунта (id, organization, position)
log.info("positionid: " + positionid);
try{
log.info("positionid: " + positionid);
PositionEntity position = positionService.findById(Long.valueOf(positionid));
//обработать вход нового пользователя
AccountEntity account = AccountEntity.builder()
.position(position)
.build();
//сохранить в базе данных
account = accountService.save(account);
log.info("сохраняем account: " + account);
//получить id аккаунта
String code = Code.encode(account.getId() + "");
account.setCode(code);
//обновили аккаунт в базе данных
account = accountService.save(account);
model.addAttribute("account", account);
//передаем в модель перечень доступных курсов
Collection<TargetEntity> targets = targetService.findAllByPositionId(account.getPosition().getId());
Collection<CourseEntity> courses = targets.stream()
.map(TargetEntity::getCourse)
.distinct()
.collect(Collectors.toList());
model.addAttribute("courses", courses);
//передаем в модель статусы прохождения курсов
return "pages/user/account";
} catch (Exception e) {
StringBuilder msg = new StringBuilder();
msg.append("Не удалось получить данные аккаунта: " + e.getMessage());
log.error(msg.toString());
model.addAttribute("error", msg.toString());
return "pages/debuger/error";
}
}
}

90
main/src/main/java/gsp/technologies/main/face/user/UserCourseController.java

@ -0,0 +1,90 @@
package gsp.technologies.main.face.user;
import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import gsp.technologies.main.api.account.AccountService;
import gsp.technologies.main.api.course.CourseEntity;
import gsp.technologies.main.api.course.CourseService;
import org.springframework.web.bind.annotation.PostMapping;
@Controller
@RequestMapping(path = "/user")
public class UserCourseController {
private static final Logger log = LoggerFactory.getLogger(UserCourseController.class);
@Autowired
private CourseService courseService;
@Autowired
private AccountService accountService;
public UserCourseController(CourseService courseService, AccountService accountService) {
this.courseService = courseService;
this.accountService = accountService;
}
/**
* Перечень курсов размещенных на сервере
* - перенести в контроллер supplier
* @param model
* @return
*/
@GetMapping("/courses")
public String course(Model model) {
log.info("GET /user/courses");
Collection <CourseEntity> courses = courseService.findAll();
model.addAttribute("courses", courses);
return "/pages/user/course";
}
/**
* Создание нового курса
* - перенести в контроллер supplier
*/
@PostMapping("/courses")
public String create(@RequestParam(name = "name", required = true) String name) {
log.info("POST /user/courses");
CourseEntity entity = new CourseEntity();
entity.setName(name);
courseService.save(entity);
return "redirect:/user/courses";
}
/**
* Просмотр контента курса назначенного пользователю
* - перенести в метод course()
* - добавить id курса в переменную пути
* @param model
* @param courseid
* @param accountid
* @return
*/
@GetMapping("/course")
public String view(
Model model,
@RequestParam(name = "courseid", required = true) Long courseid,
@RequestParam(name = "accountid", required = true) String accountid
){
log.info("GET /user/courses/view");
model.addAttribute("account", accountService.findById(Long.valueOf(accountid)));
model.addAttribute("courseid", courseid);
return "/pages/user/course";
}
}

18
main/src/main/java/gsp/technologies/main/user/login/LoginController.java → main/src/main/java/gsp/technologies/main/face/user/UserLoginController.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.login; package gsp.technologies.main.face.user;
import java.util.Collection; import java.util.Collection;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -11,10 +11,10 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import gsp.technologies.main.supplier.organization.OrganizationEntity; import gsp.technologies.main.api.organization.OrganizationEntity;
import gsp.technologies.main.supplier.organization.OrganizationService; import gsp.technologies.main.api.organization.OrganizationService;
import gsp.technologies.main.supplier.position.PositionEntity; import gsp.technologies.main.api.position.PositionEntity;
import gsp.technologies.main.supplier.position.PositionService; import gsp.technologies.main.api.position.PositionService;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -27,21 +27,21 @@ import org.springframework.web.bind.annotation.GetMapping;
*/ */
@Controller @Controller
@RequestMapping(path = "/user/login") @RequestMapping(path = "/user/login")
public class LoginController { public class UserLoginController {
@Autowired @Autowired
private OrganizationService organizationService; private OrganizationService organizationService;
@Autowired @Autowired
private PositionService positionService; private PositionService positionService;
public LoginController(PositionService positionService) { public UserLoginController(PositionService positionService) {
this.positionService = positionService; this.positionService = positionService;
} }
private static final Logger log = LoggerFactory.getLogger(LoginController.class); private static final Logger log = LoggerFactory.getLogger(UserLoginController.class);
@GetMapping("") @GetMapping("")
public String login(Model model) { public String login(Model model) {
log.info("GET /login"); log.info("GET /user/login");
log.info("текущая сессия: {}", RequestContextHolder.currentRequestAttributes().getSessionId()); log.info("текущая сессия: {}", RequestContextHolder.currentRequestAttributes().getSessionId());
//получаем список организаций //получаем список организаций
Collection<OrganizationEntity> organizations = organizationService.findAll(); Collection<OrganizationEntity> organizations = organizationService.findAll();

6
main/src/main/java/gsp/technologies/main/user/logout/LogoutController.java → main/src/main/java/gsp/technologies/main/face/user/UserLogoutController.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.logout; package gsp.technologies.main.face.user;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -13,8 +13,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
*/ */
@Controller @Controller
@RequestMapping(path = "/logout") @RequestMapping(path = "/logout")
public class LogoutController { public class UserLogoutController {
private static final Logger log = LoggerFactory.getLogger(LogoutController.class); private static final Logger log = LoggerFactory.getLogger(UserLogoutController.class);
@GetMapping("") @GetMapping("")
public String mainframe() { public String mainframe() {

6
main/src/main/java/gsp/technologies/main/user/quiz/QuizController.java → main/src/main/java/gsp/technologies/main/face/user/UserQuizController.java

@ -1,4 +1,4 @@
package gsp.technologies.main.user.quiz; package gsp.technologies.main.face.user;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.RequestParam;
@Controller @Controller
@RequestMapping(path = "/quiz") @RequestMapping(path = "/quiz")
public class QuizController { public class UserQuizController {
private static final Logger log = LoggerFactory.getLogger(QuizController.class); private static final Logger log = LoggerFactory.getLogger(UserQuizController.class);
@GetMapping("") @GetMapping("")
public String quiz(Model model, @RequestParam(name = "accountid", required = true) String accountid) { public String quiz(Model model, @RequestParam(name = "accountid", required = true) String accountid) {

149
main/src/main/java/gsp/technologies/main/user/account/AccountFaceController.java

@ -1,149 +0,0 @@
package gsp.technologies.main.user.account;
import java.util.Collection;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import gsp.technologies.main.common.code.Code;
import gsp.technologies.main.supplier.organization.OrganizationService;
import gsp.technologies.main.supplier.position.PositionEntity;
import gsp.technologies.main.supplier.position.PositionService;
import gsp.technologies.main.supplier.target.TargetEntity;
import gsp.technologies.main.supplier.target.TargetService;
import gsp.technologies.main.user.course.CourseEntity;
/**
* Контроллер формы аккаунта
* возвращает thymeleaf шаблон
*/
@Controller
@RequestMapping(path = "/account")
public class AccountFaceController {
private static final Logger log = LoggerFactory.getLogger(AccountFaceController.class);
@Autowired
private OrganizationService organizationService;
@Autowired
private PositionService positionService;
@Autowired
private AccountService accountService;
@Autowired
private TargetService targetService;
public AccountFaceController(
PositionService positionService
, OrganizationService organizationService
, AccountService accountService
, TargetService targetService
) {
this.positionService = positionService;
this.organizationService = organizationService;
this.accountService = accountService;
this.targetService = targetService;
}
/**
* Форма аккаунта:
* - данные аккаунта (id, organization, position)
* - список курсов аккаунта
*
* @param model
* @param accountid
* @param positionid
* @return
*/
@GetMapping("")
public String account(Model model,
@RequestParam(name = "accountid", required = false) String accountid,
@RequestParam(name = "positionid", required = false) String positionid
) {
log.info("GET /account");
//данные аккаунта (id, organization, position)
log.info("accountid: " + accountid);
log.info("positionid: " + positionid);
if (accountid != null) {
log.info("accountid: " + accountid);
try{
//передаем в модель данные аккаунта
AccountEntity account = accountService.findById(Long.valueOf(accountid));
model.addAttribute("account", account);
//передаем в модель перечень доступных курсов
Collection<TargetEntity> targets = targetService.findAllByPositionId(account.getPosition().getId());
Collection<CourseEntity> courses = targets.stream()
.map(TargetEntity::getCourse)
.distinct()
.collect(Collectors.toList());
model.addAttribute("courses", courses);
//передаем в модель статусы прохождения курсов
return "account";
} catch (Exception e) {
StringBuilder msg = new StringBuilder();
msg.append("Не удалось получить данные аккаунта: " + e.getMessage());
log.error(msg.toString());
model.addAttribute("error", msg.toString());
return "error";
}
}
if (positionid != null) {
try{
log.info("positionid: " + positionid);
PositionEntity position = positionService.findById(Long.valueOf(positionid));
//обработать вход нового пользователя
AccountEntity account = AccountEntity.builder()
.position(position)
.build();
//сохранить в базе данных
account = accountService.save(account);
log.info("сохраняем account: " + account);
//получить id аккаунта
String code = Code.encode(account.getId() + "");
account.setCode(code);
//обновили аккаунт в базе данных
account = accountService.save(account);
model.addAttribute("account", account);
//передаем в модель перечень доступных курсов
Collection<TargetEntity> targets = targetService.findAllByPositionId(account.getPosition().getId());
Collection<CourseEntity> courses = targets.stream()
.map(TargetEntity::getCourse)
.distinct()
.collect(Collectors.toList());
model.addAttribute("courses", courses);
//передаем в модель статусы прохождения курсов
return "account";
} catch (Exception e) {
StringBuilder msg = new StringBuilder();
msg.append("Не удалось получить данные аккаунта: " + e.getMessage());
log.error(msg.toString());
model.addAttribute("error", msg.toString());
return "error";
}
}
//вернуть страницу ошибки
StringBuilder msg = new StringBuilder();
msg.append("Не указаны данные для доступа к аккаунту.");
log.error(msg.toString());
model.addAttribute("error", msg.toString());
return "error";
}
}

21
main/src/main/resources/static/content/courses/52/main.md

@ -0,0 +1,21 @@
# Стропальщик
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Omnis inventore eveniet sunt modi deserunt, officia saepe aut in architecto id eaque reiciendis ullam eos deleniti minima, facere asperiores temporibus necessitatibus.

0
main/src/main/resources/templates/pages/reviewer/find.html → main/src/main/resources/templates/pages/reviewer/login.html

2
main/src/main/resources/templates/pages/user/course.html

@ -21,7 +21,7 @@ xmlns:th="http://www.thymeleaf.org">
</header> </header>
<body> <body>
<!-- курс --> <!-- курс -->
<div th:insert="~{shards/courses :: main(id=${courseid})}"></div> <div th:insert="~{shards/courses :: content(id=${courseid})}"></div>
<!-- <div th:insert="~{fragments/controls :: gotoQuiz(accountid=${account.id})}"></div> --> <!-- <div th:insert="~{fragments/controls :: gotoQuiz(accountid=${account.id})}"></div> -->
</body> </body>
<footer> <footer>

6
main/src/main/resources/templates/shards/accounts.html

@ -5,11 +5,7 @@
<!-- Данные об аккаунте: id, organization, position --> <!-- Данные об аккаунте: id, organization, position -->
<div th:fragment="info(account)"> <div th:fragment="info(account)">
<hr> <hr>
<!-- <span>id: <span th:text="${account.id}"></span></span>
<br> -->
<span class="code">ID: <span th:text="${account.code}"></span></span> <span class="code">ID: <span th:text="${account.code}"></span></span>
<!-- <br> -->
<!-- <span>session: <span th:text="${account.sessionid}"></span></span> -->
<br> <br>
<span>organization: <span th:text="${account.position.organization.name}"></span></span> <span>organization: <span th:text="${account.position.organization.name}"></span></span>
<br> <br>
@ -39,7 +35,7 @@
</div> </div>
</td> --> </td> -->
<td> <td>
<form th:action="@{/courses/view}" th:method="get"> <form th:action="@{/user/course}" th:method="get">
<input type="hidden" name="courseid" th:value="${course.id}"> <input type="hidden" name="courseid" th:value="${course.id}">
<input type="hidden" name="accountid" th:value="${account.id}"> <input type="hidden" name="accountid" th:value="${account.id}">
<input type="submit" value=">>>"> <input type="submit" value=">>>">

6
main/src/main/resources/templates/shards/courses.html

@ -20,8 +20,8 @@
<td th:text="${course.id}"></td> <td th:text="${course.id}"></td>
<td th:text="${course.name}"></td> <td th:text="${course.name}"></td>
<td> <td>
<a th:href="@{/courses/{id}/edit(id=${course.id})}">Редактировать</a> <a th:href="@{/supplier/courses/{id}/edit(id=${course.id})}">Редактировать</a>
<a th:href="@{/courses/{id}/delete(id=${course.id})}">Удалить</a> <a th:href="@{/supplier/courses/{id}/delete(id=${course.id})}">Удалить</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -33,7 +33,7 @@
<div th:fragment="create"> <div th:fragment="create">
<hr> <hr>
<h2>Добавление нового курса:</h2> <h2>Добавление нового курса:</h2>
<form th:action="@{/courses}" th:method="post"> <form th:action="@{/supplier/courses}" th:method="post">
<label for="name">Наименование курса </label> <label for="name">Наименование курса </label>
<input type="text" id="name" name="name"> <input type="text" id="name" name="name">
<input type="submit" value="Добавить"> <input type="submit" value="Добавить">

4
main/src/main/resources/templates/shards/navi.html

@ -17,7 +17,7 @@
<!-- отправляем наименование наименование должности <!-- отправляем наименование наименование должности
для перехода на целевой курс --> для перехода на целевой курс -->
<form th:action="@{/account}" th:method="get"> <form th:action="@{/user/account}" th:method="get">
<label for="position-select">Выберите должность</label> <label for="position-select">Выберите должность</label>
<select id="position-select" name="positionid"> <select id="position-select" name="positionid">
<option value="0" disabled selected>должность</option> <option value="0" disabled selected>должность</option>
@ -31,7 +31,7 @@
<div th:fragment="auth"> <div th:fragment="auth">
<!-- Отправляем запрос с параметром code <!-- Отправляем запрос с параметром code
открываем существующую попытку --> открываем существующую попытку -->
<form th:action="@{/account}" th:method="get"> <form th:action="@{/reviewer/account}" th:method="get">
<label for="code">Если Вам нужно продолжить прохождение уже начатого курса - введите ID своего аккаунта: </label> <label for="code">Если Вам нужно продолжить прохождение уже начатого курса - введите ID своего аккаунта: </label>
<input type="text" id="code" name="accountid"> <input type="text" id="code" name="accountid">
<input type="submit" value="Проверить код"> <input type="submit" value="Проверить код">

12
main/src/main/resources/templates/shards/organizations.html

@ -18,23 +18,19 @@
<tr th:each="organization : ${organizations}"> <tr th:each="organization : ${organizations}">
<td th:text="${organization.name}"></td> <td th:text="${organization.name}"></td>
<td> <td>
<a th:href="@{/organizations/{id}/edit(id=${organization.id})}">Редактировать</a> <a th:href="@{/supplier/organizations/{id}/edit(id=${organization.id})}">Редактировать</a>
<a th:href="@{/organizations/{id}/delete(id=${organization.id})}">Удалить</a> <a th:href="@{/supplier/organizations/{id}/delete(id=${organization.id})}">Удалить</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<hr>
<div th:each="organization : ${organizations}">
<div th:text="${organization.name}"></div>
</div>
</div> </div>
<!-- Добавление новой организации --> <!-- Добавление новой организации -->
<div th:fragment="create"> <div th:fragment="create">
<hr> <hr>
<h2>Добавление новой организации:</h2> <h2>Добавление новой организации:</h2>
<form th:action="@{/organizations}" th:method="post"> <form th:action="@{/supplier/organizations}" th:method="post">
<label for="name">Название организации: </label> <label for="name">Название организации: </label>
<input type="text" id="name" name="name"> <input type="text" id="name" name="name">
<br> <br>
@ -46,7 +42,7 @@
<div th:fragment="edit(organization)"> <div th:fragment="edit(organization)">
<hr> <hr>
<h2>Редактирование организации: <span th:text="${organization.name}"></span></h2> <h2>Редактирование организации: <span th:text="${organization.name}"></span></h2>
<form th:action="@{/organizations/{id}/edit(id=${organization.id})}" th:method="post"> <form th:action="@{/supplier/organizations/{id}/edit(id=${organization.id})}" th:method="post">
<label for="name" >Название организации: </label> <label for="name" >Название организации: </label>
<input type="text" th:name="name" th:value="${organization.name}"> <input type="text" th:name="name" th:value="${organization.name}">
<br> <br>

14
main/src/main/resources/templates/shards/positions.html

@ -3,7 +3,7 @@
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<body> <body>
<!-- Перечень организаций --> <!-- Перечень должностей -->
<div th:fragment="list(positions)"> <div th:fragment="list(positions)">
<hr> <hr>
<h2>Список должностей:</h2> <h2>Список должностей:</h2>
@ -20,23 +20,19 @@
<td th:text="${position.organization.name}"></td> <td th:text="${position.organization.name}"></td>
<td th:text="${position.name}"></td> <td th:text="${position.name}"></td>
<td> <td>
<a th:href="@{/positions/{id}/edit(id=${position.id})}">Редактировать</a> <a th:href="@{/supplier/positions/{id}/edit(id=${position.id})}">Редактировать</a>
<a th:href="@{/positions/{id}/delete(id=${position.id})}">Удалить</a> <a th:href="@{/supplier/positions/{id}/delete(id=${position.id})}">Удалить</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<hr>
<div th:each="position : ${positions}">
<div th:text="${position.name}"></div>
</div>
</div> </div>
<!-- Добавление новой должности --> <!-- Добавление новой должности -->
<div th:fragment="create(organizations)"> <div th:fragment="create(organizations)">
<hr> <hr>
<h2>Добавление новой должности:</h2> <h2>Добавление новой должности:</h2>
<form th:action="@{/positions}" th:method="post"> <form th:action="@{/supplier/positions}" th:method="post">
<label for="organizationId">Организация: </label> <label for="organizationId">Организация: </label>
<select id="organizationId" name="organizationId"> <select id="organizationId" name="organizationId">
<option value="0" disabled >выберите организацию</option> <option value="0" disabled >выберите организацию</option>
@ -49,7 +45,7 @@
</form> </form>
</div> </div>
<!-- Редактирование олжностей --> <!-- Редактирование должностей -->
<!-- <div th:fragment="edit(position)"> <!-- <div th:fragment="edit(position)">
<hr> <hr>
<h2>Редактирование должности: <span th:text="${position.name}"></span></h2> <h2>Редактирование должности: <span th:text="${position.name}"></span></h2>

59
main/src/main/resources/templates/shards/targets.html

@ -6,7 +6,7 @@
<!-- Перечень задачь --> <!-- Перечень задачь -->
<div th:fragment="list(targets)"> <div th:fragment="list(targets)">
<hr> <hr>
<h2>Список задачь:</h2> <h2>Список задач:</h2>
<table> <table>
<thead> <thead>
<tr> <tr>
@ -45,32 +45,64 @@
<div th:fragment="create(organizations, positions, courses)"> <div th:fragment="create(organizations, positions, courses)">
<hr> <hr>
<h2>Добавление новой задачи:</h2> <h2>Добавление новой задачи:</h2>
<form th:action="@{/targets}" th:method="post"> <form th:action="@{/supplier/targets}" th:method="post">
<!-- выбираем организацию -->
<table>
<thead>
<th>lables</th>
<th>inputs</th>
<th>edit</th>
</thead>
<tbody>
<tr>
<td>
<label for="organization-select">Организация: </label> <label for="organization-select">Организация: </label>
</td>
<td>
<!-- выбираем организацию -->
<select id="organization-select" name="organizationid"> <select id="organization-select" name="organizationid">
<option value="0" disabled selected>выберите организацию</option> <option value="0" disabled selected>выберите организацию</option>
<option th:each="organization : ${organizations}" th:value="${organization.id}" th:text="${organization.name}"></option> <option th:each="organization : ${organizations}" th:value="${organization.id}" th:text="${organization.name}"></option>
</select> </select>
<br> </td>
<td>
<!-- отрабатывает скрипт по добавлению селекта должности --> <a href="#">изменить список</a>
</td>
<!-- выбираем должность --> </tr>
<tr>
<td>
<label for="position-select">Должность: </label> <label for="position-select">Должность: </label>
</td>
<td>
<!-- выбираем должность -->
<select id="position-select" name="positionid"> <select id="position-select" name="positionid">
<option value="0" disabled selected>выберите должность</option> <option value="0" disabled selected>выберите должность</option>
<option th:each="position : ${positions}" th:value="${position.id}" th:text="${position.name}"></option> <option th:each="position : ${positions}" th:value="${position.id}" th:text="${position.name}"></option>
</select> </select>
<br> </td>
<td>
<a href="#">изменить список</a>
</td>
</tr>
<tr>
<td>
<label for="course-select">Курс: </label> <label for="course-select">Курс: </label>
</td>
<td>
<!-- выбираем курс -->
<select id="course-select" name="courseid"> <select id="course-select" name="courseid">
<option value="0" disabled selected >выберите курс</option> <option value="0" disabled selected >выберите курс</option>
<option th:each="course : ${courses}" th:value="${course.id}" th:text="${course.name}"></option> <option th:each="course : ${courses}" th:value="${course.id}" th:text="${course.name}"></option>
</select> </select>
<br> </td>
<td>
<a href="#">изменить список</a>
</td>
</tr>
</tbody>
</table>
<br>
<label for="questions-count">Количество вопросов для проверки знаний: </label> <label for="questions-count">Количество вопросов для проверки знаний: </label>
<br> <br>
<input type="text" id="questions-count" name="questions-count"> <input type="text" id="questions-count" name="questions-count">
@ -80,8 +112,9 @@
<br> <br>
<input type="text" id="questions-limit" name="questions-limit"> <input type="text" id="questions-limit" name="questions-limit">
<br> <br>
<br>
<input type="submit" value="Добавить"> <input type="submit" value="Добавить задачу">
</form> </form>
</div> </div>
@ -89,7 +122,7 @@
<!-- Редактирование олжностей --> <!-- Редактирование должностей -->
<!-- <div th:fragment="edit(position)"> <!-- <div th:fragment="edit(position)">
<hr> <hr>
<h2>Редактирование должности: <span th:text="${position.name}"></span></h2> <h2>Редактирование должности: <span th:text="${position.name}"></span></h2>

Loading…
Cancel
Save