#103 merge with dev

This commit is contained in:
T-Midnight 2019-06-05 09:36:29 +04:00
parent c77702704f
commit 1ff38fc80e
22 changed files with 46 additions and 40 deletions

View File

@ -25,9 +25,9 @@ import ru.ulstu.user.service.UserService;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Collections;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.springframework.util.ObjectUtils.isEmpty; import static org.springframework.util.ObjectUtils.isEmpty;

View File

@ -1,6 +1,5 @@
package ru.ulstu.grant.service; package ru.ulstu.grant.service;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@ -10,7 +10,6 @@ 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 ru.ulstu.deadline.model.Deadline; import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.grant.model.Grant;
import ru.ulstu.grant.model.GrantDto; import ru.ulstu.grant.model.GrantDto;
import ru.ulstu.project.model.Project; import ru.ulstu.project.model.Project;
import ru.ulstu.project.model.ProjectDto; import ru.ulstu.project.model.ProjectDto;

View File

@ -12,16 +12,16 @@ import ru.ulstu.grant.model.Grant;
import ru.ulstu.timeline.model.Event; import ru.ulstu.timeline.model.Event;
import ru.ulstu.user.model.User; import ru.ulstu.user.model.User;
import javax.persistence.CascadeType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.EnumType; import javax.persistence.EnumType;
import javax.persistence.Enumerated; import javax.persistence.Enumerated;
import javax.persistence.OneToMany;
import javax.persistence.CascadeType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.ManyToMany; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable; import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;

View File

@ -6,13 +6,8 @@ import org.hibernate.validator.constraints.NotBlank;
import ru.ulstu.core.model.BaseEntity; import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.core.model.EventSource; import ru.ulstu.core.model.EventSource;
import ru.ulstu.deadline.model.Deadline; import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.deadline.service.DeadlineService;
import ru.ulstu.students.repository.SchedulerRepository;
import ru.ulstu.students.repository.TaskRepository;
import ru.ulstu.tags.model.Tag; import ru.ulstu.tags.model.Tag;
import ru.ulstu.tags.service.TagService;
import ru.ulstu.timeline.model.Event; import ru.ulstu.timeline.model.Event;
import ru.ulstu.timeline.service.EventService;
import ru.ulstu.user.model.User; import ru.ulstu.user.model.User;
import ru.ulstu.user.service.UserService; import ru.ulstu.user.service.UserService;

View File

@ -18,15 +18,15 @@ import ru.ulstu.tags.service.TagService;
import ru.ulstu.timeline.service.EventService; import ru.ulstu.timeline.service.EventService;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.springframework.util.ObjectUtils.isEmpty; import static org.springframework.util.ObjectUtils.isEmpty;

View File

@ -18,7 +18,6 @@ import ru.ulstu.timeline.repository.EventRepository;
import ru.ulstu.user.model.UserDto; import ru.ulstu.user.model.UserDto;
import ru.ulstu.user.service.UserService; import ru.ulstu.user.service.UserService;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;

View File

@ -3,7 +3,6 @@ package ru.ulstu.user.controller;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.security.access.annotation.Secured; import org.springframework.security.access.annotation.Secured;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -33,7 +32,6 @@ import ru.ulstu.user.service.UserSessionService;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Map; import java.util.Map;
import static ru.ulstu.user.controller.UserController.URL; import static ru.ulstu.user.controller.UserController.URL;

View File

@ -9,8 +9,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import ru.ulstu.configuration.Constants; import ru.ulstu.configuration.Constants;
import ru.ulstu.odin.controller.OdinController; import ru.ulstu.odin.controller.OdinController;
import ru.ulstu.user.model.UserDto;
import ru.ulstu.user.model.User; import ru.ulstu.user.model.User;
import ru.ulstu.user.model.UserDto;
import ru.ulstu.user.model.UserListDto; import ru.ulstu.user.model.UserListDto;
import ru.ulstu.user.service.UserService; import ru.ulstu.user.service.UserService;
import ru.ulstu.user.service.UserSessionService; import ru.ulstu.user.service.UserSessionService;

View File

@ -252,7 +252,7 @@ public class UserService implements UserDetailsService {
mailService.sendChangePasswordMail(user); mailService.sendChangePasswordMail(user);
} }
public boolean requestUserPasswordReset(String email) { public boolean requestUserPasswordReset(String email) {
User user = userRepository.findOneByEmailIgnoreCase(email); User user = userRepository.findOneByEmailIgnoreCase(email);
if (user == null) { if (user == null) {
throw new UserNotFoundException(email); throw new UserNotFoundException(email);

View File

@ -18,7 +18,7 @@ public class TimetableService {
private static final String TIMETABLE_URL = "http://timetable.athene.tech/api/1.0/timetable?filter=%s"; private static final String TIMETABLE_URL = "http://timetable.athene.tech/api/1.0/timetable?filter=%s";
private SimpleDateFormat lessonTimeFormat = new SimpleDateFormat("hh:mm"); private SimpleDateFormat lessonTimeFormat = new SimpleDateFormat("hh:mm");
private long[] lessonsStarts = new long[] { private long[] lessonsStarts = new long[]{
lessonTimeFormat.parse("8:00:00").getTime(), lessonTimeFormat.parse("8:00:00").getTime(),
lessonTimeFormat.parse("9:40:00").getTime(), lessonTimeFormat.parse("9:40:00").getTime(),
lessonTimeFormat.parse("11:30:00").getTime(), lessonTimeFormat.parse("11:30:00").getTime(),
@ -58,8 +58,8 @@ public class TimetableService {
firstJan.set(Calendar.MONTH, 0); firstJan.set(Calendar.MONTH, 0);
firstJan.set(Calendar.DAY_OF_MONTH, 1); firstJan.set(Calendar.DAY_OF_MONTH, 1);
return (int) Math.round(Math.ceil((((currentDate.getTime() - firstJan.getTime().getTime()) / 86400000) return (int) Math.round(Math.ceil((((currentDate.getTime() - firstJan.getTime().getTime()) / 86400000)
+ DateUtils.addDays(firstJan.getTime(), 1).getTime() / 7) % 2)); + DateUtils.addDays(firstJan.getTime(), 1).getTime() / 7) % 2));
} }
private TimetableResponse getTimetableForUser(String userFIO) throws RestClientException { private TimetableResponse getTimetableForUser(String userFIO) throws RestClientException {
@ -67,7 +67,7 @@ public class TimetableService {
return restTemplate.getForObject(String.format(TIMETABLE_URL, userFIO), TimetableResponse.class); return restTemplate.getForObject(String.format(TIMETABLE_URL, userFIO), TimetableResponse.class);
} }
public Lesson getCurrentLesson(String userFio) { public Lesson getCurrentLesson(String userFio) {
TimetableResponse response; TimetableResponse response;
try { try {
response = getTimetableForUser(userFio); response = getTimetableForUser(userFio);

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class Day { public class Day {
private Integer day; private Integer day;
private List<List<Lesson>> lessons = new ArrayList<>(); private List<List<Lesson>> lessons = new ArrayList<>();

View File

@ -1,6 +1,6 @@
package ru.ulstu.utils.timetable.model; package ru.ulstu.utils.timetable.model;
public class Lesson { public class Lesson {
private String group; private String group;
private String nameOfLesson; private String nameOfLesson;
private String teacher; private String teacher;

View File

@ -1,6 +1,6 @@
package ru.ulstu.utils.timetable.model; package ru.ulstu.utils.timetable.model;
public class TimetableResponse { public class TimetableResponse {
private Response response; private Response response;
private String error; private String error;

View File

@ -8,8 +8,10 @@
<div class="col"> <div class="col">
<span th:replace="grants/fragments/grantStatusFragment :: grantStatus(grantStatus=${grant.status})"/> <span th:replace="grants/fragments/grantStatusFragment :: grantStatus(grantStatus=${grant.status})"/>
<a th:href="@{'grant?id='+${grant.id}}"> <a th:href="@{'grant?id='+${grant.id}}">
<span class="h6" th:if="${#strings.length(grant.title) > 50}" th:text="${#strings.substring(grant.title, 0, 50)} + '...'" th:title="${grant.title}"/> <span class="h6" th:if="${#strings.length(grant.title) > 50}"
<span class="h6" th:if="${#strings.length(grant.title) le 50}" th:text="${grant.title}" th:title="${grant.title}"/> th:text="${#strings.substring(grant.title, 0, 50)} + '...'" th:title="${grant.title}"/>
<span class="h6" th:if="${#strings.length(grant.title) le 50}" th:text="${grant.title}"
th:title="${grant.title}"/>
<span class="text-muted" th:text="${grant.authorsString}"/> <span class="text-muted" th:text="${grant.authorsString}"/>
</a> </a>
<input class="id-class" type="hidden" th:value="${grant.id}"/> <input class="id-class" type="hidden" th:value="${grant.id}"/>

View File

@ -8,8 +8,10 @@
<div class="col"> <div class="col">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status})"/> <span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status})"/>
<a th:href="@{'paper?id='+${paper.id}}"> <a th:href="@{'paper?id='+${paper.id}}">
<span class="h6" th:if="${#strings.length(paper.title)} > 50" th:text="${#strings.substring(paper.title, 0, 50) + '...'}" th:title="${paper.title}"/> <span class="h6" th:if="${#strings.length(paper.title)} > 50"
<span class="h6" th:if="${#strings.length(paper.title) le 50}" th:text="${paper.title}" th:title="${paper.title}"/> th:text="${#strings.substring(paper.title, 0, 50) + '...'}" th:title="${paper.title}"/>
<span class="h6" th:if="${#strings.length(paper.title) le 50}" th:text="${paper.title}"
th:title="${paper.title}"/>
<span class="text-muted" th:text="${paper.authorsString}"/> <span class="text-muted" th:text="${paper.authorsString}"/>
</a> </a>
<input class="id-class" type="hidden" th:value="${paper.id}"/> <input class="id-class" type="hidden" th:value="${paper.id}"/>

View File

@ -530,6 +530,7 @@
} }
} }
</script> </script>
<script th:inline="javascript"> <script th:inline="javascript">
/*<![CDATA[*/ /*<![CDATA[*/

View File

@ -98,9 +98,11 @@
</div> </div>
<div class="col-12" style="margin-bottom: 15px;"></div> <div class="col-12" style="margin-bottom: 15px;"></div>
<div class="col-10 div-deadline-executor"> <div class="col-10 div-deadline-executor">
<select class="selectpicker form-control" multiple="true" data-live-search="true" <select class="selectpicker form-control" multiple="true"
data-live-search="true"
title="-- Выберите исполнителя --" id="executors" title="-- Выберите исполнителя --" id="executors"
th:field="*{deadlines[__${rowStat.index}__].executors}" data-size="5"> th:field="*{deadlines[__${rowStat.index}__].executors}"
data-size="5">
<option th:each="executors : ${allExecutors}" th:value="${executors.id}" <option th:each="executors : ${allExecutors}" th:value="${executors.id}"
th:text="${executors.lastName}"> Участник th:text="${executors.lastName}"> Участник
</option> </option>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" <html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml"> layout:decorator="default">
<head> <head>
<script src="/js/users.js"></script> <script src="/js/users.js"></script>
<link rel="stylesheet" href="../css/base.css"/> <link rel="stylesheet" href="../css/base.css"/>
@ -35,7 +35,8 @@
<input type="text" name="email" id="resetKey" class="form-control" <input type="text" name="email" id="resetKey" class="form-control"
placeholder="Код подтверждения" style="display:none"/> placeholder="Код подтверждения" style="display:none"/>
</div> </div>
<div id="dvloader" class="loader" style="display:none"><img src="../img/main/ajax-loader.gif" /></div> <div id="dvloader" class="loader" style="display:none"><img src="../img/main/ajax-loader.gif"/>
</div>
<button id="btnSend" type="button" onclick="requestResetPassword()" <button id="btnSend" type="button" onclick="requestResetPassword()"
class="btn btn-success btn-block"> class="btn btn-success btn-block">
Отправить код подтверждения Отправить код подтверждения

View File

@ -29,6 +29,7 @@
showFeedbackMessage(error, MessageTypesEnum.WARNING) showFeedbackMessage(error, MessageTypesEnum.WARNING)
}); });
/*]]>*/ /*]]>*/
</script> </script>
</div> </div>
</body> </body>

View File

@ -7,9 +7,13 @@
<div th:fragment="userDashboard (user)" class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card"> <div th:fragment="userDashboard (user)" class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
<div class="row"> <div class="row">
<div class="col col-10"> <div class="col col-10">
<b><p th:text="${user.user.lastName} + ' ' + ${user.user.firstName} + ' ' + ${user.user.patronymic}"></p></b> <b><p th:text="${user.user.lastName} + ' ' + ${user.user.firstName} + ' ' + ${user.user.patronymic}"></p>
<i><p th:if="${user.conference != null}" th:text="'Сейчас на конференции ' + ${user.conference.title}"></p></i> </b>
<i><p th:if="${user.lesson != null}" th:text="'Сейчас на паре ' + ${user.lesson.nameOfLesson} + ' в аудитории ' + ${user.lesson.room}"></p></i> <i><p th:if="${user.conference != null}" th:text="'Сейчас на конференции ' + ${user.conference.title}"></p>
</i>
<i><p th:if="${user.lesson != null}"
th:text="'Сейчас на паре ' + ${user.lesson.nameOfLesson} + ' в аудитории ' + ${user.lesson.room}"></p>
</i>
<p th:if="${user.isOnline()}">Онлайн</p> <p th:if="${user.isOnline()}">Онлайн</p>
</div> </div>
</div> </div>

View File

@ -20,7 +20,10 @@ import ru.ulstu.user.model.User;
import ru.ulstu.user.service.UserService; import ru.ulstu.user.service.UserService;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import static junit.framework.TestCase.assertTrue; import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;