✨ 运次与运单下发多式联运标志,运输类型筛选分三档

transportOrgType 仍是 common/load 二值(组织形态维),另加 Boolean multimodal 表示挂了多联总单;两者可叠加,文案由前端组合。visibleRows 补选 master_no,否则派生永远为空。配载档筛选排掉挂总单的行,多式联运档只看 master_no。
This commit is contained in:
2026-10-26 00:45:54 +08:00
parent c95dccc871
commit 05aaa5396b
9 changed files with 121 additions and 11 deletions
@@ -1055,6 +1055,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
card.setCargos(withDetail ? cargoLines(cargos) : null);
card.setTransportType(toTransportTypeLabel(waybill.getTransportType()));
card.setTransportOrgType(Func.isNotBlank(waybill.getLoadingNo()) ? TRANSPORT_LOAD : TRANSPORT_COMMON);
card.setMultimodal(Func.isNotBlank(waybill.getMasterNo()));
card.setPlanShipTime(formatLocalDateYmd(waybill.getEstimatedStartTime()));
card.setPlanFinishTime(formatLocalDateYmd(waybill.getEstimatedEndTime()));
card.setRemark(Func.toStr(waybill.getRemark(), ""));
@@ -1141,6 +1142,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
card.setRequireAccept(trip.getRequireAccept());
card.setAcceptStatus(trip.getAcceptStatus());
card.setTransportOrgType(trip.getTransportOrgType());
card.setMultimodal(trip.getMultimodal());
card.setTransportType(toTransportTypeLabel(trip.getTransportType()));
card.setDriverName(Func.toStr(trip.getDriverName(), ""));
card.setDriverPhone(Func.toStr(trip.getDriverPhone(), ""));
@@ -445,6 +445,7 @@ public class ManageWaybillServiceImpl implements IManageWaybillService {
detail.setTransportMode(Func.toStr(trip.getTransportType(), ""));
detail.setTransportType(toTransportTypeLabel(Func.toStr(trip.getTransportType(), "")));
detail.setTransportOrgType(Func.isEmpty(trip.getLoadingNo()) ? TRANSPORT_COMMON : TRANSPORT_LOAD);
detail.setMultimodal(Boolean.TRUE.equals(trip.getMultimodal()));
detail.setTripId(trip.getId());
detail.setLoadingNo(Func.toStr(trip.getLoadingNo(), ""));
detail.setTripNo(Func.toStr(trip.getTripNo(), ""));
@@ -504,6 +505,7 @@ public class ManageWaybillServiceImpl implements IManageWaybillService {
detail.setLoadingNo(loading.getLoadingNo());
detail.setTripNo(loading.getLoadingNo());
detail.setTransportOrgType(TRANSPORT_LOAD);
detail.setMultimodal(children.stream().anyMatch(child -> Func.isNotBlank(child.getMasterNo())));
detail.setViaName(TripStationAssembler.transitName(stations));
detail.setStationCount(stations.size());
detail.setStations(stations);
@@ -538,6 +540,7 @@ public class ManageWaybillServiceImpl implements IManageWaybillService {
detail.setTransportMode(Func.toStr(loading.getTransportType(), ""));
detail.setTransportType(toTransportTypeLabel(Func.toStr(loading.getTransportType(), "")));
detail.setTransportOrgType(TRANSPORT_LOAD);
detail.setMultimodal(children.stream().anyMatch(child -> Func.isNotBlank(child.getMasterNo())));
detail.setTripId(String.valueOf(loading.getId()));
detail.setLoadingNo(loading.getLoadingNo());
detail.setTripNo(loading.getLoadingNo());
@@ -777,6 +780,7 @@ public class ManageWaybillServiceImpl implements IManageWaybillService {
detail.setTransportMode(mode);
detail.setTransportType(toTransportTypeLabel(mode));
detail.setTransportOrgType(Func.isNotBlank(waybill.getLoadingNo()) ? TRANSPORT_LOAD : TRANSPORT_COMMON);
detail.setMultimodal(Func.isNotBlank(waybill.getMasterNo()));
detail.setFromName(formatPlaceName(waybill.getDepartureName(), mode));
detail.setToName(formatPlaceName(waybill.getArrivalName(), mode));
@@ -79,9 +79,10 @@ public class TripQueryServiceImpl implements ITripQueryService {
private static final int DEFAULT_PAGE_SIZE = 10;
private static final int MAX_PAGE_SIZE = 50;
/** 运输组织类型:有配载单为公路配载,否则普通运输 */
/** 运输类型:有配载单为配载运输,挂多联总单为多式联运,两者都没有为普通运输 */
private static final String TRANSPORT_LOAD = "load";
private static final String TRANSPORT_COMMON = "common";
private static final String TRANSPORT_MULTIMODAL = "multimodal";
/** 未配载运次的键前缀:与 TripAggregation.SQL_TRIP_KEY 的 W 前缀同一个口径 */
private static final String LONE_KEY_PREFIX = "W";
@@ -244,6 +245,8 @@ public class TripQueryServiceImpl implements ITripQueryService {
Waybill::getDepartureName, Waybill::getDepartureAddress, Waybill::getArrivalName,
Waybill::getArrivalAddress, Waybill::getDriverName, Waybill::getDriverPhone, Waybill::getVehicleNo,
Waybill::getCustomerName, Waybill::getTransportType, Waybill::getTaskRemark,
// 运输类型的三态靠它派生,行级筛选也按它判,必须随行取回
Waybill::getMasterNo,
// 未配载运次没有配载单可依,计划时间要取运单自己的,故必须随行取回
Waybill::getEstimatedStartTime, Waybill::getEstimatedEndTime, Waybill::getCreateTime)
.in(Waybill::getBusinessStatus, TripAggregation.CHILD_STATUSES)
@@ -285,14 +288,20 @@ public class TripQueryServiceImpl implements ITripQueryService {
}
/**
* 运输组织类型按子单行筛:它在同一趟车里必然是同一个值(配载的每张子单带同一个配载单号,
* 未配载的每张自成一趟车),所以这一层不会把一趟车拆开。
* 运输类型按子单行筛,三态分区且不重叠:普通 = 两列都空,配载 = 挂配载单且未挂总单,
* 多式联运 = 挂多联总单(不问有没有配载)。配载这一档必须排掉挂总单的行,
* 否则叠加态的行会同时落进两档。
* <p>
* 与配载/普通两档不同,多式联运在同一趟车里不保证是同一个值:一张配载单可以混装来自不同总单的运单,
* 这一档按行筛会把那趟车缩小成只命中总单的那几张子单。混装是少数,此处不为它另走整趟车判据。
*/
private void applyOrgTypeFilter(LambdaQueryWrapper<Waybill> wrapper, TripQueryVO condition) {
if (TRANSPORT_LOAD.equals(condition.getTransportOrgType())) {
wrapper.apply("IFNULL(loading_no, '') <> ''");
if (TRANSPORT_MULTIMODAL.equals(condition.getTransportOrgType())) {
wrapper.apply("IFNULL(master_no, '') <> ''");
} else if (TRANSPORT_LOAD.equals(condition.getTransportOrgType())) {
wrapper.apply("IFNULL(loading_no, '') <> '' AND IFNULL(master_no, '') = ''");
} else if (TRANSPORT_COMMON.equals(condition.getTransportOrgType())) {
wrapper.apply("IFNULL(loading_no, '') = ''");
wrapper.apply("IFNULL(loading_no, '') = '' AND IFNULL(master_no, '') = ''");
}
}
@@ -530,6 +539,8 @@ public class TripQueryServiceImpl implements ITripQueryService {
trip.setLoadingNo(loading.getLoadingNo());
trip.setTripNo(loading.getLoadingNo());
trip.setTransportOrgType(TRANSPORT_LOAD);
// 多式联运与配载可叠加:任一子单挂总单即算这趟车含多式联运
trip.setMultimodal(children.stream().anyMatch(child -> Func.isNotBlank(child.getMasterNo())));
trip.setDriverName(Func.toStr(loading.getDriverName(), ""));
trip.setDriverPhone(Func.toStr(loading.getDriverPhone(), ""));
trip.setVehicleNo(Func.toStr(loading.getVehicleNo(), ""));
@@ -562,6 +573,7 @@ public class TripQueryServiceImpl implements ITripQueryService {
trip.setId(tripIdOf(waybill.getId()));
trip.setTripNo(waybill.getWaybillNo());
trip.setTransportOrgType(TRANSPORT_COMMON);
trip.setMultimodal(Func.isNotBlank(waybill.getMasterNo()));
trip.setDriverName(Func.toStr(waybill.getDriverName(), ""));
trip.setDriverPhone(Func.toStr(waybill.getDriverPhone(), ""));
trip.setVehicleNo(Func.toStr(waybill.getVehicleNo(), ""));