Merge branch 'master' into 10-savePaper
This commit is contained in:
commit
fe6e52a19c
@ -16,11 +16,14 @@ buildscript {
|
|||||||
group 'ru.ulstu'
|
group 'ru.ulstu'
|
||||||
version '0.1.0-SNAPSHOT'
|
version '0.1.0-SNAPSHOT'
|
||||||
|
|
||||||
|
apply plugin: 'application'
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'org.springframework.boot'
|
apply plugin: 'org.springframework.boot'
|
||||||
apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
apply plugin: 'checkstyle'
|
apply plugin: 'checkstyle'
|
||||||
|
|
||||||
|
mainClassName = 'ru.ulstu.NgTrackerApplication'
|
||||||
|
|
||||||
build.dependsOn checkstyleMain
|
build.dependsOn checkstyleMain
|
||||||
bootRun.dependsOn checkstyleMain
|
bootRun.dependsOn checkstyleMain
|
||||||
|
|
||||||
|
@ -18,6 +18,6 @@ fi
|
|||||||
|
|
||||||
ssh $USERSERVER "cd /tmp && rm -rf $ARTIFACT_NAME*.jar && echo `date` 'killed' >> log_$ARTIFACT_NAME"
|
ssh $USERSERVER "cd /tmp && rm -rf $ARTIFACT_NAME*.jar && echo `date` 'killed' >> log_$ARTIFACT_NAME"
|
||||||
scp build/libs/$ARTIFACT_NAME-0.1.0-SNAPSHOT.jar $USERSERVER:/tmp/$ARTIFACT_NAME-0.1.0-SNAPSHOT.jar
|
scp build/libs/$ARTIFACT_NAME-0.1.0-SNAPSHOT.jar $USERSERVER:/tmp/$ARTIFACT_NAME-0.1.0-SNAPSHOT.jar
|
||||||
ssh $USERSERVER -f "cd /tmp/ && /opt/jdk1.8.0_192/bin/java -jar $ARTIFACT_NAME-0.1.0-SNAPSHOT.jar -Xms 512m -Xmx 1024m --server.port=8443 --server.http.port=8080 >> /home/user/logfile_$ARTIFACT_NAME" &
|
ssh $USERSERVER -f "cd /tmp/ && /opt/jdk1.8.0_192/bin/java -jar $ARTIFACT_NAME-0.1.0-SNAPSHOT.jar -Xms 512m -Xmx 1024m --server.port=8443 --server.http.port=8080 --ng-tracker.base-url=http://193.110.3.124:8080 >> /home/user/logfile_$ARTIFACT_NAME" &
|
||||||
sleep 10
|
sleep 10
|
||||||
echo "is deployed"
|
echo "is deployed"
|
@ -12,6 +12,7 @@ public class MvcConfiguration extends WebMvcConfigurerAdapter {
|
|||||||
registry.addViewController("/{articlename:\\w+}");
|
registry.addViewController("/{articlename:\\w+}");
|
||||||
//registry.addViewController("/admin/{articlename:\\w+}");
|
//registry.addViewController("/admin/{articlename:\\w+}");
|
||||||
registry.addViewController("/papers/{articlename:\\w+}");
|
registry.addViewController("/papers/{articlename:\\w+}");
|
||||||
|
registry.addViewController("/grants/{articlename:\\w+}");
|
||||||
registry.addRedirectViewController("/", "/index");
|
registry.addRedirectViewController("/", "/index");
|
||||||
registry.addRedirectViewController("/default", "/index");
|
registry.addRedirectViewController("/default", "/index");
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,15 @@ import ru.ulstu.core.error.EntityIdIsNullException;
|
|||||||
import ru.ulstu.core.model.ErrorConstants;
|
import ru.ulstu.core.model.ErrorConstants;
|
||||||
import ru.ulstu.core.model.response.Response;
|
import ru.ulstu.core.model.response.Response;
|
||||||
import ru.ulstu.core.model.response.ResponseExtended;
|
import ru.ulstu.core.model.response.ResponseExtended;
|
||||||
import ru.ulstu.user.error.*;
|
import ru.ulstu.user.error.UserActivationError;
|
||||||
import ru.ulstu.user.error.*;
|
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.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -5,12 +5,25 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.core.error.OdinException;
|
import ru.ulstu.core.error.OdinException;
|
||||||
import ru.ulstu.odin.model.*;
|
import ru.ulstu.odin.model.OdinBooleanField;
|
||||||
import ru.ulstu.odin.model.*;
|
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.Field;
|
||||||
import java.lang.reflect.Modifier;
|
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;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import ru.ulstu.configuration.Constants;
|
import ru.ulstu.configuration.Constants;
|
||||||
import ru.ulstu.core.model.response.Response;
|
import ru.ulstu.core.model.response.Response;
|
||||||
import ru.ulstu.paper.model.PaperDto;
|
import ru.ulstu.paper.model.PaperDto;
|
||||||
|
import ru.ulstu.paper.model.PaperFilterDto;
|
||||||
import ru.ulstu.paper.model.PaperStatusDto;
|
import ru.ulstu.paper.model.PaperStatusDto;
|
||||||
import ru.ulstu.paper.service.PaperService;
|
import ru.ulstu.paper.service.PaperService;
|
||||||
|
|
||||||
@ -37,23 +38,28 @@ public class PaperController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Response createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
public Response<Integer> createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
||||||
return new Response(paperService.create(paperDto));
|
return new Response<>(paperService.create(paperDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public Response updatePaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
public Response<Integer> updatePaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
||||||
return new Response(paperService.update(paperDto));
|
return new Response<>(paperService.update(paperDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{paper-id}")
|
@DeleteMapping("/{paper-id}")
|
||||||
public Response delete(@PathVariable("paper-id") Integer paperId) throws IOException {
|
public Response<Boolean> delete(@PathVariable("paper-id") Integer paperId) throws IOException {
|
||||||
paperService.delete(paperId);
|
paperService.delete(paperId);
|
||||||
return new Response(true);
|
return new Response<>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/statuses")
|
@GetMapping("/statuses")
|
||||||
public Response<List<PaperStatusDto>> getPaperStatuses() {
|
public Response<List<PaperStatusDto>> getPaperStatuses() {
|
||||||
return new Response<>(paperService.getPaperStatuses());
|
return new Response<>(paperService.getPaperStatuses());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/filter")
|
||||||
|
public Response<List<PaperDto>> filter(@RequestBody @Valid PaperFilterDto paperFilterDto) throws IOException {
|
||||||
|
return new Response<>(paperService.filter(paperFilterDto));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,12 @@ import java.util.Set;
|
|||||||
@Entity
|
@Entity
|
||||||
public class Paper extends BaseEntity implements UserContainer {
|
public class Paper extends BaseEntity implements UserContainer {
|
||||||
public enum PaperStatus {
|
public enum PaperStatus {
|
||||||
ATTENTION("Обратить внимание"), ON_PREPARATION("На подготовке"), DRAFT("Черновик"), COMPLETED("Завершена");
|
ATTENTION("Обратить внимание"),
|
||||||
|
ON_PREPARATION("На подготовке"),
|
||||||
|
ON_REVIEW("На проверке"),
|
||||||
|
DRAFT("Черновик"),
|
||||||
|
COMPLETED("Завершена"),
|
||||||
|
FAILED("Провалены сроки");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import ru.ulstu.user.model.UserDto;
|
|||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||||
|
|
||||||
@ -121,4 +122,11 @@ public class PaperDto {
|
|||||||
public Set<UserDto> getAuthors() {
|
public Set<UserDto> getAuthors() {
|
||||||
return authors;
|
return authors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAuthorsString() {
|
||||||
|
return authors
|
||||||
|
.stream()
|
||||||
|
.map(author -> author.getLastName() + author.getFirstName())
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
24
src/main/java/ru/ulstu/paper/model/PaperFilterDto.java
Normal file
24
src/main/java/ru/ulstu/paper/model/PaperFilterDto.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package ru.ulstu.paper.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class PaperFilterDto {
|
||||||
|
private final Integer authorId;
|
||||||
|
private final Integer year;
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public PaperFilterDto(@JsonProperty("authorId") Integer authorId,
|
||||||
|
@JsonProperty("year") Integer year) {
|
||||||
|
this.authorId = authorId;
|
||||||
|
this.year = year;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAuthorId() {
|
||||||
|
return authorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getYear() {
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,15 @@
|
|||||||
package ru.ulstu.paper.repository;
|
package ru.ulstu.paper.repository;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
import ru.ulstu.paper.model.Paper;
|
import ru.ulstu.paper.model.Paper;
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface PaperRepository extends JpaRepository<Paper, Integer> {
|
public interface PaperRepository extends JpaRepository<Paper, Integer> {
|
||||||
|
|
||||||
|
@Query("SELECT p FROM Paper p WHERE (:author IS NULL OR :author MEMBER OF p.authors) AND YEAR(p.createDate) = :year OR :year IS NULL")
|
||||||
|
List<Paper> filter(@Param("author") User author, @Param("year") Integer year);
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,22 @@
|
|||||||
package ru.ulstu.strategy.api;
|
package ru.ulstu.paper.service;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.core.util.DateUtils;
|
import ru.ulstu.core.util.DateUtils;
|
||||||
import ru.ulstu.paper.model.Paper;
|
import ru.ulstu.paper.model.Paper;
|
||||||
import ru.ulstu.paper.service.PaperService;
|
import ru.ulstu.strategy.api.EntityCreateStrategy;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
import ru.ulstu.user.service.UserService;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class PaperCreateStrategy extends EntityCreateStrategy<Paper> {
|
public class PaperCreateStrategy extends EntityCreateStrategy<Paper> {
|
||||||
private static final String DEFAULT_NAME = "Статья создана автоматически";
|
private static final String DEFAULT_NAME = "Статья создана автоматически, т.к. у вас не найдено статей";
|
||||||
private static final int DEFAULT_DEADLINE_DAYS = 14;
|
private static final int DEFAULT_DEADLINE_DAYS = 14;
|
||||||
private final PaperService paperService;
|
private final PaperService paperService;
|
||||||
private final UserService userService;
|
|
||||||
|
|
||||||
public PaperCreateStrategy(PaperService paperService,
|
public PaperCreateStrategy(PaperService paperService) {
|
||||||
UserService userService) {
|
|
||||||
this.paperService = paperService;
|
this.paperService = paperService;
|
||||||
this.userService = userService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -31,7 +31,8 @@ public class PaperNotificationService {
|
|||||||
private boolean needToSendDeadlineNotification(Paper paper, Date compareDate, boolean isDeadlineBeforeWeek) {
|
private boolean needToSendDeadlineNotification(Paper paper, Date compareDate, boolean isDeadlineBeforeWeek) {
|
||||||
return (paper.getDeadlineDate() != null)
|
return (paper.getDeadlineDate() != null)
|
||||||
&& (compareDate.after(paper.getDeadlineDate()) && isDeadlineBeforeWeek
|
&& (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) {
|
private void sendMessageDeadline(Paper paper) {
|
||||||
@ -54,4 +55,11 @@ public class PaperNotificationService {
|
|||||||
mailService.sendEmailFromTemplate(variables, author, "paperStatusChangeNotification", "Изменился статус статьи");
|
mailService.sendEmailFromTemplate(variables, author, "paperStatusChangeNotification", "Изменился статус статьи");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendFailedNotification(Paper paper, Paper.PaperStatus oldStatus) {
|
||||||
|
Map<String, Object> variables = ImmutableMap.of("paper", paper, "oldStatus", oldStatus);
|
||||||
|
paper.getAuthors().forEach(author -> {
|
||||||
|
mailService.sendEmailFromTemplate(variables, author, "paperFailedNotification", "Статья провалена");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,16 +6,16 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DeadlineScheduler {
|
public class PaperScheduler {
|
||||||
private final static boolean IS_DEADLINE_NOTIFICATION_BEFORE_WEEK = true;
|
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 PaperNotificationService paperNotificationService;
|
||||||
private final PaperService paperService;
|
private final PaperService paperService;
|
||||||
|
|
||||||
public DeadlineScheduler(PaperNotificationService paperNotificationService,
|
public PaperScheduler(PaperNotificationService paperNotificationService,
|
||||||
PaperService paperService) {
|
PaperService paperService) {
|
||||||
this.paperNotificationService = paperNotificationService;
|
this.paperNotificationService = paperNotificationService;
|
||||||
this.paperService = paperService;
|
this.paperService = paperService;
|
||||||
}
|
}
|
||||||
@ -23,15 +23,22 @@ public class DeadlineScheduler {
|
|||||||
|
|
||||||
@Scheduled(cron = "0 0 8 * 1 ?")
|
@Scheduled(cron = "0 0 8 * 1 ?")
|
||||||
public void checkDeadlineBeforeWeek() {
|
public void checkDeadlineBeforeWeek() {
|
||||||
log.debug("DeadlineScheduler.checkDeadlineBeforeWeek started");
|
log.debug("PaperScheduler.checkDeadlineBeforeWeek started");
|
||||||
paperNotificationService.sendDeadlineNotifications(paperService.findAll(), !IS_DEADLINE_NOTIFICATION_BEFORE_WEEK);
|
paperNotificationService.sendDeadlineNotifications(paperService.findAll(), !IS_DEADLINE_NOTIFICATION_BEFORE_WEEK);
|
||||||
log.debug("DeadlineScheduler.checkDeadlineBeforeWeek finished");
|
log.debug("PaperScheduler.checkDeadlineBeforeWeek finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 8 * * ?")
|
@Scheduled(cron = "0 0 8 * * ?")
|
||||||
public void checkDeadlineAfterWeek() {
|
public void checkDeadlineAfterWeek() {
|
||||||
log.debug("DeadlineScheduler.checkDeadlineAfterWeek started");
|
log.debug("PaperScheduler.checkDeadlineAfterWeek started");
|
||||||
paperNotificationService.sendDeadlineNotifications(paperService.findAll(), IS_DEADLINE_NOTIFICATION_BEFORE_WEEK);
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,6 +5,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import ru.ulstu.file.service.FileService;
|
import ru.ulstu.file.service.FileService;
|
||||||
import ru.ulstu.paper.model.Paper;
|
import ru.ulstu.paper.model.Paper;
|
||||||
import ru.ulstu.paper.model.PaperDto;
|
import ru.ulstu.paper.model.PaperDto;
|
||||||
|
import ru.ulstu.paper.model.PaperFilterDto;
|
||||||
import ru.ulstu.paper.model.PaperStatusDto;
|
import ru.ulstu.paper.model.PaperStatusDto;
|
||||||
import ru.ulstu.paper.repository.PaperRepository;
|
import ru.ulstu.paper.repository.PaperRepository;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
@ -17,6 +18,9 @@ import java.util.List;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
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
|
@Service
|
||||||
public class PaperService {
|
public class PaperService {
|
||||||
@ -40,7 +44,7 @@ public class PaperService {
|
|||||||
return paperRepository.findAll().stream().sorted((paper1, paper2) -> {
|
return paperRepository.findAll().stream().sorted((paper1, paper2) -> {
|
||||||
int statusCompareResult =
|
int statusCompareResult =
|
||||||
Integer.valueOf(Arrays.asList(Paper.PaperStatus.values()).indexOf(paper1.getStatus()))
|
Integer.valueOf(Arrays.asList(Paper.PaperStatus.values()).indexOf(paper1.getStatus()))
|
||||||
.compareTo(Integer.valueOf(Arrays.asList(Paper.PaperStatus.values()).indexOf(paper2.getStatus())));
|
.compareTo(Arrays.asList(Paper.PaperStatus.values()).indexOf(paper2.getStatus()));
|
||||||
if (statusCompareResult != 0) {
|
if (statusCompareResult != 0) {
|
||||||
return statusCompareResult;
|
return statusCompareResult;
|
||||||
}
|
}
|
||||||
@ -53,7 +57,7 @@ public class PaperService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public int create(PaperDto paperDto) throws IOException {
|
public Integer create(PaperDto paperDto) throws IOException {
|
||||||
Paper newPaper = copyFromDto(new Paper(), paperDto);
|
Paper newPaper = copyFromDto(new Paper(), paperDto);
|
||||||
newPaper = paperRepository.save(newPaper);
|
newPaper = paperRepository.save(newPaper);
|
||||||
paperNotificationService.sendCreateNotification(newPaper);
|
paperNotificationService.sendCreateNotification(newPaper);
|
||||||
@ -64,7 +68,7 @@ public class PaperService {
|
|||||||
paper.setComment(paperDto.getComment());
|
paper.setComment(paperDto.getComment());
|
||||||
paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate());
|
paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate());
|
||||||
paper.setLocked(paperDto.getLocked());
|
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.setTitle(paperDto.getTitle());
|
||||||
paper.setUpdateDate(new Date());
|
paper.setUpdateDate(new Date());
|
||||||
paper.setDeadlineDate(paperDto.getDeadlineDate());
|
paper.setDeadlineDate(paperDto.getDeadlineDate());
|
||||||
@ -72,9 +76,7 @@ public class PaperService {
|
|||||||
paper.setFileData(fileService.createFileFromTmp(paperDto.getTmpFileName()));
|
paper.setFileData(fileService.createFileFromTmp(paperDto.getTmpFileName()));
|
||||||
}
|
}
|
||||||
if (paperDto.getAuthors() != null && !paperDto.getAuthors().isEmpty()) {
|
if (paperDto.getAuthors() != null && !paperDto.getAuthors().isEmpty()) {
|
||||||
paperDto.getAuthors().forEach(authorIds -> {
|
paperDto.getAuthors().forEach(authorIds -> paper.getAuthors().add(userService.findById(authorIds.getId())));
|
||||||
paper.getAuthors().add(userService.findById(authorIds.getId()));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return paper;
|
return paper;
|
||||||
}
|
}
|
||||||
@ -105,7 +107,7 @@ public class PaperService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<PaperStatusDto> getPaperStatuses() {
|
public List<PaperStatusDto> getPaperStatuses() {
|
||||||
return convert(Arrays.asList(Paper.PaperStatus.values()), status -> new PaperStatusDto(status));
|
return convert(Arrays.asList(Paper.PaperStatus.values()), PaperStatusDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -116,11 +118,32 @@ public class PaperService {
|
|||||||
paper.setDeadlineDate(deadlineDate);
|
paper.setDeadlineDate(deadlineDate);
|
||||||
paper.setCreateDate(new Date());
|
paper.setCreateDate(new Date());
|
||||||
paper.setUpdateDate(new Date());
|
paper.setUpdateDate(new Date());
|
||||||
paper.setStatus(Paper.PaperStatus.DRAFT);
|
paper.setStatus(DRAFT);
|
||||||
paper = paperRepository.save(paper);
|
paper = paperRepository.save(paper);
|
||||||
|
|
||||||
paperNotificationService.sendCreateNotification(paper);
|
paperNotificationService.sendCreateNotification(paper);
|
||||||
|
|
||||||
return paper;
|
return paper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PaperDto> filter(PaperFilterDto filterDto) {
|
||||||
|
return convert(paperRepository.filter(userService.findById(filterDto.getAuthorId()), filterDto.getYear()), PaperDto::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closeFailedPapers() {
|
||||||
|
List<Paper> 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);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import ru.ulstu.core.model.response.Response;
|
|||||||
import ru.ulstu.timeline.model.EventDto;
|
import ru.ulstu.timeline.model.EventDto;
|
||||||
import ru.ulstu.timeline.service.EventService;
|
import ru.ulstu.timeline.service.EventService;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static ru.ulstu.timeline.controller.EventController.URL;
|
import static ru.ulstu.timeline.controller.EventController.URL;
|
||||||
@ -30,16 +31,21 @@ public class EventController {
|
|||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public Response<List<EventDto>> getEvents() {
|
public Response<List<EventDto>> getEvents() {
|
||||||
return new Response<>(eventService.findAll());
|
return new Response<>(eventService.findAllDto());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/future")
|
||||||
|
public Response<List<EventDto>> getFutureEvents() {
|
||||||
|
return new Response<>(eventService.findAllFutureDto());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Response createEvent(@RequestBody EventDto timelineDto) {
|
public Response createEvent(@RequestBody @Valid EventDto timelineDto) {
|
||||||
return new Response(eventService.create(timelineDto));
|
return new Response(eventService.create(timelineDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public Response updateEvent(@RequestBody EventDto eventDto) {
|
public Response updateEvent(@RequestBody @Valid EventDto eventDto) {
|
||||||
return new Response(eventService.update(eventDto));
|
return new Response(eventService.update(eventDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,22 +4,50 @@ import org.hibernate.validator.constraints.NotBlank;
|
|||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToMany;
|
import javax.persistence.ManyToMany;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Event extends BaseEntity {
|
public class Event extends BaseEntity {
|
||||||
|
public enum EventStatus {
|
||||||
|
POSSIBLE("Возможное"), NEW("Новое"), IN_PROGRESS("В процессе"), COMPLETED("Завершено");
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
EventStatus(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@Enumerated(value = EnumType.STRING)
|
||||||
|
private PeriodEvent period;
|
||||||
|
|
||||||
|
@Enumerated(value = EnumType.STRING)
|
||||||
|
private EventStatus status;
|
||||||
|
|
||||||
@Column(name = "execute_date")
|
@Column(name = "execute_date")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
@NotNull
|
||||||
private Date executeDate;
|
private Date executeDate;
|
||||||
|
|
||||||
@Column(name = "create_date")
|
@Column(name = "create_date")
|
||||||
@ -35,6 +63,14 @@ public class Event extends BaseEntity {
|
|||||||
@ManyToMany(fetch = FetchType.EAGER)
|
@ManyToMany(fetch = FetchType.EAGER)
|
||||||
private List<User> recipients;
|
private List<User> recipients;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "child_id")
|
||||||
|
private Event child;
|
||||||
|
|
||||||
|
@OneToMany(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "child_id")
|
||||||
|
private List<Event> parents;
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
@ -43,6 +79,22 @@ public class Event extends BaseEntity {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Event.EventStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(EventStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PeriodEvent getPeriod() {
|
||||||
|
return period;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeriod(PeriodEvent period) {
|
||||||
|
this.period = period;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getCreateDate() {
|
public Date getCreateDate() {
|
||||||
return createDate;
|
return createDate;
|
||||||
}
|
}
|
||||||
@ -82,4 +134,20 @@ public class Event extends BaseEntity {
|
|||||||
public void setExecuteDate(Date executeDate) {
|
public void setExecuteDate(Date executeDate) {
|
||||||
this.executeDate = executeDate;
|
this.executeDate = executeDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Event getChild() {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChild(Event child) {
|
||||||
|
this.child = child;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Event> getParents() {
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParents(List<Event> parents) {
|
||||||
|
this.parents = parents;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@ package ru.ulstu.timeline.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
import ru.ulstu.user.model.UserDto;
|
import ru.ulstu.user.model.UserDto;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -11,7 +13,11 @@ import static ru.ulstu.core.util.StreamApiUtils.convert;
|
|||||||
|
|
||||||
public class EventDto {
|
public class EventDto {
|
||||||
private final Integer id;
|
private final Integer id;
|
||||||
|
@NotBlank
|
||||||
private final String title;
|
private final String title;
|
||||||
|
private final PeriodEvent period;
|
||||||
|
private final Event.EventStatus status;
|
||||||
|
@NotNull
|
||||||
private final Date executeDate;
|
private final Date executeDate;
|
||||||
private final Date createDate;
|
private final Date createDate;
|
||||||
private final Date updateDate;
|
private final Date updateDate;
|
||||||
@ -21,6 +27,8 @@ public class EventDto {
|
|||||||
@JsonCreator
|
@JsonCreator
|
||||||
public EventDto(@JsonProperty("id") Integer id,
|
public EventDto(@JsonProperty("id") Integer id,
|
||||||
@JsonProperty("title") String title,
|
@JsonProperty("title") String title,
|
||||||
|
@JsonProperty("status") Event.EventStatus status,
|
||||||
|
@JsonProperty("period") PeriodEvent period,
|
||||||
@JsonProperty("executeDate") Date executeDate,
|
@JsonProperty("executeDate") Date executeDate,
|
||||||
@JsonProperty("createDate") Date createDate,
|
@JsonProperty("createDate") Date createDate,
|
||||||
@JsonProperty("updateDate") Date updateDate,
|
@JsonProperty("updateDate") Date updateDate,
|
||||||
@ -28,6 +36,8 @@ public class EventDto {
|
|||||||
@JsonProperty("recipients") List<UserDto> recipients) {
|
@JsonProperty("recipients") List<UserDto> recipients) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
this.period = period;
|
||||||
|
this.status = status;
|
||||||
this.executeDate = executeDate;
|
this.executeDate = executeDate;
|
||||||
this.createDate = createDate;
|
this.createDate = createDate;
|
||||||
this.updateDate = updateDate;
|
this.updateDate = updateDate;
|
||||||
@ -38,6 +48,8 @@ public class EventDto {
|
|||||||
public EventDto(Event event) {
|
public EventDto(Event event) {
|
||||||
this.id = event.getId();
|
this.id = event.getId();
|
||||||
this.title = event.getTitle();
|
this.title = event.getTitle();
|
||||||
|
this.status = event.getStatus();
|
||||||
|
this.period = event.getPeriod();
|
||||||
this.executeDate = event.getExecuteDate();
|
this.executeDate = event.getExecuteDate();
|
||||||
this.createDate = event.getCreateDate();
|
this.createDate = event.getCreateDate();
|
||||||
this.updateDate = event.getUpdateDate();
|
this.updateDate = event.getUpdateDate();
|
||||||
@ -53,6 +65,14 @@ public class EventDto {
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PeriodEvent getPeriod() {
|
||||||
|
return period;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event.EventStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getCreateDate() {
|
public Date getCreateDate() {
|
||||||
return createDate;
|
return createDate;
|
||||||
}
|
}
|
||||||
|
19
src/main/java/ru/ulstu/timeline/model/EventStatusDto.java
Normal file
19
src/main/java/ru/ulstu/timeline/model/EventStatusDto.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package ru.ulstu.timeline.model;
|
||||||
|
|
||||||
|
public class EventStatusDto {
|
||||||
|
private final String id;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public EventStatusDto(Event.EventStatus status) {
|
||||||
|
this.id = status.name();
|
||||||
|
this.name = status.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
26
src/main/java/ru/ulstu/timeline/model/PeriodEvent.java
Normal file
26
src/main/java/ru/ulstu/timeline/model/PeriodEvent.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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), "Каждый день");
|
||||||
|
|
||||||
|
private Period period;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
PeriodEvent(Period period, String message) {
|
||||||
|
this.period = period;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Period getPeriod() {
|
||||||
|
return period;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
@ -9,4 +9,7 @@ import java.util.List;
|
|||||||
public interface EventRepository extends JpaRepository<Event, Integer> {
|
public interface EventRepository extends JpaRepository<Event, Integer> {
|
||||||
@Query("SELECT e FROM Event e WHERE e.executeDate = CURRENT_DATE")
|
@Query("SELECT e FROM Event e WHERE e.executeDate = CURRENT_DATE")
|
||||||
List<Event> findByCurrentDate();
|
List<Event> findByCurrentDate();
|
||||||
|
|
||||||
|
@Query("SELECT e FROM Event e WHERE e.executeDate > CURRENT_DATE ORDER BY e.executeDate")
|
||||||
|
List<Event> findAllFuture();
|
||||||
}
|
}
|
||||||
|
73
src/main/java/ru/ulstu/timeline/service/EventScheduler.java
Normal file
73
src/main/java/ru/ulstu/timeline/service/EventScheduler.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
package ru.ulstu.timeline.service;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import ru.ulstu.core.util.DateUtils;
|
||||||
|
import ru.ulstu.timeline.model.Event;
|
||||||
|
import ru.ulstu.timeline.model.PeriodEvent;
|
||||||
|
import ru.ulstu.user.service.MailService;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EventScheduler {
|
||||||
|
|
||||||
|
private final Logger log = LoggerFactory.getLogger(EventScheduler.class);
|
||||||
|
private final EventService eventService;
|
||||||
|
private final MailService mailService;
|
||||||
|
|
||||||
|
public EventScheduler(EventService eventService,
|
||||||
|
MailService mailService) {
|
||||||
|
this.eventService = eventService;
|
||||||
|
this.mailService = mailService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0 8 * * ?")
|
||||||
|
public void sendNotifications() {
|
||||||
|
List<Event> events = eventService.findByCurrentDate();
|
||||||
|
events.forEach(event -> {
|
||||||
|
Map<String, Object> variables = ImmutableMap.of("description", event.getDescription());
|
||||||
|
event.getRecipients()
|
||||||
|
.forEach(recipient -> mailService.sendEmailFromTemplate(variables, recipient, "eventNotification", event.getTitle()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0 * * * ?")
|
||||||
|
public void checkPeriodEvents() {
|
||||||
|
log.debug("EventScheduler.checkPeriodEvents started");
|
||||||
|
//TODO: filter
|
||||||
|
for (Event event : eventService.findAll()) {
|
||||||
|
if (halfOfThePeriodHasPassed(event)) {
|
||||||
|
eventService.createBasedOn(event, DateUtils.addDays(event.getExecuteDate(), getShiftInDays(event.getPeriod())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("EventScheduler.checkPeriodEvents finished");
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getShiftInDays(PeriodEvent periodEvent) {
|
||||||
|
switch (periodEvent) {
|
||||||
|
case EVERY_DAY:
|
||||||
|
return periodEvent.getPeriod().getDays();
|
||||||
|
case EVERY_WEEK:
|
||||||
|
return periodEvent.getPeriod().getDays();
|
||||||
|
case EVERY_MONTH:
|
||||||
|
return periodEvent.getPeriod().getMonths() * 30;
|
||||||
|
case EVERY_YEAR:
|
||||||
|
return periodEvent.getPeriod().getYears() * 365;
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("period event not exists");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,15 @@
|
|||||||
package ru.ulstu.timeline.service;
|
package ru.ulstu.timeline.service;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import ru.ulstu.timeline.model.Event;
|
import ru.ulstu.timeline.model.Event;
|
||||||
import ru.ulstu.timeline.model.EventDto;
|
import ru.ulstu.timeline.model.EventDto;
|
||||||
import ru.ulstu.timeline.repository.EventRepository;
|
import ru.ulstu.timeline.repository.EventRepository;
|
||||||
import ru.ulstu.user.model.UserDto;
|
import ru.ulstu.user.model.UserDto;
|
||||||
import ru.ulstu.user.service.MailService;
|
|
||||||
import ru.ulstu.user.service.UserService;
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||||
|
|
||||||
@ -21,18 +18,19 @@ public class EventService {
|
|||||||
|
|
||||||
private final EventRepository eventRepository;
|
private final EventRepository eventRepository;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final MailService mailService;
|
|
||||||
|
|
||||||
public EventService(EventRepository eventRepository,
|
public EventService(EventRepository eventRepository,
|
||||||
UserService userService,
|
UserService userService) {
|
||||||
MailService mailService) {
|
|
||||||
this.eventRepository = eventRepository;
|
this.eventRepository = eventRepository;
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
this.mailService = mailService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<EventDto> findAll() {
|
public List<EventDto> findAllDto() {
|
||||||
return convert(eventRepository.findAll(), EventDto::new);
|
return convert(findAll(), EventDto::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Event> findAll() {
|
||||||
|
return eventRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -42,11 +40,13 @@ public class EventService {
|
|||||||
|
|
||||||
private Event copyFromDto(Event event, EventDto eventDto) {
|
private Event copyFromDto(Event event, EventDto eventDto) {
|
||||||
event.setExecuteDate(eventDto.getExecuteDate());
|
event.setExecuteDate(eventDto.getExecuteDate());
|
||||||
event.setCreateDate(eventDto.getCreateDate());
|
event.setCreateDate(eventDto.getId() == null ? new Date() : eventDto.getCreateDate());
|
||||||
event.setDescription(eventDto.getDescription());
|
event.setDescription(eventDto.getDescription());
|
||||||
event.setRecipients(userService.findByIds(convert(eventDto.getRecipients(), UserDto::getId)));
|
event.setRecipients(userService.findByIds(convert(eventDto.getRecipients(), UserDto::getId)));
|
||||||
event.setTitle(eventDto.getTitle());
|
event.setTitle(eventDto.getTitle());
|
||||||
event.setUpdateDate(eventDto.getUpdateDate());
|
event.setPeriod(eventDto.getPeriod());
|
||||||
|
event.setStatus(eventDto.getStatus());
|
||||||
|
event.setUpdateDate(new Date());
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,8 +57,9 @@ public class EventService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void delete(Integer timelineId) {
|
public void delete(Integer eventId) {
|
||||||
Event event = eventRepository.findOne(timelineId);
|
Event event = eventRepository.findOne(eventId);
|
||||||
|
event.setParents(null);
|
||||||
eventRepository.delete(event);
|
eventRepository.delete(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,13 +67,32 @@ public class EventService {
|
|||||||
return eventRepository.findAll(ids);
|
return eventRepository.findAll(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 8 * * ?")
|
public void createBasedOn(Event event, Date executeDate) {
|
||||||
public void sendNotifications() {
|
//backup event id
|
||||||
List<Event> events = eventRepository.findByCurrentDate();
|
Integer parentEventId = event.getId();
|
||||||
events.forEach(event -> {
|
|
||||||
Map<String, Object> variables = ImmutableMap.of("description", event.getDescription());
|
event.setId(null);
|
||||||
event.getRecipients()
|
event.setStatus(Event.EventStatus.POSSIBLE);
|
||||||
.forEach(recipient -> mailService.sendEmailFromTemplate(variables, recipient, "eventNotification", event.getTitle()));
|
event.setExecuteDate(executeDate);
|
||||||
});
|
event.setCreateDate(new Date());
|
||||||
|
event.setUpdateDate(new Date());
|
||||||
|
event = eventRepository.save(event);
|
||||||
|
|
||||||
|
//set child to parent
|
||||||
|
Event parentEvent = eventRepository.findOne(parentEventId);
|
||||||
|
parentEvent.setChild(event);
|
||||||
|
eventRepository.save(parentEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Event> findByCurrentDate() {
|
||||||
|
return eventRepository.findByCurrentDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Event> findAllFuture() {
|
||||||
|
return eventRepository.findAllFuture();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EventDto> findAllFutureDto() {
|
||||||
|
return convert(findAllFuture(), EventDto::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,15 @@ 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.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.configuration.Constants;
|
||||||
import ru.ulstu.core.model.response.PageableItems;
|
import ru.ulstu.core.model.response.PageableItems;
|
||||||
import ru.ulstu.core.model.response.Response;
|
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.OdinMetadata;
|
||||||
import ru.ulstu.odin.model.OdinVoid;
|
import ru.ulstu.odin.model.OdinVoid;
|
||||||
import ru.ulstu.odin.service.OdinService;
|
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.UserService;
|
||||||
import ru.ulstu.user.service.UserSessionService;
|
import ru.ulstu.user.service.UserSessionService;
|
||||||
import ru.ulstu.user.model.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
@ -5,7 +5,14 @@ import org.hibernate.validator.constraints.Email;
|
|||||||
import ru.ulstu.configuration.Constants;
|
import ru.ulstu.configuration.Constants;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
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.NotNull;
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
package ru.ulstu.user.service;
|
package ru.ulstu.user.service;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.user.model.*;
|
import ru.ulstu.user.model.User;
|
||||||
import ru.ulstu.user.model.*;
|
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 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;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -16,13 +16,33 @@ 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.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.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.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;
|
||||||
|
|
||||||
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;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -6,8 +6,8 @@ import org.springframework.data.domain.Page;
|
|||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import ru.ulstu.core.model.response.PageableItems;
|
|
||||||
import ru.ulstu.core.jpa.OffsetablePageRequest;
|
import ru.ulstu.core.jpa.OffsetablePageRequest;
|
||||||
|
import ru.ulstu.core.model.response.PageableItems;
|
||||||
import ru.ulstu.user.error.UserNotFoundException;
|
import ru.ulstu.user.error.UserNotFoundException;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
import ru.ulstu.user.model.UserSession;
|
import ru.ulstu.user.model.UserSession;
|
||||||
|
@ -32,7 +32,7 @@ liquibase.drop-first=false
|
|||||||
liquibase.enabled=true
|
liquibase.enabled=true
|
||||||
liquibase.change-log=classpath:db/changelog-master.xml
|
liquibase.change-log=classpath:db/changelog-master.xml
|
||||||
# Application Settings
|
# Application Settings
|
||||||
ng-tracker.base-url=https://127.0.0.1:8443
|
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=true
|
||||||
ng-tracker.use-https=false
|
ng-tracker.use-https=false
|
13
src/main/resources/db/changelog-20181031_000000-schema.xml
Normal file
13
src/main/resources/db/changelog-20181031_000000-schema.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||||
|
<changeSet author="alyona" id="20181031_000000-1">
|
||||||
|
<preConditions onFail="MARK_RAN">
|
||||||
|
<not><columnExists columnName="status" tableName="event"/></not>
|
||||||
|
</preConditions>
|
||||||
|
<addColumn tableName="event">
|
||||||
|
<column name="status" type="varchar(255)"/>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
26
src/main/resources/db/changelog-20181111_000000-schema.xml
Normal file
26
src/main/resources/db/changelog-20181111_000000-schema.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||||
|
<changeSet author="orion" id="20181111_000000-1">
|
||||||
|
<preConditions onFail="MARK_RAN">
|
||||||
|
<not><columnExists columnName="period" tableName="event"/></not>
|
||||||
|
</preConditions>
|
||||||
|
<addColumn tableName="event">
|
||||||
|
<column name="period" type="varchar(50)"/>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
<changeSet author="orion" id="20181111_000000-2">
|
||||||
|
<preConditions onFail="MARK_RAN">
|
||||||
|
<not><columnExists columnName="child_id" tableName="event"/></not>
|
||||||
|
</preConditions>
|
||||||
|
<addColumn tableName="event">
|
||||||
|
<column name="child_id" type="integer"/>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
<changeSet author="orion" id="20181111_000000-3">
|
||||||
|
<addForeignKeyConstraint baseTableName="event" baseColumnNames="child_id"
|
||||||
|
constraintName="fk_event_child_event" referencedTableName="event"
|
||||||
|
referencedColumnNames="id"/>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -13,5 +13,7 @@
|
|||||||
<include file="db/changelog-20180505_000000-schema.xml"/>
|
<include file="db/changelog-20180505_000000-schema.xml"/>
|
||||||
<include file="db/changelog-20181027_000000-schema.xml"/>
|
<include file="db/changelog-20181027_000000-schema.xml"/>
|
||||||
<include file="db/changelog-20181030_000000-schema.xml"/>
|
<include file="db/changelog-20181030_000000-schema.xml"/>
|
||||||
|
<include file="db/changelog-20181031_000000-schema.xml"/>
|
||||||
<include file="db/changelog-20181108_000000-data.xml"/>
|
<include file="db/changelog-20181108_000000-data.xml"/>
|
||||||
|
<include file="db/changelog-20181111_000000-schema.xml"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
@ -10,7 +10,7 @@
|
|||||||
Уважаемый(ая) <span th:text="${user.firstName + ' ' + user.lastName}">Ivan Ivanov</span>
|
Уважаемый(ая) <span th:text="${user.firstName + ' ' + user.lastName}">Ivan Ivanov</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Вам нужно поработать над статьей "<span th:text="${paper.title}">Title</span>".
|
Вам нужно поработать над статьей "<a th:href="@{|${baseUrl}/papers/paper?id=${paper.id}|}"><span th:text="${paper.title}">Title</span></a>".
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Срок исполнения: <span th:text="${#dates.format(paper.deadlineDate, 'dd.MM.yyyy HH:mm')}"></span>.
|
Срок исполнения: <span th:text="${#dates.format(paper.deadlineDate, 'dd.MM.yyyy HH:mm')}"></span>.
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<title>Уведомление о провале статьи</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||||
|
<link rel="shortcut icon" th:href="@{|${baseUrl}/favicon.ico|}"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Уважаемый(ая) <span th:text="${user.firstName + ' ' + user.lastName}">Ivan Ivanov</span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Статья "<span th:text="${paper.title}">Title</span>" провалена.
|
||||||
|
Предыдущий статус - "<span th:text="${oldStatus.name}">oldStatus</span>".
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Regards,
|
||||||
|
<br/>
|
||||||
|
<em>NG-tracker.</em>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -20,17 +20,21 @@ a:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text-primary {
|
.text-primary {
|
||||||
color: #fed136 !important;
|
color: #29c0ff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-warning {
|
.text-warning {
|
||||||
color: #fe4819 !important;
|
color: red !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-success {
|
.text-success {
|
||||||
color: #00fe8e !important;
|
color: #00fe8e !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-failed {
|
||||||
|
color: #A38831 !important;
|
||||||
|
}
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
h2,
|
h2,
|
||||||
h3,
|
h3,
|
||||||
|
@ -1,19 +1,51 @@
|
|||||||
var urlPapers = "/api/1.0/papers";
|
var urlPapers = "/api/1.0/papers";
|
||||||
var urlPaperStatuses = "/api/1.0/papers/statuses";
|
var urlPaperStatuses = "/api/1.0/papers/statuses";
|
||||||
|
var urlDeletePaper = "/api/1.0/papers/";
|
||||||
|
|
||||||
function showPapers(papersElement) {
|
function showPapers(papersElement, paperRowClass) {
|
||||||
getFromRest(urlPapers, function (paperList) {
|
getFromRest(urlPapers, function (paperList) {
|
||||||
paperList.forEach(function (paper, index) {
|
paperList.forEach(function (paper, index) {
|
||||||
$(papersElement).parent().append("<div class='row text-left'>" +
|
$(papersElement).parent().append("<div class='row text-left paper-row'>" +
|
||||||
" <div class='col-md-12'>" +
|
" <div class='col'>" +
|
||||||
" <span class='fa-stack fa-1x'>\n" +
|
" <span class='fa-stack fa-1x'>\n" +
|
||||||
" <i class='fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "'></i>" +
|
" <i class='fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "'></i>" +
|
||||||
" <i class='fa fa-file-text-o fa-stack-1x fa-inverse'></i>" +
|
" <i class='fa fa-file-text-o fa-stack-1x fa-inverse'></i>" +
|
||||||
" </span>" +
|
" </span>" +
|
||||||
" <a href='paper?id=" + paper.id + "" +
|
" <a href='paper?id=" + paper.id + "" +
|
||||||
"'><span>" + paper.title + "</span></a>" +
|
"'><span>" + (index + 1) + ". " + paper.title + "</span></a>" +
|
||||||
" </div></div>");
|
"<span class='remove-paper d-none pull-right' onclick=\"deletePaper(" + paper.id + ",'" + papersElement + "', '" + paperRowClass + "')\">" +
|
||||||
|
"<i class=\"fa fa-trash\" aria-hidden=\"true\"></i></span>" +
|
||||||
|
"</div></div>");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(paperRowClass).mouseenter(function (event) {
|
||||||
|
var paperRow = $(event.target).closest(paperRowClass);
|
||||||
|
$(paperRow).css("background-color", "#f8f9fa");
|
||||||
|
$(paperRow).find(".remove-paper").removeClass("d-none");
|
||||||
|
|
||||||
|
});
|
||||||
|
$(paperRowClass).mouseleave(function (event) {
|
||||||
|
var paperRow = $(event.target).closest(paperRowClass);
|
||||||
|
$(paperRow).css("background-color", "white");
|
||||||
|
$(paperRow).closest(paperRowClass).find(".remove-paper").addClass("d-none");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletePaper(id, papersElement, paperRowClass) {
|
||||||
|
$("#remove-paper-modal").modal('show');
|
||||||
|
|
||||||
|
$("#modal-btn-yes").on("click", function () {
|
||||||
|
deleteFromRest(urlDeletePaper + id, function () {
|
||||||
|
showFeedbackMessage("Статья удалена");
|
||||||
|
$(paperRowClass).remove();
|
||||||
|
showPapers(papersElement, paperRowClass);
|
||||||
|
});
|
||||||
|
$("#remove-paper-modal").modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#modal-btn-no").on("click", function () {
|
||||||
|
$("#remove-paper-modal").modal('hide');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,11 +72,36 @@ function getPaperStatusClass(status) {
|
|||||||
return "text-draft"
|
return "text-draft"
|
||||||
case 'ON_PREPARATION':
|
case 'ON_PREPARATION':
|
||||||
return "text-primary";
|
return "text-primary";
|
||||||
|
case 'ON_REVIEW':
|
||||||
|
return "text-primary";
|
||||||
case 'COMPLETED':
|
case 'COMPLETED':
|
||||||
return "text-success";
|
return "text-success";
|
||||||
case 'ATTENTION':
|
case 'ATTENTION':
|
||||||
return "text-warning";
|
return "text-warning";
|
||||||
|
case 'FAILED':
|
||||||
|
return "text-failed";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showPaperDashboard(dashboardElement) {
|
||||||
|
getFromRest(urlPapers, function (paperList) {
|
||||||
|
paperList.forEach(function (paper, index) {
|
||||||
|
$(dashboardElement).append("<div class=\"col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card\">" +
|
||||||
|
"<div class=\"row\">" +
|
||||||
|
"<div class=\"col-2\">" +
|
||||||
|
"<span class=\"fa-stack fa-1x\">" +
|
||||||
|
"<i class=\"fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "\"></i>" +
|
||||||
|
"<i class=\"fa fa-file-text-o fa-stack-1x fa-inverse\"></i>" +
|
||||||
|
"</span>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div class=\"col col-10 text-right\">" +
|
||||||
|
"<h7 class=\"service-heading\">" + paper.title + "</h7>" +
|
||||||
|
"<p class=\"text-muted\">" + paper.authorsString + "</p>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>");
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
27
src/main/resources/public/js/timeline.js
Normal file
27
src/main/resources/public/js/timeline.js
Normal file
@ -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("<li class='" + eventInverted(index) + "'>" +
|
||||||
|
"<div class=\"timeline-image\"><h4><br/>" + formated_date + "</h4></div>" +
|
||||||
|
"<div class=\"timeline-panel\">" +
|
||||||
|
"<div class=\"timeline-heading\">" +
|
||||||
|
"<h4>" + event.title + "</h4>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div class=\"timeline-body\">" +
|
||||||
|
"<p class=\"text-muted\">" + event.description + "</p>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</li>");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function eventInverted(index) {
|
||||||
|
return index % 2 == 1 ? "timeline-inverted" : "";
|
||||||
|
}
|
@ -91,6 +91,34 @@
|
|||||||
<!-- Custom scripts for this template -->
|
<!-- Custom scripts for this template -->
|
||||||
<script src="/js/agency.js"></script>
|
<script src="/js/agency.js"></script>
|
||||||
<script src="/js/core.js"></script>
|
<script src="/js/core.js"></script>
|
||||||
|
<!-- Yandex.Metrika counter -->
|
||||||
|
<script type="text/javascript" >
|
||||||
|
(function (d, w, c) {
|
||||||
|
(w[c] = w[c] || []).push(function() {
|
||||||
|
try {
|
||||||
|
w.yaCounter49387279 = new Ya.Metrika2({
|
||||||
|
id:49387279,
|
||||||
|
clickmap:true,
|
||||||
|
trackLinks:true,
|
||||||
|
accurateTrackBounce:true,
|
||||||
|
webvisor:true
|
||||||
|
});
|
||||||
|
} catch(e) { }
|
||||||
|
});
|
||||||
|
|
||||||
|
var n = d.getElementsByTagName("script")[0],
|
||||||
|
s = d.createElement("script"),
|
||||||
|
f = function () { n.parentNode.insertBefore(s, n); };
|
||||||
|
s.type = "text/javascript";
|
||||||
|
s.async = true;
|
||||||
|
s.src = "https://mc.yandex.ru/metrika/tag.js";
|
||||||
|
|
||||||
|
if (w.opera == "[object Opera]") {
|
||||||
|
d.addEventListener("DOMContentLoaded", f, false);
|
||||||
|
} else { f(); }
|
||||||
|
})(document, window, "yandex_metrika_callbacks2");
|
||||||
|
</script>
|
||||||
|
<noscript><div><img src="https://mc.yandex.ru/watch/49387279" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
||||||
|
<!-- /Yandex.Metrika counter -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
177
src/main/resources/templates/grants/dashboard.html
Normal file
177
src/main/resources/templates/grants/dashboard.html
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorator="default">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container" layout:fragment="content">
|
||||||
|
<!-- Services -->
|
||||||
|
<section id="services">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 text-center">
|
||||||
|
<h2 class="section-heading text-uppercase">Dashboard</h2>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./grants" class="btn btn-light toolbar-button"><i class="fa fa-list-alt"></i>
|
||||||
|
Список</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o"
|
||||||
|
aria-hidden="true"></i> Панель управления</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./grant" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle" aria-hidden="true"></i>
|
||||||
|
Добавить грант</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading"><a href="./grant">Название гранта</a></h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading">Название гранта</h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading">Название гранта</h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading">Название гранта</h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading">Название гранта</h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading">Название гранта</h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading">Название гранта</h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading">Название гранта</h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<span class="fa-stack fa-1x">
|
||||||
|
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||||
|
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col col-10 text-right">
|
||||||
|
<h7 class="service-heading">Название гранта</h7>
|
||||||
|
<p class="text-muted">Краткое описание</p>
|
||||||
|
<p class="text-muted">Статус: статус</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
201
src/main/resources/templates/grants/grant.html
Normal file
201
src/main/resources/templates/grants/grant.html
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorator="default">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container" layout:fragment="content">
|
||||||
|
|
||||||
|
<section id="paper">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 text-center">
|
||||||
|
<h2 class="section-heading text-uppercase">Редактирование гранта</h2>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./grants" class="btn btn-light toolbar-button"><i class="fa fa-list-alt"></i>
|
||||||
|
Список</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o"
|
||||||
|
aria-hidden="true"></i> Панель управления</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./grant" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle" aria-hidden="true"></i>
|
||||||
|
Добавить грант</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<form id="contactForm" name="sentMessage" novalidate="">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name">Название:</label>
|
||||||
|
<input class="form-control" id="name" type="text" placeholder="Название гранта"
|
||||||
|
required="" data-validation-required-message="Введите название гранта"/>
|
||||||
|
<p class="help-block text-danger"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="status">Статус:</label>
|
||||||
|
<select class="form-control" id="status">
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="comment">Комментарий:</label>
|
||||||
|
<textarea class="form-control" rows="3" id="comment"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Дедлайн:</label>
|
||||||
|
<input type="date" class="form-control" name="deadline"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="loader">Загрузить заявку:</label>
|
||||||
|
<div id="loader">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Список статей:</label>
|
||||||
|
<p><a href="./#" class="btn btn-primary" ><i class="fa fa-plus-circle" aria-hidden="true">
|
||||||
|
</i> Добавить статью</a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>К этому гранту привязан проект:</label>
|
||||||
|
<p><a href="./#" class="btn btn-primary" ><i class="fa fa-plus-circle" aria-hidden="true">
|
||||||
|
</i> Добавить проект</a></p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Научные показатели:</label>
|
||||||
|
<p><a href="./#" class="btn btn-primary" ><i class="fa fa-plus-circle" aria-hidden="true">
|
||||||
|
</i> Добавить показатель</a></p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Публикационные показатели:</label>
|
||||||
|
<p><a href="./#" class="btn btn-primary" ><i class="fa fa-plus-circle" aria-hidden="true">
|
||||||
|
</i> Добавить показатель</a></p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Последнее изменение:</label>
|
||||||
|
<input type="date" class="form-control" name="date-update"/>
|
||||||
|
</div>
|
||||||
|
<p><a href="#myModal1" class="btn btn-primary" data-toggle="modal">Редактировать
|
||||||
|
участников гранта</a></p>
|
||||||
|
<div id="myModal1" class="modal fade">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
|
aria-hidden="true">×
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">Авторы статьи</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Фамилия</th>
|
||||||
|
<th>Имя</th>
|
||||||
|
<th>Отчество</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Иванов</td>
|
||||||
|
<td>Иван</td>
|
||||||
|
<td>Иванович</td>
|
||||||
|
<td>
|
||||||
|
<span class="table-remove"><button type="button"
|
||||||
|
class="btn btn-danger btn-rounded btn-sm my-0">Remove</button></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>text</td>
|
||||||
|
<td>text</td>
|
||||||
|
<td>text</td>
|
||||||
|
<td>
|
||||||
|
<span class="table-remove"><button type="button"
|
||||||
|
class="btn btn-danger btn-rounded btn-sm my-0">Remove</button></span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<div class="dropdown">
|
||||||
|
<button class="btn btn-primary dropdown-toggle"
|
||||||
|
type="button" data-toggle="dropdown">Выберите автора
|
||||||
|
<span class="caret"></span></button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<input class="form-control" id="myInput" type="text"
|
||||||
|
placeholder="Search.."/>
|
||||||
|
<li><a href="#">Иванов</a></li>
|
||||||
|
<li><a href="#">Смирнов</a></li>
|
||||||
|
<li><a href="#">Кузнецов</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-primary">Сохранить изменения
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||||
|
Отмена
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<button id="sendMessageButton" class="btn btn-success text-uppercase"
|
||||||
|
type="submit">
|
||||||
|
Сохранить
|
||||||
|
</button>
|
||||||
|
<button id="cancelButton" class="btn btn-default text-uppercase" type="button">
|
||||||
|
Отмена
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<script type="text/javascript" src="/js/file-loader.js"></script>
|
||||||
|
<script src="/js/papers.js"></script>
|
||||||
|
<script>
|
||||||
|
/*<![CDATA[*/
|
||||||
|
$(document).ready(function () {
|
||||||
|
new FileLoader({
|
||||||
|
div: "loader",
|
||||||
|
url: urlFileUpload,
|
||||||
|
maxSize: 1.5,
|
||||||
|
extensions: ["doc", "docx", "xls", "jpg", "pdf", "txt", "png"],
|
||||||
|
callback: function (response) {
|
||||||
|
showFeedbackMessage("Файл успешно загружен");
|
||||||
|
console.debug(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
getFromRest(urlPaperStatuses, function (response) {
|
||||||
|
fillSelect($("#status"), response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/*]]>*/
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -32,7 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 col-sm-6 portfolio-item">
|
<div class="col-md-4 col-sm-6 portfolio-item">
|
||||||
<a class="portfolio-link" data-toggle="modal" href="/grants">
|
<a class="portfolio-link" href="./grants/dashboard">
|
||||||
<div class="portfolio-hover">
|
<div class="portfolio-hover">
|
||||||
<div class="portfolio-hover-content">
|
<div class="portfolio-hover-content">
|
||||||
<i class="fa fa-arrow-right fa-3x"></i>
|
<i class="fa fa-arrow-right fa-3x"></i>
|
||||||
|
@ -10,142 +10,35 @@
|
|||||||
<!-- Services -->
|
<!-- Services -->
|
||||||
<section id="services">
|
<section id="services">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="col-lg-12 text-center">
|
||||||
<div class="col-lg-12 text-center">
|
<h2 class="section-heading text-uppercase">Статьи</h2>
|
||||||
<h2 class="section-heading text-uppercase">Dashboard</h2>
|
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./papers" class="btn btn-light toolbar-button"><i class="fa fa-list-alt"></i>
|
||||||
|
Список</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o"
|
||||||
|
aria-hidden="true"></i> Панель управления</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./paper" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle" aria-hidden="true"></i>
|
||||||
|
Добавить статью</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center" id="dashboard">
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-2">
|
|
||||||
<span class="fa-stack fa-1x">
|
|
||||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
|
||||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col col-10 text-right">
|
|
||||||
<h7 class="service-heading">Название статьи</h7>
|
|
||||||
<p class="text-muted">Список авторов И.О.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<script src="/js/papers.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
showPaperDashboard("#dashboard");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en"
|
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
||||||
layout:decorator="default">
|
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="container" layout:fragment="content">
|
|
||||||
<section id="papers">
|
|
||||||
<div class="container">
|
|
||||||
<div class="row" id="paper-list">
|
|
||||||
<div class="col-lg-12 text-center">
|
|
||||||
<h2 class="section-heading text-uppercase">Пустая страница</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
@ -14,10 +14,15 @@
|
|||||||
<h2 class="section-heading text-uppercase">Статьи</h2>
|
<h2 class="section-heading text-uppercase">Статьи</h2>
|
||||||
|
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
|
<a href="./papers" class="btn btn-light toolbar-button"><i class="fa fa-list-alt"></i>
|
||||||
|
Список</a>
|
||||||
|
</div>
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
<a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o"
|
<a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o"
|
||||||
aria-hidden="true"></i> Панель управления</a>
|
aria-hidden="true"></i> Панель управления</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||||
<a href="./paper" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle" aria-hidden="true"></i>
|
<a href="./paper" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle" aria-hidden="true"></i>
|
||||||
Добавить статью</a>
|
Добавить статью</a>
|
||||||
@ -28,12 +33,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" id="remove-paper-modal">
|
||||||
|
<div class="modal-dialog modal-sm">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h8 class="modal-title" id="myModalLabel">Удалить статью?</h8>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"><span aria-hidden="true">×</span></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" id="modal-btn-yes">Да</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modal-btn-no">Нет</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script src="/js/papers.js"></script>
|
<script src="/js/papers.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
showPapers($("#paper-list"));
|
showPapers("#paper-list", ".paper-row");
|
||||||
// only for demo
|
|
||||||
//addPaper("название", "DRAFT", "comment", false);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,94 +17,21 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<ul class="timeline">
|
<ul class="timeline">
|
||||||
<li>
|
|
||||||
<div class="timeline-image">
|
|
||||||
<h4>
|
|
||||||
<br/>
|
|
||||||
02.07.2018
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-panel">
|
|
||||||
<div class="timeline-heading">
|
|
||||||
<h4>Уход в отпуск</h4>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-body">
|
|
||||||
<p class="text-muted">Наконец-то!</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="timeline-inverted">
|
|
||||||
<div class="timeline-image">
|
|
||||||
<img class="rounded-circle img-fluid" src="img/about/2.jpg" alt=""/>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-panel">
|
|
||||||
<div class="timeline-heading">
|
|
||||||
<h4>March 2011</h4>
|
|
||||||
<h4 class="subheading">An Agency is Born</h4>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-body">
|
|
||||||
<p class="text-muted">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!</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="timeline-image">
|
|
||||||
<img class="rounded-circle img-fluid" src="img/about/3.jpg" alt=""/>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-panel">
|
|
||||||
<div class="timeline-heading">
|
|
||||||
<h4>December 2012</h4>
|
|
||||||
<h4 class="subheading">Transition to Full Service</h4>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-body">
|
|
||||||
<p class="text-muted">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!</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="timeline-inverted">
|
|
||||||
<div class="timeline-image">
|
|
||||||
<img class="rounded-circle img-fluid" src="img/about/4.jpg" alt=""/>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-panel">
|
|
||||||
<div class="timeline-heading">
|
|
||||||
<h4>July 2014</h4>
|
|
||||||
<h4 class="subheading">Phase Two Expansion</h4>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-body">
|
|
||||||
<p class="text-muted">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!</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="timeline-inverted">
|
|
||||||
<div class="timeline-image">
|
|
||||||
<h4>Be Part
|
|
||||||
<br/>Of Our
|
|
||||||
<br/>Story!</h4>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Plugin JavaScript -->
|
|
||||||
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Custom scripts for this template -->
|
<!-- Custom scripts for this template -->
|
||||||
<script src="js/agency.js"></script>
|
<script src="js/agency.js"></script>
|
||||||
|
<script src="js/timeline.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
showTimeline(".timeline")
|
||||||
|
})
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user