Resolve "Генерация периодических задач по тегам" #207
@ -13,7 +13,7 @@ import ru.ulstu.deadline.model.Deadline;
|
|||||||
import ru.ulstu.grant.model.Grant;
|
import ru.ulstu.grant.model.Grant;
|
||||||
import ru.ulstu.grant.model.GrantDto;
|
import ru.ulstu.grant.model.GrantDto;
|
||||||
import ru.ulstu.grant.service.GrantService;
|
import ru.ulstu.grant.service.GrantService;
|
||||||
import ru.ulstu.paper.model.Paper;
|
import ru.ulstu.paper.model.PaperDto;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
@ -104,7 +104,6 @@ public class GrantController {
|
|||||||
return GRANT_PAGE;
|
return GRANT_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(value = "/grant", params = "createProject")
|
@PostMapping(value = "/grant", params = "createProject")
|
||||||
public String createProject(@Valid GrantDto grantDto, Errors errors) throws IOException {
|
public String createProject(@Valid GrantDto grantDto, Errors errors) throws IOException {
|
||||||
if (errors.hasErrors()) {
|
if (errors.hasErrors()) {
|
||||||
@ -131,7 +130,7 @@ public class GrantController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ModelAttribute("allPapers")
|
@ModelAttribute("allPapers")
|
||||||
public List<Paper> getAllPapers() {
|
public List<PaperDto> getAllPapers() {
|
||||||
return grantService.getAllUncompletedPapers();
|
return grantService.getAllUncompletedPapers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ public class Grant extends BaseEntity implements UserContainer {
|
|||||||
@Fetch(FetchMode.SUBSELECT)
|
@Fetch(FetchMode.SUBSELECT)
|
||||||
private List<FileData> files = new ArrayList<>();
|
private List<FileData> files = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
@ManyToOne(cascade = CascadeType.ALL)
|
@ManyToOne(cascade = CascadeType.ALL)
|
||||||
@JoinColumn(name = "project_id")
|
@JoinColumn(name = "project_id")
|
||||||
private Project project;
|
private Project project;
|
||||||
|
@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.hibernate.validator.constraints.NotEmpty;
|
import org.hibernate.validator.constraints.NotEmpty;
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.file.model.FileDataDto;
|
import ru.ulstu.file.model.FileDataDto;
|
||||||
import ru.ulstu.paper.model.Paper;
|
import ru.ulstu.paper.model.PaperDto;
|
||||||
import ru.ulstu.project.model.ProjectDto;
|
import ru.ulstu.project.model.ProjectDto;
|
||||||
import ru.ulstu.user.model.UserDto;
|
import ru.ulstu.user.model.UserDto;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class GrantDto {
|
|||||||
private boolean hasBAKPapers;
|
private boolean hasBAKPapers;
|
||||||
private boolean hasScopusPapers;
|
private boolean hasScopusPapers;
|
||||||
private List<Integer> paperIds = new ArrayList<>();
|
private List<Integer> paperIds = new ArrayList<>();
|
||||||
private List<Paper> papers = new ArrayList<>();
|
private List<PaperDto> papers = new ArrayList<>();
|
||||||
private List<Integer> removedDeadlineIds = new ArrayList<>();
|
private List<Integer> removedDeadlineIds = new ArrayList<>();
|
||||||
|
|
||||||
public GrantDto() {
|
public GrantDto() {
|
||||||
@ -54,12 +54,12 @@ public class GrantDto {
|
|||||||
@JsonProperty("project") ProjectDto project,
|
@JsonProperty("project") ProjectDto project,
|
||||||
@JsonProperty("authorIds") Set<Integer> authorIds,
|
@JsonProperty("authorIds") Set<Integer> authorIds,
|
||||||
@JsonProperty("authors") Set<UserDto> authors,
|
@JsonProperty("authors") Set<UserDto> authors,
|
||||||
@JsonProperty("leader") Integer leaderId,
|
@JsonProperty("leaderId") Integer leaderId,
|
||||||
@JsonProperty("wasLeader") boolean wasLeader,
|
@JsonProperty("wasLeader") boolean wasLeader,
|
||||||
@JsonProperty("hasAge") boolean hasAge,
|
@JsonProperty("hasAge") boolean hasAge,
|
||||||
@JsonProperty("hasDegree") boolean hasDegree,
|
@JsonProperty("hasDegree") boolean hasDegree,
|
||||||
@JsonProperty("paperIds") List<Integer> paperIds,
|
@JsonProperty("paperIds") List<Integer> paperIds,
|
||||||
@JsonProperty("papers") List<Paper> papers) {
|
@JsonProperty("papers") List<PaperDto> papers) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@ -92,7 +92,7 @@ public class GrantDto {
|
|||||||
this.hasAge = false;
|
this.hasAge = false;
|
||||||
this.hasDegree = false;
|
this.hasDegree = false;
|
||||||
this.paperIds = convert(grant.getPapers(), paper -> paper.getId());
|
this.paperIds = convert(grant.getPapers(), paper -> paper.getId());
|
||||||
this.papers = grant.getPapers();
|
this.papers = convert(grant.getPapers(), PaperDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@ -214,11 +214,11 @@ public class GrantDto {
|
|||||||
this.paperIds = paperIds;
|
this.paperIds = paperIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Paper> getPapers() {
|
public List<PaperDto> getPapers() {
|
||||||
return papers;
|
return papers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPapers(List<Paper> papers) {
|
public void setPapers(List<PaperDto> papers) {
|
||||||
this.papers = papers;
|
this.papers = papers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,12 +248,12 @@ public class PaperService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Paper> findAllNotCompleted() {
|
public List<PaperDto> findAllNotCompleted() {
|
||||||
return paperRepository.findByStatusNot(COMPLETED);
|
return convert(paperRepository.findByStatusNot(COMPLETED), PaperDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Paper> findAllSelect(List<Integer> paperIds) {
|
public List<PaperDto> findAllSelect(List<Integer> paperIds) {
|
||||||
return sortPapers(paperRepository.findAllByIdIn(paperIds));
|
return convert(paperRepository.findAllByIdIn(paperIds), PaperDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<User> getPaperAuthors() {
|
public List<User> getPaperAuthors() {
|
||||||
|
Loading…
Reference in New Issue
Block a user