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
@@ -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 {
}
/**
* 递归校验上级部门
*