From 9f9ce7842eb0fe1a1ab55683c84ba77c93ed3f30 Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 8 Oct 2026 10:07:00 +0800 Subject: [PATCH] =?UTF-8?q?:recycle:=20=E5=8F=B8=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E5=8F=AF=E5=AE=8C=E6=88=90=E7=8A=B6=E6=80=81=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E6=94=B6=E6=95=9B=E4=B8=BA=E5=8D=95=E4=B8=80=E5=B8=B8?= =?UTF-8?q?=E9=87=8F=E5=B9=B6=E8=AE=A2=E6=AD=A3=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DriverWaybillServiceImpl.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java index a5aad0ef..33a84710 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java @@ -106,6 +106,10 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { private static final List TAB_ALL_STATUSES = Arrays.asList( STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING, STATUS_RUNNING, STATUS_COMPLETED ); + /** 允许完成运单的业务状态 */ + private static final List COMPLETABLE_STATUSES = Arrays.asList( + STATUS_RUNNING, STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING + ); private static final int DEFAULT_PREVIEW_SIZE = 2; private static final int MAX_PREVIEW_SIZE = 20; @@ -361,7 +365,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { advanceCurrentProcessNode(waybill, nodeCfg); // 末位打卡节点是到货/卸货/签收、且回单无需确认完成时,本次打卡一并把运单置为完成; - // 判定与找节点共用上面已解析的那份过程配置,不重新解析。 + // isLastDriverPunchNode 与 returnNeedsNoConfirmation 传的就是上面那份 processJson,未再调 resolveProcessJson 取过程配置。 String nodeKey = WaybillProcessSupport.nodeKey(nodeCfg); String nodeName = WaybillProcessSupport.nodeName(nodeCfg); boolean completed = false; @@ -460,10 +464,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { Driver driver = requireCurrentDriver(); Waybill waybill = loadDriverWaybill(id, currentBoundPlates(driver)); waybill = normalizeAcceptStatus(waybill); - if (!STATUS_RUNNING.equals(waybill.getBusinessStatus()) - && !STATUS_PENDING.equals(waybill.getBusinessStatus()) - && !STATUS_WAITING_DISPATCH.equals(waybill.getBusinessStatus()) - && !STATUS_DISPATCHING.equals(waybill.getBusinessStatus())) { + if (!COMPLETABLE_STATUSES.contains(waybill.getBusinessStatus())) { throw new ServiceException("当前运单状态不允许完成"); } // 有未了结异常时不允许完成——完成接口不要求节点全部打卡,不挡住就能绕过打卡门禁 @@ -535,8 +536,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { } switch (status) { case 0 -> wrapper.in(Waybill::getBusinessStatus, PENDING_STATUSES); - case 1 -> wrapper.in(Waybill::getBusinessStatus, List.of(STATUS_RUNNING, STATUS_PENDING, - STATUS_WAITING_DISPATCH, STATUS_DISPATCHING)); + case 1 -> wrapper.in(Waybill::getBusinessStatus, COMPLETABLE_STATUSES); case 2 -> wrapper.eq(Waybill::getBusinessStatus, STATUS_COMPLETED); case 3 -> wrapper.eq(Waybill::getBusinessStatus, STATUS_CANCELLED); default -> wrapper.in(Waybill::getBusinessStatus, TAB_ALL_STATUSES); @@ -1041,12 +1041,8 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { * 不满足返回 false,由调用方静默跳过,打卡不受影响。 */ private boolean canAutoCompleteWaybill(Waybill waybill) { - String status = waybill.getBusinessStatus(); - boolean statusAllowed = STATUS_RUNNING.equals(status) - || STATUS_PENDING.equals(status) - || STATUS_WAITING_DISPATCH.equals(status) - || STATUS_DISPATCHING.equals(status); - return statusAllowed && unresolvedExceptionNodeCodeList(waybill.getId()).isEmpty(); + return COMPLETABLE_STATUSES.contains(waybill.getBusinessStatus()) + && unresolvedExceptionNodeCodeList(waybill.getId()).isEmpty(); } /**