Merge remote-tracking branch 'base-version/main' into dev
This commit is contained in:
@@ -72,6 +72,7 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
IWorkHrSubcompanyPageRespVO.Subcompany sub = iterator.next();
|
IWorkHrSubcompanyPageRespVO.Subcompany sub = iterator.next();
|
||||||
if (shouldSkipByCanceled(sub.getCanceled(), options)) {
|
if (shouldSkipByCanceled(sub.getCanceled(), options)) {
|
||||||
|
logSkip("分部", sub.getSubcompanyid1(), "iWork 标记为失效且当前不同步失效记录");
|
||||||
result.increaseSkipped();
|
result.increaseSkipped();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
@@ -131,6 +132,7 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
IWorkHrDepartmentPageRespVO.Department dept = iterator.next();
|
IWorkHrDepartmentPageRespVO.Department dept = iterator.next();
|
||||||
if (shouldSkipByCanceled(dept.getCanceled(), options)) {
|
if (shouldSkipByCanceled(dept.getCanceled(), options)) {
|
||||||
|
logSkip("部门", dept.getId(), "iWork 标记为失效且当前不同步失效记录");
|
||||||
result.increaseSkipped();
|
result.increaseSkipped();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
@@ -186,6 +188,7 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (shouldSkipByCanceled(job.getCanceled(), options)) {
|
if (shouldSkipByCanceled(job.getCanceled(), options)) {
|
||||||
|
logSkip("岗位", job.getJobtitleid(), "iWork 标记为失效且当前不同步失效记录");
|
||||||
result.increaseSkipped();
|
result.increaseSkipped();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -224,6 +227,7 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
}
|
}
|
||||||
boolean inactive = isInactiveUser(user.getStatus());
|
boolean inactive = isInactiveUser(user.getStatus());
|
||||||
if (inactive && !options.isIncludeCanceled()) {
|
if (inactive && !options.isIncludeCanceled()) {
|
||||||
|
logSkip("人员", user.getId(), "用户状态为离职且当前不同步离职记录");
|
||||||
result.increaseSkipped();
|
result.increaseSkipped();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -246,16 +250,19 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
UserSyncOutcome outcome;
|
UserSyncOutcome outcome;
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
if (!options.isCreateIfMissing()) {
|
if (!options.isCreateIfMissing()) {
|
||||||
|
logSkip("人员", username, "系统未找到该账号且不同步缺失用户");
|
||||||
result.increaseSkipped();
|
result.increaseSkipped();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
outcome = createUser(user, username, deptId, postId, status);
|
outcome = createUser(user, username, deptId, postId, status);
|
||||||
} else {
|
} else {
|
||||||
if (!Objects.equals(existing.getUserSource(), UserSourceEnum.IWORK.getSource())) {
|
if (!Objects.equals(existing.getUserSource(), UserSourceEnum.IWORK.getSource())) {
|
||||||
|
logSkip("人员", existing.getId(), "非 iWork 来源用户,保持原状");
|
||||||
result.increaseSkipped();
|
result.increaseSkipped();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!options.isAllowUpdate()) {
|
if (!options.isAllowUpdate()) {
|
||||||
|
logSkip("人员", existing.getId(), "当前策略禁止更新已存在用户");
|
||||||
result.increaseSkipped();
|
result.increaseSkipped();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -281,6 +288,7 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
DeptDO existing = deptService.getDept(deptId);
|
DeptDO existing = deptService.getDept(deptId);
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
if (!options.isCreateIfMissing()) {
|
if (!options.isCreateIfMissing()) {
|
||||||
|
logSkip("部门", deptId, "当前策略禁止创建缺失部门");
|
||||||
return new DeptSyncOutcome(SyncAction.SKIPPED, false, null);
|
return new DeptSyncOutcome(SyncAction.SKIPPED, false, null);
|
||||||
}
|
}
|
||||||
desired.setId(deptId);
|
desired.setId(deptId);
|
||||||
@@ -288,9 +296,11 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
return new DeptSyncOutcome(SyncAction.CREATED, CommonStatusEnum.isDisable(desired.getStatus()), createdId);
|
return new DeptSyncOutcome(SyncAction.CREATED, CommonStatusEnum.isDisable(desired.getStatus()), createdId);
|
||||||
}
|
}
|
||||||
if (!Objects.equals(existing.getDeptSource(), DeptSourceEnum.IWORK.getSource())) {
|
if (!Objects.equals(existing.getDeptSource(), DeptSourceEnum.IWORK.getSource())) {
|
||||||
|
logSkip("部门", existing.getId(), "来源非 iWork,保持原状");
|
||||||
return new DeptSyncOutcome(SyncAction.SKIPPED, false, existing.getId());
|
return new DeptSyncOutcome(SyncAction.SKIPPED, false, existing.getId());
|
||||||
}
|
}
|
||||||
if (!options.isAllowUpdate()) {
|
if (!options.isAllowUpdate()) {
|
||||||
|
logSkip("部门", existing.getId(), "当前策略禁止更新已存在部门");
|
||||||
return new DeptSyncOutcome(SyncAction.SKIPPED, false, existing.getId());
|
return new DeptSyncOutcome(SyncAction.SKIPPED, false, existing.getId());
|
||||||
}
|
}
|
||||||
desired.setId(existing.getId());
|
desired.setId(existing.getId());
|
||||||
@@ -309,6 +319,7 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
boolean disabled = CommonStatusEnum.isDisable(status);
|
boolean disabled = CommonStatusEnum.isDisable(status);
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
if (!options.isCreateIfMissing()) {
|
if (!options.isCreateIfMissing()) {
|
||||||
|
logSkip("岗位", job.getJobtitleid(), "当前策略禁止创建缺失岗位");
|
||||||
return new JobSyncOutcome(SyncAction.SKIPPED, false, null);
|
return new JobSyncOutcome(SyncAction.SKIPPED, false, null);
|
||||||
}
|
}
|
||||||
PostSaveReqVO createReq = new PostSaveReqVO();
|
PostSaveReqVO createReq = new PostSaveReqVO();
|
||||||
@@ -334,6 +345,7 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
return new JobSyncOutcome(SyncAction.CREATED, disabled, effectivePostId);
|
return new JobSyncOutcome(SyncAction.CREATED, disabled, effectivePostId);
|
||||||
}
|
}
|
||||||
if (!options.isAllowUpdate()) {
|
if (!options.isAllowUpdate()) {
|
||||||
|
logSkip("岗位", existing.getId(), "当前策略禁止更新已存在岗位");
|
||||||
return new JobSyncOutcome(SyncAction.SKIPPED, false, existing.getId());
|
return new JobSyncOutcome(SyncAction.SKIPPED, false, existing.getId());
|
||||||
}
|
}
|
||||||
PostSaveReqVO updateReq = new PostSaveReqVO();
|
PostSaveReqVO updateReq = new PostSaveReqVO();
|
||||||
@@ -678,6 +690,12 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void logSkip(String entityLabel, Object identifier, String reason) {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("[iWork] {}[id={}] 跳过:{}", entityLabel, identifier, reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private record ParentHolder(Long parentId) {
|
private record ParentHolder(Long parentId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user