✨ 运单搜索关键字支持项目名与司机名
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@ public class TripQueryVO implements Serializable {
|
||||
@Schema(description = "多档状态:同上取值,非空时优先于 status(待处理列表要待接单与进行中两档)")
|
||||
private List<Integer> statuses;
|
||||
|
||||
@Schema(description = "关键字:运单号 / 配载单号 / 起终点 / 车牌")
|
||||
@Schema(description = "关键字:运单号 / 配载单号 / 项目 / 司机 / 车牌 / 起终点 / 地址(任一子单命中即整趟车命中)")
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "运输组织类型:load 公路配载 / common 普通运输,不传为全部(按子单行筛选)")
|
||||
|
||||
+3
-3
@@ -92,7 +92,7 @@ public class DriverWaybillController extends BladeController {
|
||||
@Parameter(description = "当前页") @RequestParam(required = false) Integer current,
|
||||
@Parameter(description = "每页条数") @RequestParam(required = false) Integer size,
|
||||
@Parameter(description = "状态:0待接单/1运输中/2已完成,不传为全部") @RequestParam(required = false) String status,
|
||||
@Parameter(description = "关键字:运单号/起终点") @RequestParam(required = false) String keyword) {
|
||||
@Parameter(description = "关键字:运单号/配载单号/项目/司机/车牌/起终点/地址") @RequestParam(required = false) String keyword) {
|
||||
Integer statusCode = parseStatus(status);
|
||||
return R.data(driverWaybillService.page(current, size, statusCode, keyword));
|
||||
}
|
||||
@@ -129,12 +129,12 @@ public class DriverWaybillController extends BladeController {
|
||||
|
||||
@GetMapping("/task/page")
|
||||
@ApiOperationSupport(order = 24)
|
||||
@Operation(summary = "运次分页列表", description = "一页即若干个运次;status:空=全部,0待接单,1运输中,2已完成;keyword 支持运单号/配载单号/起终点/车牌")
|
||||
@Operation(summary = "运次分页列表", description = "一页即若干个运次;status:空=全部,0待接单,1运输中,2已完成;keyword 支持运单号/配载单号/项目/司机/车牌/起终点/地址")
|
||||
public R<IPage<DriverWaybillCardVO>> tripPage(
|
||||
@Parameter(description = "当前页") @RequestParam(required = false) Integer current,
|
||||
@Parameter(description = "每页运次数") @RequestParam(required = false) Integer size,
|
||||
@Parameter(description = "状态:0待接单/1运输中/2已完成,不传为全部") @RequestParam(required = false) String status,
|
||||
@Parameter(description = "关键字:运单号/配载单号/起终点/车牌") @RequestParam(required = false) String keyword) {
|
||||
@Parameter(description = "关键字:运单号/配载单号/项目/司机/车牌/起终点/地址") @RequestParam(required = false) String keyword) {
|
||||
Integer statusCode = parseStatus(status);
|
||||
return R.data(driverWaybillService.tripPage(current, size, statusCode, keyword));
|
||||
}
|
||||
|
||||
+2
-2
@@ -88,7 +88,7 @@ public class ManageWaybillController extends BladeController {
|
||||
public R<IPage<AdminWaybillCardVO>> list(
|
||||
@Parameter(description = "当前页") @RequestParam(required = false) Integer current,
|
||||
@Parameter(description = "每页条数") @RequestParam(required = false) Integer size,
|
||||
@Parameter(description = "关键字:运单号/司机/车牌") @RequestParam(required = false) String keyword,
|
||||
@Parameter(description = "关键字:运单号/配载单号/项目/司机/车牌/起终点/地址") @RequestParam(required = false) String keyword,
|
||||
@Parameter(description = "状态:0待接单/1运输中/2已完成,不传为全部") @RequestParam(required = false) String status,
|
||||
@Parameter(description = "异常:exception有异常/normal无异常") @RequestParam(required = false) String exception,
|
||||
@Parameter(description = "运输组织:common普通/load配载") @RequestParam(required = false) String transportType,
|
||||
@@ -112,7 +112,7 @@ public class ManageWaybillController extends BladeController {
|
||||
public R<IPage<AdminWaybillCardVO>> pending(
|
||||
@Parameter(description = "当前页") @RequestParam(required = false) Integer current,
|
||||
@Parameter(description = "每页条数") @RequestParam(required = false) Integer size,
|
||||
@Parameter(description = "关键字:运单号/司机/车牌") @RequestParam(required = false) String keyword,
|
||||
@Parameter(description = "关键字:运单号/配载单号/项目/司机/车牌/起终点/地址") @RequestParam(required = false) String keyword,
|
||||
@Parameter(description = "是否需重新派单") @RequestParam(required = false) Boolean needReassign) {
|
||||
return R.data(manageWaybillService.pendingList(current, size, keyword, needReassign));
|
||||
}
|
||||
|
||||
+7
-2
@@ -726,13 +726,18 @@ public class ManageWaybillServiceImpl implements IManageWaybillService {
|
||||
return loading == null || loading.getId() == null ? fallback : loading.getId();
|
||||
}
|
||||
|
||||
/** 分组查询的关键字:运单号 / 司机 / 车牌,与列表关键字口径一致 */
|
||||
/**
|
||||
* 分组查询的关键字:逐行模糊匹配运单号 / 司机 / 车牌 / 项目。
|
||||
* <p>
|
||||
* 这里是逐行 LIKE,不是运次级匹配:命中哪一行只决定这趟车要不要出现,不缩小它的子单集合。
|
||||
*/
|
||||
private void applyGroupKeyword(QueryWrapper<Waybill> wrapper, String keyword) {
|
||||
if (Func.isBlank(keyword)) {
|
||||
return;
|
||||
}
|
||||
String key = keyword.trim();
|
||||
wrapper.and(w -> w.like("waybill_no", key).or().like("driver_name", key).or().like("vehicle_no", key));
|
||||
wrapper.and(w -> w.like("waybill_no", key).or().like("driver_name", key)
|
||||
.or().like("vehicle_no", key).or().like("project_name", key));
|
||||
}
|
||||
|
||||
private boolean hasExceptionIds(Waybill waybill, Set<Long> exceptionWaybillIds) {
|
||||
|
||||
+6
-2
@@ -90,10 +90,14 @@ public class TripQueryServiceImpl implements ITripQueryService {
|
||||
private static final String EXCEPTION_YES = "exception";
|
||||
private static final String EXCEPTION_NO = "normal";
|
||||
|
||||
/** 关键字在子单上匹配的字段 */
|
||||
/**
|
||||
* 关键字在子单上匹配的字段。
|
||||
* <p>
|
||||
* project_name 是运单创建时写入的快照列:项目改名后旧运单仍是旧名,按新名搜不到这些单。
|
||||
*/
|
||||
private static final String[] KEYWORD_COLUMNS = {
|
||||
"waybill_no", "loading_no", "departure_name", "arrival_name",
|
||||
"departure_address", "arrival_address", "vehicle_no"
|
||||
"departure_address", "arrival_address", "vehicle_no", "driver_name", "project_name"
|
||||
};
|
||||
|
||||
private final IWaybillService waybillService;
|
||||
|
||||
+2
@@ -221,6 +221,8 @@ class TripQueryServiceImplTest {
|
||||
String keywordSql = capturedKeywordSql();
|
||||
assertTrue(keywordSql.contains("waybill_no LIKE ?"), "关键字在子单上找:" + keywordSql);
|
||||
assertTrue(keywordSql.contains("loading_no LIKE ?"), keywordSql);
|
||||
assertTrue(keywordSql.contains("driver_name LIKE ?"), "司机名也参与匹配:" + keywordSql);
|
||||
assertTrue(keywordSql.contains("project_name LIKE ?"), "项目名(运单上的快照列)也参与匹配:" + keywordSql);
|
||||
assertEquals(2, trip.getWaybillCount(), "整趟车的子单都留着,不按命中的那一张缩小");
|
||||
assertTrue(capturedRowSql().contains("loading_no IN ("), "命中的运次键换成配载单号下发:" + capturedRowSql());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user