Add user ids

This commit is contained in:
Anton Romanov 2024-04-24 12:15:11 +04:00
parent b49adee62a
commit 37c1d0db08
4 changed files with 71 additions and 35 deletions

View File

@ -14,11 +14,7 @@ import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.Collection; import java.util.*;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static ru.ulstu.odin.model.annotation.OdinString.OdinStringType.PASSWORD; import static ru.ulstu.odin.model.annotation.OdinString.OdinStringType.PASSWORD;
@ -75,6 +71,12 @@ public class UserDto implements OdinDto {
private User.UserDegree degree; private User.UserDegree degree;
private String orcId;
private String scopusId;
private String elibraryId;
public UserDto() { public UserDto() {
activated = false; activated = false;
roles = new LinkedHashSet<>(); roles = new LinkedHashSet<>();
@ -93,6 +95,9 @@ public class UserDto implements OdinDto {
.collect(Collectors.toList())); .collect(Collectors.toList()));
this.birthDate = user.getBirthDate(); this.birthDate = user.getBirthDate();
this.degree = user.getDegree(); this.degree = user.getDegree();
this.orcId = user.getOrcId();
this.scopusId = user.getScopusId();
this.elibraryId = user.getElibraryId();
} }
public Integer getId() { public Integer getId() {
@ -186,6 +191,30 @@ public class UserDto implements OdinDto {
this.degree = degree; this.degree = degree;
} }
public String getOrcId() {
return orcId;
}
public void setOrcId(String orcId) {
this.orcId = orcId;
}
public String getScopusId() {
return scopusId;
}
public void setScopusId(String scopusId) {
this.scopusId = scopusId;
}
public String getElibraryId() {
return elibraryId;
}
public void setElibraryId(String elibraryId) {
this.elibraryId = elibraryId;
}
@JsonIgnore @JsonIgnore
public boolean isPasswordsValid() { public boolean isPasswordsValid() {
if (StringUtils.isEmpty(password) || StringUtils.isEmpty(passwordConfirm)) { if (StringUtils.isEmpty(password) || StringUtils.isEmpty(passwordConfirm)) {

View File

@ -24,25 +24,8 @@ import ru.ulstu.core.model.UserActivity;
import ru.ulstu.core.model.response.PageableItems; import ru.ulstu.core.model.response.PageableItems;
import ru.ulstu.ping.model.Ping; import ru.ulstu.ping.model.Ping;
import ru.ulstu.ping.service.PingService; import ru.ulstu.ping.service.PingService;
import ru.ulstu.user.error.UserActivationError; import ru.ulstu.user.error.*;
import ru.ulstu.user.error.UserBlockedException; import ru.ulstu.user.model.*;
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.UserDto;
import ru.ulstu.user.model.UserInfoNow;
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.UserRepository;
import ru.ulstu.user.repository.UserRoleRepository; import ru.ulstu.user.repository.UserRoleRepository;
import ru.ulstu.user.util.UserUtils; import ru.ulstu.user.util.UserUtils;
@ -52,16 +35,7 @@ import ru.ulstu.utils.timetable.model.Lesson;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
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
@ -207,6 +181,9 @@ public class UserService implements UserDetailsService {
user.setLogin(userDto.getLogin()); user.setLogin(userDto.getLogin());
user.setFirstName(userDto.getFirstName()); user.setFirstName(userDto.getFirstName());
user.setLastName(userDto.getLastName()); user.setLastName(userDto.getLastName());
user.setOrcId(userDto.getOrcId());
user.setScopusId(userDto.getScopusId());
user.setElibraryId(userDto.getElibraryId());
user.setEmail(userDto.getEmail()); user.setEmail(userDto.getEmail());
if (userDto.isActivated() != user.getActivated()) { if (userDto.isActivated() != user.getActivated()) {
if (userDto.isActivated()) { if (userDto.isActivated()) {
@ -246,6 +223,9 @@ public class UserService implements UserDetailsService {
user.setLastName(updateUser.getLastName()); user.setLastName(updateUser.getLastName());
user.setEmail(updateUser.getEmail()); user.setEmail(updateUser.getEmail());
user.setLogin(updateUser.getLogin()); user.setLogin(updateUser.getLogin());
user.setOrcId(updateUser.getOrcId());
user.setScopusId(updateUser.getScopusId());
user.setElibraryId(updateUser.getElibraryId());
user = updateUserInformation(user); user = updateUserInformation(user);
log.debug("Updated Information for User: {}", user.getLogin()); log.debug("Updated Information for User: {}", user.getLogin());
return userMapper.userEntityToUserDto(user); return userMapper.userEntityToUserDto(user);

View File

@ -36,7 +36,7 @@ spring.liquibase.enabled=true
# Application Settings # Application Settings
ng-tracker.base-url=http://127.0.0.1:8080 ng-tracker.base-url=http://127.0.0.1:8080
ng-tracker.undead-user-login=admin ng-tracker.undead-user-login=admin
ng-tracker.dev-mode=true ng-tracker.dev-mode=false
ng-tracker.debug_email= ng-tracker.debug_email=
ng-tracker.use-https=false ng-tracker.use-https=false
ng-tracker.check-run=false ng-tracker.check-run=false

View File

@ -58,6 +58,33 @@
class="alert alert-danger">Incorrect email</p> class="alert alert-danger">Incorrect email</p>
<p class="help-block text-danger"></p> <p class="help-block text-danger"></p>
</div> </div>
<div class="form-group">
<label for="orcid">Orc id:</label>
<input class="form-control" id="orcid" type="text"
placeholder="Orc id"
th:field="*{orcId}"/>
<p th:if="${#fields.hasErrors('orcId')}" th:errors="*{orcId}"
class="alert alert-danger">Incorrect orc id</p>
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<label for="scopusid">Scopus id:</label>
<input class="form-control" id="scopusid" type="text"
placeholder="Scopus id"
th:field="*{scopusId}"/>
<p th:if="${#fields.hasErrors('scopusId')}" th:errors="*{scopusId}"
class="alert alert-danger">Incorrect Scopus id</p>
<p class="help-block text-danger"></p>
</div>
<div class="form-group">
<label for="elibraryid">Elibrary id:</label>
<input class="form-control" id="elibraryid" type="text"
placeholder="Elibrary id"
th:field="*{elibraryId}"/>
<p th:if="${#fields.hasErrors('elibraryId')}" th:errors="*{elibraryId}"
class="alert alert-danger">Incorrect Elibrary id</p>
<p class="help-block text-danger"></p>
</div>
<div class="form-group"> <div class="form-group">
<button id="sendMessageButton" name="save" <button id="sendMessageButton" name="save"
class="btn btn-success text-uppercase" class="btn btn-success text-uppercase"