Эх сурвалжийг харах

Merge branch 'refs/heads/feat-opmc-pm_1.0'

wyc 6 өдөр өмнө
parent
commit
a30058463e

+ 14 - 0
code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/constant/QueryConstant.java

@@ -0,0 +1,14 @@
+package nckd.jxccl.base.common.constant;
+
+/**
+ * TODO
+ *
+ * @author W.Y.C
+ * @version 1.0
+ * @date 2025/11/19 17:29
+ */
+public class QueryConstant {
+
+    /**人员列表*/
+    public static final String PERSON_QUERY = "personquery";
+}

+ 0 - 13
code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/constant/SystemQueryConstant.java

@@ -1,13 +0,0 @@
-package nckd.jxccl.base.common.constant;
-
-/**
- * 系统内置常量
- * @author W.Y.C
- * @date 2025/10/20 16:05
- * @version 1.0
- */
-public class SystemQueryConstant {
-
-    /**人员列表*/
-    public static final String HSPM_ASSIGNMENTQUERY = "hspm_assignmentquery";
-}

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

@@ -12,7 +12,6 @@ import kd.bos.entity.constant.StatusEnum;
 import kd.bos.entity.datamodel.IDataModel;
 import kd.bos.entity.datamodel.RowDataEntity;
 import kd.bos.entity.datamodel.events.*;
-import kd.bos.entity.property.entryfilter.EntryQueryParam;
 import kd.bos.ext.hr.service.query.QueryEntityHelper;
 import kd.bos.form.ConfirmCallBackListener;
 import kd.bos.form.ConfirmTypes;
@@ -20,7 +19,6 @@ import kd.bos.form.IClientViewProxy;
 import kd.bos.form.MessageBoxOptions;
 import kd.bos.form.MessageBoxResult;
 import kd.bos.form.container.Wizard;
-import kd.bos.form.control.Control;
 import kd.bos.form.control.EntryGrid;
 import kd.bos.form.control.Steps;
 import kd.bos.form.control.events.StepEvent;
@@ -32,13 +30,12 @@ import kd.bos.form.operate.FormOperate;
 import kd.bos.form.plugin.AbstractFormPlugin;
 import kd.bos.logging.Log;
 import kd.bos.logging.LogFactory;
-import kd.bos.metadata.form.container.WizardAp;
 import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.QueryServiceHelper;
 import nckd.jxccl.base.common.constant.FormConstant;
-import nckd.jxccl.base.common.constant.SystemQueryConstant;
+import nckd.jxccl.base.common.constant.QueryConstant;
 import nckd.jxccl.base.common.enums.AppraisalResultEnum;
 import nckd.jxccl.base.common.enums.psms.JobSeqEnum;
 import nckd.jxccl.base.common.utils.ConvertUtil;
@@ -364,7 +361,7 @@ public class PerfRankMgmtFormPlugin extends AbstractFormPlugin implements Wizard
                             .addGroup(new String[]{FormConstant.EMPLOYEE_KEY}, FormConstant.ID_KEY, FormConstant.NAME_KEY, FormConstant.EMP_NUMBER_KEY);
 
                     // -------------------------------- 1、查询组织下的在职人员 --------------------------------
-                    QueryEntityType queryEntityType = (QueryEntityType) EntityMetadataCache.getDataEntityType(SystemQueryConstant.HSPM_ASSIGNMENTQUERY);
+                    QueryEntityType queryEntityType = (QueryEntityType) EntityMetadataCache.getDataEntityType(QueryConstant.PERSON_QUERY);
                     DynamicObjectCollection personList = QueryEntityHelper.getInstance().getQueryDyoColl(queryEntityType, queryFieldBuilder.buildSelect(), new QFilter[]{qFilter}, queryFieldBuilder.buildOrder());
                     //添加分录
                     DynamicObjectCollection entryEntityCols = this.getModel().getDataEntity(true).getDynamicObjectCollection(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);

+ 8 - 1
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/report/adjust/UnAdjustedReportReportListDataPlugin.java

@@ -86,7 +86,14 @@ public class UnAdjustedReportReportListDataPlugin extends AbstractReportListData
                 .add(FormConstant.ADMINORG)
                 .addIdNumberName(FormConstant.POSITION_KEY)
                 .addGroup(new String[]{FormConstant.HBPM_POSITIONHR}, PositionStructureConstant.NCKD_JOBSEQ)
-                .addGroup(new String[]{FormConstant.HBPM_POSITIONHR, PositionStructureConstant.NCKD_JOBSEQ}, FormConstant.NUMBER_KEY);
+                .addGroup(new String[]{FormConstant.HBPM_POSITIONHR, PositionStructureConstant.NCKD_JOBSEQ}, FormConstant.NUMBER_KEY)
+                .addIdNumberName(FormConstant.ADMINORG,FormConstant.NCKD_FIRSTORG)
+                .addIdNumberName(FormConstant.ADMINORG,FormConstant.NCKD_SECONDORG)
+                .addIdNumberName(FormConstant.ADMINORG,FormConstant.NCKD_THIRDORG)
+                .addIdNumberName(FormConstant.ADMINORG,FormConstant.NCKD_FOURTHORG)
+                .addIdNumberName(FormConstant.ADMINORG,FormConstant.NCKD_FIFTHORG)
+                .addIdNumberName(FormConstant.ADMINORG,FormConstant.NCKD_SIXTHORG);
+
     }
 
     /**

+ 25 - 0
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/helper/PerfManagerHelper.java

@@ -303,6 +303,31 @@ public class PerfManagerHelper {
         SaveServiceHelper.update(personPosFileColl);
     }
 
+    /***
+     * 将人员最新考核周期标记为最新的并修改状态为正常
+     * @param personIds 人员ID(可传多个)
+     * @param otherFilter 其他条件
+     * @return: void
+     * @author W.Y.C
+     * @date: 2025/11/19 18:07
+     */
+    public static void markAsCurrentNewestAndUpdateStatus(Collection personIds, QFilter otherFilter) {
+        List<DynamicObject> perfManagerColl = getNewestPerfManagerByPersonAndBeginYear(personIds, otherFilter);
+        DynamicObject[] updatePerfManagerColl = new DynamicObject[perfManagerColl.size()];
+        for (int i = 0; i < perfManagerColl.size(); i++) {
+            DynamicObject dynamicObject = perfManagerColl.get(i);
+            dynamicObject.set(FormConstant.NCKD_ISCURRENTNEWEST, Boolean.TRUE);
+
+            String theStatus = dynamicObject.getString(PerfManagerFormConstant.NCKD_THESTATUS);
+            if(theStatus.equalsIgnoreCase("3")){
+                //结束状态标记为正常
+                dynamicObject.set(PerfManagerFormConstant.NCKD_THESTATUS, EnableEnum.YES.getCode());
+            }
+            updatePerfManagerColl[i] = dynamicObject;
+        }
+        SaveServiceHelper.update(updatePerfManagerColl);
+    }
+
     /**
      * 将人员最新考核周期标记为最新的
      *

+ 2 - 5
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/plugin/operate/cycle/CycleGenerateOpPlugin.java

@@ -21,22 +21,19 @@ import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
 import kd.bos.ext.hr.service.query.QueryEntityHelper;
 import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.operation.OperationServiceHelper;
-import kd.bos.servicehelper.operation.SaveServiceHelper;
 import kd.hr.hbp.common.model.AuthorizedOrgResultWithSub;
 import kd.hr.hbp.common.model.OrgSubInfo;
 import kd.sdk.hr.hbp.business.helper.permission.HRPermissionServiceHelper;
 import kd.sdk.plugin.Plugin;
 import nckd.jxccl.base.common.constant.FormConstant;
-import nckd.jxccl.base.common.constant.SystemQueryConstant;
+import nckd.jxccl.base.common.constant.QueryConstant;
 import nckd.jxccl.base.common.enums.AppraisalResultEnum;
 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;
 import nckd.jxccl.base.entity.helper.EntityHelper;
-import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
 import nckd.jxccl.opmc.pm.common.PerfManagerFormConstant;
 
 import java.time.LocalDateTime;
@@ -234,7 +231,7 @@ public class CycleGenerateOpPlugin extends AbstractOperationServicePlugIn implem
         QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
                 .addIdNumberName(FormConstant.HRPI_EMPLOYEE)
                 .addGroup(new String[]{FormConstant.HRPI_EMPPOSORGREL},FormConstant.ID_KEY);
-        QueryEntityType queryEntityType = (QueryEntityType) EntityMetadataCache.getDataEntityType(SystemQueryConstant.HSPM_ASSIGNMENTQUERY);
+        QueryEntityType queryEntityType = (QueryEntityType) EntityMetadataCache.getDataEntityType(QueryConstant.PERSON_QUERY);
         return QueryEntityHelper.getInstance().getQueryDyoColl(queryEntityType, queryFieldBuilder.buildSelect(), new QFilter[]{filter}, null);
     }
 

+ 2 - 2
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/plugin/operate/cycle/PerfManagerDeleteOpPlugin.java

@@ -67,7 +67,7 @@ public class PerfManagerDeleteOpPlugin extends AbstractOperationServicePlugIn im
         }
         //将人员所有周期标记为非最新
         PerfManagerHelper.markAsNotCurrentNewest(personIds.toArray(new Long[0]));
-        //将当前人员最新周期(周期开始时间最近的一条)标记为最新的
-        PerfManagerHelper.markAsCurrentNewest(personIds,new QFilter(FormConstant.ID_KEY, QCP.not_in,ids));
+        //将当前人员最新周期(周期开始时间最近的一条)标记为最新的,并将最新一条“结束”状态标记为“正常”状态
+        PerfManagerHelper.markAsCurrentNewestAndUpdateStatus(personIds,new QFilter(FormConstant.ID_KEY, QCP.not_in,ids));
     }
 }

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

@@ -56,10 +56,11 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
     public void onAddValidators(AddValidatorsEventArgs e) {
         String invoker = (String)this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
         boolean dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker);
+        boolean isUpdate = ConvertUtil.toBoolean(this.getOption().getVariableValue("isUpdate",StringUtils.EMPTY),Boolean.FALSE);
         e.addValidator(new AbstractValidator() {
             @Override
             public void validate() {
-                Boolean isCycleGenerate = ConvertUtil.toBoolean(this.getOption().getVariableValue("cyclegenerate",StringUtils.EMPTY),Boolean.FALSE);
+                Boolean isCycleGenerate = ConvertUtil.toBoolean(this.getOption().getVariableValue("cyclegenerate", StringUtils.EMPTY), Boolean.FALSE);
                 //第一个循环先获取表单数据,这里需要兼容单人和批量的数据包
                 Map<Long, List<PersonPerfInfo>> currentBatchData = new HashMap<>();
                 for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
@@ -77,7 +78,7 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
                     if (beginYear != null) {
                         personBeginYearMap.put(personId, beginYear);
                     }
-                    if(id > 0) {
+                    if (id > 0) {
                         ids.add(id);
                     }
 
@@ -89,34 +90,36 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
 
                     currentBatchData.computeIfAbsent(personId, k -> new ArrayList<>()).add(perfInfo);
                 }
-                if(!dataMigration) {
-                    if (!isCycleGenerate) {
-                        //检查同一批次内同一人员的周期重叠
-                        for (Map.Entry<Long, List<PersonPerfInfo>> entry : currentBatchData.entrySet()) {
-                            List<PersonPerfInfo> personPerfList = entry.getValue();
-                            if (personPerfList.size() > 1) {
-                                // 对同一人员的多个周期进行相互比较
-                                for (int i = 0; i < personPerfList.size(); i++) {
-                                    PersonPerfInfo info1 = personPerfList.get(i);
-                                    for (int j = i + 1; j < personPerfList.size(); j++) {
-                                        PersonPerfInfo info2 = personPerfList.get(j);
-                                        String personName = info2.getPerson().getString(FormConstant.NAME_KEY);
-
-                                        // 检查开始年份是否相同
-                                        if (isSameYear(info1.getBeginYear(), info2.getBeginYear())) {
-                                            addFatalErrorMessage(getDataEntities()[info1.getDataEntityIndex()],
-                                                    StrFormatter.format("同批次数据中,人员【{}】存在相同的周期开始年份:{}",
-                                                            personName, info1.getBeginYear().getYear()));
-                                        } else {
-                                            // 只有开始年份不相同时才检查重叠
-                                            // 检查周期是否重叠
-                                            String overlapInfo = getCycleOverlapInfo(
-                                                    info1.getBeginYear(), info1.getEndYear(), null,
-                                                    info2.getBeginYear(), info2.getEndYear(), null);
-
-                                            if (StringUtils.isNotBlank(overlapInfo)) {
+                if(!isUpdate) {
+                    if (!dataMigration) {
+                        if (!isCycleGenerate) {
+                            //检查同一批次内同一人员的周期重叠
+                            for (Map.Entry<Long, List<PersonPerfInfo>> entry : currentBatchData.entrySet()) {
+                                List<PersonPerfInfo> personPerfList = entry.getValue();
+                                if (personPerfList.size() > 1) {
+                                    // 对同一人员的多个周期进行相互比较
+                                    for (int i = 0; i < personPerfList.size(); i++) {
+                                        PersonPerfInfo info1 = personPerfList.get(i);
+                                        for (int j = i + 1; j < personPerfList.size(); j++) {
+                                            PersonPerfInfo info2 = personPerfList.get(j);
+                                            String personName = info2.getPerson().getString(FormConstant.NAME_KEY);
+
+                                            // 检查开始年份是否相同
+                                            if (isSameYear(info1.getBeginYear(), info2.getBeginYear())) {
                                                 addFatalErrorMessage(getDataEntities()[info1.getDataEntityIndex()],
-                                                        StrFormatter.format("同批次数据中,人员【{}】存在重叠周期:{}", personName, overlapInfo));
+                                                        StrFormatter.format("同批次数据中,人员【{}】存在相同的周期开始年份:{}",
+                                                                personName, info1.getBeginYear().getYear()));
+                                            } else {
+                                                // 只有开始年份不相同时才检查重叠
+                                                // 检查周期是否重叠
+                                                String overlapInfo = getCycleOverlapInfo(
+                                                        info1.getBeginYear(), info1.getEndYear(), null,
+                                                        info2.getBeginYear(), info2.getEndYear(), null);
+
+                                                if (StringUtils.isNotBlank(overlapInfo)) {
+                                                    addFatalErrorMessage(getDataEntities()[info1.getDataEntityIndex()],
+                                                            StrFormatter.format("同批次数据中,人员【{}】存在重叠周期:{}", personName, overlapInfo));
+                                                }
                                             }
                                         }
                                     }
@@ -169,25 +172,26 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
                         LocalDateTime dbEndYear = DateUtil.toLocalDateTime(dynamicObject.getDate(PerfManagerFormConstant.NCKD_ENDYEAR));
                         Date actEndYear = dynamicObject.getDate(PerfManagerFormConstant.NCKD_ACTENDYEAR);
                         LocalDateTime dbActEndYear = actEndYear != null ? DateUtil.toLocalDateTime(actEndYear) : null;
-
-                        if(!dataMigration) {
-                            if (!isCycleGenerate) {
-                                // 判断周期是否重叠并获取重叠信息,已结束周期使用实际结束时间
-                                String overlapInfo = getCycleOverlapInfo(beginYear, endYear, null, dbBeginYear, dbEndYear, dbActEndYear);
-                                if (StringUtils.isNotBlank(overlapInfo)) {
-                                    addFatalErrorMessage(rowDataEntity,
-                                            StrFormatter.format("人员【{}】的考核周期与已有周期在{}重叠,请检查!",
-                                                    personName, overlapInfo));
+                        if(!isUpdate) {
+                            if (!dataMigration) {
+                                if (!isCycleGenerate) {
+                                    // 判断周期是否重叠并获取重叠信息,已结束周期使用实际结束时间
+                                    String overlapInfo = getCycleOverlapInfo(beginYear, endYear, null, dbBeginYear, dbEndYear, dbActEndYear);
+                                    if (StringUtils.isNotBlank(overlapInfo)) {
+                                        addFatalErrorMessage(rowDataEntity,
+                                                StrFormatter.format("人员【{}】的考核周期与已有周期在{}重叠,请检查!",
+                                                        personName, overlapInfo));
+                                    }
                                 }
                             }
-                        }
 
-                        //判断beginYear和dbBeginYear的年份是否相同
-                        if (isSameYear(beginYear, dbBeginYear)) {
-                            addFatalErrorMessage(rowDataEntity,
-                                    StrFormatter.format("人员【{}】已经存在周期开始年份【{}】的周期,无需进行创建。",
-                                            personName,
-                                            beginYear.getYear()));
+                            //判断beginYear和dbBeginYear的年份是否相同
+                            if (isSameYear(beginYear, dbBeginYear)) {
+                                addFatalErrorMessage(rowDataEntity,
+                                        StrFormatter.format("人员【{}】已经存在周期开始年份【{}】的周期,无需进行创建。",
+                                                personName,
+                                                beginYear.getYear()));
+                            }
                         }
 
                         //当前周期必须大于之前周期的开始时间