1、禅道#948问题修复:新增/编辑部门父级部门状态判断;2、用户手机已认证提示优化;

This commit is contained in:
gaoqr
2025-03-31 15:47:13 +08:00
parent 87dc134c4d
commit 3c28e104d8
2 changed files with 20 additions and 5 deletions
@@ -59,7 +59,7 @@ public class ErrorCodeConstants {
public static final ErrorCode INSUFFICIENT_PERMISSIONS = new ErrorCode(1_002_003_014, "当前用户权限不足,无法修改开料状态");
public static final ErrorCode USERNAME_MULTIPLE_ERROR = new ErrorCode(1_002_003_015,"存在【{}】重复用户,请联系系统管理员");
public static final ErrorCode USER_OPERATE_SELF_STATUS_ERROR = new ErrorCode(1_002_003_016, "不允许操作用户自身状态");
public static final ErrorCode USER_MOBILE_UPDATE_NOT_ALLOW_ERROR = new ErrorCode(1_002_003_017, "该用户已通过手机号认证设置密码,不允许在用户管理修改手机号,如需修改请前往个人中心");
public static final ErrorCode USER_MOBILE_UPDATE_NOT_ALLOW_ERROR = new ErrorCode(1_002_003_017, "该用户已通过手机号认证,如需修改手机号请前往个人中心");
// ========== 部门模块 1-002-004-000 ==========
public static final ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "已经存在该名字的部门");
@@ -74,6 +74,7 @@ public class ErrorCodeConstants {
public static final ErrorCode PARENT_DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_009, "不允许操作用户自身部门及其上级部门");
public static final ErrorCode DEPT_DISABLE = new ErrorCode(1_002_004_010, "部门({})已被禁用");
public static final ErrorCode DEPT_NOT_ALLOWED_LOGIN = new ErrorCode(1_002_004_011, "部门({})已被禁用,无法登录");
public static final ErrorCode PARENT_DEPT_DISABLE = new ErrorCode(1_002_004_012, "上级部门({})已被禁用,请开启后操作或选择其他上级部门");
// ========== 岗位模块 1-002-005-000 ==========
@@ -194,6 +194,9 @@ public class DeptServiceImpl implements DeptService {
if (parentDept == null) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
}
// 2.1 父部门状态校验
checkParentStatus(parentDept.getStatus(), parentDept.getName());
// 3. 递归校验父部门,如果父部门是自己的子部门,则报错,避免形成环路
if (id == null) { // id 为空,说明新增,不需要考虑环路
return;
@@ -212,6 +215,20 @@ public class DeptServiceImpl implements DeptService {
if (parentDept == null) {
break;
}
// 3.3 父部门状态校验
checkParentStatus(parentDept.getStatus(), parentDept.getName());
}
}
/**
* 校验上级部门是否开启
*
* @param status
* @param parentName
*/
private void checkParentStatus(Integer status, String parentName) {
if (!CommonStatusEnum.ENABLE.getStatus().equals(status)) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.PARENT_DEPT_DISABLE, parentName);
}
}
@@ -312,7 +329,7 @@ public class DeptServiceImpl implements DeptService {
// 用户登陆时部门校验,部门不存在时也可以进行登录
@Override
public void validUserLoginDept(Long deptId){
public void validUserLoginDept(Long deptId) {
DeptDO deptDO = deptMapper.selectById(deptId);
if (deptDO == null) {
return;
@@ -325,9 +342,6 @@ public class DeptServiceImpl implements DeptService {
}
/**
* 递归校验上级部门
*