diff --git a/checkstyle.xml b/checkstyle.xml index 5877ec9..828cdaa 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -100,7 +100,7 @@ - + + diff --git a/src/main/java/ru/ulstu/conference/controller/ConferenceController.java b/src/main/java/ru/ulstu/conference/controller/ConferenceController.java index 823f853..a416345 100644 --- a/src/main/java/ru/ulstu/conference/controller/ConferenceController.java +++ b/src/main/java/ru/ulstu/conference/controller/ConferenceController.java @@ -5,20 +5,23 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import ru.ulstu.conference.model.ConferenceDto; import ru.ulstu.conference.model.ConferenceFilterDto; +import ru.ulstu.conference.model.ConferenceUser; import ru.ulstu.conference.service.ConferenceService; import ru.ulstu.deadline.model.Deadline; -import ru.ulstu.paper.model.Paper; +import ru.ulstu.user.model.User; import springfox.documentation.annotations.ApiIgnore; import javax.validation.Valid; import java.io.IOException; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; import java.util.stream.Collectors; @@ -44,16 +47,24 @@ public class ConferenceController { modelMap.put("filteredConferences", new ConferenceFilterDto(conferenceService.findAllDto())); } + @PostMapping("/conferences") + public void filterConferences(@Valid ConferenceFilterDto conferenceFilterDto, ModelMap modelMap) { + modelMap.put("filteredConferences", new ConferenceFilterDto(conferenceService.filter(conferenceFilterDto), + conferenceFilterDto.getFilterUserId(), + conferenceFilterDto.getYear())); + } + + @GetMapping("/dashboard") + public void getDashboard(ModelMap modelMap) { + modelMap.put("conferences", conferenceService.findAllActiveDto()); + } + @GetMapping("/conference") public void getConference(ModelMap modelMap, @RequestParam(value = "id") Integer id) { if (id != null && id > 0) { - ConferenceDto conferenceDto = conferenceService.findOneDto(id); - conferenceDto.setNotSelectedPapers(getNotSelectPapers(conferenceDto.getPaperIds())); - modelMap.put("conferenceDto", conferenceDto); + modelMap.put("conferenceDto", conferenceService.getExistConferenceById(id)); } else { - ConferenceDto conferenceDto = new ConferenceDto(); - conferenceDto.setNotSelectedPapers(getNotSelectPapers(new ArrayList())); - modelMap.put("conferenceDto", conferenceDto); + modelMap.put("conferenceDto", conferenceService.getNewConference()); } } @@ -104,8 +115,37 @@ public class ConferenceController { return CONFERENCE_PAGE; } - public List getNotSelectPapers(List paperIds) { - return conferenceService.getConferencePapers(paperIds); + @PostMapping(value = "/conference", params = "takePart") + public String takePart(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException { + if (errors.hasErrors()) { + return CONFERENCE_PAGE; + } + conferenceService.takePart(conferenceDto); + return CONFERENCE_PAGE; + } + + @ModelAttribute("allParticipation") + public List getAllParticipation() { + return conferenceService.getAllParticipations(); + } + + @ModelAttribute("allDeposit") + public List getAllDeposit() { + return conferenceService.getAllDeposit(); + } + + @ModelAttribute("allUsers") + public List getAllUsers() { + return conferenceService.getAllUsers(); + } + + @ModelAttribute("allYears") + public List getAllYears() { + List years = new ArrayList<>(); + for (int i = Calendar.getInstance().get(Calendar.YEAR); i > 2010; i--) { + years.add(i); + } + return years; } private void filterEmptyDeadlines(ConferenceDto conferenceDto) { diff --git a/src/main/java/ru/ulstu/conference/model/Conference.java b/src/main/java/ru/ulstu/conference/model/Conference.java index b6affcd..e252e4d 100644 --- a/src/main/java/ru/ulstu/conference/model/Conference.java +++ b/src/main/java/ru/ulstu/conference/model/Conference.java @@ -7,7 +7,6 @@ import org.springframework.format.annotation.DateTimeFormat; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.paper.model.Paper; -import ru.ulstu.user.model.User; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -23,9 +22,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import java.util.ArrayList; import java.util.Date; -import java.util.HashSet; import java.util.List; -import java.util.Set; @Entity @Table(name = "conference") @@ -62,11 +59,10 @@ public class Conference extends BaseEntity { inverseJoinColumns = {@JoinColumn(name = "paper_id")}) private List papers = new ArrayList<>(); - @ManyToMany(fetch = FetchType.EAGER) - @JoinTable(name = "users_conference", - joinColumns = {@JoinColumn(name = "conference_id")}, - inverseJoinColumns = {@JoinColumn(name = "users_id")}) - private Set users = new HashSet<>(); + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @JoinColumn(name = "conference_id", unique = true) + @Fetch(FetchMode.SUBSELECT) + private List users = new ArrayList<>(); public String getTitle() { return title; @@ -132,11 +128,11 @@ public class Conference extends BaseEntity { this.papers = papers; } - public Set getUsers() { + public List getUsers() { return users; } - public void setUsers(Set users) { + public void setUsers(List users) { this.users = users; } } diff --git a/src/main/java/ru/ulstu/conference/model/ConferenceDto.java b/src/main/java/ru/ulstu/conference/model/ConferenceDto.java index ec9ec92..2e2f13b 100644 --- a/src/main/java/ru/ulstu/conference/model/ConferenceDto.java +++ b/src/main/java/ru/ulstu/conference/model/ConferenceDto.java @@ -6,21 +6,21 @@ import org.hibernate.validator.constraints.NotEmpty; import org.springframework.format.annotation.DateTimeFormat; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.paper.model.Paper; -import ru.ulstu.user.model.UserDto; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.Size; import java.util.ArrayList; import java.util.Date; -import java.util.HashSet; import java.util.List; -import java.util.Set; import static ru.ulstu.core.util.StreamApiUtils.convert; public class ConferenceDto { + private final static String BEGIN_DATE = "Начало: "; + private final static String END_DATE = "Конец: "; + private Integer id; @NotEmpty @Size(min = 2, max = 400) @@ -38,14 +38,12 @@ public class ConferenceDto { private Date endDate = new Date(); private List deadlines = new ArrayList<>(); private List removedDeadlineIds = new ArrayList<>(); - private Set userIds = new HashSet<>(); + private List userIds = new ArrayList<>(); private List paperIds = new ArrayList<>(); private List papers = new ArrayList<>(); - - private List notSelectedPapers = new ArrayList<>(); - private Set users = new HashSet<>(); - private Integer filterUserId; + private List users = new ArrayList<>(); + private boolean disabledTakePart = false; public ConferenceDto() { } @@ -59,11 +57,12 @@ public class ConferenceDto { @JsonProperty("beginDate") Date beginDate, @JsonProperty("endDate") Date endDate, @JsonProperty("deadlines") List deadlines, - @JsonProperty("userIds") Set userIds, + @JsonProperty("userIds") List userIds, @JsonProperty("paperIds") List paperIds, - @JsonProperty("users") Set users, + @JsonProperty("users") List users, @JsonProperty("papers") List papers, - @JsonProperty("notSelectedPapers") List notSelectedPapers) { + @JsonProperty("notSelectedPapers") List notSelectedPapers, + @JsonProperty("notSelectedPapers") Boolean disabledTakePart) { this.id = id; this.title = title; this.description = description; @@ -77,6 +76,7 @@ public class ConferenceDto { this.users = users; this.papers = papers; this.notSelectedPapers = notSelectedPapers; + this.disabledTakePart = disabledTakePart; } public ConferenceDto(Conference conference) { @@ -90,9 +90,8 @@ public class ConferenceDto { this.deadlines = conference.getDeadlines(); this.userIds = convert(conference.getUsers(), user -> user.getId()); this.paperIds = convert(conference.getPapers(), paper -> paper.getId()); - this.users = convert(conference.getUsers(), UserDto::new); + this.users = conference.getUsers(); this.papers = conference.getPapers(); - } public Integer getId() { @@ -159,11 +158,11 @@ public class ConferenceDto { this.deadlines = deadlines; } - public Set getUserIds() { + public List getUserIds() { return userIds; } - public void setUserIds(Set userIds) { + public void setUserIds(List userIds) { this.userIds = userIds; } @@ -183,20 +182,20 @@ public class ConferenceDto { this.papers = papers; } - public Set getUsers() { + public List getUsers() { return users; } - public void setUsers(Set users) { + public void setUsers(List users) { this.users = users; } - public Integer getFilterUserId() { - return filterUserId; + public boolean isDisabledTakePart() { + return disabledTakePart; } - public void setFilterUserId(Integer filterUserId) { - this.filterUserId = filterUserId; + public void setDisabledTakePart(boolean disabledTakePart) { + this.disabledTakePart = disabledTakePart; } public List getRemovedDeadlineIds() { @@ -215,4 +214,8 @@ public class ConferenceDto { this.notSelectedPapers = notSelectedPapers; } + public String getDatesString() { + return BEGIN_DATE + beginDate.toString().split(" ")[0] + " " + END_DATE + endDate.toString().split(" ")[0]; + } + } diff --git a/src/main/java/ru/ulstu/conference/model/ConferenceFilterDto.java b/src/main/java/ru/ulstu/conference/model/ConferenceFilterDto.java index 37878b2..8503b40 100644 --- a/src/main/java/ru/ulstu/conference/model/ConferenceFilterDto.java +++ b/src/main/java/ru/ulstu/conference/model/ConferenceFilterDto.java @@ -5,15 +5,15 @@ import java.util.List; public class ConferenceFilterDto { private List conferences; - private Integer filterAuthorId; + private Integer filterUserId; private Integer year; public ConferenceFilterDto() { } - public ConferenceFilterDto(List conferenceDtos, Integer filterAuthorId, Integer year) { + public ConferenceFilterDto(List conferenceDtos, Integer filterUserId, Integer year) { this.conferences = conferenceDtos; - this.filterAuthorId = filterAuthorId; + this.filterUserId = filterUserId; this.year = year; } @@ -29,12 +29,12 @@ public class ConferenceFilterDto { this.conferences = conferences; } - public Integer getFilterAuthorId() { - return filterAuthorId; + public Integer getFilterUserId() { + return filterUserId; } - public void setFilterAuthorId(Integer filterAuthorId) { - this.filterAuthorId = filterAuthorId; + public void setFilterUserId(Integer filterUserId) { + this.filterUserId = filterUserId; } public Integer getYear() { diff --git a/src/main/java/ru/ulstu/conference/model/ConferenceUser.java b/src/main/java/ru/ulstu/conference/model/ConferenceUser.java new file mode 100644 index 0000000..63eeb6d --- /dev/null +++ b/src/main/java/ru/ulstu/conference/model/ConferenceUser.java @@ -0,0 +1,110 @@ +package ru.ulstu.conference.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import ru.ulstu.core.model.BaseEntity; +import ru.ulstu.user.model.User; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name = "users_conference") +public class ConferenceUser extends BaseEntity { + + public enum Participation { + INTRAMURAL("Очная"), + EXTRAMURAL("Заочная"); + + private String participationName; + + Participation(String name) { + this.participationName = name; + } + + public String getParticipation() { + return participationName; + } + } + + public enum Deposit { + ARTICLE("Статья"), + REPORT("Доклад"), + PRESENTATION("Презентация"); + + private String depositName; + + Deposit(String name) { + this.depositName = name; + } + + public String getDeposit() { + return depositName; + } + } + + + @NotNull + @Column(name = "participation", nullable = false) + @Enumerated(value = EnumType.STRING) + private Participation participation = Participation.INTRAMURAL; + + @NotNull + @Column(name = "deposit", nullable = false) + @Enumerated(value = EnumType.STRING) + private Deposit deposit = Deposit.ARTICLE; + + @ManyToOne(optional = false) + @JoinColumn(name = "users_id") + private User user; + + public ConferenceUser() { + } + + public ConferenceUser(User user) { + this.user = user; + } + + @JsonCreator + public ConferenceUser(@JsonProperty("id") Integer id, + @JsonProperty("deposit") Participation participation, + @JsonProperty("deposit") Deposit deposit, + @JsonProperty("user") User user) { + this.setId(id); + this.participation = participation; + this.deposit = deposit; + this.user = user; + } + + + public Participation getParticipation() { + return participation; + } + + public void setParticipation(Participation participation) { + this.participation = participation; + } + + public Deposit getDeposit() { + return deposit; + } + + public void setDeposit(Deposit deposit) { + this.deposit = deposit; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + +} diff --git a/src/main/java/ru/ulstu/conference/repository/ConferenceRepository.java b/src/main/java/ru/ulstu/conference/repository/ConferenceRepository.java index 4325633..cb8a488 100644 --- a/src/main/java/ru/ulstu/conference/repository/ConferenceRepository.java +++ b/src/main/java/ru/ulstu/conference/repository/ConferenceRepository.java @@ -1,7 +1,19 @@ package ru.ulstu.conference.repository; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import ru.ulstu.conference.model.Conference; +import ru.ulstu.user.model.User; + +import java.util.Date; +import java.util.List; public interface ConferenceRepository extends JpaRepository { + @Query("SELECT c FROM Conference c LEFT JOIN c.users u WHERE (:user IS NULL OR u.user = :user) " + + "AND (YEAR(c.beginDate) = :year OR :year IS NULL) ORDER BY begin_date DESC") + List findByUserAndYear(@Param("user") User user, @Param("year") Integer year); + + @Query("SELECT c FROM Conference c WHERE c.beginDate > :date") + List findAllActive(@Param("date") Date date); } diff --git a/src/main/java/ru/ulstu/conference/repository/ConferenceUserRepository.java b/src/main/java/ru/ulstu/conference/repository/ConferenceUserRepository.java new file mode 100644 index 0000000..5e654d5 --- /dev/null +++ b/src/main/java/ru/ulstu/conference/repository/ConferenceUserRepository.java @@ -0,0 +1,7 @@ +package ru.ulstu.conference.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import ru.ulstu.conference.model.ConferenceUser; + +public interface ConferenceUserRepository extends JpaRepository { +} diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceService.java b/src/main/java/ru/ulstu/conference/service/ConferenceService.java index 4d267d1..e5ce29f 100644 --- a/src/main/java/ru/ulstu/conference/service/ConferenceService.java +++ b/src/main/java/ru/ulstu/conference/service/ConferenceService.java @@ -1,16 +1,24 @@ package ru.ulstu.conference.service; import org.apache.commons.lang3.StringUtils; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import ru.ulstu.conference.model.Conference; import ru.ulstu.conference.model.ConferenceDto; +import ru.ulstu.conference.model.ConferenceFilterDto; +import ru.ulstu.conference.model.ConferenceUser; import ru.ulstu.conference.repository.ConferenceRepository; import ru.ulstu.deadline.service.DeadlineService; import ru.ulstu.paper.model.Paper; import ru.ulstu.paper.service.PaperService; +import ru.ulstu.user.model.User; +import ru.ulstu.user.service.UserService; import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; import java.util.List; import static org.springframework.util.ObjectUtils.isEmpty; @@ -21,19 +29,39 @@ public class ConferenceService { private final static int MAX_DISPLAY_SIZE = 40; private final ConferenceRepository conferenceRepository; + private final ConferenceUserService conferenceUserService; private final DeadlineService deadlineService; private final PaperService paperService; + private final UserService userService; public ConferenceService(ConferenceRepository conferenceRepository, + ConferenceUserService conferenceUserService, DeadlineService deadlineService, - PaperService paperService) { + PaperService paperService, + UserService userService) { this.conferenceRepository = conferenceRepository; + this.conferenceUserService = conferenceUserService; this.deadlineService = deadlineService; this.paperService = paperService; + this.userService = userService; } + public ConferenceDto getExistConferenceById(Integer id) { + ConferenceDto conferenceDto = findOneDto(id); + conferenceDto.setNotSelectedPapers(getNotSelectPapers(conferenceDto.getPaperIds())); + conferenceDto.setDisabledTakePart(isCurrentUserParticipant(conferenceDto.getUsers())); + return conferenceDto; + } + + public ConferenceDto getNewConference() { + ConferenceDto conferenceDto = new ConferenceDto(); + conferenceDto.setNotSelectedPapers(getNotSelectPapers(new ArrayList())); + return conferenceDto; + } + + public List findAll() { - return conferenceRepository.findAll(); + return conferenceRepository.findAll(new Sort(Sort.Direction.DESC, "beginDate")); } public List findAllDto() { @@ -88,10 +116,27 @@ public class ConferenceService { conferenceDto.getNotSelectedPapers().add(removedPaper); } - public List getConferencePapers(List paperIds) { + public void takePart(ConferenceDto conferenceDto) throws IOException { + conferenceDto.getUsers().add(new ConferenceUser(userService.getCurrentUser())); + conferenceDto.setDisabledTakePart(true); + } + + public List getNotSelectPapers(List paperIds) { return paperService.findAllNotSelect(paperIds); } + public List getAllUsers() { + return userService.findAll(); + } + + public List getAllParticipations() { + return Arrays.asList(ConferenceUser.Participation.values()); + } + + public List getAllDeposit() { + return Arrays.asList(ConferenceUser.Deposit.values()); + } + private Conference copyFromDto(Conference conference, ConferenceDto conferenceDto) throws IOException { conference.setTitle(conferenceDto.getTitle()); conference.setDescription(conferenceDto.getDescription()); @@ -101,6 +146,7 @@ public class ConferenceService { conference.setEndDate(conferenceDto.getEndDate()); conference.setPapers(conferenceDto.getPapers()); conference.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines())); + conference.setUsers(conferenceUserService.saveOrCreate(conferenceDto.getUsers())); if (conferenceDto.getPaperIds() != null && !conferenceDto.getPaperIds().isEmpty()) { conferenceDto.getPaperIds().forEach(paperId -> conference.getPapers().add(paperService.findEntityById(paperId))); @@ -109,4 +155,22 @@ public class ConferenceService { } + public boolean isCurrentUserParticipant(List conferenceUsers) { + return conferenceUsers.stream().anyMatch(participant -> participant.getUser().equals(userService.getCurrentUser())); + } + + public List filter(ConferenceFilterDto conferenceFilterDto) { + return convert(conferenceRepository.findByUserAndYear( + conferenceFilterDto.getFilterUserId() == null ? null : userService.findById(conferenceFilterDto.getFilterUserId()), + conferenceFilterDto.getYear()), ConferenceDto::new); + + } + + public List findAllActiveDto() { + return convert(findAllActive(), ConferenceDto::new); + } + + public List findAllActive() { + return conferenceRepository.findAllActive(new Date()); + } } diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceUserService.java b/src/main/java/ru/ulstu/conference/service/ConferenceUserService.java new file mode 100644 index 0000000..f771b2a --- /dev/null +++ b/src/main/java/ru/ulstu/conference/service/ConferenceUserService.java @@ -0,0 +1,48 @@ +package ru.ulstu.conference.service; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import ru.ulstu.conference.model.ConferenceUser; +import ru.ulstu.conference.repository.ConferenceUserRepository; + +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class ConferenceUserService { + + private final ConferenceUserRepository conferenceUserRepository; + + public ConferenceUserService(ConferenceUserRepository conferenceUserRepository) { + this.conferenceUserRepository = conferenceUserRepository; + } + + public List saveOrCreate(List users) { + return users + .stream() + .map(user -> { + return user.getId() != null ? update(user) : create(user); + }).collect(Collectors.toList()); + } + + @Transactional + public ConferenceUser update(ConferenceUser user) { + ConferenceUser updateUser = conferenceUserRepository.findOne(user.getId()); + updateUser.setDeposit(user.getDeposit()); + updateUser.setParticipation(user.getParticipation()); + conferenceUserRepository.save(updateUser); + return updateUser; + } + + @Transactional + public ConferenceUser create(ConferenceUser user) { + ConferenceUser newUser = new ConferenceUser(); + newUser.setDeposit(user.getDeposit()); + newUser.setParticipation(user.getParticipation()); + newUser.setUser(user.getUser()); + newUser = conferenceUserRepository.save(newUser); + return newUser; + } + + +} diff --git a/src/main/java/ru/ulstu/core/model/BaseEntity.java b/src/main/java/ru/ulstu/core/model/BaseEntity.java index bd0f1e4..d3dfa76 100644 --- a/src/main/java/ru/ulstu/core/model/BaseEntity.java +++ b/src/main/java/ru/ulstu/core/model/BaseEntity.java @@ -1,6 +1,10 @@ package ru.ulstu.core.model; -import javax.persistence.*; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.MappedSuperclass; +import javax.persistence.Version; import java.io.Serializable; @MappedSuperclass diff --git a/src/main/java/ru/ulstu/core/util/DateUtils.java b/src/main/java/ru/ulstu/core/util/DateUtils.java index b24b09c..6122583 100644 --- a/src/main/java/ru/ulstu/core/util/DateUtils.java +++ b/src/main/java/ru/ulstu/core/util/DateUtils.java @@ -1,6 +1,11 @@ package ru.ulstu.core.util; -import java.time.*; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.Month; +import java.time.ZoneId; import java.util.Arrays; import java.util.Calendar; import java.util.Date; @@ -24,7 +29,7 @@ public class DateUtils { return cal; } - public static List getMonths () { + public static List getMonths() { return Arrays.asList(Month.values()); } diff --git a/src/main/java/ru/ulstu/file/model/FileData.java b/src/main/java/ru/ulstu/file/model/FileData.java index 08445a3..3f97130 100644 --- a/src/main/java/ru/ulstu/file/model/FileData.java +++ b/src/main/java/ru/ulstu/file/model/FileData.java @@ -20,7 +20,7 @@ public class FileData extends BaseEntity { private byte[] data; @Column(name = "is_latex_attach") - private boolean isLatexAttach; + private Boolean isLatexAttach; public String getName() { return name; @@ -54,11 +54,11 @@ public class FileData extends BaseEntity { this.data = data; } - public boolean isLatexAttach() { + public Boolean isLatexAttach() { return isLatexAttach; } - public void setLatexAttach(boolean latexAttach) { + public void setLatexAttach(Boolean latexAttach) { isLatexAttach = latexAttach; } } diff --git a/src/main/java/ru/ulstu/file/model/FileDataDto.java b/src/main/java/ru/ulstu/file/model/FileDataDto.java index 65ef275..e83bf12 100644 --- a/src/main/java/ru/ulstu/file/model/FileDataDto.java +++ b/src/main/java/ru/ulstu/file/model/FileDataDto.java @@ -9,7 +9,7 @@ public class FileDataDto { private String fileName; private String tmpFileName; private boolean deleted; - private boolean isLatexAttach; + private Boolean isLatexAttach; public FileDataDto() { } @@ -17,7 +17,7 @@ public class FileDataDto { @JsonCreator public FileDataDto(@JsonProperty("id") Integer id, @JsonProperty("name") String name, - @JsonProperty("isLatexAttach") boolean isLatexAttach, + @JsonProperty("isLatexAttach") Boolean isLatexAttach, @JsonProperty("fileName") String fileName, @JsonProperty("tmpFileName") String tmpFileName) { this.id = id; @@ -77,19 +77,19 @@ public class FileDataDto { this.deleted = deleted; } - public boolean isLatexAttach() { + public Boolean isLatexAttach() { return isLatexAttach; } - public boolean getIsLatexAttach() { + public Boolean getIsLatexAttach() { return isLatexAttach; } - public void setLatexAttach(boolean latexAttach) { + public void setLatexAttach(Boolean latexAttach) { isLatexAttach = latexAttach; } - public void setIsLatexAttach(boolean latexAttach) { + public void setIsLatexAttach(Boolean latexAttach) { isLatexAttach = latexAttach; } } diff --git a/src/main/java/ru/ulstu/file/service/FileService.java b/src/main/java/ru/ulstu/file/service/FileService.java index 3a0a87c..4bb1658 100644 --- a/src/main/java/ru/ulstu/file/service/FileService.java +++ b/src/main/java/ru/ulstu/file/service/FileService.java @@ -127,7 +127,7 @@ public class FileService { public void createLatexAttachs(PaperDto paper) throws IOException { for (FileDataDto fileDataDto : paper.getFiles() .stream() - .filter(f -> f.isLatexAttach() && !f.isDeleted()) + .filter(f -> (f.isLatexAttach() != null && f.isLatexAttach()) && !f.isDeleted()) .collect(Collectors.toList())) { if (fileDataDto.getId() == null) { File oldFile = getTmpFilePath(fileDataDto.getTmpFileName()).toFile(); diff --git a/src/main/java/ru/ulstu/grant/controller/GrantController.java b/src/main/java/ru/ulstu/grant/controller/GrantController.java index 1b6de6c..5a0c594 100644 --- a/src/main/java/ru/ulstu/grant/controller/GrantController.java +++ b/src/main/java/ru/ulstu/grant/controller/GrantController.java @@ -103,7 +103,7 @@ public class GrantController { } @PostMapping(value = "/grant", params = "createProject") - public String createProject(@Valid GrantDto grantDto, Errors errors) { + public String createProject(@Valid GrantDto grantDto, Errors errors) throws IOException { if (errors.hasErrors()) { return GRANT_PAGE; } diff --git a/src/main/java/ru/ulstu/grant/service/GrantService.java b/src/main/java/ru/ulstu/grant/service/GrantService.java index 57f9821..2c63acc 100644 --- a/src/main/java/ru/ulstu/grant/service/GrantService.java +++ b/src/main/java/ru/ulstu/grant/service/GrantService.java @@ -98,7 +98,7 @@ public class GrantService { return grant; } - public void createProject(GrantDto grantDto) { + public void createProject(GrantDto grantDto) throws IOException { grantDto.setProject( new ProjectDto(projectService.save(new ProjectDto(grantDto.getTitle())))); } diff --git a/src/main/java/ru/ulstu/odin/model/OdinField.java b/src/main/java/ru/ulstu/odin/model/OdinField.java index 5917a44..c60c945 100644 --- a/src/main/java/ru/ulstu/odin/model/OdinField.java +++ b/src/main/java/ru/ulstu/odin/model/OdinField.java @@ -31,14 +31,13 @@ public abstract class OdinField implements Comparable { return this.name().toLowerCase(); } } - - private Field field; protected final OdinFieldType fieldType; protected final String fieldName; protected final String caption; protected final OdinVisible.OdinVisibleType visible; protected final boolean readOnly; protected final boolean notEmpty; + private Field field; public OdinField(Field field, OdinFieldType fieldType) { this.field = field; @@ -126,8 +125,12 @@ public abstract class OdinField implements Comparable { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } OdinField odinField = (OdinField) o; return Objects.equals(fieldName, odinField.fieldName); } diff --git a/src/main/java/ru/ulstu/paper/controller/PaperController.java b/src/main/java/ru/ulstu/paper/controller/PaperController.java index ad30822..e11e4d9 100644 --- a/src/main/java/ru/ulstu/paper/controller/PaperController.java +++ b/src/main/java/ru/ulstu/paper/controller/PaperController.java @@ -105,6 +105,11 @@ public class PaperController { return paperService.getPaperStatuses(); } + @ModelAttribute("allTypes") + public List getPaperTypes() { + return paperService.getPaperTypes(); + } + @ModelAttribute("allAuthors") public List getAllAuthors() { return paperService.getPaperAuthors(); diff --git a/src/main/java/ru/ulstu/paper/model/Paper.java b/src/main/java/ru/ulstu/paper/model/Paper.java index c7f7fcf..65bd32c 100644 --- a/src/main/java/ru/ulstu/paper/model/Paper.java +++ b/src/main/java/ru/ulstu/paper/model/Paper.java @@ -53,12 +53,32 @@ public class Paper extends BaseEntity implements UserContainer { } } + public enum PaperType { + OTHER("Прочая публикация"), + VAK("ВАК"), + SCOPUS("Scopus"), + WEB_OF_SCIENCE("Web Of Science"); + + private String typeName; + + PaperType(String name) { + this.typeName = name; + } + + public String getTypeName() { + return typeName; + } + } + @NotBlank private String title; @Enumerated(value = EnumType.STRING) private PaperStatus status = PaperStatus.DRAFT; + @Enumerated(value = EnumType.STRING) + private PaperType type = PaperType.OTHER; + @Column(name = "create_date") @Temporal(TemporalType.TIMESTAMP) private Date createDate = new Date(); @@ -102,6 +122,14 @@ public class Paper extends BaseEntity implements UserContainer { this.status = status; } + public PaperType getType() { + return type; + } + + public void setType(PaperType type) { + this.type = type; + } + public Date getCreateDate() { return createDate; } diff --git a/src/main/java/ru/ulstu/paper/model/PaperDto.java b/src/main/java/ru/ulstu/paper/model/PaperDto.java index 7ddc0e0..11d6dfc 100644 --- a/src/main/java/ru/ulstu/paper/model/PaperDto.java +++ b/src/main/java/ru/ulstu/paper/model/PaperDto.java @@ -25,6 +25,7 @@ public class PaperDto { @Size(min = 3, max = 254) private String title; private Paper.PaperStatus status; + private Paper.PaperType type; private Date createDate; private Date updateDate; @NotEmpty @@ -46,6 +47,7 @@ public class PaperDto { public PaperDto(@JsonProperty("id") Integer id, @JsonProperty("title") String title, @JsonProperty("status") Paper.PaperStatus status, + @JsonProperty("type") Paper.PaperType type, @JsonProperty("createDate") Date createDate, @JsonProperty("updateDate") Date updateDate, @JsonProperty("deadlines") List deadlines, @@ -59,6 +61,7 @@ public class PaperDto { this.id = id; this.title = title; this.status = status; + this.type = type; this.createDate = createDate; this.updateDate = updateDate; this.deadlines = deadlines; @@ -74,6 +77,7 @@ public class PaperDto { this.id = paper.getId(); this.title = paper.getTitle(); this.status = paper.getStatus(); + this.type = paper.getType(); this.createDate = paper.getCreateDate(); this.updateDate = paper.getUpdateDate(); this.deadlines = paper.getDeadlines(); @@ -110,6 +114,14 @@ public class PaperDto { this.status = status; } + public Paper.PaperType getType() { + return type; + } + + public void setType(Paper.PaperType type) { + this.type = type; + } + public Date getCreateDate() { return createDate; } diff --git a/src/main/java/ru/ulstu/paper/service/LatexService.java b/src/main/java/ru/ulstu/paper/service/LatexService.java index 6bf5226..82dd1ba 100644 --- a/src/main/java/ru/ulstu/paper/service/LatexService.java +++ b/src/main/java/ru/ulstu/paper/service/LatexService.java @@ -12,11 +12,11 @@ import java.nio.file.Files; @Service public class LatexService { + private final String pdfLatexError = "Errors occurred while executing pdfLaTeX."; + private final String bibtexError = "Errors occurred while executing bibtex."; private String errorMessage; private File pdfFile; private FileService fileService; - private final String pdfLatexError = "Errors occurred while executing pdfLaTeX."; - private final String bibtexError = "Errors occurred while executing bibtex."; public LatexService(FileService fileService) { this.fileService = fileService; @@ -42,7 +42,9 @@ public class LatexService { InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream()); try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) { - while ((bufferedReader.readLine()) != null) ; + while ((bufferedReader.readLine()) != null) { + // + } } int exitCode = process.waitFor(); @@ -55,16 +57,18 @@ public class LatexService { private boolean generate(String filename, File dir) throws IOException, InterruptedException { startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError); startProcess(new String[]{"bibtex", filename}, dir, bibtexError); - if (startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError) != 0) + if (startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError) != 0) { return false; + } return checkPdf(filename, dir); } private boolean checkPdf(String filename, File dir) { pdfFile = new File(dir.getAbsolutePath() + File.separator + filename + ".pdf"); - if (pdfFile.isFile()) return true; - else { + if (pdfFile.isFile()) { + return true; + } else { errorMessage = "The pdf file could not be created."; return false; } diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index a484a63..ab9b770 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -31,6 +31,7 @@ import static ru.ulstu.paper.model.Paper.PaperStatus.COMPLETED; import static ru.ulstu.paper.model.Paper.PaperStatus.DRAFT; import static ru.ulstu.paper.model.Paper.PaperStatus.FAILED; import static ru.ulstu.paper.model.Paper.PaperStatus.ON_PREPARATION; +import static ru.ulstu.paper.model.Paper.PaperType.OTHER; @Service public class PaperService { @@ -99,6 +100,7 @@ public class PaperService { paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate()); paper.setLocked(paperDto.getLocked()); paper.setStatus(paperDto.getStatus() == null ? DRAFT : paperDto.getStatus()); + paper.setType(paperDto.getType() == null ? OTHER : paperDto.getType()); paper.setTitle(paperDto.getTitle()); paper.setUpdateDate(new Date()); paper.setDeadlines(deadlineService.saveOrCreate(paperDto.getDeadlines())); @@ -149,6 +151,10 @@ public class PaperService { return Arrays.asList(Paper.PaperStatus.values()); } + public List getPaperTypes() { + return Arrays.asList(Paper.PaperType.values()); + } + @Transactional public Paper create(String title, User user, Date deadlineDate) { Paper paper = new Paper(); @@ -158,6 +164,7 @@ public class PaperService { paper.setCreateDate(new Date()); paper.setUpdateDate(new Date()); paper.setStatus(DRAFT); + paper.setType(OTHER); paper = paperRepository.save(paper); paperNotificationService.sendCreateNotification(paper); diff --git a/src/main/java/ru/ulstu/project/controller/ProjectController.java b/src/main/java/ru/ulstu/project/controller/ProjectController.java index 3244ccb..1d0272d 100644 --- a/src/main/java/ru/ulstu/project/controller/ProjectController.java +++ b/src/main/java/ru/ulstu/project/controller/ProjectController.java @@ -2,16 +2,26 @@ package ru.ulstu.project.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; +import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import ru.ulstu.deadline.model.Deadline; +import ru.ulstu.grant.model.GrantDto; import ru.ulstu.project.model.Project; import ru.ulstu.project.model.ProjectDto; import ru.ulstu.project.service.ProjectService; import springfox.documentation.annotations.ApiIgnore; +import javax.validation.Valid; +import java.io.IOException; import java.util.List; +import java.util.stream.Collectors; + +import static org.springframework.util.StringUtils.isEmpty; +import static ru.ulstu.core.controller.Navigation.hasErrors; @Controller() @RequestMapping(value = "/projects") @@ -46,4 +56,33 @@ public class ProjectController { public List getProjectStatuses() { return projectService.getProjectStatuses(); } + + @PostMapping(value = "/project", params = "save") + public String save(@Valid ProjectDto projectDto, Errors errors) throws IOException { + filterEmptyDeadlines(projectDto); + if (projectDto.getDeadlines().isEmpty()) { + errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); + } + if (errors.hasErrors()) { + return "/projects/project"; + } + projectService.save(projectDto); + return String.format("redirect:%s", "/projects/projects"); + } + + @PostMapping(value = "/project", params = "addDeadline") + public String addDeadline(@Valid ProjectDto projectDto, Errors errors) { + filterEmptyDeadlines(projectDto); + if (errors.hasErrors()) { + return "/projects/project"; + } + projectDto.getDeadlines().add(new Deadline()); + return "/projects/project"; + } + + private void filterEmptyDeadlines(ProjectDto projectDto) { + projectDto.setDeadlines(projectDto.getDeadlines().stream() + .filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription())) + .collect(Collectors.toList())); + } } diff --git a/src/main/java/ru/ulstu/project/model/Project.java b/src/main/java/ru/ulstu/project/model/Project.java index 2e0e86c..c971c4b 100644 --- a/src/main/java/ru/ulstu/project/model/Project.java +++ b/src/main/java/ru/ulstu/project/model/Project.java @@ -3,6 +3,7 @@ package ru.ulstu.project.model; import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; +import ru.ulstu.file.model.FileData; import ru.ulstu.grant.model.Grant; import javax.persistence.CascadeType; @@ -57,6 +58,10 @@ public class Project extends BaseEntity { @NotNull private String repository; + @ManyToOne + @JoinColumn(name = "file_id") + private FileData application; + public String getTitle() { return title; } @@ -104,4 +109,12 @@ public class Project extends BaseEntity { public void setDeadlines(List deadlines) { this.deadlines = deadlines; } + + public FileData getApplication() { + return application; + } + + public void setApplication(FileData application) { + this.application = application; + } } diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index 6c83d59..4e03365 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -19,6 +19,7 @@ public class ProjectDto { private List deadlines = new ArrayList<>(); private GrantDto grant; private String repository; + private String applicationFileName; public ProjectDto() { } @@ -42,6 +43,7 @@ public class ProjectDto { this.grant = grant; this.repository = repository; this.deadlines = deadlines; + this.applicationFileName = null; } @@ -50,6 +52,7 @@ public class ProjectDto { this.title = project.getTitle(); this.status = project.getStatus(); this.description = project.getDescription(); + this.applicationFileName = project.getApplication() == null ? null : project.getApplication().getName(); this.grant = project.getGrant() == null ? null : new GrantDto(project.getGrant()); this.repository = project.getRepository(); this.deadlines = project.getDeadlines(); @@ -110,4 +113,12 @@ public class ProjectDto { public void setDeadlines(List deadlines) { this.deadlines = deadlines; } + + public String getApplicationFileName() { + return applicationFileName; + } + + public void setApplicationFileName(String applicationFileName) { + this.applicationFileName = applicationFileName; + } } diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index 99d8919..c15d590 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -4,15 +4,19 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.thymeleaf.util.StringUtils; import ru.ulstu.deadline.service.DeadlineService; +import ru.ulstu.file.service.FileService; +import ru.ulstu.grant.repository.GrantRepository; import ru.ulstu.project.model.Project; import ru.ulstu.project.model.ProjectDto; import ru.ulstu.project.repository.ProjectRepository; +import java.io.IOException; import java.util.Arrays; import java.util.List; import static org.springframework.util.ObjectUtils.isEmpty; import static ru.ulstu.core.util.StreamApiUtils.convert; +import static ru.ulstu.project.model.Project.ProjectStatus.APPLICATION; @Service public class ProjectService { @@ -20,11 +24,17 @@ public class ProjectService { private final ProjectRepository projectRepository; private final DeadlineService deadlineService; + private final GrantRepository grantRepository; + private final FileService fileService; public ProjectService(ProjectRepository projectRepository, - DeadlineService deadlineService) { + DeadlineService deadlineService, + GrantRepository grantRepository, + FileService fileService) { this.projectRepository = projectRepository; this.deadlineService = deadlineService; + this.grantRepository = grantRepository; + this.fileService = fileService; } public List findAll() { @@ -46,19 +56,28 @@ public class ProjectService { } @Transactional - public Project create(ProjectDto projectDto) { + public Project create(ProjectDto projectDto) throws IOException { Project newProject = copyFromDto(new Project(), projectDto); newProject = projectRepository.save(newProject); return newProject; } - private Project copyFromDto(Project project, ProjectDto projectDto) { + private Project copyFromDto(Project project, ProjectDto projectDto) throws IOException { + project.setDescription(projectDto.getDescription()); + project.setStatus(projectDto.getStatus() == null ? APPLICATION : projectDto.getStatus()); project.setTitle(projectDto.getTitle()); + if (projectDto.getGrant() != null && projectDto.getGrant().getId() != null) { + project.setGrant(grantRepository.findOne(projectDto.getGrant().getId())); + } + project.setRepository(projectDto.getRepository()); project.setDeadlines(deadlineService.saveOrCreate(projectDto.getDeadlines())); + if (projectDto.getApplicationFileName() != null) { + project.setApplication(fileService.createFileFromTmp(projectDto.getApplicationFileName())); + } return project; } - public Project save(ProjectDto projectDto) { + public Project save(ProjectDto projectDto) throws IOException { if (isEmpty(projectDto.getId())) { return create(projectDto); } else { diff --git a/src/main/java/ru/ulstu/students/controller/TaskController.java b/src/main/java/ru/ulstu/students/controller/TaskController.java index 8fd9575..50cb052 100644 --- a/src/main/java/ru/ulstu/students/controller/TaskController.java +++ b/src/main/java/ru/ulstu/students/controller/TaskController.java @@ -3,7 +3,11 @@ package ru.ulstu.students.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.validation.Errors; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.students.model.Task; import ru.ulstu.students.model.TaskDto; @@ -16,7 +20,9 @@ import java.util.List; import java.util.stream.Collectors; import static org.springframework.util.StringUtils.isEmpty; -import static ru.ulstu.students.controller.Navigation.*; +import static ru.ulstu.students.controller.Navigation.REDIRECT_TO; +import static ru.ulstu.students.controller.Navigation.TASKS_PAGE; +import static ru.ulstu.students.controller.Navigation.TASK_PAGE; @Controller() @RequestMapping(value = "/students") diff --git a/src/main/java/ru/ulstu/students/model/Task.java b/src/main/java/ru/ulstu/students/model/Task.java index be1b1c6..c4d7409 100644 --- a/src/main/java/ru/ulstu/students/model/Task.java +++ b/src/main/java/ru/ulstu/students/model/Task.java @@ -7,7 +7,19 @@ import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.tags.model.Tag; -import javax.persistence.*; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.OneToMany; +import javax.persistence.OrderBy; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/src/main/java/ru/ulstu/user/model/UserSession.java b/src/main/java/ru/ulstu/user/model/UserSession.java index 1eb761d..50fec65 100644 --- a/src/main/java/ru/ulstu/user/model/UserSession.java +++ b/src/main/java/ru/ulstu/user/model/UserSession.java @@ -2,7 +2,13 @@ package ru.ulstu.user.model; import ru.ulstu.core.model.BaseEntity; -import javax.persistence.*; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import java.util.Date; diff --git a/src/main/java/ru/ulstu/user/repository/UserRepository.java b/src/main/java/ru/ulstu/user/repository/UserRepository.java index f6fbc62..afcdd69 100644 --- a/src/main/java/ru/ulstu/user/repository/UserRepository.java +++ b/src/main/java/ru/ulstu/user/repository/UserRepository.java @@ -33,5 +33,5 @@ public interface UserRepository extends JpaRepository { "AND (u.degree = 'CANDIDATE' OR :hasDegree = FALSE)" + "ORDER BY u.lastName") List filterByAgeAndDegree(@Param("hasAge") boolean hasAge, - @Param("hasDegree") boolean hasDegree); + @Param("hasDegree") boolean hasDegree); } diff --git a/src/main/resources/db/changelog-20190417_000000-schema.xml b/src/main/resources/db/changelog-20190417_000000-schema.xml new file mode 100644 index 0000000..f0a0d64 --- /dev/null +++ b/src/main/resources/db/changelog-20190417_000000-schema.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/db/changelog-20190421_000000-schema.xml b/src/main/resources/db/changelog-20190421_000000-schema.xml new file mode 100644 index 0000000..b7fc374 --- /dev/null +++ b/src/main/resources/db/changelog-20190421_000000-schema.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/src/main/resources/db/changelog-20190422_000000-schema.xml b/src/main/resources/db/changelog-20190422_000000-schema.xml new file mode 100644 index 0000000..f110910 --- /dev/null +++ b/src/main/resources/db/changelog-20190422_000000-schema.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index 9baf3e7..6464a66 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -24,10 +24,13 @@ + + + \ No newline at end of file diff --git a/src/main/resources/public/css/conference.css b/src/main/resources/public/css/conference.css index fa3666e..ad06b3c 100644 --- a/src/main/resources/public/css/conference.css +++ b/src/main/resources/public/css/conference.css @@ -3,7 +3,7 @@ body { } .conference-row .col:hover { - background-color: #eaeaea; + background-color: #f3f3f3; border-radius: .25rem; } @@ -11,7 +11,13 @@ body { color: white; } +.filter .dropdown { + margin-bottom: 10px; +} +.conference-row .col .text-decoration { + text-decoration: none; +} .form-group textarea { @@ -43,7 +49,44 @@ body { .member { margin: 0; + height: 40px; + max-height: 40px; } +.member select { + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; + border: none; + outline: none; + padding: 0.5rem 1.75em 0.5rem 0.5em; + display: inline-block; + background: transparent url("https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-down-01-16.png") no-repeat right 7px center; + +} + +.member select:nth-child(4) { + border-right: 1px solid #ced4da; +} + + +.member-name { + padding: .75rem 1.25rem; + cursor: default; + outline: none; + border: none; + border-right: 1px solid #ced4da; +} + +#take-part[disabled=disabled] { + background-color: #ced4da; + border-color: #c2c5c7; +} + +#take-part[disabled=disabled]:hover { + background-color: #737475 !important; + border-color: #5d5e5f !important; +} + .paper-list { height: 200px; diff --git a/src/main/resources/public/js/conference.js b/src/main/resources/public/js/conference.js index dd843ca..d415ca2 100644 --- a/src/main/resources/public/js/conference.js +++ b/src/main/resources/public/js/conference.js @@ -1,17 +1,5 @@ $(document).ready(function () { - $(".conference-row").mouseenter(function (event) { - var conferenceRow = $(event.target).closest(".conference-row"); - $(conferenceRow).css("background-color", "#f8f9fa"); - $(conferenceRow).find(".remove-conference").removeClass("d-none"); - - }); - $(".conference-row").mouseleave(function (event) { - var conferenceRow = $(event.target).closest(".conference-row"); - $(conferenceRow).css("background-color", "white"); - $(conferenceRow).closest(".conference-row").find(".remove-conference").addClass("d-none"); - }); - $('a[data-confirm]').click(function(ev) { var href = $(this).attr('href'); if (!$('#dataConfirmModal').length) { diff --git a/src/main/resources/templates/conferences/conference.html b/src/main/resources/templates/conferences/conference.html index 27c602a..184f5b5 100644 --- a/src/main/resources/templates/conferences/conference.html +++ b/src/main/resources/templates/conferences/conference.html @@ -38,7 +38,7 @@
+ placeholder="http://"/>
@@ -97,38 +97,35 @@
-
-
- Пользователь 1 -
-
- очная -
-
- статья -
-
+
+ + + + +
-
- + +
diff --git a/src/main/resources/templates/conferences/conferences.html b/src/main/resources/templates/conferences/conferences.html index 46b2e73..7b0ac8d 100644 --- a/src/main/resources/templates/conferences/conferences.html +++ b/src/main/resources/templates/conferences/conferences.html @@ -27,16 +27,19 @@
Фильтр:
- + + - -
diff --git a/src/main/resources/templates/conferences/actual.html b/src/main/resources/templates/conferences/dashboard.html similarity index 71% rename from src/main/resources/templates/conferences/actual.html rename to src/main/resources/templates/conferences/dashboard.html index 7e99e74..cb4f2c0 100644 --- a/src/main/resources/templates/conferences/actual.html +++ b/src/main/resources/templates/conferences/dashboard.html @@ -16,11 +16,10 @@

-
-
- - -
+
+ +
+
diff --git a/src/main/resources/templates/conferences/fragments/confDashboardFragment.html b/src/main/resources/templates/conferences/fragments/confDashboardFragment.html index 080946c..17f4aa6 100644 --- a/src/main/resources/templates/conferences/fragments/confDashboardFragment.html +++ b/src/main/resources/templates/conferences/fragments/confDashboardFragment.html @@ -10,8 +10,14 @@
- title -

+

+

+ + title +
diff --git a/src/main/resources/templates/conferences/fragments/confLineFragment.html b/src/main/resources/templates/conferences/fragments/confLineFragment.html index d104952..7d948d4 100644 --- a/src/main/resources/templates/conferences/fragments/confLineFragment.html +++ b/src/main/resources/templates/conferences/fragments/confLineFragment.html @@ -5,13 +5,14 @@
-
- + diff --git a/src/main/resources/templates/conferences/fragments/confNavigationFragment.html b/src/main/resources/templates/conferences/fragments/confNavigationFragment.html index 45a945e..7e67365 100644 --- a/src/main/resources/templates/conferences/fragments/confNavigationFragment.html +++ b/src/main/resources/templates/conferences/fragments/confNavigationFragment.html @@ -13,7 +13,7 @@
diff --git a/src/main/resources/templates/grants/fragments/grantDashboardFragment.html b/src/main/resources/templates/grants/fragments/grantDashboardFragment.html index df3e3d0..51d0925 100644 --- a/src/main/resources/templates/grants/fragments/grantDashboardFragment.html +++ b/src/main/resources/templates/grants/fragments/grantDashboardFragment.html @@ -10,7 +10,9 @@
- title + + title +

status

diff --git a/src/main/resources/templates/grants/grant.html b/src/main/resources/templates/grants/grant.html index 322fbc9..5540e53 100644 --- a/src/main/resources/templates/grants/grant.html +++ b/src/main/resources/templates/grants/grant.html @@ -241,6 +241,7 @@ }); /*]]>*/ +