|
@@ -388,21 +388,26 @@ public class InvalidRecordService extends ServiceImpl<InvalidRecordMapper, Inval
|
|
|
List<ReportAffair> reportAffairs = reportAffairService.list(queryWrapper);
|
|
|
if (!reportAffairs.isEmpty()) {
|
|
|
List<Integer> reportAffairIds = reportAffairs.stream()
|
|
|
- .sorted(Comparator.comparing(ReportAffair::getOccurredTime).reversed())
|
|
|
- .map(ReportAffair::getId).collect(Collectors.toList());
|
|
|
+ .sorted(Comparator.comparing(ReportAffair::getOccurredTime, Comparator.nullsLast(Comparator.reverseOrder())))
|
|
|
+ .map(ReportAffair::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<Integer, Date> reportAffairTimeMap = reportAffairs.stream()
|
|
|
+ .collect(Collectors.toMap(ReportAffair::getId, ReportAffair::getOccurredTime));
|
|
|
+
|
|
|
LambdaQueryWrapper<AssoReportAffairFile> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper1.in(AssoReportAffairFile::getReportAffairId, reportAffairIds);
|
|
|
List<AssoReportAffairFile> assoReportAffairFiles = assoReportAffairFileService.list(queryWrapper1);
|
|
|
+
|
|
|
if (!assoReportAffairFiles.isEmpty()) {
|
|
|
- fileGuids = assoReportAffairFiles.stream()
|
|
|
- .sorted(Comparator.comparing(file -> {
|
|
|
- for (ReportAffair reportAffair : reportAffairs) {
|
|
|
- if (reportAffair.getId() == file.getReportAffairId()) {
|
|
|
- return reportAffair.getOccurredTime();
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }))
|
|
|
+
|
|
|
+ List<AssoReportAffairFile> filteredFiles = assoReportAffairFiles.stream()
|
|
|
+ .filter(assoFile -> reportAffairIds.contains(assoFile.getReportAffairId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ fileGuids = filteredFiles.stream()
|
|
|
+ .sorted(Comparator.comparing(file -> reportAffairTimeMap.getOrDefault(file.getReportAffairId(), null),
|
|
|
+ Comparator.nullsLast(Comparator.naturalOrder())))
|
|
|
.map(AssoReportAffairFile::getFileGuid)
|
|
|
.collect(Collectors.toList());
|
|
|
}
|