|
|
@@ -3,9 +3,13 @@ package nckd.jxccl.hr.psms.plugin.operate.initial;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import kd.bos.common.enums.EnableEnum;
|
|
|
import kd.bos.context.RequestContext;
|
|
|
+import kd.bos.dataentity.OperateOption;
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.dataentity.utils.ObjectUtils;
|
|
|
import kd.bos.entity.constant.StatusEnum;
|
|
|
+import kd.bos.entity.operate.result.IOperateInfo;
|
|
|
+import kd.bos.entity.operate.result.OperationResult;
|
|
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
|
|
import kd.bos.logging.Log;
|
|
|
import kd.bos.logging.LogFactory;
|
|
|
@@ -15,6 +19,7 @@ import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
|
import nckd.jxccl.base.common.enums.AppraisalResultEnum;
|
|
|
import nckd.jxccl.base.common.enums.psms.JobSeqEnum;
|
|
|
+import nckd.jxccl.base.common.exception.ValidationException;
|
|
|
import nckd.jxccl.base.common.utils.DateUtil;
|
|
|
import nckd.jxccl.base.common.utils.QueryFieldBuilder;
|
|
|
import nckd.jxccl.base.common.utils.StrFormatter;
|
|
|
@@ -32,6 +37,7 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.StringJoiner;
|
|
|
|
|
|
/**
|
|
|
* 人员初定操作插件基类
|
|
|
@@ -118,75 +124,101 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
* @date: 2025/10/12 14:20
|
|
|
*/
|
|
|
protected List<BaseInitialData> extractBasicInfo(DynamicObject initialData) {
|
|
|
+ logger.info("【职位体系】-开始提取基本信息");
|
|
|
List<BaseInitialData> dataList = new ArrayList<>();
|
|
|
if(initialData.containsProperty(FormConstant.NCKD_ENTRYENTITY)){
|
|
|
DynamicObjectCollection dynamicObjectCollection = initialData.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
|
|
|
- for (DynamicObject dynamicObject : dynamicObjectCollection) {
|
|
|
+ logger.info("【职位体系】-检测到批量初定数据,条数: {}", dynamicObjectCollection.size());
|
|
|
+ for (int i = 0; i < dynamicObjectCollection.size(); i++) {
|
|
|
+ DynamicObject dynamicObject = dynamicObjectCollection.get(i);
|
|
|
+ logger.info("【职位体系】-处理第 {} 条数据", i+1);
|
|
|
//批量初定
|
|
|
BaseInitialData data = getBaseInitialData(dynamicObject);
|
|
|
dataList.add(data);
|
|
|
baseInitialData.add(data);
|
|
|
}
|
|
|
}else{
|
|
|
+ logger.info("【职位体系】-处理单条初定数据");
|
|
|
BaseInitialData data = getBaseInitialData(initialData);
|
|
|
dataList.add(data);
|
|
|
baseInitialData.add(data);
|
|
|
}
|
|
|
+ logger.info("【职位体系】-基本信息提取完成,共提取 {} 条数据", dataList.size());
|
|
|
return dataList;
|
|
|
}
|
|
|
|
|
|
@NotNull
|
|
|
private BaseInitialData getBaseInitialData(DynamicObject initialData) {
|
|
|
BaseInitialData data = new BaseInitialData();
|
|
|
+ logger.info("【职位体系】-开始获取基础数据");
|
|
|
|
|
|
data.beginDate = initialData.getDate(PositionStructureConstant.NCKD_BEGINDATE);
|
|
|
data.causeRemark = initialData.getString(PositionStructureConstant.KEY_NCKD_CAUSEREMARK);
|
|
|
data.person = initialData.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
|
|
|
|
|
|
PositionAppointmentBO positionAppointment = PositionFileHelper.positionAppointmentQuery(data.person.getLong(FormConstant.ID_KEY), data.beginDate);
|
|
|
+ logger.info("【职位体系】-获取人员任职信息完成,personId={}", data.person.getLong(FormConstant.ID_KEY));
|
|
|
+
|
|
|
// 学历
|
|
|
DynamicObject perEduExp = positionAppointment.getPerEduExp();
|
|
|
if (perEduExp != null) {
|
|
|
// 学历
|
|
|
long diplomaId = perEduExp.getLong(String.join(".", FormConstant.EDUCATION_KEY, FormConstant.ID_KEY));
|
|
|
+ logger.info("【职位体系】-获取学历信息,diplomaId={}", diplomaId);
|
|
|
if(diplomaId > 0) {
|
|
|
DynamicObject diploma = BusinessDataServiceHelper.newDynamicObject(PositionStructureConstant.HBSS_DIPLOMA);
|
|
|
diploma.set(FormConstant.ID_KEY, diplomaId);
|
|
|
data.diploma = diploma;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ logger.info("【职位体系】-无学历信息");
|
|
|
}
|
|
|
+
|
|
|
// 职称信息
|
|
|
DynamicObject perProTitle = positionAppointment.getPerProTitle();
|
|
|
if (perProTitle != null) {
|
|
|
data.rankName = perProTitle.getString(String.join(".", FormConstant.PROFESSIONAL_KEY, FormConstant.NAME_KEY));
|
|
|
+ logger.info("【职位体系】-获取职称信息,rankName={}", data.rankName);
|
|
|
+
|
|
|
// 职称等级
|
|
|
long perProTitleId = perProTitle.getLong(String.join(".", FormConstant.PROLEVEL_KEY, FormConstant.ID_KEY));
|
|
|
+ logger.info("【职位体系】-获取职称等级,perProTitleId={}", perProTitleId);
|
|
|
if(perProTitleId > 0) {
|
|
|
DynamicObject proTitleLevel = BusinessDataServiceHelper.newDynamicObject(PositionStructureConstant.HBSS_PROTITLELEVEL);
|
|
|
proTitleLevel.set(FormConstant.ID_KEY, perProTitleId);
|
|
|
data.proTitleLevel = proTitleLevel;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ logger.info("【职位体系】-无职称信息");
|
|
|
}
|
|
|
|
|
|
// 技能信息
|
|
|
DynamicObject perOcpQual = positionAppointment.getPerOcpQual();
|
|
|
if (perOcpQual != null) {
|
|
|
data.jobStatusName = perOcpQual.getString(String.join(".", FormConstant.QUALIFICATION_KEY, FormConstant.NAME_KEY));
|
|
|
+ logger.info("【职位体系】-获取技能信息,jobStatusName={}", data.jobStatusName);
|
|
|
+
|
|
|
// 技能等级
|
|
|
long quaLevelId = perOcpQual.getLong(String.join(".", FormConstant.QUALEVEL_KEY, FormConstant.ID_KEY));
|
|
|
+ logger.info("【职位体系】-获取技能等级,quaLevelId={}", quaLevelId);
|
|
|
if(quaLevelId > 0) {
|
|
|
DynamicObject ocpQualLevel = BusinessDataServiceHelper.newDynamicObject(PositionStructureConstant.HBSS_OCPQUALLEVEL);
|
|
|
ocpQualLevel.set(FormConstant.ID_KEY, quaLevelId);
|
|
|
data.ocpQualLevel = ocpQualLevel;
|
|
|
}
|
|
|
-
|
|
|
+ } else {
|
|
|
+ logger.info("【职位体系】-无技能信息");
|
|
|
}
|
|
|
+
|
|
|
// 任职信息
|
|
|
DynamicObject empPosOrgRel = positionAppointment.getEmpPosOrgRel();
|
|
|
if (empPosOrgRel != null) {
|
|
|
data.empPosOrgRel = empPosOrgRel;
|
|
|
+ logger.info("【职位体系】-获取任职信息完成");
|
|
|
+
|
|
|
//岗位
|
|
|
long positionId = empPosOrgRel.getLong(String.join(".", FormConstant.POSITION_KEY, FormConstant.ID_KEY));
|
|
|
+ logger.info("【职位体系】-获取岗位信息,positionId={}", positionId);
|
|
|
if(positionId > 0) {
|
|
|
DynamicObject position = BusinessDataServiceHelper.newDynamicObject(FormConstant.HBPM_POSITIONHR);
|
|
|
position.set(FormConstant.ID_KEY, positionId);
|
|
|
@@ -195,12 +227,15 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
}
|
|
|
|
|
|
long companyId = empPosOrgRel.getLong(String.join(".", FormConstant.COMPANY_KEY, FormConstant.ID_KEY));
|
|
|
+ logger.info("【职位体系】-获取公司信息,companyId={}", companyId);
|
|
|
if(companyId > 0) {
|
|
|
DynamicObject company = BusinessDataServiceHelper.newDynamicObject(FormConstant.ADMINORG_ENTITYID);
|
|
|
company.set(FormConstant.ID_KEY, companyId);
|
|
|
data.company = company;
|
|
|
}
|
|
|
+
|
|
|
long adminOrgId = empPosOrgRel.getLong(String.join(".", FormConstant.ADMINORG, FormConstant.ID_KEY));
|
|
|
+ logger.info("【职位体系】-获取部门信息,adminOrgId={}", adminOrgId);
|
|
|
if(adminOrgId > 0) {
|
|
|
DynamicObject dep = BusinessDataServiceHelper.newDynamicObject(FormConstant.ADMINORG_ENTITYID);
|
|
|
dep.set(FormConstant.ID_KEY, adminOrgId);
|
|
|
@@ -209,6 +244,7 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
|
|
|
// 职位序列
|
|
|
Long jobSeqId = empPosOrgRel.getLong(String.join(".", FormConstant.HBPM_POSITIONHR, FormConstant.NCKD_JOBSEQ, FormConstant.ID_KEY));
|
|
|
+ logger.info("【职位体系】-获取职位序列信息,jobSeqId={}", jobSeqId);
|
|
|
if(jobSeqId > 0) {
|
|
|
String jobSeqNumber = empPosOrgRel.getString(String.join(".", FormConstant.HBPM_POSITIONHR, FormConstant.NCKD_JOBSEQ, FormConstant.NUMBER_KEY));
|
|
|
String jobSeqName = empPosOrgRel.getString(String.join(".", FormConstant.HBPM_POSITIONHR, FormConstant.NCKD_JOBSEQ, FormConstant.NAME_KEY));
|
|
|
@@ -220,20 +256,25 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
data.jobSeqNumber = jobSeqNumber;
|
|
|
data.jobSeqName = jobSeqName;
|
|
|
data.jobSeqEnum = JobSeqEnum.getByCode(data.jobSeqNumber);
|
|
|
+ logger.info("【职位体系】-职位序列编号={},名称={}", jobSeqNumber, jobSeqName);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//本次加入集团时间
|
|
|
data.joinComDate = empPosOrgRel.getDate(String.join(".", FormConstant.HRPI_PERSERLEN, FormConstant.JOINCOMDATE_KEY));
|
|
|
+ logger.info("【职位体系】-本次加入集团时间={}", data.joinComDate);
|
|
|
+ } else {
|
|
|
+ logger.info("【职位体系】-无任职信息");
|
|
|
}
|
|
|
|
|
|
data.isExcellent = Boolean.FALSE;
|
|
|
if(positionAppointment.getExcellent() != null && positionAppointment.getExcellent()){
|
|
|
data.isExcellent = Boolean.TRUE;
|
|
|
+ logger.info("【职位体系】-该员工为优秀生");
|
|
|
}
|
|
|
+
|
|
|
// 特定字段由子类处理
|
|
|
extractSpecificFields(data, initialData);
|
|
|
+ logger.info("【职位体系】-基础数据获取完成");
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
@@ -275,6 +316,7 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
* 获取积分数据
|
|
|
*/
|
|
|
protected ScoreData getScoreData(BaseInitialData data, String logPrefix) {
|
|
|
+ logger.info("{}-开始获取积分数据", logPrefix);
|
|
|
ScoreData scoreData = new ScoreData();
|
|
|
|
|
|
QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create().addIdNumberNameWithExtras(FormConstant.NCKD_SCORE);
|
|
|
@@ -282,6 +324,7 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
// 学历积分
|
|
|
scoreData.educationScore = BigDecimal.ZERO;
|
|
|
if (data.diploma != null) {
|
|
|
+ logger.info("{}-开始获取学历积分,diplomaId={}", logPrefix, data.diploma.getLong(FormConstant.ID_KEY));
|
|
|
DynamicObject education = BusinessDataServiceHelper.loadSingle(FormConstant.HBSS_DIPLOMA,
|
|
|
queryFieldBuilder.buildSelect(),
|
|
|
new QFilter[]{QFilterCommonHelper.getIdEqFilter(data.diploma.getLong(FormConstant.ID_KEY))});
|
|
|
@@ -302,30 +345,41 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
scoreData.dbProTitleLevel = null;
|
|
|
scoreData.dbOcpQualLevel = null;
|
|
|
|
|
|
-
|
|
|
+ logger.info("{}-职位序列类型={}, proTitleLevel={}, ocpQualLevel={}",
|
|
|
+ logPrefix, data.jobSeqEnum, data.proTitleLevel, data.ocpQualLevel);
|
|
|
|
|
|
if (data.jobSeqEnum != JobSeqEnum.SKILL && data.proTitleLevel != null) {
|
|
|
// 非技能序列获取职称积分
|
|
|
+ logger.info("{}-开始获取职称积分", logPrefix);
|
|
|
scoreData.dbProTitleLevel = BusinessDataServiceHelper.loadSingle(FormConstant.HBSS_PROTITLELEVEL,
|
|
|
queryFieldBuilder.buildSelect(),
|
|
|
new QFilter[]{QFilterCommonHelper.getIdEqFilter(data.proTitleLevel.getLong(FormConstant.ID_KEY))});
|
|
|
if (scoreData.dbProTitleLevel != null) {
|
|
|
scoreData.proTitleScore = scoreData.dbProTitleLevel.getBigDecimal(FormConstant.NCKD_SCORE);
|
|
|
data.jobStatusName = null;
|
|
|
+ logger.info("{}-职称积分获取完成,积分为{}", logPrefix, scoreData.proTitleScore);
|
|
|
+ } else {
|
|
|
+ logger.warn("{}-未找到职称等级信息", logPrefix);
|
|
|
}
|
|
|
} else if (data.jobSeqEnum == JobSeqEnum.SKILL && data.ocpQualLevel != null) {
|
|
|
// 技能序列获取技能积分
|
|
|
+ logger.info("{}-开始获取技能积分", logPrefix);
|
|
|
scoreData.dbOcpQualLevel = BusinessDataServiceHelper.loadSingle(FormConstant.HBSS_OCPQUALLEVEL,
|
|
|
queryFieldBuilder.buildSelect(),
|
|
|
new QFilter[]{QFilterCommonHelper.getIdEqFilter(data.ocpQualLevel.getLong(FormConstant.ID_KEY))});
|
|
|
if (scoreData.dbOcpQualLevel != null) {
|
|
|
scoreData.perOcpQualScore = scoreData.dbOcpQualLevel.getBigDecimal(FormConstant.NCKD_SCORE);
|
|
|
data.rankName = null;
|
|
|
+ logger.info("{}-技能积分获取完成,积分为{}", logPrefix, scoreData.perOcpQualScore);
|
|
|
+ } else {
|
|
|
+ logger.warn("{}-未找到技能等级信息", logPrefix);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ logger.info("{}-无需获取职称或技能积分", logPrefix);
|
|
|
}
|
|
|
|
|
|
- logger.info("{}-初定职位序列【{}】-职称积分【{}】-技能积分【{}】",
|
|
|
- logPrefix, data.jobSeqName, scoreData.proTitleScore, scoreData.perOcpQualScore);
|
|
|
+ logger.info("{}-初定职位序列【{}】-学历积分【{}】-职称积分【{}】-技能积分【{}】",
|
|
|
+ logPrefix, data.jobSeqName, scoreData.educationScore, scoreData.proTitleScore, scoreData.perOcpQualScore);
|
|
|
|
|
|
return scoreData;
|
|
|
}
|
|
|
@@ -355,12 +409,15 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
protected DynamicObject createAndSavePersonPosFile(BaseInitialData data, ScoreData scoreData,
|
|
|
BigDecimal allSumScore, BigDecimal sumScore,
|
|
|
DynamicObject jobLeve, String logPrefix, String typeState) {
|
|
|
+ logger.info("{}-开始创建并保存职位档案", logPrefix);
|
|
|
// 优秀生得2分
|
|
|
BigDecimal excellentScore = data.isExcellent ? new BigDecimal(2) : BigDecimal.ZERO;
|
|
|
+ logger.info("{}-优秀生分数: {}", logPrefix, excellentScore);
|
|
|
|
|
|
// 构建职位档案并存入数据库
|
|
|
DynamicObject personPosFile = BusinessDataServiceHelper.newDynamicObject(
|
|
|
PositionStructureConstant.PERSONPOSFILE_ENTITYID);
|
|
|
+ logger.info("{}-创建职位档案对象完成", logPrefix);
|
|
|
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_PERSON, data.person);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_FIRSTRANK, EnableEnum.YES.getCode());
|
|
|
@@ -380,18 +437,24 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_DEP, data.dep);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_ALLSUMSCORE, allSumScore);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_SUMSCORE, sumScore);
|
|
|
+ logger.info("{}-设置基本字段完成,总积分={}, 累计积分={}", logPrefix, allSumScore, sumScore);
|
|
|
|
|
|
DynamicObject convertJobSeq = data.convertJobSeq;
|
|
|
JobSeqEnum jobSeqEnum = JobSeqEnum.getByCode(convertJobSeq.getString(FormConstant.NUMBER_KEY));
|
|
|
+ logger.info("{}-转换后的职位序列类型={}", logPrefix, jobSeqEnum);
|
|
|
+
|
|
|
if(JobSeqEnum.SKILL == jobSeqEnum){
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_JOBSTATUSNAME, data.jobStatusName);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_OCPQUALLEVEL, scoreData.dbOcpQualLevel);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_JOBSTATUSSCORE, scoreData.perOcpQualScore);
|
|
|
+ logger.info("{}-设置技能序列相关信息完成", logPrefix);
|
|
|
}else{
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_RANKNAME, data.rankName);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_PROTITLELEVEL, scoreData.dbProTitleLevel);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_RANKSCORE, scoreData.proTitleScore);
|
|
|
+ logger.info("{}-设置非技能序列相关信息完成", logPrefix);
|
|
|
}
|
|
|
+
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_JOBLEVELHR, jobLeve);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_DIPLOMA, data.diploma);
|
|
|
personPosFile.set(PositionStructureConstant.NCKD_TYPESTATE, typeState);
|
|
|
@@ -405,9 +468,21 @@ public abstract class BaseInitialOperationPlugIn extends AbstractOperationServic
|
|
|
personPosFile.set(PositionStructureConstant.STATUS, StatusEnum.C.toString());
|
|
|
personPosFile.set(PositionStructureConstant.ENABLE, EnableEnum.YES.getCode());
|
|
|
personPosFile.set(PositionStructureConstant.CREATOR_KEY, RequestContext.get().getCurrUserId());
|
|
|
-
|
|
|
-
|
|
|
- SaveServiceHelper.save(new DynamicObject[]{personPosFile});
|
|
|
+ logger.info("{}-设置所有字段完成", logPrefix);
|
|
|
+
|
|
|
+// SaveServiceHelper.save(new DynamicObject[]{personPosFile});
|
|
|
+ OperationResult operationResult = SaveServiceHelper.saveOperate(PositionStructureConstant.PERSONPOSFILE_ENTITYID, new DynamicObject[]{personPosFile}, OperateOption.create());
|
|
|
+ if (!operationResult.isSuccess()) {
|
|
|
+ StringJoiner errorMsg = new StringJoiner("\n");
|
|
|
+ for (IOperateInfo error : operationResult.getAllErrorOrValidateInfo()) {
|
|
|
+ errorMsg.add(error.getMessage());
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(operationResult.getMessage())) {
|
|
|
+ errorMsg.add(operationResult.getMessage());
|
|
|
+ }
|
|
|
+ throw new ValidationException("保存职位档案失败,原因:" + errorMsg.toString());
|
|
|
+ }
|
|
|
+ logger.info("{}-职位档案保存完成,ID={}", logPrefix, personPosFile.getLong(FormConstant.ID_KEY));
|
|
|
return personPosFile;
|
|
|
}
|
|
|
|