Przeglądaj źródła

fix(performance): 修复绩效管理保存操作中的人员及部门数据处理逻辑

- 注释掉无效的排名计算调用
- 引入 EmpPosOrgRelHelper 工具类
- 优化人员信息获取逻辑,确保从 empPosOrgRel 中正确提取员工信息
- 增加对部门信息的处理,当部门为空或ID无效时自动填充
- 清理冗余的组织相关字段设置,避免数据冲突
wyc 15 godzin temu
rodzic
commit
ee5dc3162e

+ 1 - 1
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/form/performance/PerfRankMgmtFormPlugin.java

@@ -170,7 +170,7 @@ public class PerfRankMgmtFormPlugin extends AbstractFormPlugin implements Wizard
                         PerfRankMgmtConstant.NCKD_TOPRANK)
                 .anyMatch(prop -> prop.equalsIgnoreCase(name))){
             //排名信息变化计算排名数
-            calcRankCount();
+//            calcRankCount();
         }else if(FormConstant.NCKD_PERSON.equalsIgnoreCase(name)){
             //变更或选择人员重新获取是否享受职位津贴
             ChangeData[] changeSet = e.getChangeSet();

+ 23 - 1
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/plugin/operate/cycle/PerfManagerSaveOpPlugin.java

@@ -28,6 +28,7 @@ import nckd.jxccl.base.common.utils.ConvertUtil;
 import nckd.jxccl.base.common.utils.DateUtil;
 import nckd.jxccl.base.common.utils.QueryFieldBuilder;
 import nckd.jxccl.base.common.utils.StrFormatter;
+import nckd.jxccl.base.hrpi.helper.EmpPosOrgRelHelper;
 import nckd.jxccl.opmc.pm.common.PerfManagerFormConstant;
 import nckd.jxccl.opmc.pm.helper.PerfManagerHelper;
 import org.apache.commons.lang3.StringUtils;
@@ -503,10 +504,13 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
         Boolean isCycleGenerate = ConvertUtil.toBoolean(this.getOption().getVariableValue("cyclegenerate",StringUtils.EMPTY),Boolean.FALSE);
         Boolean isUpdate = ConvertUtil.toBoolean(this.getOption().getVariableValue("isUpdate",StringUtils.EMPTY),Boolean.FALSE);
         List<DynamicObject> updatePerManager = new ArrayList<>();
+
+
         for (DynamicObject dataEntity : e.getDataEntities()) {
             long id = dataEntity.getLong(FormConstant.ID_KEY);
             DynamicObject person = dataEntity.getDynamicObject(FormConstant.NCKD_PERSON);
-            person = person == null ? dataEntity.getDynamicObject(FormConstant.NCKD_EMPPOSORGREL).getDynamicObject(FormConstant.EMPLOYEE_KEY) : person;
+            DynamicObject empPosOrgRel = dataEntity.getDynamicObject(FormConstant.NCKD_EMPPOSORGREL);
+            person = person == null ? empPosOrgRel.getDynamicObject(FormConstant.EMPLOYEE_KEY) : person;
             dataEntity.set(FormConstant.NCKD_PERSON, person);
             LocalDateTime beginYear = DateUtil.toLocalDateTime(dataEntity.getDate(PerfManagerFormConstant.NCKD_BEGINYEAR));
             LocalDateTime endYear = DateUtil.toLocalDateTime(dataEntity.getDate(PerfManagerFormConstant.NCKD_ENDYEAR));
@@ -521,6 +525,24 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
             if(StringUtils.isBlank(name)){
                 dataEntity.set(FormConstant.NAME_KEY, StrFormatter.format("【{}】{}~{}的考核周期",personName,beginYear.getYear(),endYear.getYear()));
             }
+            DynamicObject dep = dataEntity.getDynamicObject(FormConstant.NCKD_DEP);
+            if(dep == null){
+                dataEntity.set(FormConstant.NCKD_DEP, empPosOrgRel.getDynamicObject(FormConstant.ADMINORG));
+            }
+
+            long depId = dataEntity.getLong(String.join(".", FormConstant.NCKD_DEP, FormConstant.ID_KEY));
+            if(depId <= 0){
+                dataEntity.set(FormConstant.NCKD_DEP, empPosOrgRel.getDynamicObject(FormConstant.ADMINORG));
+            }
+            if(dataEntity.containsProperty(FormConstant.CREATEORG_KEY)){
+                dataEntity.set(FormConstant.CREATEORG_KEY, null);
+            }
+            if(dataEntity.containsProperty(FormConstant.USEORG_KEY)){
+                dataEntity.set(FormConstant.USEORG_KEY, null);
+            }
+            if(dataEntity.containsProperty(FormConstant.ORG_KEY)){
+                dataEntity.set(FormConstant.ORG_KEY, null);
+            }
 
 
             /*DynamicObject lastPerfManager = lastPerfManagerMap.get(personId);