🐛 拒单票不再被排除在可配载之外,随配载提交清除接单事实
This commit is contained in:
-3
@@ -784,9 +784,6 @@ public class LoadingManageServiceImpl extends BaseServiceImpl<LoadingManageMappe
|
|||||||
if (!LoadableAdmissionSupport.LOADABLE_BUSINESS_STATUS.equals(waybill.getBusinessStatus())) {
|
if (!LoadableAdmissionSupport.LOADABLE_BUSINESS_STATUS.equals(waybill.getBusinessStatus())) {
|
||||||
return prefix + "当前状态不是待执行,不可配载";
|
return prefix + "当前状态不是待执行,不可配载";
|
||||||
}
|
}
|
||||||
if (WaybillProcessSupport.isRejected(waybill.getDriverAcceptStatus())) {
|
|
||||||
return prefix + "已被司机拒绝接单,不可配载";
|
|
||||||
}
|
|
||||||
return prefix + "不可配载";
|
return prefix + "不可配载";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-7
@@ -29,7 +29,10 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可配载准入判据:公路 + 待执行 + 未关联其它配载单 + 未拒单。
|
* 可配载准入判据:公路 + 待执行 + 未关联其它配载单。
|
||||||
|
* <p>
|
||||||
|
* 接单状态不进判据:拒单票照样可配载。配载提交会把它的接单事实清成待接单,
|
||||||
|
* 否则新司机看不到这张票——司机端入口一律排除已拒绝的运单。
|
||||||
* <p>
|
* <p>
|
||||||
* 候选列表取数与配载提交/编辑/重新派单的校验共用这一份定义。
|
* 候选列表取数与配载提交/编辑/重新派单的校验共用这一份定义。
|
||||||
*/
|
*/
|
||||||
@@ -99,8 +102,7 @@ public final class LoadableAdmissionSupport {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isRoadTransport(waybill.getTransportType())
|
if (!isRoadTransport(waybill.getTransportType())
|
||||||
|| !LOADABLE_BUSINESS_STATUS.equals(text(waybill.getBusinessStatus()))
|
|| !LOADABLE_BUSINESS_STATUS.equals(text(waybill.getBusinessStatus()))) {
|
||||||
|| WaybillProcessSupport.isRejected(waybill.getDriverAcceptStatus())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String loadingNo = text(waybill.getLoadingNo());
|
String loadingNo = text(waybill.getLoadingNo());
|
||||||
@@ -126,7 +128,7 @@ public final class LoadableAdmissionSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 把整条可配载判据加到运单查询上:公路 + 待执行 + 未配载 + 非拒单。
|
* 把整条可配载判据加到运单查询上:公路 + 待执行 + 未配载。
|
||||||
*
|
*
|
||||||
* @param wrapper 运单列表查询条件
|
* @param wrapper 运单列表查询条件
|
||||||
*/
|
*/
|
||||||
@@ -134,9 +136,6 @@ public final class LoadableAdmissionSupport {
|
|||||||
applyRoadTransportCondition(wrapper);
|
applyRoadTransportCondition(wrapper);
|
||||||
wrapper.eq(Waybill::getBusinessStatus, LOADABLE_BUSINESS_STATUS);
|
wrapper.eq(Waybill::getBusinessStatus, LOADABLE_BUSINESS_STATUS);
|
||||||
wrapper.and(nested -> nested.isNull(Waybill::getLoadingNo).or().eq(Waybill::getLoadingNo, ""));
|
wrapper.and(nested -> nested.isNull(Waybill::getLoadingNo).or().eq(Waybill::getLoadingNo, ""));
|
||||||
// 接单状态绝大多数为 NULL,而 NULL <> 'rejected' 不成立,只写不等于会把它们一起滤掉
|
|
||||||
wrapper.and(nested -> nested.isNull(Waybill::getDriverAcceptStatus)
|
|
||||||
.or().ne(Waybill::getDriverAcceptStatus, WaybillProcessSupport.ACCEPT_REJECTED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyRoadTransportCondition(LambdaQueryWrapper<Waybill> wrapper) {
|
private static void applyRoadTransportCondition(LambdaQueryWrapper<Waybill> wrapper) {
|
||||||
|
|||||||
+4
-6
@@ -127,16 +127,14 @@ class LoadingManageAdmissionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("已拒单的运单被拒:接单事实由配载写入路径清除,不靠放行拒单票")
|
@DisplayName("已拒单但未配载的公路待执行运单可通过提交:接单事实由配载写入路径清除,新司机由此看到它")
|
||||||
void rejectedWaybillRejected() {
|
void rejectedWaybillIsAdmitted() {
|
||||||
Waybill rejected = waybill(1L, WAYBILL_NO_A, "road", "pending", null, PROJECT_A);
|
Waybill rejected = waybill(1L, WAYBILL_NO_A, "road", "pending", null, PROJECT_A);
|
||||||
rejected.setDriverAcceptStatus("rejected");
|
rejected.setDriverAcceptStatus("rejected");
|
||||||
stubWaybills(rejected);
|
stubWaybills(rejected);
|
||||||
|
stubContract(CONTRACT_ID, PROJECT_A);
|
||||||
|
|
||||||
ServiceException exception = assertThrows(ServiceException.class,
|
assertDoesNotThrow(() -> service.submit(submitPayload(List.of(1L))));
|
||||||
() -> service.submit(submitPayload(List.of(1L))));
|
|
||||||
|
|
||||||
assertEquals("运单" + WAYBILL_NO_A + "已被司机拒绝接单,不可配载", exception.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------ 本单既有子运单
|
// ------------------------------------------------------------ 本单既有子运单
|
||||||
|
|||||||
+1
-1
@@ -368,7 +368,7 @@ class LoadingManageChildStatusWriteTest {
|
|||||||
waybill.setProjectId(projectId);
|
waybill.setProjectId(projectId);
|
||||||
waybill.setProcessJson(processJson);
|
waybill.setProcessJson(processJson);
|
||||||
waybill.setDeptId(DEPT_ID_LONG);
|
waybill.setDeptId(DEPT_ID_LONG);
|
||||||
// 可配载只放行公路 + 待执行 + 未配载 + 未拒单,夹具的票都是这种票
|
// 可配载只放行公路 + 待执行 + 未配载,夹具的票都是这种票
|
||||||
waybill.setTransportType("公路运输");
|
waybill.setTransportType("公路运输");
|
||||||
waybill.setBusinessStatus("pending");
|
waybill.setBusinessStatus("pending");
|
||||||
return waybill;
|
return waybill;
|
||||||
|
|||||||
+3
-5
@@ -68,7 +68,7 @@ class WaybillLoadableQueryTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("开关开启:公路词表、待执行、未配载、非拒单一次全部进 wrapper")
|
@DisplayName("开关开启:公路词表、待执行、未配载一次全部进 wrapper,接单状态不参与")
|
||||||
void loadableSwitchAppliesWholePredicate() {
|
void loadableSwitchAppliesWholePredicate() {
|
||||||
LambdaQueryWrapper<Waybill> wrapper = capturedQuery(loadableQuery());
|
LambdaQueryWrapper<Waybill> wrapper = capturedQuery(loadableQuery());
|
||||||
String sql = String.valueOf(wrapper.getTargetSql());
|
String sql = String.valueOf(wrapper.getTargetSql());
|
||||||
@@ -85,10 +85,8 @@ class WaybillLoadableQueryTest {
|
|||||||
"进行中一律不可配载,不能沿用「待执行与进行中都可配载」的旧口径:" + params);
|
"进行中一律不可配载,不能沿用「待执行与进行中都可配载」的旧口径:" + params);
|
||||||
assertTrue(sql.contains("loading_no IS NULL") && sql.contains("loading_no ="),
|
assertTrue(sql.contains("loading_no IS NULL") && sql.contains("loading_no ="),
|
||||||
"未配载要同时覆盖 NULL 与空串:" + sql);
|
"未配载要同时覆盖 NULL 与空串:" + sql);
|
||||||
assertTrue(sql.contains("driver_accept_status <>") && params.contains("rejected"),
|
assertFalse(sql.contains("driver_accept_status"),
|
||||||
"接单状态为已拒绝的要排除:" + sql);
|
"接单状态不进可配载判据:拒单票照样可被重新配载:" + sql);
|
||||||
assertTrue(sql.contains("driver_accept_status IS NULL"),
|
|
||||||
"接单状态大多是 NULL,只写不等于 rejected 会把它们一起滤掉:" + sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+9
-4
@@ -48,14 +48,21 @@ class LoadableAdmissionSupportTest {
|
|||||||
// ------------------------------------------------------------ 单张运单准入
|
// ------------------------------------------------------------ 单张运单准入
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("公路 + 待执行 + 未配载 + 未拒单才可配载")
|
@DisplayName("公路 + 待执行 + 未配载才可配载")
|
||||||
void loadableOnlyWhenAllConditionsHold() {
|
void loadableOnlyWhenAllConditionsHold() {
|
||||||
assertTrue(LoadableAdmissionSupport.isLoadable(waybill("road", "pending", null, "pending")));
|
assertTrue(LoadableAdmissionSupport.isLoadable(waybill("road", "pending", null, "pending")));
|
||||||
assertTrue(LoadableAdmissionSupport.isLoadable(waybill("公路运输", "pending", "", null)));
|
assertTrue(LoadableAdmissionSupport.isLoadable(waybill("公路运输", "pending", "", null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("非公路、非待执行、已关联配载单、已拒单各自单独即可拒绝")
|
@DisplayName("已拒单的票照样可配载:接单事实由配载提交清除,不靠把拒单票挡在候选之外")
|
||||||
|
void rejectedWaybillIsLoadable() {
|
||||||
|
assertTrue(LoadableAdmissionSupport.isLoadable(waybill("road", "pending", null, "rejected")));
|
||||||
|
assertTrue(LoadableAdmissionSupport.isLoadable(waybill("road", "pending", null, "rejected"), "PZ20260101-001"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("非公路、非待执行、已关联配载单各自单独即可拒绝")
|
||||||
void eachConditionRejectsOnItsOwn() {
|
void eachConditionRejectsOnItsOwn() {
|
||||||
assertFalse(LoadableAdmissionSupport.isLoadable(waybill("railway", "pending", null, "pending")),
|
assertFalse(LoadableAdmissionSupport.isLoadable(waybill("railway", "pending", null, "pending")),
|
||||||
"非公路不可配载");
|
"非公路不可配载");
|
||||||
@@ -66,8 +73,6 @@ class LoadableAdmissionSupportTest {
|
|||||||
assertFalse(LoadableAdmissionSupport.isLoadable(waybill("road", "cancelled", null, null)));
|
assertFalse(LoadableAdmissionSupport.isLoadable(waybill("road", "cancelled", null, null)));
|
||||||
assertFalse(LoadableAdmissionSupport.isLoadable(waybill("road", "pending", "PZ20260101-001", null)),
|
assertFalse(LoadableAdmissionSupport.isLoadable(waybill("road", "pending", "PZ20260101-001", null)),
|
||||||
"已挂在其它配载单上的票不可再配载");
|
"已挂在其它配载单上的票不可再配载");
|
||||||
assertFalse(LoadableAdmissionSupport.isLoadable(waybill("road", "pending", null, "rejected")),
|
|
||||||
"已拒单的票不可配载");
|
|
||||||
assertFalse(LoadableAdmissionSupport.isLoadable(null));
|
assertFalse(LoadableAdmissionSupport.isLoadable(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user