From 112958a70b85f196014dbeeeda3e655b2acb0e7a Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 14 Nov 2018 15:18:22 +0400 Subject: [PATCH] fix code --- .../ulstu/user/controller/UserController.java | 18 ++++++++++--- src/main/java/ru/ulstu/user/model/User.java | 9 ++++++- .../ru/ulstu/user/service/UserMapper.java | 13 +++++++--- .../ru/ulstu/user/service/UserService.java | 26 ++++++++++++++++--- .../user/service/UserSessionService.java | 2 +- 5 files changed, 57 insertions(+), 11 deletions(-) diff --git a/src/main/java/ru/ulstu/user/controller/UserController.java b/src/main/java/ru/ulstu/user/controller/UserController.java index f9f49e3..d7db909 100644 --- a/src/main/java/ru/ulstu/user/controller/UserController.java +++ b/src/main/java/ru/ulstu/user/controller/UserController.java @@ -3,7 +3,15 @@ package ru.ulstu.user.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.annotation.Secured; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import ru.ulstu.configuration.Constants; import ru.ulstu.core.model.response.PageableItems; import ru.ulstu.core.model.response.Response; @@ -11,10 +19,14 @@ import ru.ulstu.odin.controller.OdinController; import ru.ulstu.odin.model.OdinMetadata; import ru.ulstu.odin.model.OdinVoid; import ru.ulstu.odin.service.OdinService; -import ru.ulstu.user.model.*; +import ru.ulstu.user.model.UserDto; +import ru.ulstu.user.model.UserListDto; +import ru.ulstu.user.model.UserResetPasswordDto; +import ru.ulstu.user.model.UserRoleConstants; +import ru.ulstu.user.model.UserRoleDto; +import ru.ulstu.user.model.UserSessionListDto; import ru.ulstu.user.service.UserService; import ru.ulstu.user.service.UserSessionService; -import ru.ulstu.user.model.*; import javax.validation.Valid; diff --git a/src/main/java/ru/ulstu/user/model/User.java b/src/main/java/ru/ulstu/user/model/User.java index 8d5bce8..16a873b 100644 --- a/src/main/java/ru/ulstu/user/model/User.java +++ b/src/main/java/ru/ulstu/user/model/User.java @@ -5,7 +5,14 @@ import org.hibernate.validator.constraints.Email; import ru.ulstu.configuration.Constants; import ru.ulstu.core.model.BaseEntity; -import javax.persistence.*; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; diff --git a/src/main/java/ru/ulstu/user/service/UserMapper.java b/src/main/java/ru/ulstu/user/service/UserMapper.java index 5607a26..7359bba 100644 --- a/src/main/java/ru/ulstu/user/service/UserMapper.java +++ b/src/main/java/ru/ulstu/user/service/UserMapper.java @@ -1,11 +1,18 @@ package ru.ulstu.user.service; import org.springframework.stereotype.Service; -import ru.ulstu.user.model.*; -import ru.ulstu.user.model.*; +import ru.ulstu.user.model.User; +import ru.ulstu.user.model.UserDto; +import ru.ulstu.user.model.UserListDto; +import ru.ulstu.user.model.UserRole; +import ru.ulstu.user.model.UserRoleDto; import ru.ulstu.user.repository.UserRoleRepository; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; @Service diff --git a/src/main/java/ru/ulstu/user/service/UserService.java b/src/main/java/ru/ulstu/user/service/UserService.java index e6fca9f..d8d29a5 100644 --- a/src/main/java/ru/ulstu/user/service/UserService.java +++ b/src/main/java/ru/ulstu/user/service/UserService.java @@ -16,13 +16,33 @@ import ru.ulstu.core.error.EntityIdIsNullException; import ru.ulstu.core.jpa.OffsetablePageRequest; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.core.model.response.PageableItems; -import ru.ulstu.user.error.*; -import ru.ulstu.user.model.*; +import ru.ulstu.user.error.UserActivationError; +import ru.ulstu.user.error.UserEmailExistsException; +import ru.ulstu.user.error.UserIdExistsException; +import ru.ulstu.user.error.UserIsUndeadException; +import ru.ulstu.user.error.UserLoginExistsException; +import ru.ulstu.user.error.UserNotActivatedException; +import ru.ulstu.user.error.UserNotFoundException; +import ru.ulstu.user.error.UserPasswordsNotValidOrNotMatchException; +import ru.ulstu.user.error.UserResetKeyError; +import ru.ulstu.user.model.User; +import ru.ulstu.user.model.UserDto; +import ru.ulstu.user.model.UserListDto; +import ru.ulstu.user.model.UserResetPasswordDto; +import ru.ulstu.user.model.UserRole; +import ru.ulstu.user.model.UserRoleConstants; +import ru.ulstu.user.model.UserRoleDto; import ru.ulstu.user.repository.UserRepository; import ru.ulstu.user.repository.UserRoleRepository; import ru.ulstu.user.util.UserUtils; -import java.util.*; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; @Service diff --git a/src/main/java/ru/ulstu/user/service/UserSessionService.java b/src/main/java/ru/ulstu/user/service/UserSessionService.java index 36479a9..0d985cd 100644 --- a/src/main/java/ru/ulstu/user/service/UserSessionService.java +++ b/src/main/java/ru/ulstu/user/service/UserSessionService.java @@ -6,8 +6,8 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import ru.ulstu.core.model.response.PageableItems; import ru.ulstu.core.jpa.OffsetablePageRequest; +import ru.ulstu.core.model.response.PageableItems; import ru.ulstu.user.error.UserNotFoundException; import ru.ulstu.user.model.User; import ru.ulstu.user.model.UserSession;