瀏覽代碼

Merge branch 'refs/heads/feat-hr-psms_1.0'

wyc 1 周之前
父節點
當前提交
45edb5b1d5
共有 20 個文件被更改,包括 842 次插入78 次删除
  1. 8 0
      code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/constant/FormConstant.java
  2. 3 3
      code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/utils/DateUtil.java
  3. 35 25
      code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/utils/ShowOperExecuteResult.java
  4. 1 0
      code/base/nckd-jxccl-base-helper/src/main/java/nckd/jxccl/base/hrpi/helper/EmpPosOrgRelHelper.java
  5. 18 0
      code/base/nckd-jxccl-base-helper/src/main/java/nckd/jxccl/base/org/helper/OrgHelper.java
  6. 5 0
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/common/PositionStructureConstant.java
  7. 62 0
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/form/other/MgrAppointMgmtListPlugin.java
  8. 85 0
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/form/other/NewApptPopupFormPlugin.java
  9. 50 0
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/form/other/impt/MgrAppointMgmtImportPlugin.java
  10. 41 0
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/file/PersonPosFileSaveOpPlugin.java
  11. 65 0
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/other/EndAppointMentOpPlugin.java
  12. 181 0
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/other/MgrAppointMgmtTransferAfterEffectOp.java
  13. 231 0
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/other/NewAppointMentOpPlugin.java
  14. 12 2
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/performance/PerfRankMgmtSaveOpPlugin.java
  15. 23 4
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/performance/validate/PerfRankMgmtSaveValidate.java
  16. 14 2
      code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/plugin/operate/cycle/PerfManagerSaveOpPlugin.java
  17. 3 15
      code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/empmgt/SubCoHeadServiceListPlugin.java
  18. 4 15
      code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/empmgt/TenurePersonListListPlugin.java
  19. 1 10
      code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/structappr/AbstractStructApprFormPlugin.java
  20. 0 2
      code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/operate/empmgt/SubCoHeadServiceOpPlugin.java

+ 8 - 0
code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/constant/FormConstant.java

@@ -379,6 +379,14 @@ public class FormConstant {
     public static final String POST_PERF_WAGE_SYS = "001";
     /**薪酬标准方案*/
     public static final String NCKD_PAYSTDPLAN = "nckd_paystdplan";
+    /**调出岗位*/
+    public static final String BB_PO_POSITION = "bb_po_position";
+    /**调入岗位*/
+    public static final String APOSITION = "aposition";
+    /**待调动人员*/
+    public static final String BB_EM_TID = "bb_em_tid";
+    /**实际调动日期*/
+    public static final String B_EFFECTIVEDATE = "b_effectivedate";
 
 
 

+ 3 - 3
code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/utils/DateUtil.java

@@ -713,17 +713,17 @@ public class DateUtil {
     }
 
     /**
-     * 获取远期截止日期(2199年12月31日)
+     * 获取远期截止日期(2999年12月31日)
      * 常用于表示无截止日期限制的场景
      *
      * @return 2199年12月31日 23:59:59.999999999
      */
     public static LocalDateTime getMaxDate() {
-        return LocalDateTime.of(2199, 12, 31, 23, 59, 59, 999999999);
+        return LocalDateTime.of(2999, 12, 31, 23, 59, 59, 999999999);
     }
 
     /**
-     * 获取远期截止日期(2199年12月31日)
+     * 获取远期截止日期(2999年12月31日)
      * 常用于表示无截止日期限制的场景
      *
      * @return 2199年12月31日

+ 35 - 25
code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/utils/ShowOperExecuteResult.java

@@ -7,8 +7,10 @@ import kd.bos.entity.operate.result.IOperateInfo;
 import kd.bos.entity.operate.result.OperateErrorInfo;
 import kd.bos.entity.operate.result.OperationResult;
 import kd.bos.form.FormShowParameter;
+import kd.bos.form.IFormView;
 import kd.bos.form.IPageCache;
 import kd.bos.form.ShowType;
+import kd.bos.mvc.SessionManager;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.HashMap;
@@ -27,29 +29,28 @@ import java.util.StringJoiner;
  */
 public class ShowOperExecuteResult {
 
-    /**
-     * 获取操作结果表单显示参数(重载方法1)
-     * 
-     * @param operateName 操作名称
-     * @param successMap 成功记录映射关系(成功的数据需要显示时需要在op自定义参数中添加:this.getOperationResult().getCustomData().put("成功的id","需要显示的消息");)
-     * @param pageCache 页面缓存对象
-     * @param operationResult 操作结果对象
-     * @return 表单显示参数
-     */
-    public static FormShowParameter getOperResultForm(String operateName, Map<Object, Object> successMap, IPageCache pageCache, OperationResult operationResult) {
-        return getOperResultForm(null, operateName, successMap, pageCache, operationResult);
+    public static FormShowParameter getOperResultForm(String operateName, IFormView formView, OperationResult operationResult) {
+        String parentPageId = formView.getFormShowParameter().getPageId();
+        IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
+        IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
+        return getOperResultForm(operateName, pageCache, operationResult);
     }
 
+    public static FormShowParameter getOperResultForm(String operateName, IFormView formView,IPageCache pageCache, OperationResult operationResult) {
+        String parentPageId = formView.getFormShowParameter().getPageId();
+        IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
+        return getOperResultForm(operateName, pageCache, operationResult);
+    }
     /**
-     * 获取操作结果表单显示参数(重载方法2)
+     * 获取操作结果表单显示参数(重载方法1
      * 
      * @param operateName 操作名称
      * @param pageCache 页面缓存对象
      * @param operationResult 操作结果对象
      * @return 表单显示参数
      */
-    public static FormShowParameter getOperResultForm(String operateName, IPageCache pageCache,  OperationResult operationResult) {
-        return getOperResultForm(null, operateName, null, pageCache, operationResult);
+    public static FormShowParameter getOperResultForm(String operateName,  IPageCache pageCache, OperationResult operationResult) {
+        return getOperResultForm(null, operateName, pageCache, operationResult);
     }
 
     /**
@@ -58,27 +59,36 @@ public class ShowOperExecuteResult {
      * 
      * @param title 自定义标题,如果为空则根据成功/失败数量自动生成标题
      * @param operateName 操作名称
-     * @param successMap 成功记录映射关系
      * @param pageCache 页面缓存对象,用于存储操作结果序列化后的数据
      * @param operationResult 操作结果对象,包含详细的成功/失败信息
      * @return 表单显示参数对象
      */
-    public static FormShowParameter getOperResultForm(String title, String operateName, Map<Object, Object> successMap, IPageCache pageCache, OperationResult operationResult) {
+    public static FormShowParameter getOperResultForm(String title, String operateName,  IPageCache pageCache, OperationResult operationResult) {
 
         // 收集所有错误或验证信息
         StringJoiner errorMsgJoiner = new StringJoiner(StrFormatter.LINE_SEPARATOR);
 
         // 构建自定义参数
         Map<String, Object> customParam = new HashMap(2);
-        // 如果有成功记录映射关系,则添加到参数中
-        if (successMap != null && !successMap.isEmpty()) {
-            // 成功消息
-            customParam.put("pkNumbers", successMap);
-            for (Map.Entry<Object, Object> objectObjectEntry : successMap.entrySet()) {
-                Object key = objectObjectEntry.getKey();
-                Object value = objectObjectEntry.getValue();
-                String tip = value != null ? ConvertUtil.toStr( value) : ConvertUtil.toStr( key);
-                errorMsgJoiner.add(String.format(ResManager.loadKDString("%s:执行成功。", "ShowOperationResultPlugin_2", "bos-designer-plugin", new Object[0]), tip));
+        //成功的记录
+        Map<String, String> customData = operationResult.getCustomData();
+        if(customData != null) {
+            //成功的记录
+            Map<Object, Object> successMap = new HashMap<>();
+            for (Object successPkId : operationResult.getSuccessPkIds()) {
+                successMap.put(successPkId, customData.get(successPkId.toString()));
+            }
+
+            // 如果有成功记录映射关系,则添加到参数中
+            if (!successMap.isEmpty()) {
+                // 成功消息
+                customParam.put("pkNumbers", successMap);
+                for (Map.Entry<Object, Object> objectObjectEntry : successMap.entrySet()) {
+                    Object key = objectObjectEntry.getKey();
+                    Object value = objectObjectEntry.getValue();
+                    String tip = value != null ? ConvertUtil.toStr(value) : ConvertUtil.toStr(key);
+                    errorMsgJoiner.add(String.format(ResManager.loadKDString("%s:执行成功。", "ShowOperationResultPlugin_2", "bos-designer-plugin", new Object[0]), tip));
+                }
             }
         }
 

+ 1 - 0
code/base/nckd-jxccl-base-helper/src/main/java/nckd/jxccl/base/hrpi/helper/EmpPosOrgRelHelper.java

@@ -124,6 +124,7 @@ public class EmpPosOrgRelHelper {
                 // 所属公司
                 .addIdNumberName(FormConstant.COMPANY_KEY)
                 // 行政组织(部门)
+                .add(FormConstant.ADMINORG)
                 .addIdNumberName(FormConstant.ADMINORG)
                 // 岗位
                 .addIdNumberName(FormConstant.POSITION_KEY)

+ 18 - 0
code/base/nckd-jxccl-base-helper/src/main/java/nckd/jxccl/base/org/helper/OrgHelper.java

@@ -1,7 +1,9 @@
 package nckd.jxccl.base.org.helper;
 
+import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.servicehelper.basedata.BaseDataServiceHelper;
 import nckd.jxccl.base.common.utils.ConvertUtil;
+import nckd.jxccl.base.entity.helper.EntityHelper;
 
 import java.util.List;
 
@@ -29,6 +31,22 @@ public class OrgHelper {
         return null;
     }
 
+    /**
+     * 获取创建组织
+     * @param entity 实体id
+     * @return: java.lang.Long
+     * @author W.Y.C
+     * @date: 2025/12/04 10:27
+     */
+    public static DynamicObject getCreateOrg(String entity) {
+        List<Long> createOrgList = BaseDataServiceHelper.getCreateOrgList(entity);
+        if (createOrgList != null && !createOrgList.isEmpty()) {
+            return EntityHelper.newEntity(entity,createOrgList.get(0));
+
+        }
+        return null;
+    }
+
     /**
      * 获取控制策略
      * @param entity 实体id

+ 5 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/common/PositionStructureConstant.java

@@ -268,4 +268,9 @@ public class PositionStructureConstant extends FormConstant {
     public static final String PERFMANAGER_ENTRY_ENTITYID = "nckd_perfmanagerentry";
     /** 分录-考核年份 */
     public static final String APPRAISAL_YEAR_KEY = "nckd_appraisalyear";
+
+    /*-------------------------------------- 新建任命 begin --------------------------------------*/
+    /** 新建任命-实体标识 */
+    public static final String NEWAPPTPOPUP_ENTITYID = "nckd_newapptpopup";
+    /*-------------------------------------- 新建任命 end --------------------------------------*/
 }

+ 62 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/form/other/MgrAppointMgmtListPlugin.java

@@ -0,0 +1,62 @@
+package nckd.jxccl.hr.psms.plugin.form.other;
+
+import kd.bos.common.enums.EnableEnum;
+import kd.bos.form.CloseCallBack;
+import kd.bos.form.FormShowParameter;
+import kd.bos.form.ShowType;
+import kd.bos.form.events.AfterDoOperationEventArgs;
+import kd.bos.form.events.ClosedCallBackEvent;
+import kd.bos.form.events.SetFilterEvent;
+import kd.bos.list.plugin.AbstractListPlugin;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.enums.psms.TypeStateEnum;
+import nckd.jxccl.hr.psms.common.PositionStructureConstant;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+* 管理人员任命
+* 实体标识:nckd_mgrappointmgmt
+* @author W.Y.C
+* @date 2025/12/4 18:23
+* @version 1.0
+*/
+public class MgrAppointMgmtListPlugin extends AbstractListPlugin implements Plugin {
+
+    @Override
+    public void setFilter(SetFilterEvent e) {
+        //只查询类型状态
+        QFilter filter = new QFilter(PositionStructureConstant.NCKD_TYPESTATE, QCP.equals, TypeStateEnum.MANAGEMENT_SEQUENCE_EMPLOYMENT.getCode());
+        e.addCustomQFilter(filter);
+    }
+
+    @Override
+    public void afterDoOperation(AfterDoOperationEventArgs e) {
+        String operateKey = e.getOperateKey();
+        if(e.getOperationResult() != null && e.getOperationResult().isSuccess()){
+            if("newappointment".equalsIgnoreCase(operateKey)) {
+                FormShowParameter showParameter = new FormShowParameter();
+                showParameter.setFormId(PositionStructureConstant.NEWAPPTPOPUP_ENTITYID);
+                showParameter.getOpenStyle().setShowType(ShowType.Modal);
+                showParameter.setCaption("新建任命");
+                showParameter.setCloseCallBack(new CloseCallBack(this, PositionStructureConstant.NEWAPPTPOPUP_ENTITYID));
+                this.getView().showForm(showParameter);
+            }
+            this.getView().invokeOperation(FormConstant.REFRESH_OP);
+        }
+    }
+
+    @Override
+    public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
+        String actionId = closedCallBackEvent.getActionId();
+        if(PositionStructureConstant.NEWAPPTPOPUP_ENTITYID.equalsIgnoreCase(actionId)){
+            Object returnData = closedCallBackEvent.getReturnData();
+            if(returnData != null) {
+                //刷新列表
+                this.getView().invokeOperation(FormConstant.REFRESH_OP);
+            }
+        }
+    }
+}

+ 85 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/form/other/NewApptPopupFormPlugin.java

@@ -0,0 +1,85 @@
+package nckd.jxccl.hr.psms.plugin.form.other;
+
+import kd.bos.dataentity.OperateOption;
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.entity.EntityMetadataCache;
+import kd.bos.entity.MainEntityType;
+import kd.bos.entity.operate.result.OperationResult;
+import kd.bos.form.IFormView;
+import kd.bos.form.IPageCache;
+import kd.bos.form.MessageBoxOptions;
+import kd.bos.form.events.AfterDoOperationEventArgs;
+import kd.bos.form.plugin.AbstractFormPlugin;
+import kd.bos.mvc.SessionManager;
+import kd.bos.servicehelper.operation.OperationServiceHelper;
+import kd.bos.servicehelper.operation.SaveServiceHelper;
+import kd.bos.servicehelper.user.UserServiceHelper;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.enums.psms.TypeStateEnum;
+import nckd.jxccl.base.common.utils.DateUtil;
+import nckd.jxccl.base.common.utils.ShowOperExecuteResult;
+import nckd.jxccl.base.common.utils.StrFormatter;
+import nckd.jxccl.base.entity.helper.EntityHelper;
+import nckd.jxccl.base.hrpi.helper.EmpPosOrgRelHelper;
+import nckd.jxccl.base.org.helper.OrgHelper;
+import nckd.jxccl.hr.psms.common.PositionStructureConstant;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+* 新建任命
+* 实体标识:nckd_newapptpopup
+* @author W.Y.C
+* @date 2025/12/4 18:50
+* @version 1.0
+*/
+public class NewApptPopupFormPlugin extends AbstractFormPlugin implements Plugin {
+
+    @Override
+    public void afterDoOperation(AfterDoOperationEventArgs e) {
+        String operateKey = e.getOperateKey();
+        if(e.getOperationResult() != null && e.getOperationResult().isSuccess()){
+            if(FormConstant.AFFIRM_OP.equalsIgnoreCase(operateKey)) {
+
+                //新建管理任命
+                DynamicObjectCollection entryColl = this.getModel().getDataEntity(true).getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
+                List<DynamicObject> newEntityList = new ArrayList<>();
+                for (DynamicObject entry : entryColl) {
+                    DynamicObject newEntity = EntityHelper.newEntity(PositionStructureConstant.NCKD_PERSONPOSFILE);
+                    DynamicObject person = entry.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
+                    long personId = person.getLong(FormConstant.ID_KEY);
+                    String personName = person.getString(FormConstant.NAME_KEY);
+                    newEntity.set(FormConstant.NCKD_PERSON, entry.get(FormConstant.NCKD_PERSON));
+                    Date beginDate = entry.getDate(PositionStructureConstant.NCKD_BEGINDATE);
+                    LocalDateTime beginDateDateTime = DateUtil.toLocalDateTime(beginDate);
+                    newEntity.set(PositionStructureConstant.NCKD_BEGINDATE, beginDate);
+                    newEntityList.add(newEntity);
+                }
+                OperateOption operateOption = OperateOption.create();
+                operateOption.setVariableValue(PositionStructureConstant.NCKD_TYPESTATE, TypeStateEnum.MANAGEMENT_SEQUENCE_EMPLOYMENT.getCode());
+                OperationResult operationResult = OperationServiceHelper.executeOperate(
+                        "savenewappointment",
+                        PositionStructureConstant.PERSONPOSFILE_ENTITYID,
+                        newEntityList.toArray(new DynamicObject[0]),
+                        OperateOption.create()
+                );
+                if (!operationResult.isSuccess()) {
+                    this.getView().showForm(ShowOperExecuteResult.getOperResultForm("新建任命", this.getView().getParentView(),this.getPageCache(), operationResult));
+                } else {
+                    this.getView().returnDataToParent("true");
+                    this.getView().getParentView().showSuccessNotification("新建任命成功");
+                    this.getView().close();
+                }
+            }
+        }
+    }
+}

+ 50 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/form/other/impt/MgrAppointMgmtImportPlugin.java

@@ -0,0 +1,50 @@
+package nckd.jxccl.hr.psms.plugin.form.other.impt;
+
+import com.google.common.collect.Lists;
+import kd.bos.dataentity.OperateOption;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.hr.hbp.formplugin.web.HRDataBaseList;
+import kd.hr.impt.common.dto.ImportBillData;
+import kd.hr.impt.common.plugin.BeforeCallOperationEventArgs;
+import kd.hr.impt.common.plugin.BeforeShowTemplateSelectListEventArgs;
+import kd.hr.impt.common.plugin.HRImportPlugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.enums.psms.TypeStateEnum;
+import nckd.jxccl.hr.psms.common.PositionStructureConstant;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+* 管理人员任命导入插件
+* @author W.Y.C
+* @date 2025/12/4 22:10
+* @version 1.0
+*/
+public class MgrAppointMgmtImportPlugin extends HRDataBaseList implements HRImportPlugin {
+
+    private static String MGRAPPOINTMGMT_IMPT = "mgrappointmgmt_IMPT";
+
+    @Override
+    public void beforeShowTemplateSelectList(BeforeShowTemplateSelectListEventArgs args) {
+        List<QFilter> fileter = args.getqFilterList();
+        if(fileter == null){
+            fileter = Lists.newArrayList();
+        }
+        fileter.add(new QFilter(FormConstant.NUMBER_KEY, QCP.in, new String[]{MGRAPPOINTMGMT_IMPT}));
+        args.setqFilterList(fileter);
+    }
+
+    @Override
+    public void beforeCallOperation(BeforeCallOperationEventArgs args) {
+        String mainEntityId = ((ImportBillData)args.getImportBillDatas().get(0)).getMainEntityId();
+        OperateOption operateOption = (OperateOption)args.getOperateOptions().get(mainEntityId);
+        operateOption.setVariableValue(PositionStructureConstant.NCKD_TYPESTATE, TypeStateEnum.MANAGEMENT_SEQUENCE_EMPLOYMENT.getCode());
+        Map<String, String> submitOPs = args.getSubmitOPs();
+        String targetKey = PositionStructureConstant.NCKD_PERSONPOSFILE.toLowerCase();
+        //删除默认save方法
+        submitOPs.entrySet().removeIf(entry -> entry.getKey().toLowerCase().equals(targetKey));
+        submitOPs.put(PositionStructureConstant.NCKD_PERSONPOSFILE.toLowerCase(),"savenewappointment");
+    }
+}

+ 41 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/file/PersonPosFileSaveOpPlugin.java

@@ -0,0 +1,41 @@
+package nckd.jxccl.hr.psms.plugin.operate.file;
+
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.entity.EntityMetadataCache;
+import kd.bos.entity.ExtendedDataEntity;
+import kd.bos.entity.MainEntityType;
+import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
+import kd.bos.entity.plugin.AddValidatorsEventArgs;
+import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
+import kd.bos.entity.validate.AbstractValidator;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.QueryServiceHelper;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.enums.psms.TypeStateEnum;
+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.org.helper.OrgHelper;
+import nckd.jxccl.hr.psms.common.PositionStructureConstant;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+* 员工职位档案
+* 实体标识:nckd_personposfile
+* @author W.Y.C
+* @date 2025/12/4 19:36
+* @version 1.0
+*/
+public class PersonPosFileSaveOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
+
+}

+ 65 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/other/EndAppointMentOpPlugin.java

@@ -0,0 +1,65 @@
+package nckd.jxccl.hr.psms.plugin.operate.other;
+
+import kd.bos.dataentity.OperateOption;
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.entity.ExtendedDataEntity;
+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.servicehelper.operation.SaveServiceHelper;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.enums.psms.TypeStateEnum;
+import nckd.jxccl.base.common.exception.ValidationException;
+import nckd.jxccl.base.common.utils.StrFormatter;
+import nckd.jxccl.hr.psms.common.PositionStructureConstant;
+
+import java.util.Date;
+
+/**
+ * 终止管理人员任命
+ * 实体标识:nckd_mgrappointmgmt
+ * @author W.Y.C
+ * @date 2025/12/4 21:25
+ * @version 1.0
+ */
+public class EndAppointMentOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
+
+    @Override
+    public void onPreparePropertys(PreparePropertysEventArgs e) {
+        e.getFieldKeys().addAll(this.billEntityType.getAllFields().keySet());
+    }
+
+    @Override
+    public void onAddValidators(AddValidatorsEventArgs e) {
+        e.addValidator(new AbstractValidator(){
+            @Override
+            public void validate() {
+                for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
+                    DynamicObject data = rowDataEntity.getDataEntity();
+                    DynamicObject person = data.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
+                    String name = person.getString(PositionStructureConstant.NAME_KEY);
+                    String typeState = data.getString(PositionStructureConstant.NCKD_TYPESTATE);
+                    String appointStatus = data.getString(PositionStructureConstant.NCKD_APPOINTSTATUS);
+                    if(!"1".equalsIgnoreCase(appointStatus)){
+                        this.addErrorMessage(rowDataEntity, StrFormatter.format("【{}】状态为【已终止】,忽略此条处理!",name));
+                    }
+                }
+            }
+        });
+    }
+
+    @Override
+    public void beginOperationTransaction(BeginOperationTransactionArgs e) {
+        for (DynamicObject dataEntity : e.getDataEntities()) {
+            dataEntity.set(PositionStructureConstant.NCKD_APPOINTSTATUS, "0");
+            dataEntity.set(PositionStructureConstant.NCKD_ENDDATE, new Date());
+        }
+        OperationResult operationResult = SaveServiceHelper.saveOperate(PositionStructureConstant.PERSONPOSFILE_ENTITYID, e.getDataEntities(), OperateOption.create());
+        if (!operationResult.isSuccess()) {
+            throw new ValidationException(operationResult.getMessage());
+        }
+    }
+}

+ 181 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/other/MgrAppointMgmtTransferAfterEffectOp.java

@@ -0,0 +1,181 @@
+package nckd.jxccl.hr.psms.plugin.operate.other;
+
+import kd.bos.dataentity.OperateOption;
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.entity.EntityMetadataCache;
+import kd.bos.entity.MainEntityType;
+import kd.bos.entity.operate.result.OperationResult;
+import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
+import kd.bos.entity.plugin.PreparePropertysEventArgs;
+import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
+import kd.bos.logging.Log;
+import kd.bos.logging.LogFactory;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.BusinessDataServiceHelper;
+import kd.bos.servicehelper.QueryServiceHelper;
+import kd.bos.servicehelper.operation.OperationServiceHelper;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.enums.psms.JobSeqEnum;
+import nckd.jxccl.base.common.enums.psms.TypeStateEnum;
+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.hr.psms.common.PositionStructureConstant;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+* 事务变动生效后调动事件订阅操作插件-管理人员任命
+* 实体标识:nckd_mgrappointmgmt
+* @author W.Y.C
+* @date 2025/12/5 10:44
+* @version 1.0
+*/
+public class MgrAppointMgmtTransferAfterEffectOp extends AbstractOperationServicePlugIn implements Plugin {
+
+
+    private static final Log log = LogFactory.getLog(MgrAppointMgmtTransferAfterEffectOp.class);
+
+    @Override
+    public void onPreparePropertys(PreparePropertysEventArgs e) {
+        e.getFieldKeys().addAll(this.billEntityType.getAllFields().keySet());
+    }
+
+    @Override
+    public void beginOperationTransaction(BeginOperationTransactionArgs e) {
+        List<Long> personIdList = new ArrayList<>();
+        for (DynamicObject dataEntity : e.getDataEntities()) {
+            DynamicObject employee = dataEntity.getDynamicObject(FormConstant.BB_EM_TID);
+            if(employee != null){
+                personIdList.add(employee.getLong(FormConstant.ID_KEY));
+            }
+        }
+        //查询管理人员任命
+        QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
+                .add(FormConstant.ID_KEY);
+        QFilter qFilter = new QFilter(PositionStructureConstant.NCKD_PERSON, QCP.in, personIdList);
+        qFilter.and(PositionStructureConstant.NCKD_TYPESTATE, QCP.equals, TypeStateEnum.MANAGEMENT_SEQUENCE_EMPLOYMENT.getCode());
+        DynamicObjectCollection query = QueryServiceHelper.query(PositionStructureConstant.NCKD_PERSONPOSFILE, queryFieldBuilder.buildSelect(), new QFilter[]{});
+        List<Long> ids = query.stream()
+                .map(obj -> obj.getLong(FormConstant.ID_KEY))
+                .collect(ArrayList::new, ArrayList::add, ArrayList::addAll);
+        MainEntityType entityType = EntityMetadataCache.getDataEntityType(PositionStructureConstant.NCKD_PERSONPOSFILE);
+        DynamicObject[] load = BusinessDataServiceHelper.load(ids.toArray(new Long[0]), entityType);
+        // 按人员分组,Map<人员ID, List<职位档案>>
+        Map<Long, List<DynamicObject>> personPosFileMap = query.stream()
+                .collect(Collectors.groupingBy(
+                        obj -> obj.getLong(String.join(".", FormConstant.NCKD_PERSON, FormConstant.ID_KEY))
+                ));
+
+        List<DynamicObject> saveMgrAppointMgmt = new ArrayList<>();
+        for (DynamicObject dataEntity : e.getDataEntities()) {
+            //人员
+            DynamicObject employee = dataEntity.getDynamicObject(FormConstant.BB_EM_TID);
+            long empId = dataEntity.getLong(String.join(".", FormConstant.BB_EM_TID, FormConstant.ID_KEY));
+            //调出岗位
+            DynamicObject beforePosition = dataEntity.getDynamicObject(FormConstant.BB_PO_POSITION);
+            //调出前职位序列
+            DynamicObject beforeJobSeq = beforePosition.getDynamicObject(FormConstant.NCKD_JOBSEQ);
+            //调入岗位
+            DynamicObject afterPosition = dataEntity.getDynamicObject(FormConstant.APOSITION);
+            //调入岗位
+            DynamicObject afterJobSeq = afterPosition.getDynamicObject(FormConstant.NCKD_JOBSEQ);
+            String afterJobSeqNumber = afterJobSeq.getString(FormConstant.NUMBER_KEY);
+            //调动生效日期
+            Date effectiveDate = dataEntity.getDate(FormConstant.B_EFFECTIVEDATE);
+
+            List<DynamicObject> personPosFile = personPosFileMap.get(empId);
+
+            if(JobSeqEnum.MANAGE.getCode().equalsIgnoreCase(afterJobSeqNumber)){
+                //调入后岗位是管理序列
+                //判断有没有在任命的记录,没有则新增。如果有判断状态是不是等于0(已终止),如果是则新增
+                boolean needCreateNew = false;
+                Date latestEndDate = null;
+                if(personPosFile == null || personPosFile.isEmpty()){
+                    // 没有任命记录
+                    needCreateNew = true;
+                }else{
+                    // 检查所有记录的状态是否都为已终止(0)
+                    boolean allTerminated = true;
+
+                    for(DynamicObject record : personPosFile){
+                        String appointStatus = record.getString(PositionStructureConstant.NCKD_APPOINTSTATUS);
+                        if(!"0".equals(appointStatus)){
+                            allTerminated = false;
+                            break;
+                        }
+                        // 获取记录的终止时间,找到最近的一次
+                        Date endDate = record.getDate(PositionStructureConstant.NCKD_ENDDATE);
+                        if (endDate != null) {
+                            if (latestEndDate == null || endDate.after(latestEndDate)) {
+                                latestEndDate = endDate;
+                            }
+                        }
+                    }
+                    // 所有记录都是已终止状态
+                    if(allTerminated){
+                        needCreateNew = true;
+                    }
+                    // 如果需要使用latestEndDate,可以在这里添加相关逻辑
+                    // 例如:可以在新增记录时将此日期作为参考
+                }
+                if(needCreateNew){
+                    DynamicObject newEntity = EntityHelper.newEntity(PositionStructureConstant.NCKD_PERSONPOSFILE);
+                    newEntity.set(FormConstant.NCKD_PERSON, employee);
+                    Date beginDate;
+                    if (latestEndDate != null && latestEndDate.after(effectiveDate)) {
+                        // 如果最后结束日期在生效日期之后,则使用最后结束日期加一天
+                        beginDate = DateUtil.toDate(DateUtil.addDays(DateUtil.toLocalDateTime(latestEndDate), 1));
+                        newEntity.set(FormConstant.DESCRIPTION_KEY, StrFormatter.format("调动单生成任命。(由于最后一次任命结束时间为:【{}】,在调动生效日期:【{}】),系统自动将任命开始日期设置为【{}】",
+                                DateUtil.format(latestEndDate, "yyyy-MM-dd"),
+                                DateUtil.format(effectiveDate, "yyyy-MM-dd"),
+                                DateUtil.format(beginDate, "yyyy-MM-dd")));
+                    } else {
+                        // 否则使用生效日期
+                        beginDate = effectiveDate;
+                        newEntity.set(FormConstant.DESCRIPTION_KEY,"调动单生成任命");
+                    }
+                    newEntity.set(PositionStructureConstant.NCKD_BEGINDATE, beginDate);
+
+                }
+            }else{
+                //调入后岗位不是管理序列
+                //判断有没有在任命的记录,有则终止任命
+                if(personPosFile != null && !personPosFile.isEmpty()){
+                    for(DynamicObject record : personPosFile){
+                        String appointStatus = record.getString(PositionStructureConstant.NCKD_APPOINTSTATUS);
+                        if(!"1".equals(appointStatus)){
+                            // 终止任命
+                            record.set(PositionStructureConstant.NCKD_APPOINTSTATUS, "0");
+                            record.set(PositionStructureConstant.NCKD_ENDDATE, effectiveDate);
+                            record.set(PositionStructureConstant.NCKD_DESCRIPTION, "调动单终止任命");
+                            saveMgrAppointMgmt.add(record);
+                        }
+                    }
+                }
+            }
+        }
+
+        OperateOption operateOption = OperateOption.create();
+        operateOption.setVariableValue(PositionStructureConstant.NCKD_TYPESTATE, TypeStateEnum.MANAGEMENT_SEQUENCE_EMPLOYMENT.getCode());
+        OperationResult operationResult = OperationServiceHelper.executeOperate(
+                "savenewappointment",
+                PositionStructureConstant.PERSONPOSFILE_ENTITYID,
+                saveMgrAppointMgmt.toArray(new DynamicObject[0]),
+                OperateOption.create()
+        );
+
+        if(operationResult != null && !operationResult.isSuccess()){
+
+        }
+    }
+}

+ 231 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/other/NewAppointMentOpPlugin.java

@@ -0,0 +1,231 @@
+package nckd.jxccl.hr.psms.plugin.operate.other;
+
+import kd.bos.dataentity.OperateOption;
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.entity.ExtendedDataEntity;
+import kd.bos.entity.operate.result.IOperateInfo;
+import kd.bos.entity.operate.result.OperateErrorInfo;
+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.plugin.args.EndOperationTransactionArgs;
+import kd.bos.entity.validate.AbstractValidator;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.QueryServiceHelper;
+import kd.bos.servicehelper.operation.SaveServiceHelper;
+import kd.bos.servicehelper.user.UserServiceHelper;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.enums.psms.TypeStateEnum;
+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.hrpi.helper.EmpPosOrgRelHelper;
+import nckd.jxccl.base.org.helper.OrgHelper;
+import nckd.jxccl.hr.psms.common.PositionStructureConstant;
+import org.apache.commons.lang3.StringUtils;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.StringJoiner;
+import java.util.stream.Collectors;
+
+/**
+ * 新建管理人员任命
+ * 实体标识:nckd_mgrappointmgmt
+ * @author W.Y.C
+ * @date 2025/12/4 21:25
+ * @version 1.0
+ */
+public class NewAppointMentOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
+
+    @Override
+    public void onPreparePropertys(PreparePropertysEventArgs e) {
+
+        e.getFieldKeys().addAll(this.billEntityType.getAllFields().keySet());
+    }
+
+    @Override
+    public void onAddValidators(AddValidatorsEventArgs e) {
+        e.addValidator(new AbstractValidator() {
+            @Override
+            public void validate() {
+                List<Long> personIdList = new ArrayList<>();
+                for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
+                    DynamicObject data = rowDataEntity.getDataEntity();
+                    long personId = data.getLong(String.join(".", FormConstant.NCKD_PERSON, FormConstant.ID_KEY));
+                    personIdList.add(personId);
+
+                    DynamicObject person = data.getDynamicObject(FormConstant.NCKD_PERSON);
+                    if (person != null) {
+                        //设置每行对应的员工名称,用于准确显示每个错误属于哪个员工的
+                        getOperationResult().getCustomData().put("DataEntityIndex_" + rowDataEntity.getDataEntityIndex(), "【" + person.getString(FormConstant.NAME_KEY) + "】");
+                    }
+                }
+
+                Map<Long, List<DynamicObject>> mgrAppointMgmtMap = new HashMap<>();
+                //查询管理人员任命
+                QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
+                        .add(FormConstant.ID_KEY)
+                        .add(PositionStructureConstant.NCKD_BEGINDATE)
+                        .add(PositionStructureConstant.NCKD_ENDDATE)
+                        .add(PositionStructureConstant.NCKD_APPOINTSTATUS)
+                        .addIdNumberName(PositionStructureConstant.NCKD_PERSON);
+                QFilter qFilter = new QFilter(PositionStructureConstant.NCKD_PERSON, QCP.in, personIdList);
+                qFilter.and(PositionStructureConstant.NCKD_TYPESTATE, QCP.equals, TypeStateEnum.MANAGEMENT_SEQUENCE_EMPLOYMENT.getCode());
+                DynamicObjectCollection query = QueryServiceHelper.query(PositionStructureConstant.NCKD_PERSONPOSFILE, queryFieldBuilder.buildSelect(), new QFilter[]{});
+                // 按用户ID分组
+                mgrAppointMgmtMap = query.stream()
+                        .collect(Collectors.groupingBy(
+                                obj -> obj.getLong(String.join(".", FormConstant.NCKD_PERSON, FormConstant.ID_KEY))
+                        ));
+
+                for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
+                    DynamicObject data = rowDataEntity.getDataEntity();
+                    DynamicObject person = data.getDynamicObject(FormConstant.NCKD_PERSON);
+                    if(person == null){
+                        this.addErrorMessage(rowDataEntity, "请选择员工。");
+                        continue;
+                    }
+                    long personId = person.getLong(FormConstant.ID_KEY);
+                    String personName = person.getString(FormConstant.NAME_KEY);
+                    if(data.getDate(PositionStructureConstant.NCKD_BEGINDATE) == null){
+                        this.addErrorMessage(rowDataEntity, StrFormatter.format("【{}】的开始日期不能为空。", personName));
+                        continue;
+                    }
+
+                    //管理人员任命校验
+                    List<DynamicObject> dbmgrAppointMgmtList = mgrAppointMgmtMap.get(personId);
+                    if (dbmgrAppointMgmtList != null) {
+                        //1、判断有没有状态为【任命中=1】中的
+                        boolean hasAppointingStatus = dbmgrAppointMgmtList.stream()
+                                .anyMatch(obj -> "1".equals(obj.getString(PositionStructureConstant.NCKD_APPOINTSTATUS)));
+                        if (hasAppointingStatus) {
+                            this.addErrorMessage(rowDataEntity, StrFormatter.format("存在状态为【{}】的记录,不能任命。", "任命中"));
+                        }
+
+                        //2、判断有没有任命日期在有效时间内的
+                        if (!hasAppointingStatus) {
+                            Date beginDate = data.getDate(PositionStructureConstant.NCKD_BEGINDATE);
+
+                            Optional<DynamicObject> lastAppointment = dbmgrAppointMgmtList.stream()
+                                    .filter(obj -> {
+                                        Date endDate = obj.getDate(PositionStructureConstant.NCKD_ENDDATE);
+                                        // 新的任命开始时间必须在上一条记录的结束时间之后
+                                        return endDate != null && beginDate != null && !beginDate.after(endDate);
+                                    })
+                                    .findFirst();
+
+                            if (lastAppointment.isPresent()) {
+                                DynamicObject appointment = lastAppointment.get();
+                                Date endDate = appointment.getDate(PositionStructureConstant.NCKD_ENDDATE);
+                                String periodMessage = StrFormatter.format("新的任命开始时间不能早于或等于上一任命的结束时间【{}】。",
+                                        endDate != null ? DateUtil.format(endDate, "yyyy-MM-dd") : "");
+                                // 提示用户时间段信息
+                                this.addErrorMessage(rowDataEntity, periodMessage);
+                            }
+                        }
+
+                    }
+                }
+            }
+        });
+    }
+
+    @Override
+    public void beginOperationTransaction(BeginOperationTransactionArgs e) {
+        List<Long> personidList = new ArrayList<>();
+        for (DynamicObject dataEntity : e.getDataEntities()) {
+            long personId = dataEntity.getLong(String.join(".", PositionStructureConstant.NCKD_PERSON, FormConstant.ID_KEY));
+            personidList.add(personId);
+        }
+        DynamicObject[] empPosOrgRelArray = EmpPosOrgRelHelper.queryEmpPosOrgRelByEmployees(personidList);
+        Map<Long, DynamicObject> empPosOrgRelMap = Arrays.stream(empPosOrgRelArray)
+                .collect(Collectors.toMap(
+                        empPosOrgRelObj -> empPosOrgRelObj.getLong(String.join(".", PositionStructureConstant.EMPLOYEE_KEY, FormConstant.ID_KEY)),
+                        empPosOrgRelObj -> empPosOrgRelObj,
+                        (existing, replacement) -> replacement // 如果有重复的key,使用新的值替换旧的值
+                ));
+        List<DynamicObject> newEntityList = new ArrayList<>();
+
+        DynamicObject org = OrgHelper.getCreateOrg(PositionStructureConstant.PERSONPOSFILE_ENTITYID);
+        String bdCtrlStrgy = null;
+        if(org != null) {
+            bdCtrlStrgy = OrgHelper.getBdCtrlStrgy(PositionStructureConstant.PERSONPOSFILE_ENTITYID, org.getLong(FormConstant.ID_KEY));
+        }
+        for (DynamicObject entry : e.getDataEntities()) {
+            DynamicObject newEntity = EntityHelper.newEntity(PositionStructureConstant.NCKD_PERSONPOSFILE);
+            DynamicObject person = entry.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
+            long personId = person.getLong(FormConstant.ID_KEY);
+            String personName = person.getString(FormConstant.NAME_KEY);
+            DynamicObject empPosOrgRel = empPosOrgRelMap.get(personId);
+
+            newEntity.set(FormConstant.NCKD_PERSON, entry.get(FormConstant.NCKD_PERSON));
+            Date beginDate = entry.getDate(PositionStructureConstant.NCKD_BEGINDATE);
+            LocalDateTime beginDateDateTime = DateUtil.toLocalDateTime(beginDate);
+            newEntity.set(PositionStructureConstant.NCKD_BEGINDATE, beginDate);
+            newEntity.set(PositionStructureConstant.NCKD_TYPESTATE, TypeStateEnum.MANAGEMENT_SEQUENCE_EMPLOYMENT.getCode());
+            newEntity.set(PositionStructureConstant.NCKD_DEP, empPosOrgRel.get(PositionStructureConstant.ADMINORG));
+            newEntity.set(PositionStructureConstant.NCKD_POSITIONHR, empPosOrgRel.get(PositionStructureConstant.POSITION_KEY));
+            newEntity.set(PositionStructureConstant.NCKD_EXECUTEYEAR, beginDateDateTime.getYear());
+            newEntity.set(PositionStructureConstant.NCKD_APPOINTSTATUS, "1");
+            newEntity.set(FormConstant.CREATEORG_KEY, org);
+            newEntity.set(FormConstant.ORG_KEY, org);
+            newEntity.set(FormConstant.USEORG_KEY, org);
+            newEntity.set(FormConstant.CTRLSTRATEGY_KEY, bdCtrlStrgy);
+            newEntity.set(FormConstant.CREATOR_KEY, UserServiceHelper.getCurrentUserId());
+            newEntityList.add(newEntity);
+        }
+        OperateOption operateOption = OperateOption.create();
+        operateOption.setVariableValue(PositionStructureConstant.NCKD_TYPESTATE, TypeStateEnum.MANAGEMENT_SEQUENCE_EMPLOYMENT.getCode());
+        OperationResult operationResult = SaveServiceHelper.saveOperate(PositionStructureConstant.PERSONPOSFILE_ENTITYID, newEntityList.toArray(new DynamicObject[0]), operateOption);
+
+        if(operationResult != null && !operationResult.isSuccess()){
+            StringJoiner errorMsgJoiner = new StringJoiner(StrFormatter.LINE_SEPARATOR);
+            if(operationResult.getAllErrorOrValidateInfo() != null && !operationResult.getAllErrorOrValidateInfo().isEmpty()){
+                Iterator<IOperateInfo> iterator = operationResult.getAllErrorOrValidateInfo().iterator();
+                while (iterator.hasNext()) {
+                    IOperateInfo operateInfo = iterator.next();
+                    if(operateInfo instanceof OperateErrorInfo){
+                        OperateErrorInfo operateErrorInfo = (OperateErrorInfo) operateInfo;
+                        int dataEntityIndex = operateErrorInfo.getDataEntityIndex();
+                        String prefix = operationResult.getCustomData().get("DataEntityIndex_" + dataEntityIndex);
+                        if(StringUtils.isNotBlank(prefix)){
+                            operateErrorInfo.setMessage(prefix + operateErrorInfo.getMessage());
+                        }
+                    }
+                    errorMsgJoiner.add(operateInfo.getMessage());
+                }
+            }
+            // 如果没有具体的错误详情,则使用操作结果中的通用消息
+            if (StringUtils.isBlank(operationResult.getMessage())) {
+                errorMsgJoiner.add(operationResult.getMessage());
+            }
+            throw new ValidationException(errorMsgJoiner.toString());
+        }
+    }
+
+    @Override
+    public void endOperationTransaction(EndOperationTransactionArgs e) {
+        for (DynamicObject dataEntity : e.getDataEntities()) {
+            long id = dataEntity.getLong(FormConstant.ID_KEY);
+            DynamicObject dynamicObject = dataEntity.getDynamicObject(FormConstant.NCKD_PERSON);
+            if(dynamicObject != null) {
+                this.getOperationResult().getCustomData().put(id + "", "【" + dynamicObject.getString(FormConstant.NAME_KEY) + "】");
+            }
+        }
+    }
+}

+ 12 - 2
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/performance/PerfRankMgmtSaveOpPlugin.java

@@ -37,6 +37,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
+import kd.bos.dataentity.utils.ObjectUtils;
 
 /**
 * 年度绩效排名管理-保存插件
@@ -60,8 +61,17 @@ public class PerfRankMgmtSaveOpPlugin extends AbstractOperationServicePlugIn imp
 
     @Override
     public void beginOperationTransaction(BeginOperationTransactionArgs e) {
-        String invoker = (String)this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
-        boolean dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker);
+        boolean dataMigration = false;
+        Object invoker = this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
+        if(ObjectUtils.isEmpty(invoker)){
+            Object invoker1 = this.getOption().getVariables().get("hr_hrdmvalidatetag_of_datasource");
+            Object invoker2 = this.getOption().getVariables().get("hr_hrdmsynctag_of_datasource");
+            if(!ObjectUtils.isEmpty(invoker1) || !ObjectUtils.isEmpty(invoker2)){
+                dataMigration = true;
+            }
+        } else{
+            dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker.toString());
+        }
         for (DynamicObject dataEntity : e.getDataEntities()) {
 
             //事务开始前先查询数据库中的排名名单,找出哪些是此次被删除的人员

+ 23 - 4
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/performance/validate/PerfRankMgmtSaveValidate.java

@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.StringJoiner;
 import java.util.stream.Collectors;
+import kd.bos.dataentity.utils.ObjectUtils;
 
 /**
 * 绩效排名管理保存验证插件
@@ -39,8 +40,17 @@ public class PerfRankMgmtSaveValidate extends AbstractValidator {
     private final Map<String, BigDecimal> appraisalResultRatioMap = new HashMap<>();
     @Override
     public void validate() {
-        String invoker = (String)this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
-        boolean dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker);
+        boolean dataMigration = false;
+        Object invoker = this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
+        if(ObjectUtils.isEmpty(invoker)){
+            Object invoker1 = this.getOption().getVariables().get("hr_hrdmvalidatetag_of_datasource");
+            Object invoker2 = this.getOption().getVariables().get("hr_hrdmsynctag_of_datasource");
+            if(!ObjectUtils.isEmpty(invoker1) || !ObjectUtils.isEmpty(invoker2)){
+                dataMigration = true;
+            }
+        } else{
+            dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker.toString());
+        }
         if(!dataMigration) {
             QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
                     .addGroup(new String[]{FormConstant.NCKD_ENTRYENTITY}, PerfRankMgmtConstant.NCKD_RATIO)
@@ -262,8 +272,17 @@ public class PerfRankMgmtSaveValidate extends AbstractValidator {
      */
     private void validateEntry(DynamicObject entry, ExtendedDataEntity rowDataEntity,
                                int rowIndex, Set<Long> personIds, ValidationContext context) {
-        String invoker = (String)this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
-        boolean dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker);
+        boolean dataMigration = false;
+        Object invoker = this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
+        if(ObjectUtils.isEmpty(invoker)){
+            Object invoker1 = this.getOption().getVariables().get("hr_hrdmvalidatetag_of_datasource");
+            Object invoker2 = this.getOption().getVariables().get("hr_hrdmsynctag_of_datasource");
+            if(!ObjectUtils.isEmpty(invoker1) || !ObjectUtils.isEmpty(invoker2)){
+                dataMigration = true;
+            }
+        } else{
+            dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker.toString());
+        }
         DynamicObject empPosOrgRel = entry.getDynamicObject(PerfRankMgmtConstant.NCKD_EMPPOSORGREL);
         DynamicObject person = entry.getDynamicObject(PerfRankMgmtConstant.NCKD_PERSON);
         if(!dataMigration && empPosOrgRel == null){

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

@@ -45,6 +45,7 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.StringJoiner;
 import java.util.stream.Collectors;
+import kd.bos.dataentity.utils.ObjectUtils;
 
 /**
  * 考核周期保存OP
@@ -67,8 +68,19 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
 
     @Override
     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 dataMigration;
+        Object invoker = this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
+        if(ObjectUtils.isEmpty(invoker)){
+            Object invoker1 = this.getOption().getVariables().get("hr_hrdmvalidatetag_of_datasource");
+            Object invoker2 = this.getOption().getVariables().get("hr_hrdmsynctag_of_datasource");
+            if(!ObjectUtils.isEmpty(invoker1) || !ObjectUtils.isEmpty(invoker2)){
+                dataMigration = true;
+            } else {
+                dataMigration = false;
+            }
+        } else{
+            dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker.toString());
+        }
         boolean isUpdate = ConvertUtil.toBoolean(this.getOption().getVariableValue("isUpdate",StringUtils.EMPTY),Boolean.FALSE);
         e.addValidator(new AbstractValidator() {
             @Override

+ 3 - 15
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/empmgt/SubCoHeadServiceListPlugin.java

@@ -199,7 +199,7 @@ public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Pl
                         // 判断记录是否在当年范围内
                         return changeTime.getYear() == beginYear.getYear();
                     })
-                    .max(Comparator.comparing(record -> record.getDate(MasConstant.STARTDATE),
+                    .max(Comparator.comparing(record -> record.getDate(MasConstant.NCKD_CHANGETIME),
                             Comparator.nullsFirst(Comparator.naturalOrder())));
 
             if (latestRecord.isPresent()) {
@@ -417,16 +417,7 @@ public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Pl
             option.setVariableValue("load", Boolean.TRUE+"");
             OperationResult operationResult = SaveServiceHelper.saveOperate(MasConstant.SUBCOHEADSERVICE_ENTITYID, saveSubCoHeadServiceList.toArray(new DynamicObject[0]), option);
             if (!operationResult.isSuccess()) {
-                String parentPageId = this.getView().getFormShowParameter().getPageId();
-                IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
-                IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
-                Map<String, String> customData = operationResult.getCustomData();
-                //成功的记录
-                Map<Object, Object> successMap = new HashMap<>();
-                for (Object successPkId : operationResult.getSuccessPkIds()) {
-                    successMap.put(successPkId, customData.get(successPkId.toString()));
-                }
-                this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", successMap, pageCache, operationResult));
+                this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", this.getView(), operationResult));
                 this.getView().invokeOperation(FormConstant.REFRESH_OP);
             } else {
                 //刷新列表
@@ -437,10 +428,7 @@ public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Pl
                     successMap.put(successPkId, customData.get(successPkId.toString()));
                 }
                 if (!successMap.isEmpty()) {
-                    String parentPageId = this.getView().getFormShowParameter().getPageId();
-                    IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
-                    IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
-                    this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", successMap, pageCache, operationResult));
+                    this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历",this.getView(), operationResult));
                     this.getView().invokeOperation(FormConstant.REFRESH_OP);
                 } else {
                     this.getView().invokeOperation(FormConstant.REFRESH_OP);

+ 4 - 15
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/empmgt/TenurePersonListListPlugin.java

@@ -160,7 +160,7 @@ public class TenurePersonListListPlugin extends AbstractListPlugin implements Pl
                         // 判断记录是否在当年范围内
                         return changeTime.getYear() == beginYear.getYear();
                     })
-                    .max(Comparator.comparing(record -> record.getDate(MasConstant.STARTDATE),
+                    .max(Comparator.comparing(record -> record.getDate(MasConstant.NCKD_CHANGETIME),
                             Comparator.nullsFirst(Comparator.naturalOrder())));
 
             if (latestRecord.isPresent()) {
@@ -347,16 +347,7 @@ public class TenurePersonListListPlugin extends AbstractListPlugin implements Pl
             option.setVariableValue("load", Boolean.TRUE+"");
             OperationResult operationResult = SaveServiceHelper.saveOperate(MasConstant.TENUREPERSONLIST_ENTITYID, saveSubCoHeadServiceList.toArray(new DynamicObject[0]), option);
             if (!operationResult.isSuccess()) {
-                String parentPageId = this.getView().getFormShowParameter().getPageId();
-                IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
-                IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
-                Map<String, String> customData = operationResult.getCustomData();
-                //成功的记录
-                Map<Object, Object> successMap = new HashMap<>();
-                for (Object successPkId : operationResult.getSuccessPkIds()) {
-                    successMap.put(successPkId, customData.get(successPkId.toString()));
-                }
-                this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", successMap, pageCache, operationResult));
+                this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", this.getView(), operationResult));
                 this.getView().invokeOperation(FormConstant.REFRESH_OP);
             } else {
                 //刷新列表
@@ -367,10 +358,8 @@ public class TenurePersonListListPlugin extends AbstractListPlugin implements Pl
                     successMap.put(successPkId, customData.get(successPkId.toString()));
                 }
                 if (!successMap.isEmpty()) {
-                    String parentPageId = this.getView().getFormShowParameter().getPageId();
-                    IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
-                    IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
-                    this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", successMap, pageCache, operationResult));
+
+                    this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", this.getView(), operationResult));
                     this.getView().invokeOperation(FormConstant.REFRESH_OP);
                 } else {
                     this.getView().invokeOperation(FormConstant.REFRESH_OP);

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

@@ -277,16 +277,7 @@ public abstract class AbstractStructApprFormPlugin extends AbstractFormPlugin im
                 }
                 OperationResult operationResult = SaveServiceHelper.saveOperate(changeEntityId, new DynamicObject[]{newChangeEntity}, OperateOption.create());
                 if (!operationResult.isSuccess()) {
-                    String parentPageId = this.getView().getFormShowParameter().getPageId();
-                    IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
-                    IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
-                    Map<String, String> customData = operationResult.getCustomData();
-                    // 成功的记录
-                    Map<Object, Object> successMap = new HashMap<>();
-                    for (Object successPkId : operationResult.getSuccessPkIds()) {
-                        successMap.put(successPkId, customData.get(successPkId.toString()));
-                    }
-                    this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", successMap, pageCache, operationResult));
+                    this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历",this.getView(), operationResult));
                     this.getView().invokeOperation(FormConstant.REFRESH_OP);
                 } else {
                     // 自定义确认框按钮名称

+ 0 - 2
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/operate/empmgt/SubCoHeadServiceOpPlugin.java

@@ -56,7 +56,5 @@ public class SubCoHeadServiceOpPlugin extends AbstractOperationServicePlugIn imp
                 this.getOperationResult().getCustomData().put(id + "", "【" + dynamicObject.getString(FormConstant.NAME_KEY) + "】");
             }
         }
-
-
     }
 }