@@ -76,9 +76,15 @@ public class ViolationService {
|
|||||||
Sort sort = Sort.by(sortDirection.equalsIgnoreCase("desc") ? Sort.Direction.DESC : Sort.Direction.ASC,
|
Sort sort = Sort.by(sortDirection.equalsIgnoreCase("desc") ? Sort.Direction.DESC : Sort.Direction.ASC,
|
||||||
"createdDate");
|
"createdDate");
|
||||||
Pageable pageable = PageRequest.of(page, size, sort);
|
Pageable pageable = PageRequest.of(page, size, sort);
|
||||||
|
Page<Violation> violations;
|
||||||
|
|
||||||
Page<Violation> violations = violationRepository.findByFileEntityInAndStatusNotAndCreatedDateBetween(
|
if (start == null || end == null) {
|
||||||
userFiles, ViolationStatus.NOT_OWNER_FILE.name(), start, end, pageable);
|
violations = violationRepository.findByFileEntityInAndStatusNot( userFiles,
|
||||||
|
ViolationStatus.NOT_OWNER_FILE.name(),pageable);
|
||||||
|
} else {
|
||||||
|
violations = violationRepository.findByFileEntityInAndStatusNotAndCreatedDateBetween(
|
||||||
|
userFiles, ViolationStatus.NOT_OWNER_FILE.name(), start, end, pageable);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, List<Violation>> violationsByFileId = violations.getContent().stream()
|
Map<String, List<Violation>> violationsByFileId = violations.getContent().stream()
|
||||||
.collect(Collectors.groupingBy(v -> v.getFileEntity().getId()));
|
.collect(Collectors.groupingBy(v -> v.getFileEntity().getId()));
|
||||||
|
|||||||
Reference in New Issue
Block a user