fix code
This commit is contained in:
parent
e2c12d9fb2
commit
4f47b1beb6
@ -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);
|
||||
|
@ -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<Integer> getAllYears() {
|
||||
List<Integer> 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;
|
||||
|
@ -37,7 +37,7 @@ public class PaperRestController {
|
||||
}
|
||||
|
||||
@GetMapping("/{paper-id}")
|
||||
public Response<PaperDto> getPaper(@PathVariable("paper-id") Integer paperId){
|
||||
public Response<PaperDto> getPaper(@PathVariable("paper-id") Integer paperId) {
|
||||
return new Response(paperService.findById(paperId));
|
||||
}
|
||||
|
||||
|
@ -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<DeadlineDto> deadlines = new ArrayList<>();
|
||||
private List<DeadlineDto> 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<DeadlineDto> deadlines) {
|
||||
this.deadlines = deadlines;
|
||||
}
|
||||
public List<DeadlineDto> getDeadlines() {
|
||||
return deadlines;
|
||||
}
|
||||
|
||||
public void setDeadlines(List<DeadlineDto> deadlines) {
|
||||
this.deadlines = deadlines;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user