|
|
@ -15,6 +15,7 @@ import ru.ulstu.paper.service.PaperService;
|
|
|
|
import ru.ulstu.project.model.Project;
|
|
|
|
import ru.ulstu.project.model.Project;
|
|
|
|
import ru.ulstu.project.model.ProjectDto;
|
|
|
|
import ru.ulstu.project.model.ProjectDto;
|
|
|
|
import ru.ulstu.project.service.ProjectService;
|
|
|
|
import ru.ulstu.project.service.ProjectService;
|
|
|
|
|
|
|
|
import ru.ulstu.timeline.service.EventService;
|
|
|
|
import ru.ulstu.user.model.User;
|
|
|
|
import ru.ulstu.user.model.User;
|
|
|
|
import ru.ulstu.user.service.UserService;
|
|
|
|
import ru.ulstu.user.service.UserService;
|
|
|
|
|
|
|
|
|
|
|
@ -39,19 +40,22 @@ public class GrantService {
|
|
|
|
private final FileService fileService;
|
|
|
|
private final FileService fileService;
|
|
|
|
private final UserService userService;
|
|
|
|
private final UserService userService;
|
|
|
|
private final PaperService paperService;
|
|
|
|
private final PaperService paperService;
|
|
|
|
|
|
|
|
private final EventService eventService;
|
|
|
|
|
|
|
|
|
|
|
|
public GrantService(GrantRepository grantRepository,
|
|
|
|
public GrantService(GrantRepository grantRepository,
|
|
|
|
FileService fileService,
|
|
|
|
FileService fileService,
|
|
|
|
DeadlineService deadlineService,
|
|
|
|
DeadlineService deadlineService,
|
|
|
|
ProjectService projectService,
|
|
|
|
ProjectService projectService,
|
|
|
|
UserService userService,
|
|
|
|
UserService userService,
|
|
|
|
PaperService paperService) {
|
|
|
|
PaperService paperService,
|
|
|
|
|
|
|
|
EventService eventService) {
|
|
|
|
this.grantRepository = grantRepository;
|
|
|
|
this.grantRepository = grantRepository;
|
|
|
|
this.fileService = fileService;
|
|
|
|
this.fileService = fileService;
|
|
|
|
this.deadlineService = deadlineService;
|
|
|
|
this.deadlineService = deadlineService;
|
|
|
|
this.projectService = projectService;
|
|
|
|
this.projectService = projectService;
|
|
|
|
this.userService = userService;
|
|
|
|
this.userService = userService;
|
|
|
|
this.paperService = paperService;
|
|
|
|
this.paperService = paperService;
|
|
|
|
|
|
|
|
this.eventService = eventService;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Grant> findAll() {
|
|
|
|
public List<Grant> findAll() {
|
|
|
@ -72,6 +76,7 @@ public class GrantService {
|
|
|
|
public Integer create(GrantDto grantDto) throws IOException {
|
|
|
|
public Integer create(GrantDto grantDto) throws IOException {
|
|
|
|
Grant newGrant = copyFromDto(new Grant(), grantDto);
|
|
|
|
Grant newGrant = copyFromDto(new Grant(), grantDto);
|
|
|
|
newGrant = grantRepository.save(newGrant);
|
|
|
|
newGrant = grantRepository.save(newGrant);
|
|
|
|
|
|
|
|
eventService.createFromGrant(newGrant);
|
|
|
|
return newGrant.getId();
|
|
|
|
return newGrant.getId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -115,6 +120,7 @@ public class GrantService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
grantDto.getRemovedDeadlineIds().forEach(deadlineService::remove);
|
|
|
|
grantDto.getRemovedDeadlineIds().forEach(deadlineService::remove);
|
|
|
|
grantRepository.save(copyFromDto(grant, grantDto));
|
|
|
|
grantRepository.save(copyFromDto(grant, grantDto));
|
|
|
|
|
|
|
|
eventService.updateGrantDeadlines(grant);
|
|
|
|
return grant.getId();
|
|
|
|
return grant.getId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -140,6 +146,9 @@ public class GrantService {
|
|
|
|
grant.setLeader(user);
|
|
|
|
grant.setLeader(user);
|
|
|
|
grant.getPapers().add(paper);
|
|
|
|
grant.getPapers().add(paper);
|
|
|
|
grant = grantRepository.save(grant);
|
|
|
|
grant = grantRepository.save(grant);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eventService.createFromGrant(grant);
|
|
|
|
|
|
|
|
|
|
|
|
return grant;
|
|
|
|
return grant;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|