Merge remote-tracking branch 'base-version/main' into dev
This commit is contained in:
@@ -5,11 +5,10 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import com.zt.plat.module.system.service.integration.iwork.jackson.LenientIntegerDeserializer;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -51,8 +50,8 @@ public class IWorkHrJobTitlePageRespVO {
|
|||||||
public static class JobTitle {
|
public static class JobTitle {
|
||||||
|
|
||||||
@Schema(description = "岗位 ID")
|
@Schema(description = "岗位 ID")
|
||||||
@JsonProperty("jobtitleid")
|
@JsonProperty("id")
|
||||||
private Integer jobtitleid;
|
private Integer id;
|
||||||
|
|
||||||
@Schema(description = "岗位编码")
|
@Schema(description = "岗位编码")
|
||||||
@JsonProperty("jobtitlecode")
|
@JsonProperty("jobtitlecode")
|
||||||
|
|||||||
@@ -181,24 +181,24 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (shouldSkipByCanceled(job.getCanceled(), options)) {
|
if (shouldSkipByCanceled(job.getCanceled(), options)) {
|
||||||
logSkip("岗位", job.getJobtitleid(), "iWork 标记为失效且当前不同步失效记录");
|
logSkip("岗位", job.getId(), "iWork 标记为失效且当前不同步失效记录");
|
||||||
result.increaseSkipped();
|
result.increaseSkipped();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (job.getJobtitleid() == null) {
|
if (job.getId() == null) {
|
||||||
log.warn("[iWork] 岗位缺少标识,跳过:{}", job.getJobtitlename());
|
log.warn("[iWork] 岗位缺少标识,跳过:{}", job.getJobtitlename());
|
||||||
result.increaseFailed();
|
result.increaseFailed();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boolean canceled = isCanceledFlag(job.getCanceled());
|
boolean canceled = isCanceledFlag(job.getCanceled());
|
||||||
Integer status = toStatus(canceled);
|
Integer status = toStatus(canceled);
|
||||||
String code = buildJobCode(job.getJobtitleid());
|
String code = buildJobCode(job.getId());
|
||||||
String name = limitLength(StrUtil.blankToDefault(job.getJobtitlename(), code), 50);
|
String name = limitLength(StrUtil.blankToDefault(job.getJobtitlename(), code), 50);
|
||||||
try {
|
try {
|
||||||
JobSyncOutcome outcome = upsertJobTitle(job, code, name, status, options);
|
JobSyncOutcome outcome = upsertJobTitle(job, code, name, status, options);
|
||||||
applyJobOutcome(result, outcome, name);
|
applyJobOutcome(result, outcome, name);
|
||||||
} catch (Exception ex) {
|
} 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.increaseFailed();
|
||||||
result.withMessage("同步岗位失败: " + ex.getMessage());
|
result.withMessage("同步岗位失败: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
@@ -307,11 +307,11 @@ 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(), "当前策略禁止创建缺失岗位");
|
logSkip("岗位", job.getId(), "当前策略禁止创建缺失岗位");
|
||||||
return new JobSyncOutcome(SyncAction.SKIPPED, false, null);
|
return new JobSyncOutcome(SyncAction.SKIPPED, false, null);
|
||||||
}
|
}
|
||||||
PostSaveReqVO createReq = new PostSaveReqVO();
|
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) {
|
if (desiredId != null) {
|
||||||
createReq.setId(desiredId);
|
createReq.setId(desiredId);
|
||||||
}
|
}
|
||||||
@@ -583,9 +583,30 @@ public class IWorkSyncProcessorImpl implements IWorkSyncProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer resolveSex(String sexFlag) {
|
private Integer resolveSex(String sexFlag) {
|
||||||
|
if (StrUtil.isBlank(sexFlag)) {
|
||||||
|
return SexEnum.UNKNOWN.getSex();
|
||||||
|
}
|
||||||
Integer external = parseInteger(sexFlag);
|
Integer external = parseInteger(sexFlag);
|
||||||
Integer converted = SyncVerifyUtil.convertExternalToInternal(external);
|
if (external != null) {
|
||||||
return converted != null ? converted : SexEnum.UNKNOWN.getSex();
|
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) {
|
private Integer parseInteger(String raw) {
|
||||||
|
|||||||
Reference in New Issue
Block a user