diff --git a/build.gradle b/build.gradle index a858707..d09505e 100644 --- a/build.gradle +++ b/build.gradle @@ -16,11 +16,14 @@ buildscript { group 'ru.ulstu' version '0.1.0-SNAPSHOT' +apply plugin: 'application' apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: 'checkstyle' +mainClassName = 'ru.ulstu.NgTrackerApplication' + build.dependsOn checkstyleMain bootRun.dependsOn checkstyleMain diff --git a/src/main/java/ru/ulstu/configuration/MvcConfiguration.java b/src/main/java/ru/ulstu/configuration/MvcConfiguration.java index 14e6337..8543847 100644 --- a/src/main/java/ru/ulstu/configuration/MvcConfiguration.java +++ b/src/main/java/ru/ulstu/configuration/MvcConfiguration.java @@ -12,6 +12,7 @@ public class MvcConfiguration extends WebMvcConfigurerAdapter { registry.addViewController("/{articlename:\\w+}"); //registry.addViewController("/admin/{articlename:\\w+}"); registry.addViewController("/papers/{articlename:\\w+}"); + registry.addViewController("/grants/{articlename:\\w+}"); registry.addRedirectViewController("/", "/index"); registry.addRedirectViewController("/default", "/index"); } diff --git a/src/main/java/ru/ulstu/core/controller/AdviceController.java b/src/main/java/ru/ulstu/core/controller/AdviceController.java index 916359a..2fe853e 100644 --- a/src/main/java/ru/ulstu/core/controller/AdviceController.java +++ b/src/main/java/ru/ulstu/core/controller/AdviceController.java @@ -11,8 +11,15 @@ import ru.ulstu.core.error.EntityIdIsNullException; import ru.ulstu.core.model.ErrorConstants; import ru.ulstu.core.model.response.Response; import ru.ulstu.core.model.response.ResponseExtended; -import ru.ulstu.user.error.*; -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 java.util.Set; import java.util.stream.Collectors; diff --git a/src/main/java/ru/ulstu/odin/service/OdinService.java b/src/main/java/ru/ulstu/odin/service/OdinService.java index 9de2426..d1c9081 100644 --- a/src/main/java/ru/ulstu/odin/service/OdinService.java +++ b/src/main/java/ru/ulstu/odin/service/OdinService.java @@ -5,12 +5,25 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import ru.ulstu.core.error.OdinException; -import ru.ulstu.odin.model.*; -import ru.ulstu.odin.model.*; +import ru.ulstu.odin.model.OdinBooleanField; +import ru.ulstu.odin.model.OdinCollectionField; +import ru.ulstu.odin.model.OdinDateField; +import ru.ulstu.odin.model.OdinDto; +import ru.ulstu.odin.model.OdinField; +import ru.ulstu.odin.model.OdinMetadata; +import ru.ulstu.odin.model.OdinNumericField; +import ru.ulstu.odin.model.OdinObjectField; +import ru.ulstu.odin.model.OdinStringField; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; import java.util.stream.Collectors; @Service diff --git a/src/main/java/ru/ulstu/paper/model/Paper.java b/src/main/java/ru/ulstu/paper/model/Paper.java index e9cc92c..c2a7f31 100644 --- a/src/main/java/ru/ulstu/paper/model/Paper.java +++ b/src/main/java/ru/ulstu/paper/model/Paper.java @@ -23,7 +23,12 @@ import java.util.Set; @Entity public class Paper extends BaseEntity implements UserContainer { public enum PaperStatus { - ATTENTION("Обратить внимание"), ON_PREPARATION("На подготовке"), DRAFT("Черновик"), COMPLETED("Завершена"); + ATTENTION("Обратить внимание"), + ON_PREPARATION("На подготовке"), + ON_REVIEW("На проверке"), + DRAFT("Черновик"), + COMPLETED("Завершена"), + FAILED("Провалены сроки"); private String name; diff --git a/src/main/java/ru/ulstu/paper/model/PaperDto.java b/src/main/java/ru/ulstu/paper/model/PaperDto.java index dc48fcd..d9a1229 100644 --- a/src/main/java/ru/ulstu/paper/model/PaperDto.java +++ b/src/main/java/ru/ulstu/paper/model/PaperDto.java @@ -8,6 +8,7 @@ import ru.ulstu.user.model.UserDto; import javax.validation.constraints.NotNull; import java.util.Date; import java.util.Set; +import java.util.stream.Collectors; import static ru.ulstu.core.util.StreamApiUtils.convert; @@ -121,4 +122,11 @@ public class PaperDto { public Set getAuthors() { return authors; } + + public String getAuthorsString() { + return authors + .stream() + .map(author -> author.getLastName() + author.getFirstName()) + .collect(Collectors.joining(", ")); + } } diff --git a/src/main/java/ru/ulstu/paper/service/PaperNotificationService.java b/src/main/java/ru/ulstu/paper/service/PaperNotificationService.java index 736ae87..99e0c86 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperNotificationService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperNotificationService.java @@ -31,7 +31,8 @@ public class PaperNotificationService { private boolean needToSendDeadlineNotification(Paper paper, Date compareDate, boolean isDeadlineBeforeWeek) { return (paper.getDeadlineDate() != null) && (compareDate.after(paper.getDeadlineDate()) && isDeadlineBeforeWeek - || compareDate.before(paper.getDeadlineDate()) && !isDeadlineBeforeWeek); + || compareDate.before(paper.getDeadlineDate()) && !isDeadlineBeforeWeek) + && paper.getDeadlineDate().after(new Date()); } private void sendMessageDeadline(Paper paper) { @@ -54,4 +55,11 @@ public class PaperNotificationService { mailService.sendEmailFromTemplate(variables, author, "paperStatusChangeNotification", "Изменился статус статьи"); }); } + + public void sendFailedNotification(Paper paper, Paper.PaperStatus oldStatus) { + Map variables = ImmutableMap.of("paper", paper, "oldStatus", oldStatus); + paper.getAuthors().forEach(author -> { + mailService.sendEmailFromTemplate(variables, author, "paperFailedNotification", "Статья провалена"); + }); + } } diff --git a/src/main/java/ru/ulstu/paper/service/DeadlineScheduler.java b/src/main/java/ru/ulstu/paper/service/PaperScheduler.java similarity index 55% rename from src/main/java/ru/ulstu/paper/service/DeadlineScheduler.java rename to src/main/java/ru/ulstu/paper/service/PaperScheduler.java index d6d9852..ed035d9 100644 --- a/src/main/java/ru/ulstu/paper/service/DeadlineScheduler.java +++ b/src/main/java/ru/ulstu/paper/service/PaperScheduler.java @@ -6,16 +6,16 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @Service -public class DeadlineScheduler { +public class PaperScheduler { private final static boolean IS_DEADLINE_NOTIFICATION_BEFORE_WEEK = true; - private final Logger log = LoggerFactory.getLogger(DeadlineScheduler.class); + private final Logger log = LoggerFactory.getLogger(PaperScheduler.class); private final PaperNotificationService paperNotificationService; private final PaperService paperService; - public DeadlineScheduler(PaperNotificationService paperNotificationService, - PaperService paperService) { + public PaperScheduler(PaperNotificationService paperNotificationService, + PaperService paperService) { this.paperNotificationService = paperNotificationService; this.paperService = paperService; } @@ -23,15 +23,22 @@ public class DeadlineScheduler { @Scheduled(cron = "0 0 8 * 1 ?") public void checkDeadlineBeforeWeek() { - log.debug("DeadlineScheduler.checkDeadlineBeforeWeek started"); + log.debug("PaperScheduler.checkDeadlineBeforeWeek started"); paperNotificationService.sendDeadlineNotifications(paperService.findAll(), !IS_DEADLINE_NOTIFICATION_BEFORE_WEEK); - log.debug("DeadlineScheduler.checkDeadlineBeforeWeek finished"); + log.debug("PaperScheduler.checkDeadlineBeforeWeek finished"); } @Scheduled(cron = "0 0 8 * * ?") public void checkDeadlineAfterWeek() { - log.debug("DeadlineScheduler.checkDeadlineAfterWeek started"); + log.debug("PaperScheduler.checkDeadlineAfterWeek started"); paperNotificationService.sendDeadlineNotifications(paperService.findAll(), IS_DEADLINE_NOTIFICATION_BEFORE_WEEK); - log.debug("DeadlineScheduler.checkDeadlineAfterWeek finished"); + log.debug("PaperScheduler.checkDeadlineAfterWeek finished"); + } + + @Scheduled(cron = "0 0 6 * * ?") + public void closeFailedPapers() { + log.debug("PaperScheduler.closeFailedPapers started"); + paperService.closeFailedPapers(); + log.debug("PaperScheduler.closeFailedPapers finished"); } } diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index a75592b..0e1abbc 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -18,6 +18,9 @@ import java.util.List; import java.util.stream.Collectors; import static ru.ulstu.core.util.StreamApiUtils.convert; +import static ru.ulstu.paper.model.Paper.PaperStatus.ATTENTION; +import static ru.ulstu.paper.model.Paper.PaperStatus.DRAFT; +import static ru.ulstu.paper.model.Paper.PaperStatus.ON_PREPARATION; @Service public class PaperService { @@ -65,7 +68,7 @@ public class PaperService { paper.setComment(paperDto.getComment()); paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate()); paper.setLocked(paperDto.getLocked()); - paper.setStatus(paperDto.getStatus() == null ? Paper.PaperStatus.DRAFT : paperDto.getStatus()); + paper.setStatus(paperDto.getStatus() == null ? DRAFT : paperDto.getStatus()); paper.setTitle(paperDto.getTitle()); paper.setUpdateDate(new Date()); paper.setDeadlineDate(paperDto.getDeadlineDate()); @@ -115,7 +118,7 @@ public class PaperService { paper.setDeadlineDate(deadlineDate); paper.setCreateDate(new Date()); paper.setUpdateDate(new Date()); - paper.setStatus(Paper.PaperStatus.DRAFT); + paper.setStatus(DRAFT); paper = paperRepository.save(paper); paperNotificationService.sendCreateNotification(paper); @@ -126,4 +129,21 @@ public class PaperService { public List filter(PaperFilterDto filterDto) { return convert(paperRepository.filter(userService.findById(filterDto.getAuthorId()), filterDto.getYear()), PaperDto::new); } + + public void closeFailedPapers() { + List papers = paperRepository.findAll() + .stream() + .filter(paper -> paper.getDeadlineDate() != null + && (paper.getStatus() == ON_PREPARATION + || paper.getStatus() == DRAFT + || paper.getStatus() == ATTENTION) + && paper.getDeadlineDate().before(new Date())) + .collect(Collectors.toList()); + papers.forEach(paper -> { + Paper.PaperStatus oldStatus = paper.getStatus(); + paper.setStatus(Paper.PaperStatus.FAILED); + paperRepository.save(paper); + paperNotificationService.sendFailedNotification(paper, oldStatus); + }); + } } diff --git a/src/main/java/ru/ulstu/timeline/controller/EventController.java b/src/main/java/ru/ulstu/timeline/controller/EventController.java index b2e4a23..77cb118 100644 --- a/src/main/java/ru/ulstu/timeline/controller/EventController.java +++ b/src/main/java/ru/ulstu/timeline/controller/EventController.java @@ -34,6 +34,11 @@ public class EventController { return new Response<>(eventService.findAllDto()); } + @GetMapping("/future") + public Response> getFutureEvents() { + return new Response<>(eventService.findAllFutureDto()); + } + @PostMapping public Response createEvent(@RequestBody @Valid EventDto timelineDto) { return new Response(eventService.create(timelineDto)); diff --git a/src/main/java/ru/ulstu/timeline/model/Event.java b/src/main/java/ru/ulstu/timeline/model/Event.java index 7ae715d..290f136 100644 --- a/src/main/java/ru/ulstu/timeline/model/Event.java +++ b/src/main/java/ru/ulstu/timeline/model/Event.java @@ -4,6 +4,7 @@ import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.user.model.User; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -66,6 +67,10 @@ public class Event extends BaseEntity { @JoinColumn(name = "child_id") private Event child; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "child_id") + private List parents; + public String getTitle() { return title; } @@ -137,4 +142,12 @@ public class Event extends BaseEntity { public void setChild(Event child) { this.child = child; } + + public List getParents() { + return parents; + } + + public void setParents(List parents) { + this.parents = parents; + } } diff --git a/src/main/java/ru/ulstu/timeline/model/EventDto.java b/src/main/java/ru/ulstu/timeline/model/EventDto.java index 0ec07ea..9e70a9d 100644 --- a/src/main/java/ru/ulstu/timeline/model/EventDto.java +++ b/src/main/java/ru/ulstu/timeline/model/EventDto.java @@ -65,9 +65,13 @@ public class EventDto { return title; } - public PeriodEvent getPeriod() { return period; } + public PeriodEvent getPeriod() { + return period; + } - public Event.EventStatus getStatus() { return status; } + public Event.EventStatus getStatus() { + return status; + } public Date getCreateDate() { return createDate; diff --git a/src/main/java/ru/ulstu/timeline/model/PeriodEvent.java b/src/main/java/ru/ulstu/timeline/model/PeriodEvent.java index b5e73b8..c25528e 100644 --- a/src/main/java/ru/ulstu/timeline/model/PeriodEvent.java +++ b/src/main/java/ru/ulstu/timeline/model/PeriodEvent.java @@ -3,22 +3,24 @@ package ru.ulstu.timeline.model; import java.time.Period; public enum PeriodEvent { - EVERY_YEAR(Period.ofYears(1), "Каждый год"), - EVERY_MONTH(Period.ofMonths(1), "Каждый месяц"), - EVERY_WEEK(Period.ofWeeks(1), "Каждую неделю"), - EVERY_DAY(Period.ofDays(1), "Каждый день"); + EVERY_YEAR(Period.ofYears(1), "Каждый год"), + EVERY_MONTH(Period.ofMonths(1), "Каждый месяц"), + EVERY_WEEK(Period.ofWeeks(1), "Каждую неделю"), + EVERY_DAY(Period.ofDays(1), "Каждый день"); - private Period period; - private String message; + private Period period; + private String message; PeriodEvent(Period period, String message) { - this.period = period; - this.message = message; - } + this.period = period; + this.message = message; + } - public Period getPeriod() { return period; } + public Period getPeriod() { + return period; + } - public String getMessage() { - return message; - } + public String getMessage() { + return message; + } } diff --git a/src/main/java/ru/ulstu/timeline/repository/EventRepository.java b/src/main/java/ru/ulstu/timeline/repository/EventRepository.java index 2829261..4848e12 100644 --- a/src/main/java/ru/ulstu/timeline/repository/EventRepository.java +++ b/src/main/java/ru/ulstu/timeline/repository/EventRepository.java @@ -10,6 +10,6 @@ public interface EventRepository extends JpaRepository { @Query("SELECT e FROM Event e WHERE e.executeDate = CURRENT_DATE") List findByCurrentDate(); - @Query("SELECT e FROM Event e WHERE e.executeDate > CURRENT_DATE") + @Query("SELECT e FROM Event e WHERE e.executeDate > CURRENT_DATE ORDER BY e.executeDate") List findAllFuture(); } diff --git a/src/main/java/ru/ulstu/timeline/service/EventScheduler.java b/src/main/java/ru/ulstu/timeline/service/EventScheduler.java index 7a0bc66..6df7fcb 100644 --- a/src/main/java/ru/ulstu/timeline/service/EventScheduler.java +++ b/src/main/java/ru/ulstu/timeline/service/EventScheduler.java @@ -40,7 +40,8 @@ public class EventScheduler { @Scheduled(cron = "0 0 * * * ?") public void checkPeriodEvents() { log.debug("EventScheduler.checkPeriodEvents started"); - for (Event event : eventService.findAllFuture()) { + //TODO: filter + for (Event event : eventService.findAll()) { if (halfOfThePeriodHasPassed(event)) { eventService.createBasedOn(event, DateUtils.addDays(event.getExecuteDate(), getShiftInDays(event.getPeriod()))); } @@ -67,6 +68,6 @@ public class EventScheduler { private boolean halfOfThePeriodHasPassed(Event event) { return event.getPeriod() != null && event.getChild() == null && new Date().after( - DateUtils.addDays(event.getExecuteDate(), (int) -Math.round((double) getShiftInDays(event.getPeriod()) / 2))); + DateUtils.addDays(event.getExecuteDate(), (int) Math.round((double) getShiftInDays(event.getPeriod()) / 2))); } } diff --git a/src/main/java/ru/ulstu/timeline/service/EventService.java b/src/main/java/ru/ulstu/timeline/service/EventService.java index 602e7aa..ca95b9a 100644 --- a/src/main/java/ru/ulstu/timeline/service/EventService.java +++ b/src/main/java/ru/ulstu/timeline/service/EventService.java @@ -57,8 +57,9 @@ public class EventService { } @Transactional - public void delete(Integer timelineId) { - Event event = eventRepository.findOne(timelineId); + public void delete(Integer eventId) { + Event event = eventRepository.findOne(eventId); + event.setParents(null); eventRepository.delete(event); } @@ -90,4 +91,8 @@ public class EventService { public List findAllFuture() { return eventRepository.findAllFuture(); } + + public List findAllFutureDto() { + return convert(findAllFuture(), EventDto::new); + } } 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; diff --git a/src/main/resources/mail_templates/paperFailedNotification.html b/src/main/resources/mail_templates/paperFailedNotification.html new file mode 100644 index 0000000..cacc7e9 --- /dev/null +++ b/src/main/resources/mail_templates/paperFailedNotification.html @@ -0,0 +1,22 @@ + + + + Уведомление о провале статьи + + + + +

+ Уважаемый(ая) Ivan Ivanov +

+

+ Статья "Title" провалена. + Предыдущий статус - "oldStatus". +

+

+ Regards, +
+ NG-tracker. +

+ + diff --git a/src/main/resources/public/css/agency.css b/src/main/resources/public/css/agency.css index a754bc3..80102ba 100644 --- a/src/main/resources/public/css/agency.css +++ b/src/main/resources/public/css/agency.css @@ -20,17 +20,21 @@ a:hover { } .text-primary { - color: #fed136 !important; + color: #29c0ff !important; } .text-warning { - color: #fe4819 !important; + color: red !important; } .text-success { color: #00fe8e !important; } +.text-failed { + color: #A38831 !important; +} + h1, h2, h3, diff --git a/src/main/resources/public/js/papers.js b/src/main/resources/public/js/papers.js index a06198e..88eaed1 100644 --- a/src/main/resources/public/js/papers.js +++ b/src/main/resources/public/js/papers.js @@ -6,17 +6,16 @@ function showPapers(papersElement, paperRowClass) { getFromRest(urlPapers, function (paperList) { paperList.forEach(function (paper, index) { $(papersElement).parent().append("
" + - "
" + + "
" + " \n" + " " + " " + " " + " " + paper.title + "
" + - "
" + - "" + + "'>" + (index + 1) + ". " + paper.title + "" + + "" + "" + - "
"); + "
"); }); $(paperRowClass).mouseenter(function (event) { @@ -78,11 +77,36 @@ function getPaperStatusClass(status) { return "text-draft" case 'ON_PREPARATION': return "text-primary"; + case 'ON_REVIEW': + return "text-primary"; case 'COMPLETED': return "text-success"; case 'ATTENTION': return "text-warning"; + case 'FAILED': + return "text-failed"; default: return ""; } +} + +function showPaperDashboard(dashboardElement) { + getFromRest(urlPapers, function (paperList) { + paperList.forEach(function (paper, index) { + $(dashboardElement).append("
" + + "
" + + "
" + + "" + + "" + + "" + + "" + + "
" + + "
" + + "" + paper.title + "" + + "

" + paper.authorsString + "

" + + "
" + + "
" + + "
"); + }); + }); } \ No newline at end of file diff --git a/src/main/resources/public/js/timeline.js b/src/main/resources/public/js/timeline.js new file mode 100644 index 0000000..6f2b52f --- /dev/null +++ b/src/main/resources/public/js/timeline.js @@ -0,0 +1,27 @@ +var urlTimeline = "/api/1.0/events/future"; + +function showTimeline(timelineElement) { + $(timelineElement).empty(); + getFromRest(urlTimeline, function (eventList) { + eventList.forEach(function (event, index) { + var date = new Date(event.executeDate); + var formated_date = date.toLocaleDateString(); + + $(timelineElement).append("
  • " + + "


    " + formated_date + "

    " + + "
    " + + "
    " + + "

    " + event.title + "

    " + + "
    " + + "
    " + + "

    " + event.description + "

    " + + "
    " + + "
    " + + "
  • "); + }); + }); +} + +function eventInverted(index) { + return index % 2 == 1 ? "timeline-inverted" : ""; +} \ No newline at end of file diff --git a/src/main/resources/templates/default.html b/src/main/resources/templates/default.html index 33884bf..b261b2f 100644 --- a/src/main/resources/templates/default.html +++ b/src/main/resources/templates/default.html @@ -91,6 +91,34 @@ + + + + diff --git a/src/main/resources/templates/grants/dashboard.html b/src/main/resources/templates/grants/dashboard.html new file mode 100644 index 0000000..afadb51 --- /dev/null +++ b/src/main/resources/templates/grants/dashboard.html @@ -0,0 +1,177 @@ + + + + + + +
    + +
    +
    + +
    +
    +
    +
    + + + + +
    + +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    + +
    +
    +
    +
    +
    + + + + +
    +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    +
    +
    +
    +
    +
    + + + + +
    +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    +
    +
    +
    +
    +
    + + + + +
    +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    +
    +
    +
    +
    +
    + + + + +
    +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    +
    +
    +
    +
    +
    + + + + +
    +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    +
    +
    +
    +
    +
    + + + + +
    +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    +
    +
    +
    +
    +
    + + + + +
    +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    +
    +
    +
    +
    +
    + + + + +
    +
    + Название гранта +

    Краткое описание

    +

    Статус: статус

    +
    +
    +
    +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/src/main/resources/templates/grants/grant.html b/src/main/resources/templates/grants/grant.html new file mode 100644 index 0000000..a77b856 --- /dev/null +++ b/src/main/resources/templates/grants/grant.html @@ -0,0 +1,201 @@ + + + + + + + +
    + +
    +
    +
    +
    +

    Редактирование гранта

    + +
    +
    +
    +
    +
    +
    +
    +
    + + +

    +
    + +
    + + +
    + +
    + + +
    +
    + + +
    +
    + +
    + +
    +
    +
    + +

    Добавить статью

    +
    + +
    + +

    Добавить проект

    +
    +
    + +

    Добавить показатель

    +
    +
    + +

    Добавить показатель

    +
    +
    + + +
    +

    Редактировать + участников гранта

    + +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    + + + +
    + + diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 155ec6a..0f83f3f 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -32,7 +32,7 @@
    - +
    diff --git a/src/main/resources/templates/papers/dashboard.html b/src/main/resources/templates/papers/dashboard.html index b4e18d7..5e6708f 100644 --- a/src/main/resources/templates/papers/dashboard.html +++ b/src/main/resources/templates/papers/dashboard.html @@ -10,142 +10,35 @@
    -
    -
    -

    Dashboard

    +
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    -
    -
    -
    - - - - -
    -
    - Название статьи -

    Список авторов И.О.

    -
    -
    -
    +
    +
    - + +
    diff --git a/src/main/resources/templates/papers/myPaper.html b/src/main/resources/templates/papers/myPaper.html deleted file mode 100644 index 14fc771..0000000 --- a/src/main/resources/templates/papers/myPaper.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -

    Пустая страница

    -
    -
    -
    -
    -
    - - - diff --git a/src/main/resources/templates/papers/papers.html b/src/main/resources/templates/papers/papers.html index 9a9ee7f..b381204 100644 --- a/src/main/resources/templates/papers/papers.html +++ b/src/main/resources/templates/papers/papers.html @@ -14,10 +14,15 @@

    Статьи

    + +
    Добавить статью diff --git a/src/main/resources/templates/timeline.html b/src/main/resources/templates/timeline.html index 1109686..5eda9f3 100644 --- a/src/main/resources/templates/timeline.html +++ b/src/main/resources/templates/timeline.html @@ -17,94 +17,21 @@
      -
    • -
      -

      -
      - 02.07.2018 -

      -
      -
      -
      -

      Уход в отпуск

      -
      -
      -

      Наконец-то!

      -
      -
      -
    • -
    • -
      - -
      -
      -
      -

      March 2011

      -

      An Agency is Born

      -
      -
      -

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt - ut - voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae - sit - vero unde, sed, incidunt et ea quo dolore laudantium consectetur!

      -
      -
      -
    • -
    • -
      - -
      -
      -
      -

      December 2012

      -

      Transition to Full Service

      -
      -
      -

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt - ut - voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae - sit - vero unde, sed, incidunt et ea quo dolore laudantium consectetur!

      -
      -
      -
    • -
    • -
      - -
      -
      -
      -

      July 2014

      -

      Phase Two Expansion

      -
      -
      -

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt - ut - voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae - sit - vero unde, sed, incidunt et ea quo dolore laudantium consectetur!

      -
      -
      -
    • -
    • -
      -

      Be Part -
      Of Our -
      Story!

      -
      -
    • +
    - - - + +