Skip to content

Commit

Permalink
fix #59
Browse files Browse the repository at this point in the history
  • Loading branch information
vzwingma committed Oct 12, 2024
1 parent ced5f62 commit 2b7ab73
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ public Uni<BudgetMensuel> createOperationsIntercomptes(String idBudget, final Li
final String libelleOperation = ligneOperation.getLibelle();
String idBudgetDestination = BudgetDataUtils.getBudgetId(idCompteDestination, BudgetDataUtils.getMoisFromBudgetId(idBudget), BudgetDataUtils.getAnneeFromBudgetId(idBudget));
String idCompteSource = BudgetDataUtils.getCompteFromBudgetId(idBudget);

Month moisFromBudgetId = BudgetDataUtils.getMoisFromBudgetId(idBudget);
Integer anneeFromBudgetId = BudgetDataUtils.getAnneeFromBudgetId(idBudget);
LOGGER.info("Ajout d'un transfert intercompte de {} vers {} ({}) > {} ", idBudget, idBudgetDestination, idCompteDestination, ligneOperation);

/*
Expand Down Expand Up @@ -511,18 +512,14 @@ public Uni<BudgetMensuel> createOperationsIntercomptes(String idBudget, final Li
/*
* Opération sur Compte cible
*/

Uni<BudgetMensuel> budgetCible =
Uni.combine().all().unis(
getBudgetAndCompteActif(idBudgetDestination).map(Tuple2::getItem1),
this.comptesService.getCompteById(idCompteSource))
.asTuple()
Uni<BudgetMensuel> budgetCible = this.comptesService.getCompteById(idCompteDestination)
.onItem().ifNotNull()
.transformToUni(compteDestination -> chargerBudgetMensuelSurCompteActif(compteDestination, moisFromBudgetId, anneeFromBudgetId))
.invoke(tuple -> {
BusinessTraceContext.get().put(BusinessTraceContextKeyEnum.BUDGET, idBudgetDestination).put(BusinessTraceContextKeyEnum.COMPTE, idCompteSource);
String libelleOperationCible = "[depuis " + tuple.getItem2().getId() + "] " + libelleOperation;
this.operationsAppProvider.addOperationIntercompte(tuple.getItem1().getListeOperations(), ligneOperation, libelleOperationCible, auteur);
String libelleOperationCible = "[depuis " + idCompteSource+ "] " + libelleOperation;
this.operationsAppProvider.addOperationIntercompte(tuple.getListeOperations(), ligneOperation, libelleOperationCible, auteur);
})
.map(Tuple2::getItem1)
.onItem().ifNotNull()
.invoke(this::recalculSoldes)
// Sauvegarde du budget
Expand Down

0 comments on commit 2b7ab73

Please sign in to comment.