From c0fd835365b7adb4d19b49858ce669d810114df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Fri, 17 Apr 2026 19:14:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UserApplicationService.java | 21 +++++++++++++++++-- .../interfaces/dto/addDTO/CustomerDTO.java | 1 - 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java index 3e9694159..900aa8caa 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java +++ b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java @@ -1319,7 +1319,10 @@ public class UserApplicationService { //组装新增用户信息 addUserInfoShipper(userDO); UserEntity userEntity = userDomainService.addUser(userDO); - if ((StringUtils.isEmpty(userEntity.getRoleCode()) || !RoleEnum.PLAT_ADMIN.getCode().equals(userEntity.getRoleCode())) && + // 客户管理(addCustomer 等)已指定 customer/supplier 并写入 user_role,不可再覆盖为默认货主 ownerCargo + if (isCustomerManagementPresetRole(userEntity.getRoleCode())) { + // 保持插入结果,不再改 role_code / user_role + } else if ((StringUtils.isEmpty(userEntity.getRoleCode()) || !RoleEnum.PLAT_ADMIN.getCode().equals(userEntity.getRoleCode())) && (userDO.getUserAccountType() == null || userDO.getUserAccountType() < 4)) { //给用户分配默认普通角色权限 RoleDo roleDo = new RoleDo(); @@ -1432,7 +1435,9 @@ public class UserApplicationService { //组装新增用户信息 addUserInfo(userDO); UserEntity userEntity = userDomainService.addUser(userDO); - if ((StringUtils.isEmpty(userEntity.getRoleCode()) || !RoleEnum.PLAT_ADMIN.getCode().equals(userEntity.getRoleCode())) && + if (isCustomerManagementPresetRole(userEntity.getRoleCode())) { + // 保持插入结果,不再改 role_code / user_role + } else if ((StringUtils.isEmpty(userEntity.getRoleCode()) || !RoleEnum.PLAT_ADMIN.getCode().equals(userEntity.getRoleCode())) && (userDO.getUserAccountType() == null || userDO.getUserAccountType() < 4)) { //给用户分配默认普通角色权限 RoleDo roleDo = new RoleDo(); @@ -5139,6 +5144,18 @@ public class UserApplicationService { return userShipperDO; } + /** + * 客户管理入口(如 addCustomer)已按 customer/supplier 写入角色与 user_role, + * addUser 内对「非 plat_admin」统一覆盖为默认货主时会误伤此类用户,需跳过覆盖。 + */ + private static boolean isCustomerManagementPresetRole(String roleCode) { + if (roleCode == null) { + return false; + } + return RoleEnum.CUSTOMER.getCode().equals(roleCode) + || RoleEnum.SUPPLIER.getCode().equals(roleCode); + } + /** * @return boolean * @description 判断是否开启仓配一体 diff --git a/mhd-user-center/src/main/java/com/mhd/user/interfaces/dto/addDTO/CustomerDTO.java b/mhd-user-center/src/main/java/com/mhd/user/interfaces/dto/addDTO/CustomerDTO.java index fb3fc2460..badac2c2e 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/interfaces/dto/addDTO/CustomerDTO.java +++ b/mhd-user-center/src/main/java/com/mhd/user/interfaces/dto/addDTO/CustomerDTO.java @@ -31,7 +31,6 @@ public class CustomerDTO extends BaseVOEntity { private String userName; @ApiModelProperty("联系人") - @NotBlank(message = "联系人不能为空") private String emergencyContactName; @ApiModelProperty("联系电话") From 3d235e48f6b0fff313b84d21edeb6f60e02a5ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Fri, 17 Apr 2026 19:31:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=93=E5=BA=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WarehouseApplicationService.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/warehouse/WarehouseApplicationService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/warehouse/WarehouseApplicationService.java index 4c8b96457..58c70ce15 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/warehouse/WarehouseApplicationService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/warehouse/WarehouseApplicationService.java @@ -2,9 +2,6 @@ package com.mhd.basic.application.service.warehouse; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO; -import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO; -import com.mhd.basic.domain.areaAggregate.service.SysProvinceCityCountyDomainService; import com.mhd.basic.domain.associationWarehouse.entity.AssociationWarehouse; import com.mhd.basic.domain.associationWarehouse.repository.facade.IAssociationWarehouseService; import com.mhd.basic.domain.warehouse.repository.po.WarehousePO; @@ -39,8 +36,6 @@ public class WarehouseApplicationService { @Autowired private ISysDictTypeService dictTypeService; @Autowired - private SysProvinceCityCountyDomainService sysProvinceCityCountyDomainService; - @Autowired private IAssociationWarehouseService associationWarehouseService; @@ -180,14 +175,20 @@ public class WarehouseApplicationService { } SysDictData warmLayerDictDataVo = warmLayerDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), warehouseDO.getWarmLayerCode())).findAny().orElse(null); if (null == warmLayerDictDataVo) { - throw new ServiceException("温层类型【" + warehouseDO.getWarehouseType() + "】数据字典不存在 请联系管理员"); + throw new ServiceException("温层类型【" + warehouseDO.getWarmLayerCode() + "】数据字典不存在 请联系管理员"); } warehouseDO.setWarmLayerName(warmLayerDictDataVo.getDictLabel()); - //翻译省市区 - SysProvinceCityCountyDO loadingProvinceCityCountyDO = new SysProvinceCityCountyDO(); - loadingProvinceCityCountyDO.setCountyCode(Long.parseLong(warehouseDO.getRegionCode())); - SysAreaPO sysAreaPO = sysProvinceCityCountyDomainService.findAreaInfo(loadingProvinceCityCountyDO); - warehouseDO.setRegionName(sysAreaPO.getProvinceCityCountyName()); + // 翻译省市区(已注释:不再根据 regionCode 回填 regionName) + /* + if (StrUtil.isNotBlank(warehouseDO.getRegionCode())) { + SysProvinceCityCountyDO loadingProvinceCityCountyDO = new SysProvinceCityCountyDO(); + loadingProvinceCityCountyDO.setCountyCode(Long.parseLong(warehouseDO.getRegionCode().trim())); + SysAreaPO sysAreaPO = sysProvinceCityCountyDomainService.findAreaInfo(loadingProvinceCityCountyDO); + if (sysAreaPO != null) { + warehouseDO.setRegionName(sysAreaPO.getProvinceCityCountyName()); + } + } + */ } /**