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

This commit is contained in:
chenbowen
2025-11-26 13:46:02 +08:00
2 changed files with 32 additions and 12 deletions

View File

@@ -5,11 +5,10 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.zt.plat.module.system.service.integration.iwork.jackson.LenientIntegerDeserializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import com.zt.plat.module.system.service.integration.iwork.jackson.LenientIntegerDeserializer;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
@@ -51,8 +50,8 @@ public class IWorkHrJobTitlePageRespVO {
public static class JobTitle {
@Schema(description = "岗位 ID")
@JsonProperty("jobtitleid")
private Integer jobtitleid;
@JsonProperty("id")
private Integer id;
@Schema(description = "岗位编码")
@JsonProperty("jobtitlecode")

View File

@@ -181,24 +181,24 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
continue;
}
if (shouldSkipByCanceled(job.getCanceled(), options)) {
logSkip("岗位", job.getJobtitleid(), "iWork 标记为失效且当前不同步失效记录");
logSkip("岗位", job.getId(), "iWork 标记为失效且当前不同步失效记录");
result.increaseSkipped();
continue;
}
if (job.getJobtitleid() == null) {
if (job.getId() == null) {
log.warn("[iWork] 岗位缺少标识,跳过:{}", job.getJobtitlename());
result.increaseFailed();
continue;
}
boolean canceled = isCanceledFlag(job.getCanceled());
Integer status = toStatus(canceled);
String code = buildJobCode(job.getJobtitleid());
String code = buildJobCode(job.getId());
String name = limitLength(StrUtil.blankToDefault(job.getJobtitlename(), code), 50);
try {
JobSyncOutcome outcome = upsertJobTitle(job, code, name, status, options);
applyJobOutcome(result, outcome, name);
} catch (Exception ex) {
log.error("[iWork] 同步岗位失败: id={} name={}", job.getJobtitleid(), job.getJobtitlename(), ex);
log.error("[iWork] 同步岗位失败: id={} name={}", job.getId(), job.getJobtitlename(), ex);
result.increaseFailed();
result.withMessage("同步岗位失败: " + ex.getMessage());
}
@@ -307,11 +307,11 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
boolean disabled = CommonStatusEnum.isDisable(status);
if (existing == null) {
if (!options.isCreateIfMissing()) {
logSkip("岗位", job.getJobtitleid(), "当前策略禁止创建缺失岗位");
logSkip("岗位", job.getId(), "当前策略禁止创建缺失岗位");
return new JobSyncOutcome(SyncAction.SKIPPED, false, null);
}
PostSaveReqVO createReq = new PostSaveReqVO();
Long desiredId = job.getJobtitleid() == null ? null : job.getJobtitleid().longValue();
Long desiredId = job.getId() == null ? null : job.getId().longValue();
if (desiredId != null) {
createReq.setId(desiredId);
}
@@ -583,10 +583,31 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
}
private Integer resolveSex(String sexFlag) {
if (StrUtil.isBlank(sexFlag)) {
return SexEnum.UNKNOWN.getSex();
}
Integer external = parseInteger(sexFlag);
if (external != null) {
Integer converted = SyncVerifyUtil.convertExternalToInternal(external);
return converted != null ? converted : SexEnum.UNKNOWN.getSex();
}
String normalized = sexFlag.trim();
if (isMaleFlag(normalized)) {
return SexEnum.MALE.getSex();
}
if (isFemaleFlag(normalized)) {
return SexEnum.FEMALE.getSex();
}
return SexEnum.UNKNOWN.getSex();
}
private boolean isMaleFlag(String value) {
return "".equals(value) || "M".equalsIgnoreCase(value) || "MALE".equalsIgnoreCase(value);
}
private boolean isFemaleFlag(String value) {
return "".equals(value) || "F".equalsIgnoreCase(value) || "FEMALE".equalsIgnoreCase(value);
}
private Integer parseInteger(String raw) {
if (StrUtil.isBlank(raw)) {