Merge remote-tracking branch 'base-version/main' into dev

This commit is contained in:
chenbowen
2025-11-25 23:27:01 +08:00
5 changed files with 149 additions and 157 deletions

View File

@@ -189,7 +189,7 @@ public class DeptServiceImpl implements DeptService {
// 2. 父部门不存在
DeptDO parentDept = deptMapper.selectById(parentId);
if (parentDept == null) {
throw exception(DEPT_PARENT_NOT_EXITS);
return;
}
// 3. 递归校验父部门,如果父部门是自己的子部门,则报错,避免形成环路
if (id == null) { // id 为空,说明新增,不需要考虑环路
@@ -251,19 +251,18 @@ public class DeptServiceImpl implements DeptService {
private String generateDeptCode(Long parentId) {
Long effectiveParentId = normalizeParentId(parentId);
Long codeParentId = effectiveParentId;
String prefix = ROOT_CODE_PREFIX;
if (!DeptDO.PARENT_ID_ROOT.equals(effectiveParentId)) {
DeptDO parentDept = deptMapper.selectById(effectiveParentId);
if (parentDept == null) {
throw exception(DEPT_PARENT_NOT_EXITS);
}
if (StrUtil.isBlank(parentDept.getCode())) {
throw exception(DEPT_PARENT_CODE_NOT_INITIALIZED);
}
if (parentDept == null || StrUtil.isBlank(parentDept.getCode())) {
codeParentId = DeptDO.PARENT_ID_ROOT;
} else {
prefix = parentDept.getCode();
}
}
int nextSequence = determineNextSequence(effectiveParentId, prefix);
int nextSequence = determineNextSequence(codeParentId, prefix);
assertSequenceRange(nextSequence);
return prefix + formatSequence(nextSequence);
}

View File

@@ -38,18 +38,21 @@ public class IWorkSyncServiceImpl implements IWorkSyncService {
respVO.setBatches(batchStats);
Set<IWorkSyncEntityTypeEnum> scopes = reqVO.resolveScopes();
boolean syncUsers = scopes.contains(IWorkSyncEntityTypeEnum.USER);
boolean syncDepartments = scopes.contains(IWorkSyncEntityTypeEnum.DEPARTMENT) || syncUsers;
boolean syncSubcompanies = scopes.contains(IWorkSyncEntityTypeEnum.SUBCOMPANY) || syncDepartments;
int processedPages = 0;
IWorkSyncProcessor.SyncOptions options = buildFullSyncOptions(reqVO);
if (scopes.contains(IWorkSyncEntityTypeEnum.SUBCOMPANY)) {
if (syncSubcompanies) {
processedPages += executeSubcompanyFullSync(reqVO, options, respVO.getSubcompanyStat(), batchStats);
}
if (scopes.contains(IWorkSyncEntityTypeEnum.DEPARTMENT)) {
if (syncDepartments) {
processedPages += executeDepartmentFullSync(reqVO, options, respVO.getDepartmentStat(), batchStats);
}
if (scopes.contains(IWorkSyncEntityTypeEnum.JOB_TITLE)) {
processedPages += executeJobTitleFullSync(reqVO, options, respVO.getJobTitleStat(), batchStats);
}
if (scopes.contains(IWorkSyncEntityTypeEnum.USER)) {
if (syncUsers) {
processedPages += executeUserFullSync(reqVO, options, respVO.getUserStat(), batchStats);
}
respVO.setProcessedPages(processedPages);

View File

@@ -523,8 +523,6 @@ public class AdminUserServiceImpl implements AdminUserService {
validateMobileUnique(id, mobile);
// 校验邮箱唯一
validateEmailUnique(id, email);
// 校验部门处于开启状态
deptService.validateDeptList(deptIds);
// 校验岗位处于开启状态
postService.validatePostList(postIds);
return user;