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(), "客户合同不能为空");