1. 统一 iwork 的同步组织代码生成逻辑
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -84,13 +84,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
validateParentDept(null, createReqVO.getParentId());
|
||||
// 校验部门名的唯一性
|
||||
validateDeptNameUnique(null, createReqVO.getParentId(), createReqVO.getName());
|
||||
// 生成并校验部门编码
|
||||
boolean isIWorkSource = Objects.equals(createReqVO.getDeptSource(), DeptSourceEnum.IWORK.getSource());
|
||||
if (isIWorkSource) {
|
||||
// iWork 来源直接使用提供的编码,不再生成
|
||||
String providedCode = StrUtil.blankToDefault(createReqVO.getCode(), null);
|
||||
createReqVO.setCode(providedCode);
|
||||
} else {
|
||||
// 生成并校验部门编码(所有来源统一走生成逻辑,iWork 不再豁免)
|
||||
if (Boolean.TRUE.equals(createReqVO.getDelayCodeGeneration())) {
|
||||
createReqVO.setCode(null);
|
||||
} else {
|
||||
@@ -98,7 +92,6 @@ public class DeptServiceImpl implements DeptService {
|
||||
validateDeptCodeUnique(null, resolvedCode);
|
||||
createReqVO.setCode(resolvedCode);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入部门
|
||||
DeptDO dept = BeanUtils.toBean(createReqVO, DeptDO.class);
|
||||
@@ -127,12 +120,6 @@ public class DeptServiceImpl implements DeptService {
|
||||
validateParentDept(updateReqVO.getId(), updateReqVO.getParentId());
|
||||
// 校验部门名的唯一性
|
||||
validateDeptNameUnique(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName());
|
||||
boolean isIWorkSource = Objects.equals(originalDept.getDeptSource(), DeptSourceEnum.IWORK.getSource());
|
||||
if (isIWorkSource) {
|
||||
// iWork 来源直接使用提供的编码,不再生成
|
||||
String providedCode = StrUtil.blankToDefault(updateReqVO.getCode(), originalDept.getCode());
|
||||
updateReqVO.setCode(providedCode);
|
||||
} else {
|
||||
Integer source = ObjectUtil.defaultIfNull(updateReqVO.getDeptSource(), originalDept.getDeptSource());
|
||||
if (source == null) {
|
||||
source = DeptSourceEnum.EXTERNAL.getSource();
|
||||
@@ -149,7 +136,6 @@ public class DeptServiceImpl implements DeptService {
|
||||
} else {
|
||||
updateReqVO.setCode(existingCode);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新部门
|
||||
DeptDO updateObj = BeanUtils.toBean(updateReqVO, DeptDO.class);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user