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

View File

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

View File

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