|
|
|
@ -18,11 +18,12 @@ import ru.ulstu.user.model.User;
|
|
|
|
|
import ru.ulstu.user.service.UserService;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static java.util.stream.Collectors.toList;
|
|
|
|
|
import static org.springframework.util.ObjectUtils.isEmpty;
|
|
|
|
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
|
|
|
|
import static ru.ulstu.grant.model.Grant.GrantStatus.APPLICATION;
|
|
|
|
@ -156,8 +157,15 @@ public class GrantService {
|
|
|
|
|
filteredUsers = filteredUsers
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(getCompletedGrantLeaders()::contains)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
.collect(toList());
|
|
|
|
|
}
|
|
|
|
|
if (grantDto.isHasBAKPapers()) {
|
|
|
|
|
filteredUsers = filteredUsers
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(getCompletedBAKPapersAuthors()::contains)
|
|
|
|
|
.collect(toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return filteredUsers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -165,7 +173,7 @@ public class GrantService {
|
|
|
|
|
return grantRepository.findByStatus(Grant.GrantStatus.COMPLETED)
|
|
|
|
|
.stream()
|
|
|
|
|
.map(Grant::getLeader)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
.collect(toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Paper> getGrantPapers(List<Integer> paperIds) {
|
|
|
|
@ -193,4 +201,22 @@ public class GrantService {
|
|
|
|
|
grantDto.getDeadlines().remove((int) deadlineId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<User> getCompletedBAKPapersAuthors() {
|
|
|
|
|
List<Paper> papers = paperService.findCompletedVAKPapers()
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(paper -> paper.getAuthors() != null)
|
|
|
|
|
.collect(toList());
|
|
|
|
|
|
|
|
|
|
List<User> users = new ArrayList<>();
|
|
|
|
|
for (Paper p : papers) {
|
|
|
|
|
p.getAuthors()
|
|
|
|
|
.stream()
|
|
|
|
|
.forEach(users::add);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return users
|
|
|
|
|
.stream()
|
|
|
|
|
.distinct()
|
|
|
|
|
.collect(toList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|