✅ 待回单确认:详情与卡片下发原始业务状态的红测试
This commit is contained in:
+5
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
+116
@@ -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;
|
||||
|
||||
/**
|
||||
* 调度端运单详情的原始业务状态。
|
||||
* <p>
|
||||
* 数字态只有 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<Waybill> rows = invocation.getArgument(0);
|
||||
rows.setRecords(List.of(waybill()));
|
||||
rows.setTotal(1);
|
||||
return rows;
|
||||
});
|
||||
|
||||
IPage<AdminWaybillCardVO> 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 <T> Wrapper<T> anyWrapper() {
|
||||
return org.mockito.ArgumentMatchers.<Wrapper<T>>any();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user