Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -214,22 +214,10 @@ public String processFile(
CustomMessage customMessage,
@AuthenticationPrincipal UserPrincipal principal
) {
tenantService.processFile(id, customMessage, principal);

// Si returnToHome est demandé, retourner à l'accueil
tenantService.processFile(id, customMessage, principal);
if (returnToHome != null && returnToHome.equals("true")) {
return REDIRECT_BO;
}

// Trouver le prochain tenant du même dossier COUPLE en statut TO_PROCESS
// pour router les locataires d'un meme dossier COUPLE vers le même opérateur
Optional<Tenant> nextTenantInCouple = tenantService.findNextTenantInCouple(id);
if (nextTenantInCouple.isPresent()) {
// Rediriger vers le prochain locataire du dossier
return tenantService.redirectToApplication(principal, nextTenantInCouple.get().getId());
}

// Sinon, continuer avec le comportement normal (prochain dossier disponible)
return tenantService.redirectToApplication(principal, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,33 +883,5 @@ public Tenant deleteGuarantor(Long guarantorId, User operator) {
updateTenantStatus(tenant, operator);
return tenant;
}

/**
* Trouve le prochain tenant de la meme dossier COUPLE (apartment sharing) en statut TO_PROCESS
* pour router les locataires d'un meme dossier COUPLE vers le même opérateur
*/
public Optional<Tenant> findNextTenantInCouple(Long currentTenantId) {
Tenant currentTenant = find(currentTenantId);
if (currentTenant == null) {
return Optional.empty();
}

ApartmentSharing apartmentSharing = currentTenant.getApartmentSharing();
if (apartmentSharing == null) {
return Optional.empty();
}

if (apartmentSharing.getApplicationType() != ApplicationType.COUPLE) {
return Optional.empty();
}

List<Tenant> allTenants = tenantRepository.findAllByApartmentSharingId(
currentTenant.getApartmentSharing().getId());

return allTenants.stream()
.filter(tenant -> !tenant.getId().equals(currentTenantId))
.filter(tenant -> tenant.getStatus() == TenantFileStatus.TO_PROCESS)
.findFirst();
}
}

This file was deleted.