From dffd839905ffda7d0d5cf86821b7c266abab9178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=9C?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D1=8F?= Date: Tue, 7 May 2019 20:26:49 +0400 Subject: [PATCH 1/3] #109 only uncompleted for grant --- src/main/java/ru/ulstu/grant/controller/GrantController.java | 2 +- src/main/java/ru/ulstu/grant/service/GrantService.java | 4 ++++ src/main/java/ru/ulstu/paper/repository/PaperRepository.java | 2 ++ src/main/java/ru/ulstu/paper/service/PaperService.java | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/ulstu/grant/controller/GrantController.java b/src/main/java/ru/ulstu/grant/controller/GrantController.java index 85a0cd9..b28f8c0 100644 --- a/src/main/java/ru/ulstu/grant/controller/GrantController.java +++ b/src/main/java/ru/ulstu/grant/controller/GrantController.java @@ -132,7 +132,7 @@ public class GrantController { @ModelAttribute("allPapers") public List getAllPapers() { - return grantService.getAllPapers(); + return grantService.getAllUncompletedPapers(); } private void filterEmptyDeadlines(GrantDto grantDto) { diff --git a/src/main/java/ru/ulstu/grant/service/GrantService.java b/src/main/java/ru/ulstu/grant/service/GrantService.java index 9cff4b6..ae11850 100644 --- a/src/main/java/ru/ulstu/grant/service/GrantService.java +++ b/src/main/java/ru/ulstu/grant/service/GrantService.java @@ -196,6 +196,10 @@ public class GrantService { return paperService.findAll(); } + public List getAllUncompletedPapers() { + return paperService.findAllNotCompleted(); + } + public void attachPaper(GrantDto grantDto) { if (!grantDto.getPaperIds().isEmpty()) { grantDto.getPapers().clear(); diff --git a/src/main/java/ru/ulstu/paper/repository/PaperRepository.java b/src/main/java/ru/ulstu/paper/repository/PaperRepository.java index f935247..7eff73d 100644 --- a/src/main/java/ru/ulstu/paper/repository/PaperRepository.java +++ b/src/main/java/ru/ulstu/paper/repository/PaperRepository.java @@ -18,4 +18,6 @@ public interface PaperRepository extends JpaRepository { List findAllByIdIn(List paperIds); List findByTypeAndStatus(Paper.PaperType type, Paper.PaperStatus status); + + List findByStatusNot(Paper.PaperStatus status); } diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index f98997d..956b4b6 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -246,7 +246,10 @@ public class PaperService { } else { return sortPapers(paperRepository.findAll()); } + } + public List findAllNotCompleted() { + return paperRepository.findByStatusNot(COMPLETED); } public List findAllSelect(List paperIds) { From 1e07c5424dd0dddeaf1e109d20dc53d488e2b027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=9C?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D1=8F?= Date: Tue, 7 May 2019 21:35:50 +0400 Subject: [PATCH 2/3] #109 only one conference for paper --- src/main/java/ru/ulstu/paper/model/Paper.java | 12 ++++++++++++ .../ru/ulstu/paper/repository/PaperRepository.java | 4 ++++ .../java/ru/ulstu/paper/service/PaperService.java | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/paper/model/Paper.java b/src/main/java/ru/ulstu/paper/model/Paper.java index 65bd32c..eae8764 100644 --- a/src/main/java/ru/ulstu/paper/model/Paper.java +++ b/src/main/java/ru/ulstu/paper/model/Paper.java @@ -3,6 +3,7 @@ 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; @@ -114,6 +115,9 @@ public class Paper extends BaseEntity implements UserContainer { @Column(name = "latex_text") private String latexText; + @ManyToMany(mappedBy = "papers") + private List conferences; + public PaperStatus getStatus() { return status; } @@ -218,6 +222,14 @@ public class Paper extends BaseEntity implements UserContainer { this.latexText = latexText; } + public List getConferences() { + return conferences; + } + + public void setConferences(List conferences) { + this.conferences = conferences; + } + @Override public Set getUsers() { return getAuthors(); diff --git a/src/main/java/ru/ulstu/paper/repository/PaperRepository.java b/src/main/java/ru/ulstu/paper/repository/PaperRepository.java index 7eff73d..42d3703 100644 --- a/src/main/java/ru/ulstu/paper/repository/PaperRepository.java +++ b/src/main/java/ru/ulstu/paper/repository/PaperRepository.java @@ -20,4 +20,8 @@ public interface PaperRepository extends JpaRepository { List findByTypeAndStatus(Paper.PaperType type, Paper.PaperStatus status); List findByStatusNot(Paper.PaperStatus status); + + List findByConferencesIsNullAndStatusNot(Paper.PaperStatus status); + + List findByIdNotInAndConferencesIsNullAndStatusNot(List paperIds, Paper.PaperStatus status); } diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index 956b4b6..0083de7 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -242,9 +242,9 @@ public class PaperService { public List findAllNotSelect(List 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)); } } From 2fba252df088b38068f76ddcc6ae2098e90074df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=9C?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D1=8F?= Date: Tue, 7 May 2019 23:53:10 +0400 Subject: [PATCH 3/3] #109 show other paper attachs --- src/main/java/ru/ulstu/paper/model/Paper.java | 12 ++++++++++ .../resources/templates/grants/grant.html | 24 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/main/java/ru/ulstu/paper/model/Paper.java b/src/main/java/ru/ulstu/paper/model/Paper.java index eae8764..4536ce5 100644 --- a/src/main/java/ru/ulstu/paper/model/Paper.java +++ b/src/main/java/ru/ulstu/paper/model/Paper.java @@ -8,6 +8,7 @@ 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; @@ -118,6 +119,9 @@ public class Paper extends BaseEntity implements UserContainer { @ManyToMany(mappedBy = "papers") private List conferences; + @ManyToMany(mappedBy = "papers") + private List grants; + public PaperStatus getStatus() { return status; } @@ -230,6 +234,14 @@ public class Paper extends BaseEntity implements UserContainer { this.conferences = conferences; } + public List getGrants() { + return grants; + } + + public void setGrants(List grants) { + this.grants = grants; + } + @Override public Set getUsers() { return getAuthors(); diff --git a/src/main/resources/templates/grants/grant.html b/src/main/resources/templates/grants/grant.html index 4d3cdde..e357876 100644 --- a/src/main/resources/templates/grants/grant.html +++ b/src/main/resources/templates/grants/grant.html @@ -201,6 +201,30 @@ Статус статьи +
+ +
+
+
  • + + + +
  • +
    +
    +
    +
    + +
    +
  • + + + +
  • +
    +