diff --git a/main/src/main/java/gsp/technologies/main/access/login/AuthController.java b/main/src/main/java/gsp/technologies/main/access/login/AuthController.java deleted file mode 100644 index ea4a7da..0000000 --- a/main/src/main/java/gsp/technologies/main/access/login/AuthController.java +++ /dev/null @@ -1,55 +0,0 @@ -package gsp.technologies.main.access.login; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Controller; -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.mainframe.MainframeController; - -/** - * Контроллер авторизации пользователя - * - обработка запросов с учетными данными пользователя (id аккаунта) - * - обработка запросов с данным сессии (id сессии) - * - * сюда обращаются сервисы, которые хотят получить доступ к аккаунту - * - mainframe (содержит поля для перехода к аккаунту) - * - login (разработка формы пока не предусмотрена) - */ -@Controller -@RequestMapping(path = "/auth") -public class AuthController { - private static final Logger log = LoggerFactory.getLogger(MainframeController.class); - - /** - * Проверка наличия аккаунта в базе. - * В метод передается номер аккаунта в 35-ричной системе счисления - * номер аккаунта декодируется и направляется запрос на проверку в базу - * при отсутствии аккаунта в базе возвращается соответствующее сообщение - * при наличии аккаунта в базе возвращаются данные для перехода к запрошенному аккаунту - * - * @return - * - */ - @GetMapping("/check") - public AuthDTO checkAccount(@RequestParam("account") String account) { - log.info("GET /auth/check"); - log.info("Запрошен номер аккаунта: {}", account); - //сравнить номер сессии с имеющимися в базе - //при наличии вернуть порядковый номер существующей сессии (в 35-ричной системе счисления) - //при отсутствии внести новую запись в базу и вернуть ее порядковый номер - return new AuthDTO(); - } - - @GetMapping("/current") - public AuthDTO checkSession(@RequestParam("session") String session) { - log.info("GET /auth/current"); - log.info("Запрошен номер сессии: {}", session); - - - return new AuthDTO(); - } - -} diff --git a/main/src/main/java/gsp/technologies/main/access/login/AuthDTO.java b/main/src/main/java/gsp/technologies/main/access/login/AuthDTO.java deleted file mode 100644 index cc772b7..0000000 --- a/main/src/main/java/gsp/technologies/main/access/login/AuthDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package gsp.technologies.main.access.login; - -import java.io.Serializable; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * DTO для обмена данными с сервисом авторизации - * хранит: - * - номер сессии пользователя - * - номер запрошенного аккаунта - */ - -@AllArgsConstructor -@NoArgsConstructor -@Data -public class AuthDTO implements Serializable { - - private String sessionId; - private String accountId; - private String code35; - -} diff --git a/main/src/main/java/gsp/technologies/main/code/Code.java b/main/src/main/java/gsp/technologies/main/common/code/Code.java similarity index 88% rename from main/src/main/java/gsp/technologies/main/code/Code.java rename to main/src/main/java/gsp/technologies/main/common/code/Code.java index 4c7b920..af99e64 100644 --- a/main/src/main/java/gsp/technologies/main/code/Code.java +++ b/main/src/main/java/gsp/technologies/main/common/code/Code.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.code; +package gsp.technologies.main.common.code; /** * Класс, содержащий методы преобразования id в 35-ричное представление diff --git a/main/src/main/java/gsp/technologies/main/hello/HelloController.java b/main/src/main/java/gsp/technologies/main/common/hello/HelloController.java similarity index 81% rename from main/src/main/java/gsp/technologies/main/hello/HelloController.java rename to main/src/main/java/gsp/technologies/main/common/hello/HelloController.java index 26070f2..8cead44 100644 --- a/main/src/main/java/gsp/technologies/main/hello/HelloController.java +++ b/main/src/main/java/gsp/technologies/main/common/hello/HelloController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.hello; +package gsp.technologies.main.common.hello; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,6 +13,6 @@ public class HelloController { @CrossOrigin @GetMapping("/hello") public String hello(){ - return "hello"; + return "pages/common/hello"; } } \ No newline at end of file diff --git a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationApiController.java b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationApiController.java similarity index 94% rename from main/src/main/java/gsp/technologies/main/api/organization/OrganizationApiController.java rename to main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationApiController.java index aba4da2..ad05089 100644 --- a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationApiController.java +++ b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationApiController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.organization; +package gsp.technologies.main.supplier.organization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationEntity.java b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationEntity.java similarity index 88% rename from main/src/main/java/gsp/technologies/main/api/organization/OrganizationEntity.java rename to main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationEntity.java index 092b641..1c7a6db 100644 --- a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationEntity.java +++ b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationEntity.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.organization; +package gsp.technologies.main.supplier.organization; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationFaceController.java b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationFaceController.java similarity index 95% rename from main/src/main/java/gsp/technologies/main/api/organization/OrganizationFaceController.java rename to main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationFaceController.java index 39bf35d..8a5b6f3 100644 --- a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationFaceController.java +++ b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationFaceController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.organization; +package gsp.technologies.main.supplier.organization; import java.util.Collection; import java.util.stream.Collectors; diff --git a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationRepository.java b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationRepository.java similarity index 77% rename from main/src/main/java/gsp/technologies/main/api/organization/OrganizationRepository.java rename to main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationRepository.java index d01436c..b58aad3 100644 --- a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationRepository.java +++ b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationRepository.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.organization; +package gsp.technologies.main.supplier.organization; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationService.java b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationService.java similarity index 88% rename from main/src/main/java/gsp/technologies/main/api/organization/OrganizationService.java rename to main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationService.java index 111a51c..ebe6887 100644 --- a/main/src/main/java/gsp/technologies/main/api/organization/OrganizationService.java +++ b/main/src/main/java/gsp/technologies/main/supplier/organization/OrganizationService.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.organization; +package gsp.technologies.main.supplier.organization; import java.util.Collection; diff --git a/main/src/main/java/gsp/technologies/main/api/position/PositionApiController.java b/main/src/main/java/gsp/technologies/main/supplier/position/PositionApiController.java similarity index 96% rename from main/src/main/java/gsp/technologies/main/api/position/PositionApiController.java rename to main/src/main/java/gsp/technologies/main/supplier/position/PositionApiController.java index 899df9e..7a7391a 100644 --- a/main/src/main/java/gsp/technologies/main/api/position/PositionApiController.java +++ b/main/src/main/java/gsp/technologies/main/supplier/position/PositionApiController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.position; +package gsp.technologies.main.supplier.position; import java.util.Collection; diff --git a/main/src/main/java/gsp/technologies/main/api/position/PositionEntity.java b/main/src/main/java/gsp/technologies/main/supplier/position/PositionEntity.java similarity index 85% rename from main/src/main/java/gsp/technologies/main/api/position/PositionEntity.java rename to main/src/main/java/gsp/technologies/main/supplier/position/PositionEntity.java index c92863b..35940f3 100644 --- a/main/src/main/java/gsp/technologies/main/api/position/PositionEntity.java +++ b/main/src/main/java/gsp/technologies/main/supplier/position/PositionEntity.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.position; +package gsp.technologies.main.supplier.position; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; @@ -15,7 +15,7 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; -import gsp.technologies.main.api.organization.OrganizationEntity; +import gsp.technologies.main.supplier.organization.OrganizationEntity; @Data @AllArgsConstructor diff --git a/main/src/main/java/gsp/technologies/main/api/position/PositionFaceController.java b/main/src/main/java/gsp/technologies/main/supplier/position/PositionFaceController.java similarity index 90% rename from main/src/main/java/gsp/technologies/main/api/position/PositionFaceController.java rename to main/src/main/java/gsp/technologies/main/supplier/position/PositionFaceController.java index 740032a..448751c 100644 --- a/main/src/main/java/gsp/technologies/main/api/position/PositionFaceController.java +++ b/main/src/main/java/gsp/technologies/main/supplier/position/PositionFaceController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.position; +package gsp.technologies.main.supplier.position; import java.util.Collection; import java.util.stream.Collectors; @@ -16,8 +16,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import gsp.technologies.main.api.organization.OrganizationEntity; -import gsp.technologies.main.api.organization.OrganizationService; +import gsp.technologies.main.supplier.organization.OrganizationEntity; +import gsp.technologies.main.supplier.organization.OrganizationService; @Controller @RequestMapping(path = "/positions") diff --git a/main/src/main/java/gsp/technologies/main/api/position/PositionRepository.java b/main/src/main/java/gsp/technologies/main/supplier/position/PositionRepository.java similarity index 87% rename from main/src/main/java/gsp/technologies/main/api/position/PositionRepository.java rename to main/src/main/java/gsp/technologies/main/supplier/position/PositionRepository.java index f087f78..1405320 100644 --- a/main/src/main/java/gsp/technologies/main/api/position/PositionRepository.java +++ b/main/src/main/java/gsp/technologies/main/supplier/position/PositionRepository.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.position; +package gsp.technologies.main.supplier.position; import java.util.Collection; diff --git a/main/src/main/java/gsp/technologies/main/api/position/PositionService.java b/main/src/main/java/gsp/technologies/main/supplier/position/PositionService.java similarity index 91% rename from main/src/main/java/gsp/technologies/main/api/position/PositionService.java rename to main/src/main/java/gsp/technologies/main/supplier/position/PositionService.java index 7c7e8ae..302ad08 100644 --- a/main/src/main/java/gsp/technologies/main/api/position/PositionService.java +++ b/main/src/main/java/gsp/technologies/main/supplier/position/PositionService.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.position; +package gsp.technologies.main.supplier.position; import java.util.Collection; diff --git a/main/src/main/java/gsp/technologies/main/api/target/TargetEntity.java b/main/src/main/java/gsp/technologies/main/supplier/target/TargetEntity.java similarity index 86% rename from main/src/main/java/gsp/technologies/main/api/target/TargetEntity.java rename to main/src/main/java/gsp/technologies/main/supplier/target/TargetEntity.java index 7e62455..5880b6d 100644 --- a/main/src/main/java/gsp/technologies/main/api/target/TargetEntity.java +++ b/main/src/main/java/gsp/technologies/main/supplier/target/TargetEntity.java @@ -1,10 +1,10 @@ -package gsp.technologies.main.api.target; +package gsp.technologies.main.supplier.target; import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; -import gsp.technologies.main.api.course.CourseEntity; -import gsp.technologies.main.api.position.PositionEntity; +import gsp.technologies.main.supplier.position.PositionEntity; +import gsp.technologies.main.user.course.CourseEntity; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; diff --git a/main/src/main/java/gsp/technologies/main/api/target/TargetFaceController.java b/main/src/main/java/gsp/technologies/main/supplier/target/TargetFaceController.java similarity index 85% rename from main/src/main/java/gsp/technologies/main/api/target/TargetFaceController.java rename to main/src/main/java/gsp/technologies/main/supplier/target/TargetFaceController.java index d0e4440..6396dde 100644 --- a/main/src/main/java/gsp/technologies/main/api/target/TargetFaceController.java +++ b/main/src/main/java/gsp/technologies/main/supplier/target/TargetFaceController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.target; +package gsp.technologies.main.supplier.target; import java.util.Collection; import java.util.Collections; @@ -13,12 +13,12 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import gsp.technologies.main.api.course.CourseEntity; -import gsp.technologies.main.api.course.CourseService; -import gsp.technologies.main.api.organization.OrganizationEntity; -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.supplier.organization.OrganizationEntity; +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.user.course.CourseEntity; +import gsp.technologies.main.user.course.CourseService; @Controller @RequestMapping(path = "/targets") diff --git a/main/src/main/java/gsp/technologies/main/api/target/TargetRepository.java b/main/src/main/java/gsp/technologies/main/supplier/target/TargetRepository.java similarity index 58% rename from main/src/main/java/gsp/technologies/main/api/target/TargetRepository.java rename to main/src/main/java/gsp/technologies/main/supplier/target/TargetRepository.java index d22e45f..1b2a471 100644 --- a/main/src/main/java/gsp/technologies/main/api/target/TargetRepository.java +++ b/main/src/main/java/gsp/technologies/main/supplier/target/TargetRepository.java @@ -1,9 +1,11 @@ -package gsp.technologies.main.api.target; +package gsp.technologies.main.supplier.target; + +import java.util.Collection; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface TargetRepository extends JpaRepository { - + Collection findAllByPositionId(Long id); } diff --git a/main/src/main/java/gsp/technologies/main/api/target/TargetService.java b/main/src/main/java/gsp/technologies/main/supplier/target/TargetService.java similarity index 62% rename from main/src/main/java/gsp/technologies/main/api/target/TargetService.java rename to main/src/main/java/gsp/technologies/main/supplier/target/TargetService.java index 04d4e5e..498348a 100644 --- a/main/src/main/java/gsp/technologies/main/api/target/TargetService.java +++ b/main/src/main/java/gsp/technologies/main/supplier/target/TargetService.java @@ -1,11 +1,11 @@ -package gsp.technologies.main.api.target; +package gsp.technologies.main.supplier.target; import java.util.Collection; import org.springframework.stereotype.Service; -import gsp.technologies.main.api.course.CourseEntity; -import gsp.technologies.main.api.position.PositionEntity; +import gsp.technologies.main.supplier.position.PositionEntity; +import gsp.technologies.main.user.course.CourseEntity; @Service public class TargetService { @@ -23,10 +23,6 @@ public class TargetService { return repo.save(entity); } - public Collection findAllByPosition(PositionEntity position) { - return repo.findAllByPosition(position); - } - public Collection findAllByPositionId(Long id) { return repo.findAllByPositionId(id); } diff --git a/main/src/main/java/gsp/technologies/main/api/account/AccountEntity.java b/main/src/main/java/gsp/technologies/main/user/account/AccountEntity.java similarity index 86% rename from main/src/main/java/gsp/technologies/main/api/account/AccountEntity.java rename to main/src/main/java/gsp/technologies/main/user/account/AccountEntity.java index 1cf0396..dd8c498 100644 --- a/main/src/main/java/gsp/technologies/main/api/account/AccountEntity.java +++ b/main/src/main/java/gsp/technologies/main/user/account/AccountEntity.java @@ -1,9 +1,9 @@ -package gsp.technologies.main.api.account; +package gsp.technologies.main.user.account; import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; -import gsp.technologies.main.api.position.PositionEntity; +import gsp.technologies.main.supplier.position.PositionEntity; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; diff --git a/main/src/main/java/gsp/technologies/main/api/account/AccountFaceController.java b/main/src/main/java/gsp/technologies/main/user/account/AccountFaceController.java similarity index 76% rename from main/src/main/java/gsp/technologies/main/api/account/AccountFaceController.java rename to main/src/main/java/gsp/technologies/main/user/account/AccountFaceController.java index 7a75c6d..5ddb5d2 100644 --- a/main/src/main/java/gsp/technologies/main/api/account/AccountFaceController.java +++ b/main/src/main/java/gsp/technologies/main/user/account/AccountFaceController.java @@ -1,6 +1,7 @@ -package gsp.technologies.main.api.account; +package gsp.technologies.main.user.account; import java.util.Collection; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -11,13 +12,13 @@ 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.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.code.Code; +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; /** * Контроллер формы аккаунта @@ -81,7 +82,10 @@ public class AccountFaceController { //передаем в модель перечень доступных курсов Collection targets = targetService.findAllByPositionId(account.getPosition().getId()); - Collection courses = targetService.findAllByPosition(account.getPosition()); + Collection courses = targets.stream() + .map(TargetEntity::getCourse) + .distinct() + .collect(Collectors.toList()); model.addAttribute("courses", courses); //передаем в модель статусы прохождения курсов @@ -115,6 +119,17 @@ public class AccountFaceController { account = accountService.save(account); model.addAttribute("account", account); + + //передаем в модель перечень доступных курсов + Collection targets = targetService.findAllByPositionId(account.getPosition().getId()); + + Collection courses = targets.stream() + .map(TargetEntity::getCourse) + .distinct() + .collect(Collectors.toList()); + model.addAttribute("courses", courses); + //передаем в модель статусы прохождения курсов + return "account"; } catch (Exception e) { StringBuilder msg = new StringBuilder(); diff --git a/main/src/main/java/gsp/technologies/main/api/account/AccountRepository.java b/main/src/main/java/gsp/technologies/main/user/account/AccountRepository.java similarity index 79% rename from main/src/main/java/gsp/technologies/main/api/account/AccountRepository.java rename to main/src/main/java/gsp/technologies/main/user/account/AccountRepository.java index f0b6fbc..e038c4e 100644 --- a/main/src/main/java/gsp/technologies/main/api/account/AccountRepository.java +++ b/main/src/main/java/gsp/technologies/main/user/account/AccountRepository.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.account; +package gsp.technologies.main.user.account; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/main/src/main/java/gsp/technologies/main/api/account/AccountService.java b/main/src/main/java/gsp/technologies/main/user/account/AccountService.java similarity index 86% rename from main/src/main/java/gsp/technologies/main/api/account/AccountService.java rename to main/src/main/java/gsp/technologies/main/user/account/AccountService.java index 87ec70f..de6efa8 100644 --- a/main/src/main/java/gsp/technologies/main/api/account/AccountService.java +++ b/main/src/main/java/gsp/technologies/main/user/account/AccountService.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.account; +package gsp.technologies.main.user.account; import org.springframework.stereotype.Service; diff --git a/main/src/main/java/gsp/technologies/main/api/course/CourseEntity.java b/main/src/main/java/gsp/technologies/main/user/course/CourseEntity.java similarity index 87% rename from main/src/main/java/gsp/technologies/main/api/course/CourseEntity.java rename to main/src/main/java/gsp/technologies/main/user/course/CourseEntity.java index 90c9779..1f04cea 100644 --- a/main/src/main/java/gsp/technologies/main/api/course/CourseEntity.java +++ b/main/src/main/java/gsp/technologies/main/user/course/CourseEntity.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.course; +package gsp.technologies.main.user.course; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; diff --git a/main/src/main/java/gsp/technologies/main/api/course/CourseFaceController.java b/main/src/main/java/gsp/technologies/main/user/course/CourseFaceController.java similarity index 64% rename from main/src/main/java/gsp/technologies/main/api/course/CourseFaceController.java rename to main/src/main/java/gsp/technologies/main/user/course/CourseFaceController.java index fa75e73..e647aa9 100644 --- a/main/src/main/java/gsp/technologies/main/api/course/CourseFaceController.java +++ b/main/src/main/java/gsp/technologies/main/user/course/CourseFaceController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.course; +package gsp.technologies.main.user.course; import java.util.Collection; @@ -11,6 +11,8 @@ 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.user.account.AccountService; + import org.springframework.web.bind.annotation.PostMapping; @Controller @@ -21,8 +23,13 @@ public class CourseFaceController { @Autowired private CourseService courseService; - public CourseFaceController(CourseService courseService) { + + @Autowired + private AccountService accountService; + + public CourseFaceController(CourseService courseService, AccountService accountService) { this.courseService = courseService; + this.accountService = accountService; } @GetMapping("") @@ -47,6 +54,17 @@ public class CourseFaceController { return "redirect:/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"; + } diff --git a/main/src/main/java/gsp/technologies/main/api/course/CourseRepository.java b/main/src/main/java/gsp/technologies/main/user/course/CourseRepository.java similarity index 79% rename from main/src/main/java/gsp/technologies/main/api/course/CourseRepository.java rename to main/src/main/java/gsp/technologies/main/user/course/CourseRepository.java index 5eb4acf..1110711 100644 --- a/main/src/main/java/gsp/technologies/main/api/course/CourseRepository.java +++ b/main/src/main/java/gsp/technologies/main/user/course/CourseRepository.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.course; +package gsp.technologies.main.user.course; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/main/src/main/java/gsp/technologies/main/api/course/CourseService.java b/main/src/main/java/gsp/technologies/main/user/course/CourseService.java similarity index 88% rename from main/src/main/java/gsp/technologies/main/api/course/CourseService.java rename to main/src/main/java/gsp/technologies/main/user/course/CourseService.java index f5bd6e2..121a3c2 100644 --- a/main/src/main/java/gsp/technologies/main/api/course/CourseService.java +++ b/main/src/main/java/gsp/technologies/main/user/course/CourseService.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.course; +package gsp.technologies.main.user.course; import java.util.Collection; diff --git a/main/src/main/java/gsp/technologies/main/mainframe/MainframeController.java b/main/src/main/java/gsp/technologies/main/user/login/LoginController.java similarity index 72% rename from main/src/main/java/gsp/technologies/main/mainframe/MainframeController.java rename to main/src/main/java/gsp/technologies/main/user/login/LoginController.java index 06cb3e9..9f454ea 100644 --- a/main/src/main/java/gsp/technologies/main/mainframe/MainframeController.java +++ b/main/src/main/java/gsp/technologies/main/user/login/LoginController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.mainframe; +package gsp.technologies.main.user.login; import java.util.Collection; import java.util.stream.Collectors; @@ -6,19 +6,15 @@ import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Pageable; -import org.springframework.data.domain.Sort; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.request.RequestContextHolder; -import gsp.technologies.main.api.organization.OrganizationEntity; -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.supplier.organization.OrganizationEntity; +import gsp.technologies.main.supplier.organization.OrganizationService; +import gsp.technologies.main.supplier.position.PositionEntity; +import gsp.technologies.main.supplier.position.PositionService; import org.springframework.web.bind.annotation.GetMapping; @@ -30,22 +26,22 @@ import org.springframework.web.bind.annotation.GetMapping; * */ @Controller -@RequestMapping(path = "/mainframe") -public class MainframeController { +@RequestMapping(path = "/user/login") +public class LoginController { @Autowired private OrganizationService organizationService; @Autowired private PositionService positionService; - public MainframeController(PositionService positionService) { + public LoginController(PositionService positionService) { this.positionService = positionService; } - private static final Logger log = LoggerFactory.getLogger(MainframeController.class); + private static final Logger log = LoggerFactory.getLogger(LoginController.class); @GetMapping("") - public String mainframe(Model model) { - log.info("GET /mainframe"); + public String login(Model model) { + log.info("GET /login"); log.info("текущая сессия: {}", RequestContextHolder.currentRequestAttributes().getSessionId()); //получаем список организаций Collection organizations = organizationService.findAll(); @@ -64,6 +60,6 @@ public class MainframeController { //при наличии вернуть порядковый номер существующей сессии (в 35-ричной системе счисления) //при отсутствии внести новую запись в базу и вернуть ее порядковый номер - return "mainframe"; + return "pages/user/login"; } } diff --git a/main/src/main/java/gsp/technologies/main/access/logout/LogoutController.java b/main/src/main/java/gsp/technologies/main/user/logout/LogoutController.java similarity index 94% rename from main/src/main/java/gsp/technologies/main/access/logout/LogoutController.java rename to main/src/main/java/gsp/technologies/main/user/logout/LogoutController.java index d89a3c0..8a8e165 100644 --- a/main/src/main/java/gsp/technologies/main/access/logout/LogoutController.java +++ b/main/src/main/java/gsp/technologies/main/user/logout/LogoutController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.access.logout; +package gsp.technologies.main.user.logout; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/main/src/main/java/gsp/technologies/main/api/quiz/QuizController.java b/main/src/main/java/gsp/technologies/main/user/quiz/QuizController.java similarity index 91% rename from main/src/main/java/gsp/technologies/main/api/quiz/QuizController.java rename to main/src/main/java/gsp/technologies/main/user/quiz/QuizController.java index 292ac2d..b74740b 100644 --- a/main/src/main/java/gsp/technologies/main/api/quiz/QuizController.java +++ b/main/src/main/java/gsp/technologies/main/user/quiz/QuizController.java @@ -1,4 +1,4 @@ -package gsp.technologies.main.api.quiz; +package gsp.technologies.main.user.quiz; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/main/src/main/resources/static/content/courses/1/main.md b/main/src/main/resources/static/content/courses/1/main.md index 2dbb6b6..2374438 100644 --- a/main/src/main/resources/static/content/courses/1/main.md +++ b/main/src/main/resources/static/content/courses/1/main.md @@ -1,7 +1,16 @@ -# Курс: Охрана труда +# Курс: Работы на высоте ## диаграмма usecase -Устанавливает роли и основные способы использования приложения +**Устанавливает роли и основные способы использования приложения** +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. + ![диаграмма usecase](/content/courses/1/pictures/usecase.png) diff --git a/main/src/main/resources/static/content/courses/2/main.md b/main/src/main/resources/static/content/courses/2/main.md index 9d788b0..3b40669 100644 --- a/main/src/main/resources/static/content/courses/2/main.md +++ b/main/src/main/resources/static/content/courses/2/main.md @@ -1 +1 @@ -# Курс: Работы на высоте \ No newline at end of file +# Курс: Охрана труда \ No newline at end of file diff --git a/main/src/main/resources/templates/fragments/code.html b/main/src/main/resources/templates/fragments/code.html deleted file mode 100644 index e33d871..0000000 --- a/main/src/main/resources/templates/fragments/code.html +++ /dev/null @@ -1,10 +0,0 @@ - - - -
-
- CODE: - -
- - \ No newline at end of file diff --git a/main/src/main/resources/templates/fragments/course.html b/main/src/main/resources/templates/fragments/course.html deleted file mode 100644 index 4cf1ab3..0000000 --- a/main/src/main/resources/templates/fragments/course.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - -
-
- -
- - \ No newline at end of file diff --git a/main/src/main/resources/templates/hello.html b/main/src/main/resources/templates/pages/common/hello.html similarity index 100% rename from main/src/main/resources/templates/hello.html rename to main/src/main/resources/templates/pages/common/hello.html diff --git a/main/src/main/resources/templates/error.html b/main/src/main/resources/templates/pages/debuger/error.html similarity index 89% rename from main/src/main/resources/templates/error.html rename to main/src/main/resources/templates/pages/debuger/error.html index 82b4d97..831bb14 100644 --- a/main/src/main/resources/templates/error.html +++ b/main/src/main/resources/templates/pages/debuger/error.html @@ -20,7 +20,7 @@ xmlns:th="http://www.thymeleaf.org">
-
+
\ No newline at end of file diff --git a/main/src/main/resources/templates/auth.html b/main/src/main/resources/templates/pages/reviewer/find.html similarity index 65% rename from main/src/main/resources/templates/auth.html rename to main/src/main/resources/templates/pages/reviewer/find.html index 25493a3..2f5e56e 100644 --- a/main/src/main/resources/templates/auth.html +++ b/main/src/main/resources/templates/pages/reviewer/find.html @@ -4,18 +4,17 @@ xmlns:th="http://www.thymeleaf.org"> - exam-auth + exam-reviewer-find
-
-
-
+ +
-
+
\ No newline at end of file diff --git a/main/src/main/resources/templates/courses/main.html b/main/src/main/resources/templates/pages/supplier/courses.html similarity index 74% rename from main/src/main/resources/templates/courses/main.html rename to main/src/main/resources/templates/pages/supplier/courses.html index 6b1c1f6..742a6ed 100644 --- a/main/src/main/resources/templates/courses/main.html +++ b/main/src/main/resources/templates/pages/supplier/courses.html @@ -14,12 +14,12 @@ xmlns:th="http://www.thymeleaf.org">

Фрагменты для работы с курсами

-
+
-
+
-
+
\ No newline at end of file diff --git a/main/src/main/resources/templates/organizations/edit.html b/main/src/main/resources/templates/pages/supplier/organizations-edit.html similarity index 78% rename from main/src/main/resources/templates/organizations/edit.html rename to main/src/main/resources/templates/pages/supplier/organizations-edit.html index ac4e393..97bc7aa 100644 --- a/main/src/main/resources/templates/organizations/edit.html +++ b/main/src/main/resources/templates/pages/supplier/organizations-edit.html @@ -14,10 +14,10 @@ xmlns:th="http://www.thymeleaf.org">

Фрагменты для работы с данными организаций

-
+
-
+
\ No newline at end of file diff --git a/main/src/main/resources/templates/organizations/main.html b/main/src/main/resources/templates/pages/supplier/organizations.html similarity index 73% rename from main/src/main/resources/templates/organizations/main.html rename to main/src/main/resources/templates/pages/supplier/organizations.html index 99df71e..3f27079 100644 --- a/main/src/main/resources/templates/organizations/main.html +++ b/main/src/main/resources/templates/pages/supplier/organizations.html @@ -14,12 +14,12 @@ xmlns:th="http://www.thymeleaf.org">

Фрагменты для работы с данными организаций

-
+
-
+
-
+
\ No newline at end of file diff --git a/main/src/main/resources/templates/positions/main.html b/main/src/main/resources/templates/pages/supplier/positions.html similarity index 72% rename from main/src/main/resources/templates/positions/main.html rename to main/src/main/resources/templates/pages/supplier/positions.html index 95d04b2..1dbcdc5 100644 --- a/main/src/main/resources/templates/positions/main.html +++ b/main/src/main/resources/templates/pages/supplier/positions.html @@ -14,12 +14,12 @@ xmlns:th="http://www.thymeleaf.org">

Фрагменты для работы с данными о должностях

-
+
-
+
-
+
\ No newline at end of file diff --git a/main/src/main/resources/templates/targets/main.html b/main/src/main/resources/templates/pages/supplier/targets.html similarity index 86% rename from main/src/main/resources/templates/targets/main.html rename to main/src/main/resources/templates/pages/supplier/targets.html index d665914..c6e9c2e 100644 --- a/main/src/main/resources/templates/targets/main.html +++ b/main/src/main/resources/templates/pages/supplier/targets.html @@ -14,13 +14,13 @@ xmlns:th="http://www.thymeleaf.org">

Фрагменты для работы с назначением курсов

-
+
-
+
-
+