From 654a7776b720bb7da009223f210bbd6673ff2355 Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 22 Oct 2026 14:05:42 +0800 Subject: [PATCH 1/7] =?UTF-8?q?:white=5Fcheck=5Fmark:=20=E5=BE=85=E5=9B=9E?= =?UTF-8?q?=E5=8D=95=E7=A1=AE=E8=AE=A4=EF=BC=9A=E8=A1=A5=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=88=86=E6=A1=A3=E3=80=81=E6=95=B0=E5=AD=97=E6=80=81=E3=80=81?= =?UTF-8?q?=E4=B8=A4=E5=A5=97=E5=90=8D=E7=A7=B0=E8=A1=A8=E4=B8=8E=E5=B7=B2?= =?UTF-8?q?=E5=88=B0=E8=BE=BE=E5=8F=A3=E5=BE=84=E7=9A=84=E7=BA=A2=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DriverWaybillTabStatusTest.java | 176 ++++++++++++++++++ .../service/impl/MasterOrderProgressTest.java | 150 +++++++++++++++ .../service/impl/TripAggregationTest.java | 17 ++ .../impl/WaybillBusinessStatusNameTest.java | 65 +++++++ 4 files changed, 408 insertions(+) create mode 100644 blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java create mode 100644 blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/MasterOrderProgressTest.java create mode 100644 blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/WaybillBusinessStatusNameTest.java diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java new file mode 100644 index 00000000..802564b0 --- /dev/null +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java @@ -0,0 +1,176 @@ +package org.springblade.transport.service.impl; + +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; +import org.apache.ibatis.builder.MapperBuilderAssistant; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.MockedStatic; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.system.feign.IMpUserClient; +import org.springblade.transport.mapper.ExceptionDisposalMapper; +import org.springblade.transport.mapper.WaybillEnroutePunchMapper; +import org.springblade.transport.mapper.WaybillNodePunchMapper; +import org.springblade.transport.pojo.entity.Driver; +import org.springblade.transport.pojo.entity.Waybill; +import org.springblade.transport.pojo.entity.WaybillNodePunch; +import org.springblade.transport.pojo.vo.DriverWaybillCardVO; +import org.springblade.transport.pojo.vo.DriverWaybillTabCountsVO; +import org.springblade.transport.service.IDriverService; +import org.springblade.transport.service.IProcessConfigService; +import org.springblade.transport.service.ITransportVehicleService; +import org.springblade.transport.service.ITripQueryService; +import org.springblade.transport.service.IWaybillService; +import org.springblade.transport.support.CertificationGate; +import org.springblade.transport.support.WaybillProcessSupport; + +import java.util.Collection; +import java.util.List; +import java.util.function.Supplier; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +/** + * 司机端四个 Tab 的状态分档。 + *

+ * 待回单确认是「等业务员动手」的进行中:数字态沿用 1(进行中),查询口径也必须认它。 + * 漏掉的话司机打完末位卡,这张单从他的列表里彻底消失——不是展示问题,是单子不见了。 + */ +class DriverWaybillTabStatusTest { + + private static final Long WAYBILL_ID = 5901L; + private static final Long USER_ID = 7001L; + private static final String PLATE = "桂AAW3256"; + private static final String PHONE = "13800138002"; + + private IWaybillService waybillService; + private IDriverService driverService; + private WaybillNodePunchMapper nodePunchMapper; + private ExceptionDisposalMapper exceptionDisposalMapper; + private DriverWaybillServiceImpl service; + + @BeforeAll + static void initTableInfo() { + // 构造 LambdaQueryWrapper 需要 MyBatis-Plus 的实体元数据缓存 + MybatisConfiguration configuration = new MybatisConfiguration(); + MapperBuilderAssistant assistant = new MapperBuilderAssistant(configuration, ""); + assistant.setCurrentNamespace("test"); + TableInfoHelper.initTableInfo(assistant, Waybill.class); + TableInfoHelper.initTableInfo(assistant, Driver.class); + TableInfoHelper.initTableInfo(assistant, WaybillNodePunch.class); + } + + @BeforeEach + void setUp() { + waybillService = mock(IWaybillService.class); + driverService = mock(IDriverService.class); + nodePunchMapper = mock(WaybillNodePunchMapper.class); + exceptionDisposalMapper = mock(ExceptionDisposalMapper.class); + service = new DriverWaybillServiceImpl( + waybillService, + driverService, + mock(IMpUserClient.class), + mock(IProcessConfigService.class), + mock(ITransportVehicleService.class), + mock(CertificationGate.class), + mock(WaybillEnroutePunchMapper.class), + nodePunchMapper, + exceptionDisposalMapper, + mock(ITripQueryService.class)); + + when(driverService.getOne(any())).thenReturn(driver()); + when(waybillService.syncDriverAcceptState(any())).thenAnswer(invocation -> invocation.getArgument(0)); + when(waybillService.list(anyWrapper())).thenReturn(List.of(pendingReturnConfirmWaybill())); + } + + @Test + @DisplayName("待回单确认落在「进行中」档:列表查得到,数字态是 1") + void pendingReturnConfirmIsInProgressTier() { + IPage page = runAsDriver(() -> service.page(1, 10, 1, null)); + + assertEquals(1, page.getRecords().size(), "进行中档必须包含待回单确认,否则司机看不到这张单"); + assertEquals(Integer.valueOf(1), page.getRecords().get(0).getStatus(), "数字态沿用 1(进行中),不新增档位"); + } + + @Test + @DisplayName("「进行中」查询口径在库层就带上待回单确认") + void inProgressQueryCarriesPendingReturnConfirm() { + runAsDriver(() -> service.page(1, 10, 1, null)); + + assertTrue(queriedStatuses().contains(WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM)); + } + + @Test + @DisplayName("「全部」tab 不漏掉待回单确认的运单") + void allTabKeepsPendingReturnConfirm() { + IPage page = runAsDriver(() -> service.page(1, 10, null, null)); + + assertEquals(1, page.getRecords().size(), "打完末位卡的单不能从全部 tab 消失"); + assertEquals(Integer.valueOf(1), page.getRecords().get(0).getStatus()); + assertTrue(queriedStatuses().contains(WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM)); + } + + @Test + @DisplayName("Tab 计数把它算进进行中,不算已完成") + void tabCountsCountsItAsDoing() { + DriverWaybillTabCountsVO counts = runAsDriver(service::tabCounts); + + assertEquals(1, counts.getDoing(), "待回单确认仍是进行中,不是已完成"); + assertEquals(0, counts.getDone()); + assertEquals(1, counts.getAll()); + } + + // ------------------------------------------------------------ 夹具 + + private T runAsDriver(Supplier action) { + try (MockedStatic authUtil = mockStatic(AuthUtil.class)) { + authUtil.when(AuthUtil::getUserId).thenReturn(USER_ID); + return action.get(); + } + } + + @SuppressWarnings("unchecked") + private Collection queriedStatuses() { + ArgumentCaptor> captor = ArgumentCaptor.forClass(Wrapper.class); + verify(waybillService).list(captor.capture()); + return ((LambdaQueryWrapper) captor.getValue()).getParamNameValuePairs().values(); + } + + @SuppressWarnings("unchecked") + private static Wrapper anyWrapper() { + return org.mockito.ArgumentMatchers.>any(); + } + + private Waybill pendingReturnConfirmWaybill() { + Waybill waybill = new Waybill(); + waybill.setId(WAYBILL_ID); + waybill.setWaybillNo("YD202610080002"); + waybill.setVehicleNo(PLATE); + waybill.setDriverPhone(PHONE); + waybill.setBusinessStatus(WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM); + waybill.setIsDeleted(0); + return waybill; + } + + private Driver driver() { + Driver driver = new Driver(); + driver.setId(9001L); + driver.setUserId(USER_ID); + driver.setDrivingVehicle(PLATE); + driver.setMobile(PHONE); + return driver; + } + +} diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/MasterOrderProgressTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/MasterOrderProgressTest.java new file mode 100644 index 00000000..f7d77747 --- /dev/null +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/MasterOrderProgressTest.java @@ -0,0 +1,150 @@ +package org.springblade.transport.service.impl; + +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; +import org.apache.ibatis.builder.MapperBuilderAssistant; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springblade.transport.mapper.MasterOrderMapper; +import org.springblade.transport.pojo.entity.MasterOrder; +import org.springblade.transport.pojo.entity.TransportPlan; +import org.springblade.transport.pojo.entity.Waybill; +import org.springblade.transport.pojo.vo.MasterOrderVO; +import org.springblade.transport.service.IContractManageService; +import org.springblade.transport.service.IProjectApplyService; +import org.springblade.transport.service.ITransportPlanService; +import org.springblade.transport.service.IWaybillService; +import org.springblade.transport.support.WaybillProcessSupport; + +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * 多联总单分段进度的「已到达数量」口径。 + *

+ * 到货但回单待确认的运单算到达:货物确实到了,回单只是单据。 + * 不算会让下一段被「调度总量不能大于上一段已到达数量」挡住,整条线路卡在第二段。 + */ +class MasterOrderProgressTest { + + private static final Long MASTER_ID = 6101L; + private static final String MASTER_NO = "ZD20261008001"; + private static final String ROUTE_JSON = """ + [{"segmentNo":"1","transportType":"公路运输","departureName":"南宁","arrivalName":"北海"}, + {"segmentNo":"2","transportType":"铁路运输","departureName":"北海","arrivalName":"昆明"}] + """; + + private MasterOrderMapper masterOrderMapper; + private IWaybillService waybillService; + private ITransportPlanService transportPlanService; + private MasterOrderServiceImpl service; + + @BeforeAll + static void initTableInfo() { + // 构造 LambdaQueryWrapper 需要 MyBatis-Plus 的实体元数据缓存 + MybatisConfiguration configuration = new MybatisConfiguration(); + MapperBuilderAssistant assistant = new MapperBuilderAssistant(configuration, ""); + assistant.setCurrentNamespace("test"); + TableInfoHelper.initTableInfo(assistant, Waybill.class); + TableInfoHelper.initTableInfo(assistant, TransportPlan.class); + TableInfoHelper.initTableInfo(assistant, MasterOrder.class); + } + + @BeforeEach + void setUp() throws Exception { + masterOrderMapper = mock(MasterOrderMapper.class); + waybillService = mock(IWaybillService.class); + transportPlanService = mock(ITransportPlanService.class); + service = new MasterOrderServiceImpl( + waybillService, + transportPlanService, + mock(IProjectApplyService.class), + mock(IContractManageService.class)); + inject("baseMapper", masterOrderMapper); + + when(transportPlanService.list(anyWrapper())).thenReturn(List.of()); + } + + @Test + @DisplayName("到货但回单待确认的运单计入「已到达数量」") + void arrivedQuantityCountsPendingReturnConfirm() { + when(masterOrderMapper.selectById(MASTER_ID)).thenReturn(masterOrder()); + when(waybillService.list(anyWrapper())).thenReturn(List.of( + child(1L, "1", WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM, "8"))); + + MasterOrderVO vo = service.detail(MASTER_ID); + + assertEquals(0, decimalOf(vo.getRouteProgress().get(0).get("arrivedQuantity")) + .compareTo(new BigDecimal("8")), "回单待确认不等于没到货"); + assertEquals(0, decimalOf(vo.getRouteProgress().get(1).get("arrivedQuantity")).signum(), + "第二段还没有到货的运单"); + } + + @Test + @DisplayName("已到达口径:已完成 + 待回单确认,进行中不算") + void arrivedQuantityIgnoresRunning() { + when(masterOrderMapper.selectById(MASTER_ID)).thenReturn(masterOrder()); + when(waybillService.list(anyWrapper())).thenReturn(List.of( + child(1L, "1", "running", "8"), + child(2L, "1", "completed", "5"), + child(3L, "1", WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM, "3"))); + + MasterOrderVO vo = service.detail(MASTER_ID); + + assertEquals(0, decimalOf(vo.getRouteProgress().get(0).get("arrivedQuantity")) + .compareTo(new BigDecimal("8")), "5 + 3:进行中的 8 吨还没到,不能算到达"); + } + + // ------------------------------------------------------------ 夹具 + + private MasterOrder masterOrder() { + MasterOrder masterOrder = new MasterOrder(); + masterOrder.setId(MASTER_ID); + masterOrder.setMasterNo(MASTER_NO); + masterOrder.setRouteJson(ROUTE_JSON); + return masterOrder; + } + + private Waybill child(Long id, String segmentNo, String businessStatus, String quantity) { + Waybill waybill = new Waybill(); + waybill.setId(id); + waybill.setMasterNo(MASTER_NO); + waybill.setRelationNo(segmentNo); + waybill.setBusinessStatus(businessStatus); + waybill.setGoodsJson("[{\"cargoName\":\"钢材\",\"quantity\":" + quantity + "}]"); + return waybill; + } + + private BigDecimal decimalOf(Object value) { + return value == null ? BigDecimal.ZERO : (BigDecimal) value; + } + + @SuppressWarnings("unchecked") + private static Wrapper anyWrapper() { + return org.mockito.ArgumentMatchers.>any(); + } + + private void inject(String field, Object value) throws Exception { + Class type = service.getClass(); + while (type != null) { + try { + Field declared = type.getDeclaredField(field); + declared.setAccessible(true); + declared.set(service, value); + return; + } catch (NoSuchFieldException ignored) { + type = type.getSuperclass(); + } + } + throw new IllegalStateException("未找到字段:" + field); + } + +} diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/TripAggregationTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/TripAggregationTest.java index a5375241..1bee8fd5 100644 --- a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/TripAggregationTest.java +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/TripAggregationTest.java @@ -193,6 +193,23 @@ class TripAggregationTest { assertTrue(TripAggregation.CHILD_STATUSES.containsAll(TripAggregation.TERMINAL_STATUSES)); } + @Test + @DisplayName("待回单确认的子单仍进运次,且不会把运次判成已完成") + void pendingReturnConfirmChildKeepsTripRunning() { + String pendingReturnConfirm = org.springblade.transport.support.WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM; + + assertTrue(TripAggregation.CHILD_STATUSES.contains(pendingReturnConfirm), + "漏掉这个状态,子单会从运次读服务消失,配载单被当成全部完成"); + + // 与一张已完成的子单拼载:还有子单没走完,运次只能是运输中 + List children = List.of( + waybill("completed", null, null), + waybill(pendingReturnConfirm, null, null)); + String status = TripAggregation.statusOf(children, false, false); + assertEquals("running", status); + assertEquals(1, TripAggregation.appStatus(status), "运次不进已完成档"); + } + private Waybill waybill(String businessStatus, String acceptStatus, String processJson) { Waybill waybill = new Waybill(); waybill.setBusinessStatus(businessStatus); diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/WaybillBusinessStatusNameTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/WaybillBusinessStatusNameTest.java new file mode 100644 index 00000000..392c0550 --- /dev/null +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/WaybillBusinessStatusNameTest.java @@ -0,0 +1,65 @@ +package org.springblade.transport.service.impl; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springblade.transport.mapper.MasterOrderMapper; +import org.springblade.transport.mapper.ReceivablePayableCargoFeeMapper; +import org.springblade.transport.mapper.ReceivablePayableChangeRecordMapper; +import org.springblade.transport.service.IContractManageService; +import org.springblade.transport.service.ICommonAddressService; +import org.springblade.transport.service.IFormalSettlementService; +import org.springblade.transport.service.IPreSettlementService; +import org.springblade.transport.service.IWaybillService; +import org.springblade.transport.support.WaybillProcessSupport; +import org.springblade.transport.wrapper.WaybillWrapper; + +import java.lang.reflect.Method; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; + +/** + * 运单业务状态的中文名,两套表并存(历史结构,不合并):运单管理一套、应收应付一套。 + *

+ * 两套都要认待回单确认:漏一套就在页面上露出原始英文码。 + */ +class WaybillBusinessStatusNameTest { + + private static final String PENDING_RETURN_CONFIRM = WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM; + + @Test + @DisplayName("运单管理名称表给出「待回单确认」——导出与详情共用这张表") + void waybillWrapperNamesPendingReturnConfirm() { + assertEquals("待回单确认", WaybillWrapper.businessStatusName(PENDING_RETURN_CONFIRM)); + // 相邻档位不受影响 + assertEquals("进行中", WaybillWrapper.businessStatusName("running")); + assertEquals("已完成", WaybillWrapper.businessStatusName("completed")); + } + + @Test + @DisplayName("应收应付的第二套名称表同步给出「待回单确认」") + void receivablePayableNamesPendingReturnConfirm() throws Exception { + assertEquals("待回单确认", receivableStatusName(PENDING_RETURN_CONFIRM)); + } + + /** + * 应收应付那张表只被 waybillMap 用,而 waybillMap 当前没有调用方, + * 没有公共接缝;它是纯函数,按既有做法直接取私有方法(同 LoadingManageChildStatusWriteTest)。 + */ + private String receivableStatusName(String status) throws Exception { + ReceivablePayableDetailServiceImpl service = new ReceivablePayableDetailServiceImpl( + mock(ReceivablePayableCargoFeeMapper.class), + mock(ReceivablePayableChangeRecordMapper.class), + mock(MasterOrderMapper.class), + mock(IWaybillService.class), + mock(IContractManageService.class), + mock(ICommonAddressService.class), + mock(IPreSettlementService.class), + mock(IFormalSettlementService.class)); + Method method = ReceivablePayableDetailServiceImpl.class + .getDeclaredMethod("waybillStatusName", String.class); + method.setAccessible(true); + return (String) method.invoke(service, status); + } + +} From 53f208cf05c7fbdacd80b4206fbfc9bd76c150ad Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 22 Oct 2026 14:08:22 +0800 Subject: [PATCH 2/7] =?UTF-8?q?:sparkles:=20=E5=BE=85=E5=9B=9E=E5=8D=95?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=EF=BC=9A=E5=8F=B8=E6=9C=BA=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=88=86=E6=A1=A3=E3=80=81=E6=95=B0=E5=AD=97=E6=80=81=E3=80=81?= =?UTF-8?q?=E4=B8=A4=E5=A5=97=E5=90=8D=E7=A7=B0=E8=A1=A8=E3=80=81=E8=BF=90?= =?UTF-8?q?=E6=AC=A1=E5=AD=90=E5=8D=95=E4=B8=8E=E6=80=BB=E5=8D=95=E5=B7=B2?= =?UTF-8?q?=E5=88=B0=E8=BE=BE=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DriverWaybillServiceImpl.java | 23 +++++++++++-------- .../service/impl/MasterOrderServiceImpl.java | 14 +++++++++-- .../ReceivablePayableDetailServiceImpl.java | 2 ++ .../service/impl/TripAggregation.java | 4 +++- .../transport/wrapper/WaybillWrapper.java | 1 + 5 files changed, 32 insertions(+), 12 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 16466128..d2369c3f 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 @@ -118,13 +118,18 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { private static final List PENDING_STATUSES = Arrays.asList( STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING ); - /** Tab「全部」统计口径:待接 + 运输中 + 已完成(不含已取消) */ + /** Tab「全部」统计口径:待接 + 运输中 + 待回单确认 + 已完成(不含已取消) */ private static final List TAB_ALL_STATUSES = Arrays.asList( - STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING, STATUS_RUNNING, STATUS_COMPLETED + STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING, STATUS_RUNNING, + WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM, STATUS_COMPLETED ); - /** 允许完成运单的业务状态 */ - private static final List COMPLETABLE_STATUSES = Arrays.asList( - STATUS_RUNNING, STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING + /** + * 进行中口径:司机手上还没走完的单。 + * 待回单确认也算进行中——司机侧已打完末位卡,等业务员确认回单才变已完成。 + */ + private static final List ACTIVE_STATUSES = Arrays.asList( + STATUS_RUNNING, STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING, + WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM ); private static final int DEFAULT_PREVIEW_SIZE = 2; @@ -838,7 +843,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { } switch (status) { case 0 -> wrapper.in(Waybill::getBusinessStatus, PENDING_STATUSES); - case 1 -> wrapper.in(Waybill::getBusinessStatus, COMPLETABLE_STATUSES); + case 1 -> wrapper.in(Waybill::getBusinessStatus, ACTIVE_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); @@ -1514,12 +1519,12 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { } /** - * 自动完成的前置:业务状态允许完成,且没有未了结异常。 + * 自动完成的前置:业务状态在进行中口径内,且没有未了结异常。 *

* 不满足返回 false,由调用方静默跳过,打卡不受影响。 */ private boolean canAutoCompleteWaybill(Waybill waybill) { - return COMPLETABLE_STATUSES.contains(waybill.getBusinessStatus()) + return ACTIVE_STATUSES.contains(waybill.getBusinessStatus()) && unresolvedExceptionNodeCodeList(waybill.getId()).isEmpty(); } @@ -1986,7 +1991,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { } return switch (businessStatus) { case STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING -> 0; - case STATUS_RUNNING -> 1; + case STATUS_RUNNING, WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM -> 1; case STATUS_COMPLETED -> 2; case STATUS_CANCELLED -> 3; default -> null; diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/MasterOrderServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/MasterOrderServiceImpl.java index 51491538..3c3dc747 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/MasterOrderServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/MasterOrderServiceImpl.java @@ -362,7 +362,7 @@ public class MasterOrderServiceImpl extends BaseServiceImpl dispatchedGoods = dispatchedGoods(routeWaybills, routePlans); route.put("dispatchedQuantity", dispatchedGoods.values().stream().reduce(BigDecimal.ZERO, BigDecimal::add)); route.put("dispatchedGoods", dispatchedGoods); - route.put("arrivedQuantity", routeWaybills.stream().filter(item -> "completed".equals(item.getBusinessStatus())).flatMap(item -> waybillGoods(item).stream()).map(item -> decimal(item, "quantity")).reduce(BigDecimal.ZERO, BigDecimal::add)); + route.put("arrivedQuantity", routeWaybills.stream().filter(item -> arrived(item.getBusinessStatus())).flatMap(item -> waybillGoods(item).stream()).map(item -> decimal(item, "quantity")).reduce(BigDecimal.ZERO, BigDecimal::add)); route.put("waybills", routeWaybills); route.put("transportPlans", routePlans); } @@ -541,12 +541,22 @@ public class MasterOrderServiceImpl extends BaseServiceImpl route) { return waybillsByMasterNo(masterNo).stream() - .filter(item -> "completed".equals(item.getBusinessStatus())) + .filter(item -> arrived(item.getBusinessStatus())) .filter(item -> belongsToRoute(item, route)) .flatMap(item -> waybillGoods(item).stream()) .map(item -> decimal(item, "quantity")) .reduce(BigDecimal.ZERO, BigDecimal::add); } + + /** + * 已到达口径:待回单确认也算到达——货物确实到了,回单只是单据。 + * 不计入会按「调度总量不能大于上一段已到达数量」把多联总单的下一段挡在门外。 + */ + static boolean arrived(String businessStatus) { + return "completed".equals(businessStatus) + || WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM.equals(businessStatus); + } + private Map availableGoods(MasterOrder masterOrder) { Map available = new LinkedHashMap<>(); for (Map goods : parseArray(masterOrder.getGoodsJson())) available.merge(goodsKey(goods), decimal(goods, "quantity"), BigDecimal::add); diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ReceivablePayableDetailServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ReceivablePayableDetailServiceImpl.java index 8ce2f5f7..7a757025 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ReceivablePayableDetailServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ReceivablePayableDetailServiceImpl.java @@ -61,6 +61,7 @@ import org.springblade.transport.service.IFormalSettlementService; import org.springblade.transport.service.IPreSettlementService; import org.springblade.transport.service.IReceivablePayableDetailService; import org.springblade.transport.service.IWaybillService; +import org.springblade.transport.support.WaybillProcessSupport; import org.springblade.transport.wrapper.ReceivablePayableDetailWrapper; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -3295,6 +3296,7 @@ public class ReceivablePayableDetailServiceImpl case "completed" -> "已完成"; case "processing", "running", "in_progress", "inProgress" -> "进行中"; case "pending", "created" -> "待执行"; + case WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM -> "待回单确认"; case "cancelled", "canceled" -> "已取消"; default -> status; }; diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/TripAggregation.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/TripAggregation.java index d55d700a..6eb4689a 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/TripAggregation.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/TripAggregation.java @@ -45,6 +45,7 @@ final class TripAggregation { static final String RUNNING = "running"; static final String COMPLETED = "completed"; static final String CANCELLED = "cancelled"; + static final String PENDING_RETURN_CONFIRM = WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM; /** 待接单档:与运单侧 Tab「待接单」取同一组状态 */ static final List PENDING_STATUSES = List.of(PENDING, WAITING_DISPATCH, DISPATCHING); @@ -53,9 +54,10 @@ final class TripAggregation { /** * 进运次的子单状态:草稿尚未派单、不成运次;已取消要进, * 否则「子单全已取消」会被算成运输中而不是已取消。 + * 待回单确认要进:子单漏在运次外,剩下那几张会被判成整趟车已走完。 */ static final List CHILD_STATUSES = List.of( - PENDING, WAITING_DISPATCH, DISPATCHING, RUNNING, COMPLETED, CANCELLED + PENDING, WAITING_DISPATCH, DISPATCHING, RUNNING, PENDING_RETURN_CONFIRM, COMPLETED, CANCELLED ); /** 待重新派单的口径:子单被拒且这趟车还没结束 */ diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/wrapper/WaybillWrapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/wrapper/WaybillWrapper.java index 1dab5a5b..d0257f86 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/wrapper/WaybillWrapper.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/wrapper/WaybillWrapper.java @@ -122,6 +122,7 @@ public class WaybillWrapper extends BaseEntityWrapper { case "waiting_dispatch" -> "待调度"; case "dispatching" -> "调度中"; case "running", "processing", "in_progress", "inProgress" -> "进行中"; + case WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM -> "待回单确认"; case "completed" -> "已完成"; case "cancelled" -> "已取消"; case "closed" -> "已关闭"; From 67480098f35f5a0eb7f38c6aa0d8a2a4e4607420 Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 22 Oct 2026 14:11:18 +0800 Subject: [PATCH 3/7] =?UTF-8?q?:white=5Fcheck=5Fmark:=20=E5=BE=85=E5=9B=9E?= =?UTF-8?q?=E5=8D=95=E7=A1=AE=E8=AE=A4=EF=BC=9A=E5=88=97=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=96=AD=E8=A8=80=E6=94=B9=E4=B8=BA=20Answer=20?= =?UTF-8?q?=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DriverWaybillTabStatusTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java index 802564b0..c556a398 100644 --- a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java @@ -10,7 +10,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; import org.mockito.MockedStatic; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.system.feign.IMpUserClient; @@ -30,6 +29,7 @@ import org.springblade.transport.service.IWaybillService; import org.springblade.transport.support.CertificationGate; import org.springblade.transport.support.WaybillProcessSupport; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.function.Supplier; @@ -39,7 +39,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mockStatic; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** @@ -59,6 +58,7 @@ class DriverWaybillTabStatusTest { private IDriverService driverService; private WaybillNodePunchMapper nodePunchMapper; private ExceptionDisposalMapper exceptionDisposalMapper; + private final List> queried = new ArrayList<>(); private DriverWaybillServiceImpl service; @BeforeAll @@ -92,7 +92,10 @@ class DriverWaybillTabStatusTest { when(driverService.getOne(any())).thenReturn(driver()); when(waybillService.syncDriverAcceptState(any())).thenAnswer(invocation -> invocation.getArgument(0)); - when(waybillService.list(anyWrapper())).thenReturn(List.of(pendingReturnConfirmWaybill())); + when(waybillService.list(anyWrapper())).thenAnswer(invocation -> { + queried.add(invocation.getArgument(0)); + return List.of(pendingReturnConfirmWaybill()); + }); } @Test @@ -143,9 +146,8 @@ class DriverWaybillTabStatusTest { @SuppressWarnings("unchecked") private Collection queriedStatuses() { - ArgumentCaptor> captor = ArgumentCaptor.forClass(Wrapper.class); - verify(waybillService).list(captor.capture()); - return ((LambdaQueryWrapper) captor.getValue()).getParamNameValuePairs().values(); + assertEquals(1, queried.size(), "一次列表查询"); + return ((LambdaQueryWrapper) queried.get(0)).getParamNameValuePairs().values(); } @SuppressWarnings("unchecked") From 66a4a4945211f4a9fc8a54c3eff9d45f6e8b62f2 Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 22 Oct 2026 14:14:19 +0800 Subject: [PATCH 4/7] =?UTF-8?q?:white=5Fcheck=5Fmark:=20=E5=BE=85=E5=9B=9E?= =?UTF-8?q?=E5=8D=95=E7=A1=AE=E8=AE=A4=EF=BC=9A=E8=AF=A6=E6=83=85=E4=B8=8E?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E4=B8=8B=E5=8F=91=E5=8E=9F=E5=A7=8B=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E7=8A=B6=E6=80=81=E7=9A=84=E7=BA=A2=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DriverWaybillTabStatusTest.java | 5 + .../impl/ManageWaybillBusinessStatusTest.java | 116 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/ManageWaybillBusinessStatusTest.java diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java index c556a398..5de8ac1d 100644 --- a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java @@ -105,6 +105,9 @@ class DriverWaybillTabStatusTest { assertEquals(1, page.getRecords().size(), "进行中档必须包含待回单确认,否则司机看不到这张单"); assertEquals(Integer.valueOf(1), page.getRecords().get(0).getStatus(), "数字态沿用 1(进行中),不新增档位"); + assertEquals(WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM, + page.getRecords().get(0).getBusinessStatus(), + "原始业务状态随卡片下发:数字态恒为 1,前端靠它区分运输中与待回单确认"); } @Test @@ -122,6 +125,8 @@ class DriverWaybillTabStatusTest { assertEquals(1, page.getRecords().size(), "打完末位卡的单不能从全部 tab 消失"); assertEquals(Integer.valueOf(1), page.getRecords().get(0).getStatus()); + assertEquals(WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM, + page.getRecords().get(0).getBusinessStatus()); assertTrue(queriedStatuses().contains(WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM)); } diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/ManageWaybillBusinessStatusTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/ManageWaybillBusinessStatusTest.java new file mode 100644 index 00000000..e7f39d3d --- /dev/null +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/ManageWaybillBusinessStatusTest.java @@ -0,0 +1,116 @@ +package org.springblade.transport.service.impl; + +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.builder.MapperBuilderAssistant; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springblade.transport.pojo.entity.ExceptionDisposal; +import org.springblade.transport.pojo.entity.Waybill; +import org.springblade.transport.pojo.vo.AdminWaybillCardVO; +import org.springblade.transport.pojo.vo.AdminWaybillDetailVO; +import org.springblade.transport.service.IDriverService; +import org.springblade.transport.service.IDriverWaybillService; +import org.springblade.transport.service.IExceptionDisposalService; +import org.springblade.transport.service.ILoadingManageService; +import org.springblade.transport.service.IRiskDisposalService; +import org.springblade.transport.service.ITripQueryService; +import org.springblade.transport.service.IWaybillService; +import org.springblade.transport.support.WaybillProcessSupport; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * 调度端运单详情的原始业务状态。 + *

+ * 数字态只有 0/1/2/3:待回单确认落进行中(1),与运输中同档。 + * 调度端要区分这两者只能看原始状态码,所以详情与卡片都得带上它。 + */ +class ManageWaybillBusinessStatusTest { + + private static final Long WAYBILL_ID = 6201L; + private static final String PENDING_RETURN_CONFIRM = WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM; + + private ManageWaybillServiceImpl service; + private IWaybillService waybillService; + + @BeforeAll + static void initTableInfo() { + MybatisConfiguration configuration = new MybatisConfiguration(); + MapperBuilderAssistant assistant = new MapperBuilderAssistant(configuration, ""); + assistant.setCurrentNamespace("test"); + TableInfoHelper.initTableInfo(assistant, Waybill.class); + TableInfoHelper.initTableInfo(assistant, ExceptionDisposal.class); + } + + @BeforeEach + void setUp() { + waybillService = mock(IWaybillService.class); + IExceptionDisposalService exceptionDisposalService = mock(IExceptionDisposalService.class); + service = new ManageWaybillServiceImpl( + waybillService, + mock(IDriverService.class), + exceptionDisposalService, + mock(IRiskDisposalService.class), + mock(IDriverWaybillService.class), + mock(ITripQueryService.class), + mock(ILoadingManageService.class)); + when(exceptionDisposalService.list(anyWrapper())).thenReturn(new ArrayList<>()); + } + + @Test + @DisplayName("运单详情:数字态 1,原始业务状态是待回单确认") + void detailCarriesRawBusinessStatus() { + when(waybillService.getById(WAYBILL_ID)).thenReturn(waybill()); + + AdminWaybillDetailVO detail = service.detail(String.valueOf(WAYBILL_ID)); + + assertEquals(Integer.valueOf(1), detail.getStatus(), "数字态仍落进行中,未新增档位"); + assertEquals(PENDING_RETURN_CONFIRM, detail.getBusinessStatus()); + } + + @Test + @DisplayName("待重新派单卡片:原始业务状态随卡片下发") + void reassignCardCarriesRawBusinessStatus() { + when(waybillService.page(any(), any())).thenAnswer(invocation -> { + Page rows = invocation.getArgument(0); + rows.setRecords(List.of(waybill())); + rows.setTotal(1); + return rows; + }); + + IPage page = service.pendingList(1, 10, null, true); + + assertEquals(1, page.getRecords().size()); + assertEquals(PENDING_RETURN_CONFIRM, page.getRecords().get(0).getBusinessStatus()); + } + + // ------------------------------------------------------------ 夹具 + + private Waybill waybill() { + Waybill waybill = new Waybill(); + waybill.setId(WAYBILL_ID); + waybill.setWaybillNo("YD202610080003"); + waybill.setBusinessStatus(PENDING_RETURN_CONFIRM); + waybill.setDriverAcceptStatus("rejected"); + waybill.setIsDeleted(0); + return waybill; + } + + @SuppressWarnings("unchecked") + private static Wrapper anyWrapper() { + return org.mockito.ArgumentMatchers.>any(); + } + +} From d2f7d6aed0009e94c5d1b57a393738b1a21a45aa Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 22 Oct 2026 14:15:33 +0800 Subject: [PATCH 5/7] =?UTF-8?q?:sparkles:=20=E5=BE=85=E5=9B=9E=E5=8D=95?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=EF=BC=9A=E5=8F=B8=E6=9C=BA=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E4=B8=8E=E8=B0=83=E5=BA=A6=E7=AB=AF=E8=AF=A6=E6=83=85/?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E4=B8=8B=E5=8F=91=E5=8E=9F=E5=A7=8B=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/springblade/transport/pojo/vo/AdminWaybillCardVO.java | 3 +++ .../springblade/transport/pojo/vo/AdminWaybillDetailVO.java | 3 +++ .../org/springblade/transport/pojo/vo/DriverWaybillCardVO.java | 3 +++ .../transport/service/impl/DriverWaybillServiceImpl.java | 1 + .../transport/service/impl/ManageWaybillServiceImpl.java | 2 ++ 5 files changed, 12 insertions(+) diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/AdminWaybillCardVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/AdminWaybillCardVO.java index b0dca1a4..aa0dbfb5 100644 --- a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/AdminWaybillCardVO.java +++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/AdminWaybillCardVO.java @@ -65,6 +65,9 @@ public class AdminWaybillCardVO implements Serializable { @Schema(description = "状态:0待接单/1运输中/2已完成/3已取消") private Integer status; + @Schema(description = "原始业务状态:pending / running / pending_return_confirm / completed / cancelled") + private String businessStatus; + @Schema(description = "承运方") private String carrierName; diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/AdminWaybillDetailVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/AdminWaybillDetailVO.java index ff601f14..e874df68 100644 --- a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/AdminWaybillDetailVO.java +++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/AdminWaybillDetailVO.java @@ -48,6 +48,9 @@ public class AdminWaybillDetailVO implements Serializable { @Schema(description = "状态:0待接单/1运输中/2已完成/3已取消") private Integer status; + @Schema(description = "原始业务状态:pending / running / pending_return_confirm / completed / cancelled") + private String businessStatus; + @Schema(description = "起点名称") private String fromName; diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/DriverWaybillCardVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/DriverWaybillCardVO.java index 23432c6a..a4be3625 100644 --- a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/DriverWaybillCardVO.java +++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/DriverWaybillCardVO.java @@ -76,6 +76,9 @@ public class DriverWaybillCardVO implements Serializable { @Schema(description = "状态:0待接单/1运输中/2已完成/3已取消") private Integer status; + @Schema(description = "原始业务状态:pending / running / pending_return_confirm / completed / cancelled") + private String businessStatus; + @Schema(description = "创建时间") private String createTime; 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 d2369c3f..4348f65b 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 @@ -1011,6 +1011,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { WaybillCargoSupport.Quantity weighing = WaybillCargoSupport.weighing(cargos); card.setWeight(weighing == null ? "" : formatWeight(weighing.value(), weighing.unit())); card.setStatus(toAppStatus(waybill.getBusinessStatus())); + card.setBusinessStatus(waybill.getBusinessStatus()); String createTime = formatDateTime(waybill.getCreateTime()); card.setCreateTime(createTime); card.setPublishTime(createTime); diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageWaybillServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageWaybillServiceImpl.java index 4b1e5c93..0e303dcc 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageWaybillServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageWaybillServiceImpl.java @@ -744,6 +744,7 @@ public class ManageWaybillServiceImpl implements IManageWaybillService { detail.setId(waybill.getId()); detail.setWaybillNo(waybill.getWaybillNo()); detail.setStatus(toAppStatus(waybill.getBusinessStatus())); + detail.setBusinessStatus(waybill.getBusinessStatus()); String mode = Func.toStr(waybill.getTransportType(), ""); detail.setTransportMode(mode); @@ -937,6 +938,7 @@ public class ManageWaybillServiceImpl implements IManageWaybillService { card.setPlanTime(formatLocalDate(waybill.getEstimatedStartTime())); card.setPlanTimeEnd(formatLocalDate(waybill.getEstimatedEndTime())); card.setStatus(toAppStatus(waybill.getBusinessStatus())); + card.setBusinessStatus(waybill.getBusinessStatus()); card.setCarrierName(Func.toStr(waybill.getCarrierName(), "")); card.setDriverName(Func.toStr(waybill.getDriverName(), "")); card.setVehicleNo(Func.toStr(waybill.getVehicleNo(), "")); From 86da6f32dcef31c23f4e6722e537a725b29c5d4e Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 22 Oct 2026 14:18:34 +0800 Subject: [PATCH 6/7] =?UTF-8?q?:white=5Fcheck=5Fmark:=20=E5=BE=85=E5=9B=9E?= =?UTF-8?q?=E5=8D=95=E7=A1=AE=E8=AE=A4=EF=BC=9A=E9=94=81=E4=BD=8F=E8=B0=83?= =?UTF-8?q?=E5=BA=A6=E7=AB=AF=E6=95=B0=E5=AD=97=E6=80=81=E8=90=BD=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transport/service/impl/ManageWaybillBusinessStatusTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/ManageWaybillBusinessStatusTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/ManageWaybillBusinessStatusTest.java index e7f39d3d..ad43545b 100644 --- a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/ManageWaybillBusinessStatusTest.java +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/ManageWaybillBusinessStatusTest.java @@ -93,6 +93,8 @@ class ManageWaybillBusinessStatusTest { IPage page = service.pendingList(1, 10, null, true); assertEquals(1, page.getRecords().size()); + assertEquals(Integer.valueOf(1), page.getRecords().get(0).getStatus(), + "数字态落进行中:null 到前端会掉进「非 0/1/2 即已取消」的展示分支"); assertEquals(PENDING_RETURN_CONFIRM, page.getRecords().get(0).getBusinessStatus()); } From 833c3e247e2e0ce5a5dbf50cb15b8df9612534e1 Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 22 Oct 2026 14:19:06 +0800 Subject: [PATCH 7/7] =?UTF-8?q?:bug:=20=E5=BE=85=E5=9B=9E=E5=8D=95?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=EF=BC=9A=E8=B0=83=E5=BA=A6=E7=AB=AF=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E6=80=81=E8=90=BD=E8=BF=9B=E8=A1=8C=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E8=BF=94=E5=9B=9E=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transport/service/impl/ManageWaybillServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageWaybillServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageWaybillServiceImpl.java index 0e303dcc..0f692983 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageWaybillServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageWaybillServiceImpl.java @@ -996,7 +996,9 @@ public class ManageWaybillServiceImpl implements IManageWaybillService { } return switch (businessStatus) { case STATUS_PENDING, "waiting_dispatch", "dispatching" -> 0; - case STATUS_RUNNING -> 1; + // 与司机端 toAppStatus 同一份数字枚举(0 待接单 / 1 运输中 / 2 已完成 / 3 已取消),待回单确认属进行中: + // 两处对同一状态必须给同一个数字,给 null 前端只能落到「未知」兜底 + case STATUS_RUNNING, WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM -> 1; case STATUS_COMPLETED -> 2; case STATUS_CANCELLED -> 3; default -> null;