From 683351d7642c9c714163cb9bf52fce9b53009150 Mon Sep 17 00:00:00 2001 From: b2894lxlx <517289602@qq.com> Date: Sun, 4 Oct 2026 20:26:16 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=94=BE=E5=BC=80=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E7=B1=BB=E5=9E=8B=E5=B1=82=E7=BA=A7=E7=BA=A6=E6=9D=9F?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=BF=AE=E5=A4=8D=E8=B0=83=E5=BA=A6=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E5=8D=95=E4=BD=8D=E5=9B=9E=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 组织树不再按类型约束上下级;计量维度扩展整车/里程/吨·公里;运单从货物明细补齐数量单位,用户查询支持模糊匹配。 Co-authored-by: Cursor --- .../springblade/system/mapper/UserMapper.xml | 9 ++- .../system/service/impl/DeptServiceImpl.java | 25 +------ .../impl/MeasurementUnitServiceImpl.java | 2 +- .../service/impl/WaybillServiceImpl.java | 69 ++++++++++++++++++- 4 files changed, 77 insertions(+), 28 deletions(-) diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/UserMapper.xml b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/UserMapper.xml index 70dd2e9a..79fcb79f 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/UserMapper.xml +++ b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/UserMapper.xml @@ -44,13 +44,16 @@ and bu.tenant_id = #{user.tenantId} - and bu.account = #{user.account} + and bu.account like concat(concat('%', #{user.account}), '%') - and bu.real_name = #{user.realName} + and bu.real_name like concat(concat('%', #{user.realName}), '%') - and bu.phone = #{user.phone} + and ( + bu.phone like concat(concat('%', #{user.phone}), '%') + or bu.account like concat(concat('%', #{user.phone}), '%') + ) and bu.user_type = #{user.userType} diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java index a07ec19c..d94020a4 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java @@ -437,7 +437,7 @@ public class DeptServiceImpl extends ServiceImpl implements ID if (Func.isEmpty(dept.getTenantId())) { throw new ServiceException("租户ID不能为空"); } - validateDeptCategory(dept, parent); + validateDeptCategory(dept); validateDeptCode(dept, parent); return saveOrUpdate(dept); } @@ -619,27 +619,8 @@ public class DeptServiceImpl extends ServiceImpl implements ID return "Basic " + value; } - private void validateDeptCategory(Dept dept, Dept parent) { - // 顶级组织不要求选择上级组织 - if (parent == null) { - if (Integer.valueOf(6).equals(dept.getDeptCategory()) && Func.isEmpty(dept.getCarrierCustomerId())) { - throw new ServiceException("请选择承运商"); - } - return; - } - List allowedCategories; - if (BladeConstant.TOP_PARENT_ID.equals(parent.getParentId())) { - allowedCategories = "外部组织".equals(parent.getDeptName()) ? List.of(6) : List.of(1); - } else if (Integer.valueOf(1).equals(parent.getDeptCategory())) { - allowedCategories = List.of(2, 3); - } else if (List.of(2, 3).contains(parent.getDeptCategory())) { - allowedCategories = List.of(4, 5, 6); - } else { - throw new ServiceException("上级组织层级不支持新增下级组织"); - } - if (!allowedCategories.contains(dept.getDeptCategory())) { - throw new ServiceException("组织类型不符合上级组织层级规则"); - } + private void validateDeptCategory(Dept dept) { + // 组织树层级仅由 parentId / ancestors 决定,组织类型不再做上下级约束 if (Integer.valueOf(6).equals(dept.getDeptCategory()) && Func.isEmpty(dept.getCarrierCustomerId())) { throw new ServiceException("请选择承运商"); } diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/MeasurementUnitServiceImpl.java b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/MeasurementUnitServiceImpl.java index df18f4f4..4c43c474 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/MeasurementUnitServiceImpl.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/MeasurementUnitServiceImpl.java @@ -50,7 +50,7 @@ public class MeasurementUnitServiceImpl extends BaseServiceImpl DIMENSIONS = Set.of("重量", "体积", "数量"); + private static final Set DIMENSIONS = Set.of("重量", "体积", "数量", "整车", "里程", "吨·公里"); @Override public IPage selectMeasurementUnitPage(IPage page, diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/WaybillServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/WaybillServiceImpl.java index 4d2217c6..5da21fac 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/WaybillServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/WaybillServiceImpl.java @@ -1458,7 +1458,9 @@ public class WaybillServiceImpl extends BaseServiceImpl } /** - * 完整录入多货物时,运单主表 quantity 按 goodsJson 数量合计回写,避免只落首行数量。 + * 从 goodsJson 回写运单主表货物字段: + * 1. 顶层数量单位 / 货物名称 / 货物类型为空时,取首条有效货物补齐; + * 2. 完整录入多货物时,数量按 goodsJson 合计回写。 */ private void syncQuantityFromGoodsJson(Waybill waybill) { if (waybill == null || Func.isEmpty(waybill.getGoodsJson())) { @@ -1470,7 +1472,53 @@ public class WaybillServiceImpl extends BaseServiceImpl } catch (Exception exception) { return; } - if (Func.isEmpty(goodsList) || goodsList.size() <= 1) { + if (Func.isEmpty(goodsList)) { + return; + } + Map firstGoods = null; + for (Map goods : goodsList) { + if (goods == null) { + continue; + } + firstGoods = goods; + break; + } + if (firstGoods != null) { + if (Func.isEmpty(waybill.getQuantityUnit())) { + String quantityUnit = firstNonBlank(firstGoods, "quantityUnit", "goodsQuantityUnit", "unit"); + if (Func.isNotEmpty(quantityUnit)) { + waybill.setQuantityUnit(quantityUnit); + } + } + if (Func.isEmpty(waybill.getCargoName())) { + String cargoName = firstNonBlank(firstGoods, "cargoName", "goodsName"); + if (Func.isNotEmpty(cargoName)) { + waybill.setCargoName(cargoName); + } + } + if (Func.isEmpty(waybill.getCargoType())) { + String cargoType = firstNonBlank(firstGoods, "cargoType", "goodsType"); + if (Func.isNotEmpty(cargoType)) { + waybill.setCargoType(cargoType); + } + } + if (waybill.getQuantity() == null && goodsList.size() == 1) { + Object quantityValue = firstGoods.get("quantity"); + if (quantityValue == null) { + quantityValue = firstGoods.get("cargoQuantity"); + } + if (quantityValue == null) { + quantityValue = firstGoods.get("goodsQuantity"); + } + if (quantityValue != null && Func.isNotEmpty(String.valueOf(quantityValue).trim())) { + BigDecimal quantity = new BigDecimal(String.valueOf(quantityValue).trim()); + if (!isSentinelMinusOne(quantity)) { + waybill.setQuantity(quantity); + } + } + } + } + if (goodsList.size() <= 1) { return; } BigDecimal total = BigDecimal.ZERO; @@ -1491,6 +1539,23 @@ public class WaybillServiceImpl extends BaseServiceImpl } } + private String firstNonBlank(Map goods, String... keys) { + if (goods == null || keys == null) { + return null; + } + for (String key : keys) { + Object value = goods.get(key); + if (value == null) { + continue; + } + String text = String.valueOf(value).trim(); + if (Func.isNotEmpty(text)) { + return text; + } + } + return null; + } + private void validate(Waybill waybill) { TransportBusinessSupport.validateRequired(waybill.getProjectName(), "项目不能为空"); TransportBusinessSupport.validateRequired(waybill.getContractName(), "客户合同不能为空");