RED-3014: Sort soft deleted files and soft deleted dossier responses by soft deleted date / time descending

This commit is contained in:
aoezyetimoglu 2022-01-11 09:22:58 +01:00
parent b147779a4c
commit 1f66ef0efb
2 changed files with 8 additions and 2 deletions

View File

@ -127,10 +127,13 @@ public class DossierController implements DossierResource {
@Transactional
public List<Dossier> getSoftDeletedDossiers() {
return convert(dossierService.getAllDossiers()
var softDeletedDossiers = convert(dossierService.getAllDossiers()
.stream()
.filter(p -> p.getStatus().equals(DossierStatus.DELETED) && p.getHardDeletedTime() == null)
.collect(Collectors.toList()), Dossier.class, new DossierMapper());
softDeletedDossiers.sort((dossier1, dossier2) -> dossier2.getSoftDeletedTime().compareTo(dossier1.getSoftDeletedTime()));
return softDeletedDossiers;
}

View File

@ -61,10 +61,13 @@ public class FileStatusController implements StatusResource {
@Override
public List<FileModel> getSoftDeletedDossierStatus(@PathVariable(DOSSIER_ID_PARAM) String dossierId) {
return reanalysisRequiredStatusService.enhanceFileStatusWithAnalysisRequirements(convert(fileStatusService.getDossierStatus(dossierId)
var softDeletedFiles = reanalysisRequiredStatusService.enhanceFileStatusWithAnalysisRequirements(convert(fileStatusService.getDossierStatus(dossierId)
.stream()
.filter(f -> f.getProcessingStatus().equals(ProcessingStatus.DELETED) && f.getHardDeletedTime() == null)
.collect(Collectors.toList()), FileModel.class, new FileModelMapper()));
softDeletedFiles.sort((f1, f2) -> f2.getDeleted().compareTo(f1.getDeleted()));
return softDeletedFiles;
}