From 8fbce550286d4dcd6ba02dce5104690653f8cdfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Wed, 17 Apr 2019 11:04:35 +0300 Subject: [PATCH 01/13] #86 projects main page --- .../project/controller/ProjectController.java | 39 +++++++++++++++++++ .../ulstu/project/service/ProjectService.java | 9 +++++ src/main/resources/templates/index.html | 2 +- .../templates/projects/dashboard.html | 24 ++++++++++++ .../fragments/projectNavigationFragment.html | 26 +++++++++++++ .../templates/projects/projects.html | 33 ++++++++++++++++ 6 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 src/main/java/ru/ulstu/project/controller/ProjectController.java create mode 100644 src/main/resources/templates/projects/dashboard.html create mode 100644 src/main/resources/templates/projects/fragments/projectNavigationFragment.html create mode 100644 src/main/resources/templates/projects/projects.html diff --git a/src/main/java/ru/ulstu/project/controller/ProjectController.java b/src/main/java/ru/ulstu/project/controller/ProjectController.java new file mode 100644 index 0000000..5b5eb4a --- /dev/null +++ b/src/main/java/ru/ulstu/project/controller/ProjectController.java @@ -0,0 +1,39 @@ +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.*; +import ru.ulstu.deadline.model.Deadline; +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 liquibase.util.StringUtils.isEmpty; + +@Controller() +@RequestMapping(value = "/projects") +@ApiIgnore +public class ProjectController { + private final ProjectService projectService; + + public ProjectController(ProjectService projectService) { + this.projectService = projectService; + } + + @GetMapping("/dashboard") + public void getDashboard(ModelMap modelMap) { + modelMap.put("projects", projectService.findAllDto()); + } + + @GetMapping("/projects") + public void getProjects(ModelMap modelMap) { + modelMap.put("projects", projectService.findAllDto()); + } +} diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index b54a60a..78a9d3c 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -2,6 +2,7 @@ package ru.ulstu.project.service; 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.project.model.Project; import ru.ulstu.project.model.ProjectDto; @@ -10,9 +11,11 @@ import ru.ulstu.project.repository.ProjectRepository; import java.util.List; import static org.springframework.util.ObjectUtils.isEmpty; +import static ru.ulstu.core.util.StreamApiUtils.convert; @Service public class ProjectService { + private final static int MAX_DISPLAY_SIZE = 40; private final ProjectRepository projectRepository; private final DeadlineService deadlineService; @@ -27,6 +30,12 @@ public class ProjectService { return projectRepository.findAll(); } + public List findAllDto() { + List projects = convert(findAll(), ProjectDto::new); + projects.forEach(projectDto -> projectDto.setTitle(StringUtils.abbreviate(projectDto.getTitle(), MAX_DISPLAY_SIZE))); + return projects; + } + @Transactional public Project create(ProjectDto projectDto) { Project newProject = copyFromDto(new Project(), projectDto); diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 2d86945..6ca1c12 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -46,7 +46,7 @@
- +
diff --git a/src/main/resources/templates/projects/dashboard.html b/src/main/resources/templates/projects/dashboard.html new file mode 100644 index 0000000..882c202 --- /dev/null +++ b/src/main/resources/templates/projects/dashboard.html @@ -0,0 +1,24 @@ + + + + + +
+
+
+
+

Проекты

+
+
+
+ +
+ +
+
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/projects/fragments/projectNavigationFragment.html b/src/main/resources/templates/projects/fragments/projectNavigationFragment.html new file mode 100644 index 0000000..c26d8b8 --- /dev/null +++ b/src/main/resources/templates/projects/fragments/projectNavigationFragment.html @@ -0,0 +1,26 @@ + + + + + + +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/projects/projects.html b/src/main/resources/templates/projects/projects.html new file mode 100644 index 0000000..0336770 --- /dev/null +++ b/src/main/resources/templates/projects/projects.html @@ -0,0 +1,33 @@ + + + + + +
+
+ +
+
+
+
+

Проекты

+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+ + From ee55e08feee4ea20dfa52403996f0659cd42f1d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Mon, 6 May 2019 17:43:20 +0300 Subject: [PATCH 02/13] #98 project tasks deadline edited --- .../conference/service/ConferenceService.java | 3 +- .../ru/ulstu/deadline/model/Deadline.java | 35 ++++++++++++++++--- .../ru/ulstu/grant/service/GrantService.java | 2 +- .../ru/ulstu/paper/service/PaperService.java | 2 +- .../project/controller/ProjectController.java | 7 ++++ .../ru/ulstu/project/model/ProjectDto.java | 9 +++++ .../ulstu/project/service/ProjectService.java | 7 ++++ .../db/changelog-20190506_000000-schema.xml | 13 +++++++ src/main/resources/db/changelog-master.xml | 1 + .../resources/templates/projects/project.html | 8 +++-- 10 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 src/main/resources/db/changelog-20190506_000000-schema.xml diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceService.java b/src/main/java/ru/ulstu/conference/service/ConferenceService.java index 38de435..b42f981 100644 --- a/src/main/java/ru/ulstu/conference/service/ConferenceService.java +++ b/src/main/java/ru/ulstu/conference/service/ConferenceService.java @@ -267,7 +267,8 @@ public class ConferenceService { } public Deadline copyDeadline(Deadline oldDeadline) { - Deadline newDeadline = new Deadline(oldDeadline.getDate(), oldDeadline.getDescription()); + Deadline newDeadline = new Deadline(oldDeadline.getDate(), oldDeadline.getDescription(), + oldDeadline.getExecutor(), oldDeadline.getDone()); newDeadline.setId(oldDeadline.getId()); return newDeadline; } diff --git a/src/main/java/ru/ulstu/deadline/model/Deadline.java b/src/main/java/ru/ulstu/deadline/model/Deadline.java index 148697c..9ab9acd 100644 --- a/src/main/java/ru/ulstu/deadline/model/Deadline.java +++ b/src/main/java/ru/ulstu/deadline/model/Deadline.java @@ -20,21 +20,30 @@ public class Deadline extends BaseEntity { @DateTimeFormat(pattern = "yyyy-MM-dd") private Date date; + private String executor; + private Boolean done; + public Deadline() { } - public Deadline(Date deadlineDate, String description) { + public Deadline(Date deadlineDate, String description, String executor, Boolean done) { this.date = deadlineDate; this.description = description; + this.executor = executor; + this.done = done; } @JsonCreator public Deadline(@JsonProperty("id") Integer id, @JsonProperty("description") String description, - @JsonProperty("date") Date date) { + @JsonProperty("date") Date date, + @JsonProperty("executor") String executor, + @JsonProperty("done") Boolean done) { this.setId(id); this.description = description; this.date = date; + this.executor = executor; + this.done = done; } public String getDescription() { @@ -53,6 +62,22 @@ public class Deadline extends BaseEntity { this.date = date; } + public String getExecutor() { + return executor; + } + + public void setExecutor(String executor) { + this.executor = executor; + } + + public Boolean getDone() { + return done; + } + + public void setDone(Boolean done) { + this.done = done; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -67,11 +92,13 @@ public class Deadline extends BaseEntity { Deadline deadline = (Deadline) o; return getId().equals(deadline.getId()) && description.equals(deadline.description) && - date.equals(deadline.date); + date.equals(deadline.date) && + executor.equals(deadline.executor) && + done.equals(deadline.done); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), description, date); + return Objects.hash(super.hashCode(), description, date, executor, done); } } diff --git a/src/main/java/ru/ulstu/grant/service/GrantService.java b/src/main/java/ru/ulstu/grant/service/GrantService.java index 9cff4b6..0837b49 100644 --- a/src/main/java/ru/ulstu/grant/service/GrantService.java +++ b/src/main/java/ru/ulstu/grant/service/GrantService.java @@ -141,7 +141,7 @@ public class GrantService { grant.setComment("Комментарий к гранту 1"); grant.setProject(projectId); grant.setStatus(APPLICATION); - grant.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн")); + grant.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн", "", false)); grant.getAuthors().add(user); grant.setLeader(user); grant.getPapers().add(paper); diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index f98997d..1188c28 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -173,7 +173,7 @@ public class PaperService { Paper paper = new Paper(); paper.setTitle(title); paper.getAuthors().add(user); - paper.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн")); + paper.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн", "", false)); paper.setCreateDate(new Date()); paper.setUpdateDate(new Date()); paper.setStatus(DRAFT); diff --git a/src/main/java/ru/ulstu/project/controller/ProjectController.java b/src/main/java/ru/ulstu/project/controller/ProjectController.java index ae09658..14b8736 100644 --- a/src/main/java/ru/ulstu/project/controller/ProjectController.java +++ b/src/main/java/ru/ulstu/project/controller/ProjectController.java @@ -79,6 +79,13 @@ public class ProjectController { return "/projects/project"; } + @PostMapping(value = "/project", params = "removeDeadline") + public String removeDeadline(ProjectDto projectDto, + @RequestParam(value = "removeDeadline") Integer deadlineId) { + projectService.removeDeadline(projectDto, deadlineId); + return "/projects/project"; + } + @GetMapping("/delete/{project-id}") public String delete(@PathVariable("project-id") Integer projectId) throws IOException { projectService.delete(projectId); diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index 4e03365..319609c 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -20,6 +20,7 @@ public class ProjectDto { private GrantDto grant; private String repository; private String applicationFileName; + private List removedDeadlineIds = new ArrayList<>(); public ProjectDto() { } @@ -121,4 +122,12 @@ public class ProjectDto { public void setApplicationFileName(String applicationFileName) { this.applicationFileName = applicationFileName; } + + public List getRemovedDeadlineIds() { + return removedDeadlineIds; + } + + public void setRemovedDeadlineIds(List removedDeadlineIds) { + this.removedDeadlineIds = removedDeadlineIds; + } } diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index 247624d..4a79e6c 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -104,6 +104,13 @@ public class ProjectService { } } + public void removeDeadline(ProjectDto projectDto, Integer deadlineId) { + if (projectDto.getDeadlines().get(deadlineId).getId() != null) { + projectDto.getRemovedDeadlineIds().add(projectDto.getDeadlines().get(deadlineId).getId()); + } + projectDto.getDeadlines().remove((int) deadlineId); + } + public Project findById(Integer id) { return projectRepository.findOne(id); } diff --git a/src/main/resources/db/changelog-20190506_000000-schema.xml b/src/main/resources/db/changelog-20190506_000000-schema.xml new file mode 100644 index 0000000..cd5a59b --- /dev/null +++ b/src/main/resources/db/changelog-20190506_000000-schema.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index 83ff280..3b455a8 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -38,4 +38,5 @@ + \ No newline at end of file diff --git a/src/main/resources/templates/projects/project.html b/src/main/resources/templates/projects/project.html index dc3fa6d..cd49319 100644 --- a/src/main/resources/templates/projects/project.html +++ b/src/main/resources/templates/projects/project.html @@ -73,14 +73,18 @@
-
+
-
+
+
+ +
-
+
-
+
-
+
-
- -
+
+
+
+ +
+
+
From 4025aa67ca1720d75cdda18dcf4221868470f162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Mon, 6 May 2019 21:51:58 +0300 Subject: [PATCH 04/13] #98 project completion added --- .../java/ru/ulstu/project/model/Project.java | 16 ++++++++ .../ru/ulstu/project/model/ProjectDto.java | 41 ++++++++++++++++++- .../db/changelog-20190506_000001-schema.xml | 17 ++++++++ src/main/resources/db/changelog-master.xml | 1 + src/main/resources/public/css/project.css | 5 +++ .../resources/templates/projects/project.html | 15 +++---- 6 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/db/changelog-20190506_000001-schema.xml create mode 100644 src/main/resources/public/css/project.css diff --git a/src/main/java/ru/ulstu/project/model/Project.java b/src/main/java/ru/ulstu/project/model/Project.java index c971c4b..acf0d0f 100644 --- a/src/main/java/ru/ulstu/project/model/Project.java +++ b/src/main/java/ru/ulstu/project/model/Project.java @@ -5,17 +5,22 @@ 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 ru.ulstu.user.model.User; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; +import javax.persistence.FetchType; import javax.persistence.JoinColumn; +import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.validation.constraints.NotNull; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; @Entity public class Project extends BaseEntity { @@ -62,6 +67,9 @@ public class Project extends BaseEntity { @JoinColumn(name = "file_id") private FileData application; + @ManyToMany(fetch = FetchType.EAGER) + private Set executors = new HashSet<>(); + public String getTitle() { return title; } @@ -117,4 +125,12 @@ public class Project extends BaseEntity { public void setApplication(FileData application) { this.application = application; } + + public Set getExecutors() { + return executors; + } + + public void setExecutors(Set executors) { + this.executors = executors; + } } diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index 319609c..0f86e1a 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -3,11 +3,17 @@ package ru.ulstu.project.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.hibernate.validator.constraints.NotEmpty; +import org.thymeleaf.util.StringUtils; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.grant.model.GrantDto; +import ru.ulstu.user.model.UserDto; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import static ru.ulstu.core.util.StreamApiUtils.convert; public class ProjectDto { private Integer id; @@ -21,6 +27,10 @@ public class ProjectDto { private String repository; private String applicationFileName; private List removedDeadlineIds = new ArrayList<>(); + private Set executorIds; + private Set executors; + + private final static int MAX_EXECUTORS_LENGTH = 40; public ProjectDto() { } @@ -36,7 +46,9 @@ public class ProjectDto { @JsonProperty("description") String description, @JsonProperty("grant") GrantDto grant, @JsonProperty("repository") String repository, - @JsonProperty("deadlines") List deadlines) { + @JsonProperty("deadlines") List deadlines, + @JsonProperty("executorIds") Set executorIds, + @JsonProperty("executors") Set executors) { this.id = id; this.title = title; this.status = status; @@ -45,6 +57,8 @@ public class ProjectDto { this.repository = repository; this.deadlines = deadlines; this.applicationFileName = null; + this.executorIds = executorIds; + this.executors = executors; } @@ -57,6 +71,8 @@ public class ProjectDto { this.grant = project.getGrant() == null ? null : new GrantDto(project.getGrant()); this.repository = project.getRepository(); this.deadlines = project.getDeadlines(); + this.executorIds = convert(project.getExecutors(), user -> user.getId()); + this.executors = convert(project.getExecutors(), UserDto::new); } public Integer getId() { @@ -130,4 +146,27 @@ public class ProjectDto { public void setRemovedDeadlineIds(List removedDeadlineIds) { this.removedDeadlineIds = removedDeadlineIds; } + + public Set getExecutorIds() { + return executorIds; + } + + public void setExecutorIds(Set executorIds) { + this.executorIds = executorIds; + } + + public Set getExecutors() { + return executors; + } + + public void setExecutors(Set executors) { + this.executors = executors; + } + + public String getExecutorsString() { + return StringUtils.abbreviate(executors + .stream() + .map(executor -> executor.getLastName()) + .collect(Collectors.joining(", ")), MAX_EXECUTORS_LENGTH); + } } diff --git a/src/main/resources/db/changelog-20190506_000001-schema.xml b/src/main/resources/db/changelog-20190506_000001-schema.xml new file mode 100644 index 0000000..e28d009 --- /dev/null +++ b/src/main/resources/db/changelog-20190506_000001-schema.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index 3b455a8..051c953 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -39,4 +39,5 @@ + \ No newline at end of file diff --git a/src/main/resources/public/css/project.css b/src/main/resources/public/css/project.css new file mode 100644 index 0000000..24e12ea --- /dev/null +++ b/src/main/resources/public/css/project.css @@ -0,0 +1,5 @@ +.div-deadline-done { + width: 60%; + height: 100%; + float: right; +} \ No newline at end of file diff --git a/src/main/resources/templates/projects/project.html b/src/main/resources/templates/projects/project.html index 2a0b7cf..8385694 100644 --- a/src/main/resources/templates/projects/project.html +++ b/src/main/resources/templates/projects/project.html @@ -3,7 +3,7 @@ xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html"> - + @@ -90,17 +90,18 @@ aria-hidden="true">
-
-

Incorrect title

-
-
-
+
+
+ +
+

Incorrect title

Date: Mon, 6 May 2019 22:10:40 +0300 Subject: [PATCH 05/13] #98 deadline edited --- src/main/java/ru/ulstu/deadline/model/Deadline.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/ulstu/deadline/model/Deadline.java b/src/main/java/ru/ulstu/deadline/model/Deadline.java index 5a05ea1..9ab9acd 100644 --- a/src/main/java/ru/ulstu/deadline/model/Deadline.java +++ b/src/main/java/ru/ulstu/deadline/model/Deadline.java @@ -66,7 +66,9 @@ public class Deadline extends BaseEntity { return executor; } - public void setExecutor(String executor) { this.executor = executor; } + public void setExecutor(String executor) { + this.executor = executor; + } public Boolean getDone() { return done; From f960d4de1b78cd9a8cd01ea43bdd6304fcc7d844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Fri, 17 May 2019 11:30:26 +0300 Subject: [PATCH 06/13] #98 deadline model edited --- src/main/java/ru/ulstu/deadline/model/Deadline.java | 5 +++++ src/main/java/ru/ulstu/grant/service/GrantService.java | 2 +- src/main/java/ru/ulstu/paper/service/PaperService.java | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/deadline/model/Deadline.java b/src/main/java/ru/ulstu/deadline/model/Deadline.java index 9ab9acd..5ab9f47 100644 --- a/src/main/java/ru/ulstu/deadline/model/Deadline.java +++ b/src/main/java/ru/ulstu/deadline/model/Deadline.java @@ -26,6 +26,11 @@ public class Deadline extends BaseEntity { public Deadline() { } + public Deadline(Date deadlineDate, String description) { + this.date = deadlineDate; + this.description = description; + } + public Deadline(Date deadlineDate, String description, String executor, Boolean done) { this.date = deadlineDate; this.description = description; diff --git a/src/main/java/ru/ulstu/grant/service/GrantService.java b/src/main/java/ru/ulstu/grant/service/GrantService.java index c06a71c..45f9b2f 100644 --- a/src/main/java/ru/ulstu/grant/service/GrantService.java +++ b/src/main/java/ru/ulstu/grant/service/GrantService.java @@ -164,7 +164,7 @@ public class GrantService { grant.setComment("Комментарий к гранту 1"); grant.setProject(projectId); grant.setStatus(APPLICATION); - grant.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн", "", false)); + grant.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн")); grant.getAuthors().add(user); grant.setLeader(user); grant.getPapers().add(paper); diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index 0a60c92..db810f5 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -173,7 +173,7 @@ public class PaperService { Paper paper = new Paper(); paper.setTitle(title); paper.getAuthors().add(user); - paper.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн", "", false)); + paper.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн")); paper.setCreateDate(new Date()); paper.setUpdateDate(new Date()); paper.setStatus(DRAFT); From 4eeb79ab80fedec0b8d69dc901cb5d9cb326e312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Mon, 27 May 2019 09:19:52 +0300 Subject: [PATCH 07/13] #98 changelog edited --- .../java/ru/ulstu/deadline/model/Deadline.java | 10 +++++----- .../db/changelog-20190517_000001-schema.xml | 14 ++++++++++++++ src/main/resources/db/changelog-master.xml | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/db/changelog-20190517_000001-schema.xml diff --git a/src/main/java/ru/ulstu/deadline/model/Deadline.java b/src/main/java/ru/ulstu/deadline/model/Deadline.java index 5ab9f47..4dfebef 100644 --- a/src/main/java/ru/ulstu/deadline/model/Deadline.java +++ b/src/main/java/ru/ulstu/deadline/model/Deadline.java @@ -20,7 +20,7 @@ public class Deadline extends BaseEntity { @DateTimeFormat(pattern = "yyyy-MM-dd") private Date date; - private String executor; + private Integer executor; private Boolean done; public Deadline() { @@ -31,7 +31,7 @@ public class Deadline extends BaseEntity { this.description = description; } - public Deadline(Date deadlineDate, String description, String executor, Boolean done) { + public Deadline(Date deadlineDate, String description, Integer executor, Boolean done) { this.date = deadlineDate; this.description = description; this.executor = executor; @@ -42,7 +42,7 @@ public class Deadline extends BaseEntity { public Deadline(@JsonProperty("id") Integer id, @JsonProperty("description") String description, @JsonProperty("date") Date date, - @JsonProperty("executor") String executor, + @JsonProperty("executor") Integer executor, @JsonProperty("done") Boolean done) { this.setId(id); this.description = description; @@ -67,11 +67,11 @@ public class Deadline extends BaseEntity { this.date = date; } - public String getExecutor() { + public Integer getExecutor() { return executor; } - public void setExecutor(String executor) { + public void setExecutor(Integer executor) { this.executor = executor; } diff --git a/src/main/resources/db/changelog-20190517_000001-schema.xml b/src/main/resources/db/changelog-20190517_000001-schema.xml new file mode 100644 index 0000000..73c6435 --- /dev/null +++ b/src/main/resources/db/changelog-20190517_000001-schema.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index 1cab67b..d81f1cb 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -44,4 +44,5 @@ + \ No newline at end of file From 7388e12e3f5d50ab6278f99e96ff0d49046b9ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Mon, 27 May 2019 18:19:31 +0300 Subject: [PATCH 08/13] #98 edited project executors --- .../project/controller/ProjectController.java | 6 +++++ .../java/ru/ulstu/project/model/Project.java | 9 ++++++- .../ru/ulstu/project/model/ProjectDto.java | 24 ++++++++++++++++++- .../ulstu/project/service/ProjectService.java | 13 +++++++++- .../resources/templates/projects/project.html | 9 +++++-- 5 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/main/java/ru/ulstu/project/controller/ProjectController.java b/src/main/java/ru/ulstu/project/controller/ProjectController.java index 14b8736..88f0c7a 100644 --- a/src/main/java/ru/ulstu/project/controller/ProjectController.java +++ b/src/main/java/ru/ulstu/project/controller/ProjectController.java @@ -13,6 +13,7 @@ import ru.ulstu.deadline.model.Deadline; import ru.ulstu.project.model.Project; import ru.ulstu.project.model.ProjectDto; import ru.ulstu.project.service.ProjectService; +import ru.ulstu.user.model.User; import springfox.documentation.annotations.ApiIgnore; import javax.validation.Valid; @@ -92,6 +93,11 @@ public class ProjectController { return String.format("redirect:%s", "/projects/projects"); } + @ModelAttribute("allExecutors") + public List getAllExecutors(ProjectDto projectDto) { + return projectService.getProjectExecutors(projectDto); + } + private void filterEmptyDeadlines(ProjectDto projectDto) { projectDto.setDeadlines(projectDto.getDeadlines().stream() .filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription())) diff --git a/src/main/java/ru/ulstu/project/model/Project.java b/src/main/java/ru/ulstu/project/model/Project.java index acf0d0f..f061221 100644 --- a/src/main/java/ru/ulstu/project/model/Project.java +++ b/src/main/java/ru/ulstu/project/model/Project.java @@ -2,6 +2,7 @@ package ru.ulstu.project.model; import org.hibernate.validator.constraints.NotBlank; 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; @@ -23,7 +24,8 @@ import java.util.List; import java.util.Set; @Entity -public class Project extends BaseEntity { +public class Project extends BaseEntity implements UserContainer { + public enum ProjectStatus { APPLICATION("Заявка"), ON_COMPETITION("Отправлен на конкурс"), @@ -133,4 +135,9 @@ public class Project extends BaseEntity { public void setExecutors(Set executors) { this.executors = executors; } + + @Override + public Set getUsers() { + return getExecutors(); + } } diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index 0f86e1a..0292f1f 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -29,6 +29,8 @@ public class ProjectDto { private List removedDeadlineIds = new ArrayList<>(); private Set executorIds; private Set executors; + private boolean hasAge; + private boolean hasDegree; private final static int MAX_EXECUTORS_LENGTH = 40; @@ -48,7 +50,9 @@ public class ProjectDto { @JsonProperty("repository") String repository, @JsonProperty("deadlines") List deadlines, @JsonProperty("executorIds") Set executorIds, - @JsonProperty("executors") Set executors) { + @JsonProperty("executors") Set executors, + @JsonProperty("hasAge") boolean hasAge, + @JsonProperty("hasDegree") boolean hasDegree) { this.id = id; this.title = title; this.status = status; @@ -59,6 +63,8 @@ public class ProjectDto { this.applicationFileName = null; this.executorIds = executorIds; this.executors = executors; + this.hasAge = hasAge; + this.hasDegree = hasDegree; } @@ -163,6 +169,22 @@ public class ProjectDto { this.executors = executors; } + public boolean isHasAge() { + return hasAge; + } + + public void setHasAge(boolean hasAge) { + this.hasAge = hasAge; + } + + public boolean isHasDegree() { + return hasDegree; + } + + public void setHasDegree(boolean hasDegree) { + this.hasDegree = hasDegree; + } + public String getExecutorsString() { return StringUtils.abbreviate(executors .stream() diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index 4a79e6c..2f6473b 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -5,10 +5,13 @@ 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.model.GrantDto; 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 ru.ulstu.user.model.User; +import ru.ulstu.user.service.UserService; import java.io.IOException; import java.util.Arrays; @@ -26,15 +29,18 @@ public class ProjectService { private final DeadlineService deadlineService; private final GrantRepository grantRepository; private final FileService fileService; + private final UserService userService; public ProjectService(ProjectRepository projectRepository, DeadlineService deadlineService, GrantRepository grantRepository, - FileService fileService) { + FileService fileService, + UserService userService) { this.projectRepository = projectRepository; this.deadlineService = deadlineService; this.grantRepository = grantRepository; this.fileService = fileService; + this.userService = userService; } public List findAll() { @@ -115,4 +121,9 @@ public class ProjectService { return projectRepository.findOne(id); } + public List getProjectExecutors(ProjectDto projectDto) { + List filteredUsers = userService.filterByAgeAndDegree(projectDto.isHasAge(), projectDto.isHasDegree()); + return filteredUsers; + } + } diff --git a/src/main/resources/templates/projects/project.html b/src/main/resources/templates/projects/project.html index 8385694..304fed0 100644 --- a/src/main/resources/templates/projects/project.html +++ b/src/main/resources/templates/projects/project.html @@ -92,8 +92,13 @@
- +
Date: Tue, 28 May 2019 00:40:36 +0400 Subject: [PATCH 09/13] #98 project statuses edited --- src/main/java/ru/ulstu/project/model/Project.java | 10 +++++----- .../java/ru/ulstu/project/service/ProjectService.java | 4 ++-- .../projects/fragments/projectStatusFragment.html | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/ru/ulstu/project/model/Project.java b/src/main/java/ru/ulstu/project/model/Project.java index f061221..cf0de14 100644 --- a/src/main/java/ru/ulstu/project/model/Project.java +++ b/src/main/java/ru/ulstu/project/model/Project.java @@ -27,11 +27,11 @@ import java.util.Set; public class Project extends BaseEntity implements UserContainer { public enum ProjectStatus { - APPLICATION("Заявка"), - ON_COMPETITION("Отправлен на конкурс"), - SUCCESSFUL_PASSAGE("Успешное прохождение"), + TT("ТЗ"), + OPEN("Открыт"), IN_WORK("В работе"), - COMPLETED("Завершен"), + CERTIFICATE_ISSUED("Оформление свидетельства"), + CLOSED("Закрыт"), FAILED("Провалены сроки"); private String statusName; @@ -49,7 +49,7 @@ public class Project extends BaseEntity implements UserContainer { private String title; @Enumerated(value = EnumType.STRING) - private ProjectStatus status = ProjectStatus.APPLICATION; + private ProjectStatus status = ProjectStatus.TT; @NotNull private String description; diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index 2f6473b..2b9e82b 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -19,7 +19,7 @@ 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; +import static ru.ulstu.project.model.Project.ProjectStatus.TT; @Service public class ProjectService { @@ -89,7 +89,7 @@ public class ProjectService { private Project copyFromDto(Project project, ProjectDto projectDto) throws IOException { project.setDescription(projectDto.getDescription()); - project.setStatus(projectDto.getStatus() == null ? APPLICATION : projectDto.getStatus()); + project.setStatus(projectDto.getStatus() == null ? TT : projectDto.getStatus()); project.setTitle(projectDto.getTitle()); if (projectDto.getGrant() != null && projectDto.getGrant().getId() != null) { project.setGrant(grantRepository.findOne(projectDto.getGrant().getId())); diff --git a/src/main/resources/templates/projects/fragments/projectStatusFragment.html b/src/main/resources/templates/projects/fragments/projectStatusFragment.html index d8f29cc..c56958e 100644 --- a/src/main/resources/templates/projects/fragments/projectStatusFragment.html +++ b/src/main/resources/templates/projects/fragments/projectStatusFragment.html @@ -6,19 +6,19 @@ -
+
-
+
-
+
-
+
-
+
From 3b0a2dd964c60fc53c4ec9ac64fedcedb4dc7594 Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Tue, 28 May 2019 11:12:27 +0400 Subject: [PATCH 10/13] #98 executors list added --- .../ru/ulstu/deadline/model/Deadline.java | 30 ++++++++++--------- .../deadline/service/DeadlineService.java | 4 +-- .../java/ru/ulstu/project/model/Project.java | 15 +++++----- .../ru/ulstu/project/model/ProjectDto.java | 13 ++++---- .../ulstu/project/service/ProjectService.java | 5 ++-- .../db/changelog-20190528_000000-schema.xml | 11 +++++++ .../db/changelog-20190528_000001-schema.xml | 17 +++++++++++ src/main/resources/db/changelog-master.xml | 2 ++ .../fragments/projectStatusFragment.html | 2 +- 9 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 src/main/resources/db/changelog-20190528_000000-schema.xml create mode 100644 src/main/resources/db/changelog-20190528_000001-schema.xml diff --git a/src/main/java/ru/ulstu/deadline/model/Deadline.java b/src/main/java/ru/ulstu/deadline/model/Deadline.java index 3a54bec..97b6441 100644 --- a/src/main/java/ru/ulstu/deadline/model/Deadline.java +++ b/src/main/java/ru/ulstu/deadline/model/Deadline.java @@ -4,11 +4,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.format.annotation.DateTimeFormat; import ru.ulstu.core.model.BaseEntity; +import ru.ulstu.user.model.User; -import javax.persistence.Entity; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; +import javax.persistence.*; import java.util.Date; +import java.util.List; import java.util.Objects; @Entity @@ -20,7 +20,9 @@ public class Deadline extends BaseEntity { @DateTimeFormat(pattern = "yyyy-MM-dd") private Date date; - private Integer executor; + @OneToMany(targetEntity=User.class, fetch=FetchType.EAGER) + private List executors; + private Boolean done; public Deadline() { @@ -31,10 +33,10 @@ public class Deadline extends BaseEntity { this.description = description; } - public Deadline(Date deadlineDate, String description, Integer executor, Boolean done) { + public Deadline(Date deadlineDate, String description, List executors, Boolean done) { this.date = deadlineDate; this.description = description; - this.executor = executor; + this.executors = executors; this.done = done; } @@ -42,12 +44,12 @@ public class Deadline extends BaseEntity { public Deadline(@JsonProperty("id") Integer id, @JsonProperty("description") String description, @JsonProperty("date") Date date, - @JsonProperty("executor") Integer executor, + @JsonProperty("executors") List executors, @JsonProperty("done") Boolean done) { this.setId(id); this.description = description; this.date = date; - this.executor = executor; + this.executors = executors; this.done = done; } @@ -67,12 +69,12 @@ public class Deadline extends BaseEntity { this.date = date; } - public Integer getExecutor() { - return executor; + public List getExecutors() { + return executors; } - public void setExecutor(Integer executor) { - this.executor = executor; + public void setExecutors(List executors) { + this.executors = executors; } public Boolean getDone() { @@ -103,12 +105,12 @@ public class Deadline extends BaseEntity { return getId().equals(deadline.getId()) && description.equals(deadline.description) && date.equals(deadline.date) && - executor.equals(deadline.executor) && + executors.equals(deadline.executors) && done.equals(deadline.done); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), description, date, executor, done); + return Objects.hash(super.hashCode(), description, date, executors, done); } } diff --git a/src/main/java/ru/ulstu/deadline/service/DeadlineService.java b/src/main/java/ru/ulstu/deadline/service/DeadlineService.java index 83f1afb..9c45537 100644 --- a/src/main/java/ru/ulstu/deadline/service/DeadlineService.java +++ b/src/main/java/ru/ulstu/deadline/service/DeadlineService.java @@ -30,7 +30,7 @@ public class DeadlineService { Deadline updateDeadline = deadlineRepository.findOne(deadline.getId()); updateDeadline.setDate(deadline.getDate()); updateDeadline.setDescription(deadline.getDescription()); - updateDeadline.setExecutor(deadline.getExecutor()); + updateDeadline.setExecutors(deadline.getExecutors()); updateDeadline.setDone(deadline.getDone()); deadlineRepository.save(updateDeadline); return updateDeadline; @@ -41,7 +41,7 @@ public class DeadlineService { Deadline newDeadline = new Deadline(); newDeadline.setDate(deadline.getDate()); newDeadline.setDescription(deadline.getDescription()); - newDeadline.setExecutor(deadline.getExecutor()); + newDeadline.setExecutors(deadline.getExecutors()); newDeadline.setDone(deadline.getDone()); newDeadline = deadlineRepository.save(newDeadline); return newDeadline; diff --git a/src/main/java/ru/ulstu/project/model/Project.java b/src/main/java/ru/ulstu/project/model/Project.java index cf0de14..3d11583 100644 --- a/src/main/java/ru/ulstu/project/model/Project.java +++ b/src/main/java/ru/ulstu/project/model/Project.java @@ -27,7 +27,7 @@ import java.util.Set; public class Project extends BaseEntity implements UserContainer { public enum ProjectStatus { - TT("ТЗ"), + TECHNICAL_TASK("Техническое задание"), OPEN("Открыт"), IN_WORK("В работе"), CERTIFICATE_ISSUED("Оформление свидетельства"), @@ -49,7 +49,7 @@ public class Project extends BaseEntity implements UserContainer { private String title; @Enumerated(value = EnumType.STRING) - private ProjectStatus status = ProjectStatus.TT; + private ProjectStatus status = ProjectStatus.TECHNICAL_TASK; @NotNull private String description; @@ -69,8 +69,8 @@ public class Project extends BaseEntity implements UserContainer { @JoinColumn(name = "file_id") private FileData application; - @ManyToMany(fetch = FetchType.EAGER) - private Set executors = new HashSet<>(); + @ManyToMany(fetch = FetchType.LAZY) + private List executors = new ArrayList<>(); public String getTitle() { return title; @@ -128,16 +128,17 @@ public class Project extends BaseEntity implements UserContainer { this.application = application; } - public Set getExecutors() { + public List getExecutors() { return executors; } - public void setExecutors(Set executors) { + public void setExecutors(List executors) { this.executors = executors; } @Override public Set getUsers() { - return getExecutors(); + Set users = new HashSet(getExecutors()); + return users; } } diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index 0292f1f..f6ee831 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -6,9 +6,11 @@ import org.hibernate.validator.constraints.NotEmpty; import org.thymeleaf.util.StringUtils; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.grant.model.GrantDto; +import ru.ulstu.user.model.User; import ru.ulstu.user.model.UserDto; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -28,7 +30,7 @@ public class ProjectDto { private String applicationFileName; private List removedDeadlineIds = new ArrayList<>(); private Set executorIds; - private Set executors; + private List executors; private boolean hasAge; private boolean hasDegree; @@ -50,7 +52,7 @@ public class ProjectDto { @JsonProperty("repository") String repository, @JsonProperty("deadlines") List deadlines, @JsonProperty("executorIds") Set executorIds, - @JsonProperty("executors") Set executors, + @JsonProperty("executors") List executors, @JsonProperty("hasAge") boolean hasAge, @JsonProperty("hasDegree") boolean hasDegree) { this.id = id; @@ -69,6 +71,7 @@ public class ProjectDto { public ProjectDto(Project project) { + Set users = new HashSet(project.getExecutors()); this.id = project.getId(); this.title = project.getTitle(); this.status = project.getStatus(); @@ -77,7 +80,7 @@ public class ProjectDto { this.grant = project.getGrant() == null ? null : new GrantDto(project.getGrant()); this.repository = project.getRepository(); this.deadlines = project.getDeadlines(); - this.executorIds = convert(project.getExecutors(), user -> user.getId()); + this.executorIds = convert(users, user -> user.getId()); this.executors = convert(project.getExecutors(), UserDto::new); } @@ -161,11 +164,11 @@ public class ProjectDto { this.executorIds = executorIds; } - public Set getExecutors() { + public List getExecutors() { return executors; } - public void setExecutors(Set executors) { + public void setExecutors(List executors) { this.executors = executors; } diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index 2b9e82b..ab2fa91 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -5,7 +5,6 @@ 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.model.GrantDto; import ru.ulstu.grant.repository.GrantRepository; import ru.ulstu.project.model.Project; import ru.ulstu.project.model.ProjectDto; @@ -19,7 +18,7 @@ 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.TT; +import static ru.ulstu.project.model.Project.ProjectStatus.TECHNICAL_TASK; @Service public class ProjectService { @@ -89,7 +88,7 @@ public class ProjectService { private Project copyFromDto(Project project, ProjectDto projectDto) throws IOException { project.setDescription(projectDto.getDescription()); - project.setStatus(projectDto.getStatus() == null ? TT : projectDto.getStatus()); + project.setStatus(projectDto.getStatus() == null ? TECHNICAL_TASK : projectDto.getStatus()); project.setTitle(projectDto.getTitle()); if (projectDto.getGrant() != null && projectDto.getGrant().getId() != null) { project.setGrant(grantRepository.findOne(projectDto.getGrant().getId())); diff --git a/src/main/resources/db/changelog-20190528_000000-schema.xml b/src/main/resources/db/changelog-20190528_000000-schema.xml new file mode 100644 index 0000000..02ba642 --- /dev/null +++ b/src/main/resources/db/changelog-20190528_000000-schema.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/src/main/resources/db/changelog-20190528_000001-schema.xml b/src/main/resources/db/changelog-20190528_000001-schema.xml new file mode 100644 index 0000000..0605b48 --- /dev/null +++ b/src/main/resources/db/changelog-20190528_000001-schema.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index b4ce865..fbc1ec3 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -47,4 +47,6 @@ + + \ No newline at end of file diff --git a/src/main/resources/templates/projects/fragments/projectStatusFragment.html b/src/main/resources/templates/projects/fragments/projectStatusFragment.html index c56958e..bf0d3f6 100644 --- a/src/main/resources/templates/projects/fragments/projectStatusFragment.html +++ b/src/main/resources/templates/projects/fragments/projectStatusFragment.html @@ -6,7 +6,7 @@ -
+
From c25392337a3ababebf34e4c3404f277ab945b184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Tue, 28 May 2019 16:16:41 +0300 Subject: [PATCH 11/13] #98 project deadlines edited --- .../ru/ulstu/project/model/ProjectDto.java | 24 +------------------ .../ulstu/project/service/ProjectService.java | 8 +++---- ...l => changelog-20190528_000002-schema.xml} | 6 ++--- src/main/resources/db/changelog-master.xml | 2 +- .../resources/templates/projects/project.html | 8 +++---- 5 files changed, 13 insertions(+), 35 deletions(-) rename src/main/resources/db/{changelog-20190528_000001-schema.xml => changelog-20190528_000002-schema.xml} (87%) diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index f6ee831..affee4e 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -31,8 +31,6 @@ public class ProjectDto { private List removedDeadlineIds = new ArrayList<>(); private Set executorIds; private List executors; - private boolean hasAge; - private boolean hasDegree; private final static int MAX_EXECUTORS_LENGTH = 40; @@ -52,9 +50,7 @@ public class ProjectDto { @JsonProperty("repository") String repository, @JsonProperty("deadlines") List deadlines, @JsonProperty("executorIds") Set executorIds, - @JsonProperty("executors") List executors, - @JsonProperty("hasAge") boolean hasAge, - @JsonProperty("hasDegree") boolean hasDegree) { + @JsonProperty("executors") List executors) { this.id = id; this.title = title; this.status = status; @@ -65,8 +61,6 @@ public class ProjectDto { this.applicationFileName = null; this.executorIds = executorIds; this.executors = executors; - this.hasAge = hasAge; - this.hasDegree = hasDegree; } @@ -172,22 +166,6 @@ public class ProjectDto { this.executors = executors; } - public boolean isHasAge() { - return hasAge; - } - - public void setHasAge(boolean hasAge) { - this.hasAge = hasAge; - } - - public boolean isHasDegree() { - return hasDegree; - } - - public void setHasDegree(boolean hasDegree) { - this.hasDegree = hasDegree; - } - public String getExecutorsString() { return StringUtils.abbreviate(executors .stream() diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index ab2fa91..fe8813c 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -110,8 +110,8 @@ public class ProjectService { } public void removeDeadline(ProjectDto projectDto, Integer deadlineId) { - if (projectDto.getDeadlines().get(deadlineId).getId() != null) { - projectDto.getRemovedDeadlineIds().add(projectDto.getDeadlines().get(deadlineId).getId()); + if (deadlineId != null) { + projectDto.getRemovedDeadlineIds().add(deadlineId); } projectDto.getDeadlines().remove((int) deadlineId); } @@ -121,8 +121,8 @@ public class ProjectService { } public List getProjectExecutors(ProjectDto projectDto) { - List filteredUsers = userService.filterByAgeAndDegree(projectDto.isHasAge(), projectDto.isHasDegree()); - return filteredUsers; + List users = userService.findAll(); + return users; } } diff --git a/src/main/resources/db/changelog-20190528_000001-schema.xml b/src/main/resources/db/changelog-20190528_000002-schema.xml similarity index 87% rename from src/main/resources/db/changelog-20190528_000001-schema.xml rename to src/main/resources/db/changelog-20190528_000002-schema.xml index 0605b48..7df707c 100644 --- a/src/main/resources/db/changelog-20190528_000001-schema.xml +++ b/src/main/resources/db/changelog-20190528_000002-schema.xml @@ -2,15 +2,15 @@ - + - + - diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index fbc1ec3..c8a6e63 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -48,5 +48,5 @@ - + \ No newline at end of file diff --git a/src/main/resources/templates/projects/project.html b/src/main/resources/templates/projects/project.html index 304fed0..2c4a67b 100644 --- a/src/main/resources/templates/projects/project.html +++ b/src/main/resources/templates/projects/project.html @@ -92,11 +92,11 @@
-
From 8ffafd669328c16d759e37d91fb04cfe32cb07ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Tue, 28 May 2019 16:46:12 +0300 Subject: [PATCH 12/13] #98 deadline imports edited --- src/main/java/ru/ulstu/deadline/model/Deadline.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/deadline/model/Deadline.java b/src/main/java/ru/ulstu/deadline/model/Deadline.java index 97b6441..d9f2373 100644 --- a/src/main/java/ru/ulstu/deadline/model/Deadline.java +++ b/src/main/java/ru/ulstu/deadline/model/Deadline.java @@ -6,7 +6,11 @@ import org.springframework.format.annotation.DateTimeFormat; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.user.model.User; -import javax.persistence.*; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.OneToMany; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; import java.util.Date; import java.util.List; import java.util.Objects; @@ -20,7 +24,7 @@ public class Deadline extends BaseEntity { @DateTimeFormat(pattern = "yyyy-MM-dd") private Date date; - @OneToMany(targetEntity=User.class, fetch=FetchType.EAGER) + @OneToMany(targetEntity=User.class, fetch= FetchType.EAGER) private List executors; private Boolean done; From 77ce908d584caf5d4346c0929b22744037319c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Tue, 28 May 2019 16:55:08 +0300 Subject: [PATCH 13/13] #98 deadline edited --- src/main/java/ru/ulstu/deadline/model/Deadline.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ru/ulstu/deadline/model/Deadline.java b/src/main/java/ru/ulstu/deadline/model/Deadline.java index d9f2373..17287a8 100644 --- a/src/main/java/ru/ulstu/deadline/model/Deadline.java +++ b/src/main/java/ru/ulstu/deadline/model/Deadline.java @@ -24,7 +24,7 @@ public class Deadline extends BaseEntity { @DateTimeFormat(pattern = "yyyy-MM-dd") private Date date; - @OneToMany(targetEntity=User.class, fetch= FetchType.EAGER) + @OneToMany(targetEntity = User.class, fetch = FetchType.EAGER) private List executors; private Boolean done;