Merge branch '109-paper-attach-control' into 'dev'
Resolve "Контроль прикрепления статей" Closes #109 See merge request romanov73/ng-tracker!87
This commit is contained in:
commit
662847698e
@ -132,7 +132,7 @@ public class GrantController {
|
|||||||
|
|
||||||
@ModelAttribute("allPapers")
|
@ModelAttribute("allPapers")
|
||||||
public List<Paper> getAllPapers() {
|
public List<Paper> getAllPapers() {
|
||||||
return grantService.getAllPapers();
|
return grantService.getAllUncompletedPapers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void filterEmptyDeadlines(GrantDto grantDto) {
|
private void filterEmptyDeadlines(GrantDto grantDto) {
|
||||||
|
@ -196,6 +196,10 @@ public class GrantService {
|
|||||||
return paperService.findAll();
|
return paperService.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Paper> getAllUncompletedPapers() {
|
||||||
|
return paperService.findAllNotCompleted();
|
||||||
|
}
|
||||||
|
|
||||||
public void attachPaper(GrantDto grantDto) {
|
public void attachPaper(GrantDto grantDto) {
|
||||||
if (!grantDto.getPaperIds().isEmpty()) {
|
if (!grantDto.getPaperIds().isEmpty()) {
|
||||||
grantDto.getPapers().clear();
|
grantDto.getPapers().clear();
|
||||||
|
@ -3,10 +3,12 @@ package ru.ulstu.paper.model;
|
|||||||
import org.hibernate.annotations.Fetch;
|
import org.hibernate.annotations.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
import org.hibernate.validator.constraints.NotBlank;
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
import ru.ulstu.conference.model.Conference;
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
import ru.ulstu.core.model.UserContainer;
|
import ru.ulstu.core.model.UserContainer;
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.file.model.FileData;
|
import ru.ulstu.file.model.FileData;
|
||||||
|
import ru.ulstu.grant.model.Grant;
|
||||||
import ru.ulstu.timeline.model.Event;
|
import ru.ulstu.timeline.model.Event;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
|
|
||||||
@ -114,6 +116,12 @@ public class Paper extends BaseEntity implements UserContainer {
|
|||||||
@Column(name = "latex_text")
|
@Column(name = "latex_text")
|
||||||
private String latexText;
|
private String latexText;
|
||||||
|
|
||||||
|
@ManyToMany(mappedBy = "papers")
|
||||||
|
private List<Conference> conferences;
|
||||||
|
|
||||||
|
@ManyToMany(mappedBy = "papers")
|
||||||
|
private List<Grant> grants;
|
||||||
|
|
||||||
public PaperStatus getStatus() {
|
public PaperStatus getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -218,6 +226,22 @@ public class Paper extends BaseEntity implements UserContainer {
|
|||||||
this.latexText = latexText;
|
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
|
@Override
|
||||||
public Set<User> getUsers() {
|
public Set<User> getUsers() {
|
||||||
return getAuthors();
|
return getAuthors();
|
||||||
|
@ -18,4 +18,10 @@ public interface PaperRepository extends JpaRepository<Paper, Integer> {
|
|||||||
List<Paper> findAllByIdIn(List<Integer> paperIds);
|
List<Paper> findAllByIdIn(List<Integer> paperIds);
|
||||||
|
|
||||||
List<Paper> findByTypeAndStatus(Paper.PaperType type, Paper.PaperStatus status);
|
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) {
|
public List<Paper> findAllNotSelect(List<Integer> paperIds) {
|
||||||
if (!paperIds.isEmpty()) {
|
if (!paperIds.isEmpty()) {
|
||||||
return sortPapers(paperRepository.findByIdNotIn(paperIds));
|
return sortPapers(paperRepository.findByIdNotInAndConferencesIsNullAndStatusNot(paperIds, COMPLETED));
|
||||||
} else {
|
} 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) {
|
public List<Paper> findAllSelect(List<Integer> paperIds) {
|
||||||
|
@ -201,6 +201,30 @@
|
|||||||
Статус статьи
|
Статус статьи
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user