Merge remote-tracking branch 'remotes/origin/dev' into 119-notification-grants
This commit is contained in:
commit
e3ad5ba510
@ -132,7 +132,7 @@ public class GrantController {
|
||||
|
||||
@ModelAttribute("allPapers")
|
||||
public List<Paper> getAllPapers() {
|
||||
return grantService.getAllPapers();
|
||||
return grantService.getAllUncompletedPapers();
|
||||
}
|
||||
|
||||
private void filterEmptyDeadlines(GrantDto grantDto) {
|
||||
|
@ -196,6 +196,10 @@ public class GrantService {
|
||||
return paperService.findAll();
|
||||
}
|
||||
|
||||
public List<Paper> getAllUncompletedPapers() {
|
||||
return paperService.findAllNotCompleted();
|
||||
}
|
||||
|
||||
public void attachPaper(GrantDto grantDto) {
|
||||
if (!grantDto.getPaperIds().isEmpty()) {
|
||||
grantDto.getPapers().clear();
|
||||
|
@ -3,10 +3,12 @@ package ru.ulstu.paper.model;
|
||||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import ru.ulstu.conference.model.Conference;
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
import ru.ulstu.core.model.UserContainer;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.file.model.FileData;
|
||||
import ru.ulstu.grant.model.Grant;
|
||||
import ru.ulstu.timeline.model.Event;
|
||||
import ru.ulstu.user.model.User;
|
||||
|
||||
@ -114,6 +116,12 @@ public class Paper extends BaseEntity implements UserContainer {
|
||||
@Column(name = "latex_text")
|
||||
private String latexText;
|
||||
|
||||
@ManyToMany(mappedBy = "papers")
|
||||
private List<Conference> conferences;
|
||||
|
||||
@ManyToMany(mappedBy = "papers")
|
||||
private List<Grant> grants;
|
||||
|
||||
public PaperStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
@ -218,6 +226,22 @@ public class Paper extends BaseEntity implements UserContainer {
|
||||
this.latexText = latexText;
|
||||
}
|
||||
|
||||
public List<Conference> getConferences() {
|
||||
return conferences;
|
||||
}
|
||||
|
||||
public void setConferences(List<Conference> conferences) {
|
||||
this.conferences = conferences;
|
||||
}
|
||||
|
||||
public List<Grant> getGrants() {
|
||||
return grants;
|
||||
}
|
||||
|
||||
public void setGrants(List<Grant> grants) {
|
||||
this.grants = grants;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<User> getUsers() {
|
||||
return getAuthors();
|
||||
|
@ -18,4 +18,10 @@ public interface PaperRepository extends JpaRepository<Paper, Integer> {
|
||||
List<Paper> findAllByIdIn(List<Integer> paperIds);
|
||||
|
||||
List<Paper> findByTypeAndStatus(Paper.PaperType type, Paper.PaperStatus status);
|
||||
|
||||
List<Paper> findByStatusNot(Paper.PaperStatus status);
|
||||
|
||||
List<Paper> findByConferencesIsNullAndStatusNot(Paper.PaperStatus status);
|
||||
|
||||
List<Paper> findByIdNotInAndConferencesIsNullAndStatusNot(List<Integer> paperIds, Paper.PaperStatus status);
|
||||
}
|
||||
|
@ -242,11 +242,14 @@ public class PaperService {
|
||||
|
||||
public List<Paper> findAllNotSelect(List<Integer> paperIds) {
|
||||
if (!paperIds.isEmpty()) {
|
||||
return sortPapers(paperRepository.findByIdNotIn(paperIds));
|
||||
return sortPapers(paperRepository.findByIdNotInAndConferencesIsNullAndStatusNot(paperIds, COMPLETED));
|
||||
} else {
|
||||
return sortPapers(paperRepository.findAll());
|
||||
return sortPapers(paperRepository.findByConferencesIsNullAndStatusNot(COMPLETED));
|
||||
}
|
||||
}
|
||||
|
||||
public List<Paper> findAllNotCompleted() {
|
||||
return paperRepository.findByStatusNot(COMPLETED);
|
||||
}
|
||||
|
||||
public List<Paper> findAllSelect(List<Integer> paperIds) {
|
||||
|
14
src/main/resources/db/changelog-20190507_000001-schema.xml
Normal file
14
src/main/resources/db/changelog-20190507_000001-schema.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?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="tanya" id="20190507_000001-1">
|
||||
<sql>
|
||||
update grants
|
||||
set leader_id =
|
||||
(select u.id
|
||||
from users u
|
||||
where u.last_name = 'Романов' AND u.first_name = 'Антон');
|
||||
</sql>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -39,4 +39,5 @@
|
||||
<include file="db/changelog-20190430_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190505_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190507_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190507_000001-schema.xml"/>
|
||||
</databaseChangeLog>
|
@ -201,6 +201,30 @@
|
||||
Статус статьи
|
||||
</span>
|
||||
</div>
|
||||
<div class="col" th:unless="${#lists.isEmpty(paper.grants)}">
|
||||
<label>Гранты: </label>
|
||||
<div th:each="grant, grantRowStat : *{papers[__${rowStat.index}__].grants}"
|
||||
th:remove="tag">
|
||||
<div th:unless="${grant.id}==*{id}" th:remove="tag">
|
||||
<li>
|
||||
<a th:href="@{'/grants/grant?id=' + ${grant.id} + ''}">
|
||||
<span th:text="${grant.title} "></span>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" th:unless="${#lists.isEmpty(paper.conferences)}">
|
||||
<label>Конференции: </label>
|
||||
<div th:each="conference, conferenceRowStat : *{papers[__${rowStat.index}__].conferences}"
|
||||
th:remove="tag">
|
||||
<li>
|
||||
<a th:href="@{'/conferences/conference?id=' + ${conference.id} + ''}">
|
||||
<span th:text="${conference.title}"></span>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user