From 4f47b1beb6b1627c396593a1bde9bc4322b46ca7 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Mon, 4 Mar 2019 10:28:46 +0400 Subject: [PATCH] fix code --- .../ru/ulstu/grant/service/GrantService.java | 4 +-- .../paper/controller/PaperController.java | 4 +-- .../paper/controller/PaperRestController.java | 2 +- .../ru/ulstu/project/model/ProjectDto.java | 25 ++++++++++--------- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/main/java/ru/ulstu/grant/service/GrantService.java b/src/main/java/ru/ulstu/grant/service/GrantService.java index 31d0a04..d5beec3 100644 --- a/src/main/java/ru/ulstu/grant/service/GrantService.java +++ b/src/main/java/ru/ulstu/grant/service/GrantService.java @@ -107,11 +107,11 @@ public class GrantService { } @Transactional - public Grant create(String title, Project project_id, Date deadlineDate) { + public Grant create(String title, Project projectId, Date deadlineDate) { Grant grant = new Grant(); grant.setTitle(title); grant.setComment("Комментарий к гранту 1"); - grant.setProject(project_id); + grant.setProject(projectId); grant.setStatus(APPLICATION); grant.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн")); grant = grantRepository.save(grant); diff --git a/src/main/java/ru/ulstu/paper/controller/PaperController.java b/src/main/java/ru/ulstu/paper/controller/PaperController.java index 6f475bf..cb34a8a 100644 --- a/src/main/java/ru/ulstu/paper/controller/PaperController.java +++ b/src/main/java/ru/ulstu/paper/controller/PaperController.java @@ -65,7 +65,7 @@ public class PaperController { public String save(@Valid PaperDto paperDto, Errors errors) throws IOException { filterEmptyDeadlines(paperDto); if (paperDto.getDeadlines().isEmpty()) { - errors.rejectValue("deadlines", "errorCode","Не может быть пустым"); + errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); } if (errors.hasErrors()) { return "/papers/paper"; @@ -103,7 +103,7 @@ public class PaperController { @ModelAttribute("allYears") public List getAllYears() { List years = new ArrayList<>(); - for (int i = Calendar.getInstance().get(Calendar.YEAR); i > 2010; i-- ) { + for (int i = Calendar.getInstance().get(Calendar.YEAR); i > 2010; i--) { years.add(i); } return years; diff --git a/src/main/java/ru/ulstu/paper/controller/PaperRestController.java b/src/main/java/ru/ulstu/paper/controller/PaperRestController.java index 66efcc7..5dd6b9f 100644 --- a/src/main/java/ru/ulstu/paper/controller/PaperRestController.java +++ b/src/main/java/ru/ulstu/paper/controller/PaperRestController.java @@ -37,7 +37,7 @@ public class PaperRestController { } @GetMapping("/{paper-id}") - public Response getPaper(@PathVariable("paper-id") Integer paperId){ + public Response getPaper(@PathVariable("paper-id") Integer paperId) { return new Response(paperService.findById(paperId)); } diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index 7c2664e..fdce26b 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.deadline.model.DeadlineDto; -import ru.ulstu.project.model.Project; import java.util.ArrayList; import java.util.List; @@ -12,14 +11,15 @@ import java.util.List; import static ru.ulstu.core.util.StreamApiUtils.convert; public class ProjectDto { - private Integer id; + private Integer id; @NotEmpty - private String title; + private String title; - private List deadlines = new ArrayList<>(); + private List deadlines = new ArrayList<>(); - public ProjectDto() {} + public ProjectDto() { + } public ProjectDto(String title) { this.title = title; @@ -45,22 +45,23 @@ public class ProjectDto { return id; } - public String getTitle() { - return title; - } - public void setId(Integer id) { this.id = id; } + public String getTitle() { + return title; + } + public void setTitle(String title) { this.title = title; } - public void setDeadlines(List deadlines) { - this.deadlines = deadlines; - } public List getDeadlines() { return deadlines; } + + public void setDeadlines(List deadlines) { + this.deadlines = deadlines; + } }