Просмотр исходного кода

原矿运输运单详情接口更改

donglang 1 месяц назад
Родитель
Сommit
d31f17f3be

+ 13 - 5
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderV1Service.java

@@ -4319,11 +4319,19 @@ public class KwtWaybillOrderV1Service {
 
         // 等待所有并行查询完成
         log.debug("等待所有并行查询完成");
-        CompletableFuture.allOf(
-                truckFuture, fleetFuture, addressFuture, ticketFuture, userFuture,
-                goodsFuture, orderDetailFuture, unitFuture, nodeFuture, waybillSubtaskFuture,
-                contractFuture
-        ).join();
+        try {
+            CompletableFuture.allOf(
+                    truckFuture, fleetFuture, addressFuture, ticketFuture, userFuture,
+                    goodsFuture, orderDetailFuture, unitFuture, nodeFuture, waybillSubtaskFuture,
+                    contractFuture
+            ).get(30, TimeUnit.SECONDS);
+
+        } catch (Exception e) {
+            // 超时会抛出 TimeoutException
+            // 任意任务失败会抛出 ExecutionException
+            // 中断会抛出 InterruptedException
+            throw new RuntimeException("批量异步任务执行失败/超时", e);
+        }
         log.debug("所有并行查询完成");
 
         // 获取查询结果