Merge remote-tracking branch 'origin/dev_WMS20260401' into dev_WMS20260401

This commit is contained in:
王奎兴
2026-04-17 19:34:48 +08:00
3 changed files with 31 additions and 14 deletions
@@ -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());
}
}
*/
}
/**
@@ -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 判断是否开启仓配一体
@@ -31,7 +31,6 @@ public class CustomerDTO extends BaseVOEntity {
private String userName;
@ApiModelProperty("联系人")
@NotBlank(message = "联系人不能为空")
private String emergencyContactName;
@ApiModelProperty("联系电话")