Forráskód Böngészése

refactor(hr): 重构岗位审核插件的数据处理逻辑

- 添加 PreparePropertys 事件重写方法以支持字段属性准备
- 修改人员数据获取逻辑从单条记录改为循环处理明细数据集合
- 更新实体字段映射关系以匹配新的数据结构
- 优化任务类中的查询字段构建器配置
- 新增延期支付比例表单插件实现新增行号自动生成功能
- 移除废弃的 BillStatusEnum 导入并更新为正确的枚举引用
wyc 4 napja
szülő
commit
40ab18ee87

+ 30 - 17
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/ijp/plugin/operate/IntJobPostAuditedOpPlugin.java

@@ -12,6 +12,7 @@ import kd.bos.entity.operate.result.IOperateInfo;
 import kd.bos.entity.operate.result.OperationResult;
 import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
 import kd.bos.entity.plugin.AddValidatorsEventArgs;
+import kd.bos.entity.plugin.PreparePropertysEventArgs;
 import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
 import kd.bos.entity.validate.AbstractValidator;
 import kd.bos.orm.query.QCP;
@@ -51,6 +52,11 @@ import java.util.stream.Collectors;
 */
 public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
 
+    @Override
+    public void onPreparePropertys(PreparePropertysEventArgs e) {
+        e.getFieldKeys().addAll(billEntityType.getAllFields().keySet());
+    }
+
     @Override
     public void onAddValidators(AddValidatorsEventArgs e) {
         e.addValidator(new AbstractValidator(){
@@ -59,22 +65,29 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
                 List<Long> personIds = new ArrayList<>();
                 for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
                     DynamicObject data = rowDataEntity.getDataEntity();
-                    DynamicObject person = data.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
-                    if(person == null){
-                        this.addFatalErrorMessage(rowDataEntity,"请选择人员");
-                    }else{
-                        long personId = person.getLong(FormConstant.ID_KEY);
-                        personIds.add(personId);
+                    DynamicObjectCollection entryEntity = data.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
+                    for (DynamicObject entry : entryEntity) {
+                        DynamicObject person = entry.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
+                        if(person == null){
+                            this.addFatalErrorMessage(rowDataEntity,"请选择人员");
+                        }else{
+                            long personId = person.getLong(FormConstant.ID_KEY);
+                            personIds.add(personId);
+                        }
                     }
+
                 }
                 Map<Long, DynamicObject> empPosOrgRelMap = EmpPosOrgRelHelper.queryEmpPosOrgRelByEmployeesMap(personIds);
                 for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
                     DynamicObject data = rowDataEntity.getDataEntity();
-                    DynamicObject person = data.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
-                    if(person != null){
-                        long personId = person.getLong(FormConstant.ID_KEY);
-                        if(empPosOrgRelMap.get(personId) == null){
-                            this.addFatalErrorMessage(rowDataEntity,StrFormatter.format("人员【{}】没有在岗状态的任职经历",person.getString(FormConstant.NAME_KEY)));
+                    DynamicObjectCollection entryEntity = data.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
+                    for (DynamicObject entry : entryEntity) {
+                        DynamicObject person = entry.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
+                        if (person != null) {
+                            long personId = person.getLong(FormConstant.ID_KEY);
+                            if (empPosOrgRelMap.get(personId) == null) {
+                                this.addFatalErrorMessage(rowDataEntity, StrFormatter.format("人员【{}】没有在岗状态的任职经历", person.getString(FormConstant.NAME_KEY)));
+                            }
                         }
                     }
                 }
@@ -90,9 +103,10 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
         for (DynamicObject dataEntity : e.getDataEntities()) {
             DynamicObjectCollection entryEntity = dataEntity.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
             for (DynamicObject entry : entryEntity) {
+                DynamicObject person = entry.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
                 boolean isEnter = entry.getBoolean(IntJobPostConstant.NCKD_ISENTER);
                 if(isEnter){
-                    personIds.add(entry.getLong(IntJobPostConstant.NCKD_PERSON));
+                    personIds.add(person.getLong(IntJobPostConstant.ID_KEY));
                 }
                 entityIds.add(entry.getLong(IntJobPostConstant.ID_KEY));
             }
@@ -110,14 +124,13 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
         Map<Long, DynamicObject> latestLocusMap = findLatestLocusByPerson(personIds);
         for (DynamicObject dataEntity : e.getDataEntities()) {
             Date auditDate = dataEntity.getDate(IntJobPostConstant.AUDIT_DATE_KEY);
-            long personId = dataEntity.getLong(String.join(".", IntJobPostConstant.NCKD_PERSON, IntJobPostConstant.ID_KEY));
             String talentType = dataEntity.getString(IntJobPostConstant.NCKD_TALENTTYPE);
             TalentTypeEnum talentTypeEnum = TalentTypeEnum.getByCode(talentType);
             DynamicObjectCollection entryEntity = dataEntity.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
-
             for (DynamicObject entry : entryEntity) {
                 long id = entry.getLong(IntJobPostConstant.ID_KEY);
                 boolean isEnter = entry.getBoolean(IntJobPostConstant.NCKD_ISENTER);
+                long personId = entry.getLong(String.join(".", IntJobPostConstant.NCKD_PERSON, IntJobPostConstant.ID_KEY));
                 if(isEnter){
                     DynamicObject latestRecord = latestRecordMap.get(personId);
                     if(latestRecord != null) {
@@ -136,7 +149,7 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
                     // --- B. 插入新记录 ---
                     DynamicObject newRecord = EntityHelper.newEntity(IntJobPostConstant.INTJOBPOSTRECORD_ENTITYID);
                     DynamicObject empPosOrgRel = empPosOrgRelMap.get(personId);
-                    newRecord.set(IntJobPostConstant.HRPI_EMPPOSORGREL, empPosOrgRel);
+                    newRecord.set(IntJobPostConstant.NCKD_EMPPOSORGREL, empPosOrgRel);
                     newRecord.set(IntJobPostConstant.NCKD_ADMINORG,empPosOrgRel.get(IntJobPostConstant.ADMINORG));
                     newRecord.set(IntJobPostConstant.NCKD_ISCURRENTNEWEST, Boolean.TRUE);
                     //初始状态:进入市场
@@ -145,7 +158,7 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
                     newRecord.set(IntJobPostConstant.NCKD_BEGINDATE,dataEntity.get(IntJobPostConstant.NCKD_BIZDAY));
                     newRecord.set(IntJobPostConstant.NCKD_YEAR,dataEntity.get(IntJobPostConstant.NCKD_YEAR));
                     //分录
-                    newRecord.set(IntJobPostConstant.NCKD_INTJOBPOSTENTRY,latestRecord);
+                    newRecord.set(IntJobPostConstant.NCKD_INTJOBPOSTENTRY,entry);
                     newRecord.set(IntJobPostConstant.NCKD_APPRAISALRESULT,entry.get(IntJobPostConstant.NCKD_APPRAISALRESULT));
                     newRecord.set(IntJobPostConstant.NCKD_BEFORELAST,entry.get(IntJobPostConstant.NCKD_BEFORELAST));
                     newRecord.set(FormConstant.CREATOR_KEY,currUserId);
@@ -167,7 +180,7 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
                     }
                     // 2. 插入新轨迹
                     DynamicObject newLocus = EntityHelper.newEntity(IntJobPostConstant.INTJOBPOSTLOCUS_ENTITYID);
-                    newLocus.set(IntJobPostConstant.HRPI_EMPPOSORGREL, empPosOrgRel);
+                    newLocus.set(IntJobPostConstant.NCKD_EMPPOSORGREL, empPosOrgRel);
                     newLocus.set(IntJobPostConstant.NCKD_ADMINORG,empPosOrgRel.get(IntJobPostConstant.ADMINORG));
                     newLocus.set(IntJobPostConstant.NCKD_ISCURRENTNEWEST, Boolean.TRUE);
                     newLocus.set(IntJobPostConstant.NCKD_INTJOBPOSTRECORD, newRecord);

+ 1 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/task/KeyBeHavEvalTask.java

@@ -118,6 +118,7 @@ public class KeyBeHavEvalTask extends AbstractTask implements Plugin {
         QueryFieldBuilder perfManagerQueryField = QueryFieldBuilder.create()
                 .addIdNumberName(PositionStructureConstant.NCKD_PERSON)
                 .add(PositionStructureConstant.NCKD_PERFMANAGERENTRY,PositionStructureConstant.NCKD_APPRAISALYEAR)
+                //考核结果(nckd.jxccl.base.common.enums.AppraisalResultEnum)
                 .addIdNumberName(PositionStructureConstant.NCKD_PERFMANAGERENTRY,PositionStructureConstant.NCKD_APPRAISALRESULT);
         DynamicObjectCollection perfManagerColl = QueryServiceHelper.query(PositionStructureConstant.PERFMANAGER_ENTITYID, perfManagerQueryField.buildSelect(), new QFilter[]{perfManagerFilter}, perfManagerQueryField.buildOrder());
         logger.info("考核结果查询完成,查询结果数量: {}", perfManagerColl.size());

+ 27 - 0
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/base/DeferPayratioConfFormPlugin.java

@@ -0,0 +1,27 @@
+package nckd.jxccl.swc.mas.plugin.form.base;
+
+import kd.bos.entity.datamodel.RowDataEntity;
+import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
+import kd.bos.form.plugin.AbstractFormPlugin;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.swc.constants.MasConstant;
+
+/**
+* 延期支付比例
+* 实体标识:nckd_deferpayratioconf
+* @author W.Y.C
+* @date 2026/1/14 14:28
+* @version 1.0
+*/
+public class DeferPayratioConfFormPlugin extends AbstractFormPlugin implements Plugin {
+
+    @Override
+    public void afterAddRow(AfterAddRowEventArgs e) {
+        int rowCount = this.getModel().getEntryRowCount(FormConstant.NCKD_ENTRYENTITY);
+        for (RowDataEntity rowDataEntity : e.getRowDataEntities()) {
+            int rowIndex = rowDataEntity.getRowIndex();
+            this.getModel().setValue(MasConstant.NCKD_TIMES, rowCount, rowIndex);
+        }
+    }
+}

+ 1 - 2
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/structappr/AbstractStructApprFormPlugin.java

@@ -24,7 +24,6 @@ import kd.bos.orm.query.QFilter;
 import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.QueryServiceHelper;
 import kd.bos.servicehelper.operation.SaveServiceHelper;
-import kd.drp.mem.er.BillStatusEnum;
 import kd.hr.hbp.common.util.HRDynamicObjectUtils;
 import kd.sdk.plugin.Plugin;
 import nckd.jxccl.base.common.constant.FormConstant;
@@ -252,7 +251,7 @@ public abstract class AbstractStructApprFormPlugin extends AbstractFormPlugin im
                 HRDynamicObjectUtils.copy(data, newChangeEntity);
                 newChangeEntity.set(FormConstant.NCKD_DESCRIPTION, data.getString(FormConstant.DESCRIPTION_KEY));
                 newChangeEntity.set(entityId, data);
-                newChangeEntity.set(FormConstant.BILL_STATUS_KEY, BillStatusEnum.SAVED.getValue());
+                newChangeEntity.set(FormConstant.BILL_STATUS_KEY, BillStatus.A.getValue());
 
                 // 变更前
                 DynamicObjectCollection newEntryColl = newChangeEntity.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);