|
|
@ -13,12 +13,20 @@ import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import ru.ulstu.configuration.ApplicationProperties;
|
|
|
|
import ru.ulstu.configuration.ApplicationProperties;
|
|
|
|
import ru.ulstu.configuration.Constants;
|
|
|
|
|
|
|
|
import ru.ulstu.core.error.EntityIdIsNullException;
|
|
|
|
import ru.ulstu.core.error.EntityIdIsNullException;
|
|
|
|
import ru.ulstu.core.jpa.OffsetablePageRequest;
|
|
|
|
import ru.ulstu.core.jpa.OffsetablePageRequest;
|
|
|
|
import ru.ulstu.core.model.BaseEntity;
|
|
|
|
import ru.ulstu.core.model.BaseEntity;
|
|
|
|
import ru.ulstu.core.model.response.PageableItems;
|
|
|
|
import ru.ulstu.core.model.response.PageableItems;
|
|
|
|
import ru.ulstu.user.error.*;
|
|
|
|
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.error.UserSendingMailException;
|
|
|
|
import ru.ulstu.user.model.User;
|
|
|
|
import ru.ulstu.user.model.User;
|
|
|
|
import ru.ulstu.user.model.UserDto;
|
|
|
|
import ru.ulstu.user.model.UserDto;
|
|
|
|
import ru.ulstu.user.model.UserListDto;
|
|
|
|
import ru.ulstu.user.model.UserListDto;
|
|
|
@ -31,7 +39,14 @@ import ru.ulstu.user.repository.UserRoleRepository;
|
|
|
|
import ru.ulstu.user.util.UserUtils;
|
|
|
|
import ru.ulstu.user.util.UserUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.mail.MessagingException;
|
|
|
|
import javax.mail.MessagingException;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.Collections;
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
@ -44,7 +59,6 @@ public class UserService implements UserDetailsService {
|
|
|
|
private final UserMapper userMapper;
|
|
|
|
private final UserMapper userMapper;
|
|
|
|
private final MailService mailService;
|
|
|
|
private final MailService mailService;
|
|
|
|
private final ApplicationProperties applicationProperties;
|
|
|
|
private final ApplicationProperties applicationProperties;
|
|
|
|
private final Random random;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public UserService(UserRepository userRepository,
|
|
|
|
public UserService(UserRepository userRepository,
|
|
|
|
PasswordEncoder passwordEncoder,
|
|
|
|
PasswordEncoder passwordEncoder,
|
|
|
@ -58,7 +72,6 @@ public class UserService implements UserDetailsService {
|
|
|
|
this.userMapper = userMapper;
|
|
|
|
this.userMapper = userMapper;
|
|
|
|
this.mailService = mailService;
|
|
|
|
this.mailService = mailService;
|
|
|
|
this.applicationProperties = applicationProperties;
|
|
|
|
this.applicationProperties = applicationProperties;
|
|
|
|
this.random = new Random();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private User getUserByEmail(String email) {
|
|
|
|
private User getUserByEmail(String email) {
|
|
|
|