#116 add removeDeadline method
This commit is contained in:
parent
7c5a0826c5
commit
4fa0c14ae6
@ -97,6 +97,14 @@ public class GrantController {
|
||||
return GRANT_PAGE;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/grant", params = "removeDeadline")
|
||||
public String removeDeadline(GrantDto grantDto,
|
||||
@RequestParam(value = "removeDeadline") Integer deadlineId) {
|
||||
grantService.removeDeadline(grantDto, deadlineId);
|
||||
return GRANT_PAGE;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/grant", params = "createProject")
|
||||
public String createProject(@Valid GrantDto grantDto, Errors errors) throws IOException {
|
||||
if (errors.hasErrors()) {
|
||||
|
@ -109,6 +109,7 @@ public class GrantService {
|
||||
if (grantDto.getApplicationFileName() != null && grant.getApplication() != null) {
|
||||
fileService.deleteFile(grant.getApplication());
|
||||
}
|
||||
grantDto.getRemovedDeadlineIds().forEach(deadlineService::remove);
|
||||
grantRepository.save(copyFromDto(grant, grantDto));
|
||||
return grant.getId();
|
||||
}
|
||||
@ -184,4 +185,12 @@ public class GrantService {
|
||||
grantDto.getPapers().clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeDeadline(GrantDto grantDto, Integer deadlineId) {
|
||||
if (grantDto.getDeadlines().get(deadlineId).getId() != null) {
|
||||
grantDto.getRemovedDeadlineIds().add(grantDto.getDeadlines().get(deadlineId).getId());
|
||||
}
|
||||
grantDto.getDeadlines().remove((int) deadlineId);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user