|
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.logging.Level;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -51,7 +52,9 @@ public class TmDepartmentServiceImpl extends ServiceImpl<ITmDepartmentMapper, Tm
|
|
|
if(!checkDeptNameUnique(dept.getName(),null)){
|
|
|
throw new BusinessException(ResultCode.DEPT_NAME_EXITS);
|
|
|
}
|
|
|
- //TmDepartment info = this.getById(dept.getParentId());
|
|
|
+ if(dept.getLevel() >4){
|
|
|
+ throw new BusinessException(ResultCode.DEPT_ADD_ERROR);
|
|
|
+ }
|
|
|
dept.setId(IdPreEnum.DEPARTMENT_PRE.getPre() +IdUtil.getSnowflake(1).nextId() );
|
|
|
//dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
|
|
dept.setCreatorId((String) StpUtil.getLoginId());
|
|
@@ -66,6 +69,9 @@ public class TmDepartmentServiceImpl extends ServiceImpl<ITmDepartmentMapper, Tm
|
|
|
if(dept.getId().equals(dept.getParentId())){
|
|
|
throw new BusinessException(ResultCode.DEPT_EDIT_ERROR);
|
|
|
}
|
|
|
+ if(dept.getLevel() >4){
|
|
|
+ throw new BusinessException(ResultCode.DEPT_ADD_ERROR);
|
|
|
+ }
|
|
|
List<TmDepartment> sonByDeptId = this.getSonByDeptId(dept.getId());
|
|
|
if(sonByDeptId.size() >0){
|
|
|
List<String> collect = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
|