From 302967e6459800db905bcc325b7e27fdc38e93d2 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 28 Oct 2025 21:35:30 +0100 Subject: [PATCH] Enhanced error handling and route saving mechanism, improved UI modal behavior: - **Frontend**: Updated `CalculationAssistant.vue` modal to disable backdrop closing via `:close-on-backdrop="false"`. - **Backend**: - Adjusted error message processing in `CalculationExecutionService` to handle potential `null` values gracefully. - Improved route saving in `DestinationService` by correcting source node logic and refining `RouteIds` assignments. --- src/frontend/src/pages/CalculationAssistant.vue | 2 +- .../de/avatic/lcc/service/access/DestinationService.java | 4 ++-- .../calculation/execution/CalculationExecutionService.java | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/pages/CalculationAssistant.vue b/src/frontend/src/pages/CalculationAssistant.vue index 2639a6d..682304a 100644 --- a/src/frontend/src/pages/CalculationAssistant.vue +++ b/src/frontend/src/pages/CalculationAssistant.vue @@ -14,7 +14,7 @@ - +

Drop part numbers here

diff --git a/src/main/java/de/avatic/lcc/service/access/DestinationService.java b/src/main/java/de/avatic/lcc/service/access/DestinationService.java index 658a04d..60f10f3 100644 --- a/src/main/java/de/avatic/lcc/service/access/DestinationService.java +++ b/src/main/java/de/avatic/lcc/service/access/DestinationService.java @@ -106,7 +106,7 @@ public class DestinationService { Node source = premise.getSupplierNodeId() == null ? userNodeRepository.getById(premise.getUserSupplierNodeId()).orElseThrow() : nodeRepository.getById(premise.getSupplierNodeId()).orElseThrow(); //noinspection SpringTransactionalMethodCallsInspection - saveRoute(routes.get(new RouteIds(premise.getSupplierNodeId(), destinationNodeId, premise.getSupplierNodeId() == null)), destination.getId()); + saveRoute(routes.get(new RouteIds(source.getId(), destinationNodeId, premise.getSupplierNodeId() == null)), destination.getId()); destinations.add(destination); } @@ -180,7 +180,7 @@ public class DestinationService { for(var premise : premisses) { for(var destinationId : destinationIds) { boolean isUserSupplierNode = (premise.getSupplierNodeId() == null); - var ids = new RouteIds(premise.getSupplierNodeId(), destinationId, isUserSupplierNode); + var ids = new RouteIds(isUserSupplierNode ? premise.getUserSupplierNodeId() : premise.getSupplierNodeId(), destinationId, isUserSupplierNode); if(routes.containsKey(ids)) continue; if(!nodes.containsKey(destinationId)) { diff --git a/src/main/java/de/avatic/lcc/service/calculation/execution/CalculationExecutionService.java b/src/main/java/de/avatic/lcc/service/calculation/execution/CalculationExecutionService.java index 85e085f..c0dab67 100644 --- a/src/main/java/de/avatic/lcc/service/calculation/execution/CalculationExecutionService.java +++ b/src/main/java/de/avatic/lcc/service/calculation/execution/CalculationExecutionService.java @@ -100,7 +100,10 @@ public class CalculationExecutionService { error.setType(SysErrorType.CALCULATION); error.setCode(e.getClass().getSimpleName().substring(0, Math.min(e.getClass().getSimpleName().length(), 253))); error.setTitle("Calculation operation execution " + calculationId + " failed"); - error.setMessage(e.getMessage().substring(0, Math.min(e.getMessage().length(), 1000))); + + var msg = e.getMessage() == null ? "" : e.getMessage(); + + error.setMessage(msg.substring(0, Math.min(e.getMessage().length(), 1000))); error.setUserId(calc == null ? null : calc.getUserId()); error.setCalculationJobId(calculationId); error.setTrace(Arrays.stream(e.getStackTrace()).map(sysErrorTransformer::toSysErrorTraceItem).toList());