Преглед на файлове

Merge remote-tracking branch 'origin/master'

wyc преди 1 седмица
родител
ревизия
7b5014730d
променени са 19 файла, в които са добавени 784 реда и са изтрити 283 реда
  1. 2 0
      code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/constant/FormConstant.java
  2. 1 1
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/homs/business/application/event/GenerateEmploymentContractEventServicePlugin.java
  3. 70 33
      code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/sdm/plugin/operate/SendTaskOpPlugin.java
  4. 135 0
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PosBillEntryFastChgHelper.java
  5. 31 0
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillAfterBindDataService.java
  6. 1 0
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillBaseService.java
  7. 12 11
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillClosedCallBackService.java
  8. 32 27
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillConfirmCallBackService.java
  9. 40 20
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillPropertyChangedService.java
  10. 44 0
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillSaveHelper.java
  11. 155 45
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillServiceHelper.java
  12. 67 1
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/common/hr/PositionBillConstant.java
  13. 3 2
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/form/hr/ParentPositionListPlugin.java
  14. 115 62
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/form/hr/PosBillEntryAddFormPlugin.java
  15. 29 26
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/form/hr/PositionBillEntryFormPlugin.java
  16. 44 52
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/form/hr/PositionBillFormPlugin.java
  17. 1 1
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/operate/hr/PosBillEntryAddSaveOpPlugin.java
  18. 1 1
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/operate/hr/validator/PositionBillEntryNameValidator.java
  19. 1 1
      code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/operate/hr/validator/PositionBillEntryNumberValidator.java

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

@@ -136,6 +136,8 @@ public class FormConstant {
     public static final String BOS_LIST_ENTITY = "bos_list";
     /** HR组织树实体标识 */
     public static final String HAOS_ADMINORGTREELISTF7_ENTITY = "haos_adminorgtreelistf7";
+    /** 批量单组织F7-树实体标识 */
+    public static final String HAOS_ORGBATCHTREELISTF7_ENTITY = "haos_orgbatchtreelistf7";
 
     //====================================== 标品op ======================================
     /** 确认框确认按钮 */

+ 1 - 1
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/homs/business/application/event/GenerateEmploymentContractEventServicePlugin.java

@@ -67,7 +67,7 @@ public class GenerateEmploymentContractEventServicePlugin implements IEventServi
         }
 
         public long getPkId() {
-            return this.pkId;// 37
+            return this.pkId;
         }
     }
 

+ 70 - 33
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/sdm/plugin/operate/SendTaskOpPlugin.java

@@ -17,18 +17,22 @@ import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
 import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
 import kd.bos.exception.ErrorCode;
 import kd.bos.exception.KDBizException;
-import kd.bos.message.util.MessageUtils;
+import kd.bos.logging.Log;
+import kd.bos.logging.LogFactory;
 import kd.bos.orm.ORM;
 import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
 import kd.bos.servicehelper.operation.SaveServiceHelper;
 import kd.bos.servicehelper.user.UserServiceHelper;
+import kd.bos.servicehelper.workflow.MessageCenterServiceHelper;
 import kd.bos.url.UrlService;
+import kd.bos.util.JSONUtils;
 import kd.bos.workflow.engine.msg.info.MessageInfo;
 import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
 import kd.hr.hbp.business.servicehelper.HRQueryEntityHelper;
 import kd.hr.hbp.common.constants.history.HisModelDataStatusEnum;
+import kd.hr.hbp.common.util.HRCollUtil;
 import kd.hr.hbp.common.util.HRDateTimeUtils;
 import kd.hr.hbp.common.util.HRObjectUtils;
 import kd.sdk.hr.hrpi.business.helper.HRPIEmployeeServiceHelper;
@@ -40,6 +44,7 @@ import nckd.jxccl.hr.sdm.business.SdmBusinessService;
 import nckd.jxccl.hr.sdm.common.SanDingConstant;
 import nckd.jxccl.hr.sdm.common.SanDingPlanEntryStatus;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -60,6 +65,7 @@ import java.util.stream.Collectors;
  * @date: 2025/12/3 15:01
  */
 public class SendTaskOpPlugin extends AbstractOperationServicePlugIn {
+    private static final Log logger = LogFactory.getLog(SendTaskOpPlugin.class);
 
     /** 特殊借调变动操作编码 */
     private static final String TSJD_CHGACTION_NUMBER = "JTCC_1001";
@@ -97,10 +103,39 @@ public class SendTaskOpPlugin extends AbstractOperationServicePlugIn {
         try {
             DynamicObject[] dyos = e.getDataEntities();
             // 推送消息
+            List<MessageInfo> messageInfos = new ArrayList<MessageInfo>();
             for (DynamicObject dyo : dyos) {
                 DynamicObjectCollection entryDyoColl = dyo.getDynamicObjectCollection(SanDingConstant.NCKD_ENTRYENTITY);
                 for (DynamicObject entryDyo : entryDyoColl) {
-                    //sendMessage(entryDyo);
+                    buildMessage(messageInfos, entryDyo);
+                }
+            }
+            if (HRCollUtil.isNotEmpty(messageInfos)) {
+                try {
+                    Map<String, Object> sendMsgResult = MessageCenterServiceHelper.batchSendMessages(messageInfos);
+                    boolean success = (Boolean)sendMsgResult.get("success");
+                    String description = (String)sendMsgResult.get("description");
+                    logger.info(String.format("successToSendMessageSanDingTaskSendTask: messageInfos.size: %s, success: %s, description: %s", messageInfos.size(), success, description));
+                    Map<String, Object> data = (Map<String, Object>) sendMsgResult.getOrDefault("data", new HashMap());
+                    if (!data.isEmpty()) {
+                        for(Long successMsgId : (List<Long>) data.getOrDefault("successMsgIds", new ArrayList())) {
+                            logger.info(String.format("successToSendMessageSanDingTaskSendTask-success: %s, messageID: %s", null, successMsgId));
+                        }
+
+                        Map<MessageInfo, String> failMsgs = (Map<MessageInfo, String>) data.getOrDefault("failMsgs", new HashMap());
+
+                        for(Map.Entry<MessageInfo, String> failMsg : failMsgs.entrySet()) {
+                            MessageInfo failMessageInfo = failMsg.getKey();
+                            String failDescription = failMsg.getValue();
+                            logger.info(String.format("successToSendMessageSanDingTaskSendTask-fail: %s, messageID: %s, description: %s", JSONUtils.toString(failMessageInfo), failMessageInfo.getId(), failDescription));
+                        }
+                    }
+                } catch (Exception var45) {
+                    try {
+                        logger.error("FailedSendMessageSanDingTaskSendTask: " + JSONUtils.toString(messageInfos));
+                    } catch (IOException var43) {
+                        logger.error("Failed to parse message: " + messageInfos);
+                    }
                 }
             }
         } catch (Exception ex) {
@@ -338,35 +373,34 @@ public class SendTaskOpPlugin extends AbstractOperationServicePlugIn {
             // 构建单据体
             DynamicObjectCollection sanDingTaskEntryDyoColl = sanDingTaskDyo.getDynamicObjectCollection(SanDingConstant.NCKD_ENTRYENTITY);
             List<Map<String, Long>> positionBoIdList = companyPositionMap.get(entryDyo.getLong(companyBoIdKey));
-            if (positionBoIdList == null || positionBoIdList.isEmpty()) {
-                continue;
-            }
-            for (Map<String, Long> positionOrgMap : positionBoIdList) {
-                DynamicObject sanDingTaskEntryDyo = sanDingTaskEntryDyoColl.addNew();
-                // 岗位BOID
-                Long positionBoId = positionOrgMap.get("positionBoId");
-                // 设置 组织
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_ADMINORG, EntityHelper.newEntity(SanDingConstant.ADMINORG_ENTITYID, positionOrgMap.get("adminOrgSourceVid")));
-                // 设置 岗位
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_POSITION_KEY, EntityHelper.newEntity(SanDingConstant.HBPM_POSITIONHR, positionOrgMap.get("positionSourceVid")));
-                // 设置 定员数
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_AUTHORIZEDSTRENGTH_KEY, lastSanDingTaskMap.getOrDefault(entryDyo.getLong(companyBoIdKey)+"@"+positionBoId, 0));
-                // 设置 实际占编人数
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_ACTUALSTAFFCOUNT_KEY, positionInStaffEmployeeCountMap.getOrDefault(positionBoId, 0));
-                // 设置 缺编人数
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_STAFFINGSHORTFALL_KEY, 0);
-                // 设置 前一年流失人数(系统数)
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y1OUT_SYS_KEY, y1OutSysMap.getOrDefault(positionBoId + "@" + y1, 0) + kgsddEmpPosOrgRelMap.getOrDefault(positionBoId + "@" + y1, 0));
-                // 设置 前两年流失人数(系统数)
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y2OUT_SYS_KEY, y2OutSysMap.getOrDefault(positionBoId + "@" + y2, 0) + kgsddEmpPosOrgRelMap.getOrDefault(positionBoId + "@" + y2, 0));
-                // 设置 前三年流失人数(系统数)
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y3OUT_SYS_KEY, y3OutSysMap.getOrDefault(positionBoId + "@" + y3, 0) + kgsddEmpPosOrgRelMap.getOrDefault(positionBoId + "@" + y3, 0));
-                // 设置 前一年流失人数(确认数)
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y1OUT_CONF_KEY, sanDingTaskEntryDyo.get(SanDingConstant.NCKD_Y1OUT_SYS_KEY));
-                // 设置 前两年流失人数(确认数)
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y2OUT_CONF_KEY, sanDingTaskEntryDyo.get(SanDingConstant.NCKD_Y2OUT_SYS_KEY));
-                // 设置 前三年流失人数(确认数)
-                sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y3OUT_CONF_KEY, sanDingTaskEntryDyo.get(SanDingConstant.NCKD_Y3OUT_SYS_KEY));
+            if (HRCollUtil.isNotEmpty(positionBoIdList)) {
+                for (Map<String, Long> positionOrgMap : positionBoIdList) {
+                    DynamicObject sanDingTaskEntryDyo = sanDingTaskEntryDyoColl.addNew();
+                    // 岗位BOID
+                    Long positionBoId = positionOrgMap.get("positionBoId");
+                    // 设置 组织
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_ADMINORG, EntityHelper.newEntity(SanDingConstant.ADMINORG_ENTITYID, positionOrgMap.get("adminOrgSourceVid")));
+                    // 设置 岗位
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_POSITION_KEY, EntityHelper.newEntity(SanDingConstant.HBPM_POSITIONHR, positionOrgMap.get("positionSourceVid")));
+                    // 设置 定员数
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_AUTHORIZEDSTRENGTH_KEY, lastSanDingTaskMap.getOrDefault(entryDyo.getLong(companyBoIdKey)+"@"+positionBoId, 0));
+                    // 设置 实际占编人数
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_ACTUALSTAFFCOUNT_KEY, positionInStaffEmployeeCountMap.getOrDefault(positionBoId, 0));
+                    // 设置 缺编人数
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_STAFFINGSHORTFALL_KEY, 0);
+                    // 设置 前一年流失人数(系统数)
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y1OUT_SYS_KEY, y1OutSysMap.getOrDefault(positionBoId + "@" + y1, 0) + kgsddEmpPosOrgRelMap.getOrDefault(positionBoId + "@" + y1, 0));
+                    // 设置 前两年流失人数(系统数)
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y2OUT_SYS_KEY, y2OutSysMap.getOrDefault(positionBoId + "@" + y2, 0) + kgsddEmpPosOrgRelMap.getOrDefault(positionBoId + "@" + y2, 0));
+                    // 设置 前三年流失人数(系统数)
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y3OUT_SYS_KEY, y3OutSysMap.getOrDefault(positionBoId + "@" + y3, 0) + kgsddEmpPosOrgRelMap.getOrDefault(positionBoId + "@" + y3, 0));
+                    // 设置 前一年流失人数(确认数)
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y1OUT_CONF_KEY, sanDingTaskEntryDyo.get(SanDingConstant.NCKD_Y1OUT_SYS_KEY));
+                    // 设置 前两年流失人数(确认数)
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y2OUT_CONF_KEY, sanDingTaskEntryDyo.get(SanDingConstant.NCKD_Y2OUT_SYS_KEY));
+                    // 设置 前三年流失人数(确认数)
+                    sanDingTaskEntryDyo.set(SanDingConstant.NCKD_Y3OUT_CONF_KEY, sanDingTaskEntryDyo.get(SanDingConstant.NCKD_Y3OUT_SYS_KEY));
+                }
             }
             sanDingTaskDyoList.add(sanDingTaskDyo);
             SANDING_TASK_MAP.put(entryDyo.getLong(SanDingConstant.ID_KEY), sanDingTaskDyo.getLong(SanDingConstant.ID_KEY));
@@ -399,7 +433,7 @@ public class SendTaskOpPlugin extends AbstractOperationServicePlugIn {
         SaveServiceHelper.save(dyos);
     }
 
-    private void sendMessage(DynamicObject entryDyo) {
+    private void buildMessage(List<MessageInfo> messageInfos, DynamicObject entryDyo) {
         // 构建 消息
         MessageInfo messageInfo = new MessageInfo();
         // 设置 消息标题
@@ -410,6 +444,7 @@ public class SendTaskOpPlugin extends AbstractOperationServicePlugIn {
         messageInfo.setType(MessageInfo.TYPE_MESSAGE);
         // 设置 实体编码
         messageInfo.setEntityNumber(SanDingConstant.NCKD_SANDINGTASK_ENTITY);
+        // 设置 业务单据ID
         messageInfo.setBizDataId(SANDING_TASK_MAP.get(entryDyo.getLong(SanDingConstant.ID_KEY)));
         // 设置 标签
         messageInfo.setTag("三定管理");
@@ -419,7 +454,9 @@ public class SendTaskOpPlugin extends AbstractOperationServicePlugIn {
         messageInfo.setUserIds(userIds);
         // 设置 消息Web端url
         messageInfo.setContentUrl(UrlService.getDomainContextUrl() + "/index.html?formId="+SanDingConstant.NCKD_SANDINGTASK_ENTITY+"&pkId=" + SANDING_TASK_MAP.get(entryDyo.getLong(SanDingConstant.ID_KEY)));
-        MessageUtils.sendMessage(messageInfo);
+        // 设置发送人
+        messageInfo.setSenderId(UserServiceHelper.getCurrentUserId());
+        messageInfos.add(messageInfo);
     }
 
     private List<Long> getUserIds(List<Long> managerBoIdList) {

+ 135 - 0
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PosBillEntryFastChgHelper.java

@@ -0,0 +1,135 @@
+package nckd.jxccl.hrmp.hbpm.business.hr;
+
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.dataentity.metadata.IDataEntityProperty;
+import kd.bos.dataentity.metadata.IDataEntityType;
+import kd.bos.dataentity.utils.StringUtils;
+import kd.bos.db.DB;
+import kd.bos.db.DBRoute;
+import kd.bos.entity.EntityMetadataCache;
+import kd.bos.entity.MainEntityType;
+import kd.bos.entity.datamodel.IDataModel;
+import kd.bos.entity.datamodel.events.ChangeData;
+import kd.bos.entity.datamodel.events.PropertyChangedArgs;
+import kd.bos.entity.property.BasedataProp;
+import kd.bos.form.ConfirmCallBackListener;
+import kd.bos.form.IFormView;
+import kd.bos.form.MessageBoxOptions;
+import kd.bos.form.plugin.IFormPlugin;
+import kd.bos.orm.util.CollectionUtils;
+import kd.bos.servicehelper.basedata.BaseDataServiceHelper;
+import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
+import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
+
+import java.sql.ResultSet;
+
+/**
+ * 岗位申请分录快速变更帮助类
+ * @from: kd.hr.homs.business.domain.orgfast.repository.AdminOrgFastChgHelper
+ * @author: jtd
+ * @date: 2025/12/27 17:19
+ */
+public class PosBillEntryFastChgHelper {
+
+    public static void orgPropertyChanged(PropertyChangedArgs changedArgs, IFormView iFormView, IFormPlugin formPlugin) {
+        ChangeData changeData = changedArgs.getChangeSet()[0];
+        DynamicObject newDy = (DynamicObject) changeData.getNewValue();
+        DynamicObject oldDy = (DynamicObject) changeData.getOldValue();
+        String masterOrg = iFormView.getPageCache().get(PositionBillConstant.PC_MASTERORG);
+        if (changedArgs.getChangeSet()[0].getNewValue() != null) {
+            HRBaseServiceHelper hrBaseServiceHelper = new HRBaseServiceHelper(PositionBillConstant.NCKD_POSITIONBILL_ENTITY);
+            boolean exists = hrBaseServiceHelper.isExists(iFormView.getModel().getDataEntity().getLong(PositionBillConstant.ID_KEY));
+            if (!exists) {
+                Long orgIdNew = newDy.getLong(PositionBillConstant.ID_KEY);
+                if (StringUtils.isNotEmpty(masterOrg) && !StringUtils.equals(masterOrg, String.valueOf(orgIdNew))) {
+                    Long orgIDOld = oldDy == null ? 0L : oldDy.getLong(PositionBillConstant.ID_KEY);
+                    iFormView.getPageCache().put(PositionBillConstant.PC_MASTERORG, String.valueOf(orgIDOld));
+                    ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener(PositionBillConstant.CB_CHG_ORG, formPlugin);
+                    iFormView.showConfirm("切换组织体系管理组织后,将清除该组织不可使用的基础资料信息,是否切换?", MessageBoxOptions.OKCancel, confirmCallBackListener);
+                }
+
+            }
+        }
+    }
+
+    public static void cleanOrgBaseInfo(long orgId, IFormView iFormView) {
+        MainEntityType entityType = EntityMetadataCache.getDataEntityType(iFormView.getEntityId());
+        IDataModel model = iFormView.getModel();
+
+        for(IDataEntityProperty property : entityType.getAllFields().values()) {
+            if (property instanceof BasedataProp) {
+                IDataEntityType parent = property.getParent();
+                if (parent != null) {
+                    if (!parent.getName().equals(iFormView.getEntityId())) {
+                        if (model.getDataEntity().containsProperty(property.getParent().getName())) {
+                            DynamicObjectCollection dynamicObjectCollection = model.getDataEntity(true).getDynamicObjectCollection(property.getParent().getName());
+                            if (!CollectionUtils.isEmpty(dynamicObjectCollection)) {
+                                for(int i = 0; i < dynamicObjectCollection.size(); ++i) {
+                                    DynamicObject entrtyDy = dynamicObjectCollection.get(i);
+                                    DynamicObject baseDy = entrtyDy.getDynamicObject(property.getName());
+                                    if (baseDy != null && cleanBastInfo(baseDy, property, iFormView, orgId)) {
+                                        model.setValue(property.getName(), null, i);
+                                        iFormView.updateView(property.getName(), i);
+                                    }
+                                }
+                            }
+                        }
+                    } else if (model.getDataEntity().containsProperty(property.getName())) {
+                        DynamicObject baseDy = model.getDataEntity().getDynamicObject(property.getName());
+                        if (baseDy != null && cleanBastInfo(baseDy, property, iFormView, orgId)) {
+                            model.setValue(property.getName(), null);
+                            iFormView.updateView(property.getName());
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
+    public static void cleanOrgBaseInfoForBillEntry(IFormView iFormView, int row, String fieldKey, String entryId) {
+        IDataModel model = iFormView.getModel();
+        DynamicObjectCollection collection = model.getDataEntity(true).getDynamicObjectCollection(entryId);
+        if (collection != null && collection.size() != 0) {
+            for(IDataEntityProperty entityProperty : collection.getDynamicObjectType().getProperties()) {
+                if (!entityProperty.getName().equals(fieldKey) && entityProperty instanceof BasedataProp) {
+                    DynamicObject entrtyDy = collection.get(row);
+                    DynamicObject orgId = entrtyDy.getDynamicObject(fieldKey);
+                    DynamicObject baseDy = entrtyDy.getDynamicObject(entityProperty.getName());
+                    if (baseDy != null && cleanBastInfo(baseDy, entityProperty, iFormView, orgId.getLong(PositionBillConstant.ID_KEY))) {
+                        iFormView.getModel().beginInit();
+                        model.setValue(entityProperty.getName(), null, row);
+                        iFormView.updateView(entityProperty.getName(), row);
+                        iFormView.getModel().endInit();
+                    }
+                }
+            }
+
+        }
+    }
+
+    private static boolean cleanBastInfo(DynamicObject baseDy, IDataEntityProperty property, IFormView iFormView, long orgId) {
+        Boolean baseDataCtrl = BaseDataServiceHelper.checkBaseDataCtrl(((BasedataProp) property).getBaseEntityId());
+        if (baseDataCtrl) {
+            if (!checkAssign(iFormView, property, baseDy, orgId)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private static boolean checkAssign(IFormView iFormView, IDataEntityProperty property, DynamicObject baseDy, long orgId) {
+        IDataEntityType dataEntityType = baseDy.getDataEntityType();
+        String baseDataTableName = dataEntityType.getAlias();
+        String dbRouteKey = dataEntityType.getDBRouteKey();
+        DBRoute dbRoute = DBRoute.of(dbRouteKey);
+        String bsaeDataUseRegTableName = baseDataTableName + "UseReg";
+        String countUseRegSql = "select FDataID from " + bsaeDataUseRegTableName + " where FDataID = ? and fuseorgid = ? ";
+        Object[] params = new Object[]{baseDy.get(PositionBillConstant.ID_KEY), orgId};
+        Boolean assign = DB.query(dbRoute, countUseRegSql, params, ResultSet::next);
+        return assign;
+    }
+
+}

+ 31 - 0
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillAfterBindDataService.java

@@ -0,0 +1,31 @@
+package nckd.jxccl.hrmp.hbpm.business.hr;
+
+import kd.bos.form.IFormView;
+import kd.bos.orm.ORM;
+import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
+
+/**
+ * 岗位申请单后置绑定数据服务
+ * @from: kd.hr.homs.business.domain.batchbill.service.impl.AdminOrgBatchBillAfterBindDataService
+ * @author: jtd
+ * @date: 2025/12/27 21:48
+ */
+public class PositionBillAfterBindDataService extends PositionBillBaseService {
+    public PositionBillAfterBindDataService(IFormView view) {
+        super(view);
+    }
+
+    public void afterBindData() {
+        genBillIdIfNotExist();
+        getModel().setDataChanged(false);
+    }
+
+    private void genBillIdIfNotExist() {
+        long billId = getModel().getDataEntity().getLong(PositionBillConstant.ID_KEY);
+        if (billId == 0L) {
+            billId = ORM.create().genLongId(getView().getEntityId());
+            getModel().setValue(PositionBillConstant.ID_KEY, billId);
+        }
+    }
+
+}

+ 1 - 0
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillBaseService.java

@@ -5,6 +5,7 @@ import kd.bos.form.IFormView;
 
 /**
  * 岗位申请单基础服务类
+ * @from: kd.hr.homs.business.domain.batchbill.service.impl.AdminOrgBatchBillBaseService
  * @author: jtd
  * @date: 2025/12/20 17:47
  */

+ 12 - 11
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillClosedCallBackService.java

@@ -14,6 +14,7 @@ import kd.bos.form.events.ClosedCallBackEvent;
 import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
+import kd.hr.hbp.common.util.HRDyObjectPropUtil;
 import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
 import nckd.jxccl.hrmp.hbpm.common.hr.PositionChangeTypeEnum;
 
@@ -27,6 +28,7 @@ import java.util.stream.Collectors;
 
 /**
  * 岗位申请单关闭回调服务类
+ * @from: kd.hr.homs.business.domain.batchbill.service.impl.AdminOrgBatchBillClosedCallBackService
  * @author: jtd
  * @date: 2025/12/20 17:29
  */
@@ -59,11 +61,11 @@ public class PositionBillClosedCallBackService extends PositionBillBaseService {
         List<String> selectPropList = new ArrayList<String>();
         Set<String> toSetValueEntryPropList = new HashSet<String>();
 
-        String suffix = "_"+tag;
+        String lineSuffix = "_"+tag;
         for(IDataEntityProperty iDataEntityProperty : entryEntityInfo) {
             String entryPropName = iDataEntityProperty.getName();
-            if (entryPropName.endsWith(suffix)) {
-                String entryPropNameSub = entryPropName.replace(suffix, "");
+            if (entryPropName.endsWith(lineSuffix)) {
+                String entryPropNameSub = PositionBillServiceHelper.getNoLineSuffixProp(entryPropName, lineSuffix);
                 if (addNamePropMap.containsKey(entryPropNameSub)) {
                     selectPropList.add(entryPropNameSub);
                     toSetValueEntryPropList.add(entryPropName);
@@ -71,11 +73,11 @@ public class PositionBillClosedCallBackService extends PositionBillBaseService {
             }
         }
 
-        // 获取需要转换的键值
-        Map<String, String> transKeyMap = PositionBillServiceHelper.getPosBillEntryReverseTransKeyMap();
+        // 获取分录需要转换的键值,将单据分录字段转换转成分录页面字段
+        Map<String, String> transKeyMap = PositionBillServiceHelper.getPosBillEntryTransKeyMap();
         transKeyMap.forEach((key, value) -> {
-            selectPropList.add(value);
-            toSetValueEntryPropList.add(key);
+            selectPropList.add(value);// 岗位查询字段放入分录页面字段
+            toSetValueEntryPropList.add(key+lineSuffix);// 放入单据分录字段(带后缀)
         });
         toSetValueEntryPropList.add(PositionBillConstant.ID_KEY);
 
@@ -94,12 +96,11 @@ public class PositionBillClosedCallBackService extends PositionBillBaseService {
             for(String entryPropName : toSetValueEntryPropList) {
                 if (entryPropName.equals(PositionBillConstant.ID_KEY)) {
                     values.add(addPositionDy.getLong(PositionBillConstant.ID_KEY));
-                } else if (transKeyMap.containsKey(entryPropName)) {
-                    values.add(addPositionDy.get(transKeyMap.get(entryPropName)));
                 } else {
-                    String propName = entryPropName.replace(suffix, "");
+                    String propName = PositionBillServiceHelper.getNoLineSuffixProp(entryPropName, lineSuffix);
+                    propName = transKeyMap.getOrDefault(propName, propName);
                     if (addPositionDy.get(propName) instanceof DynamicObject) {
-                        values.add(((DynamicObject) addPositionDy.get(propName)).getLong(PositionBillConstant.ID_KEY));
+                        values.add(HRDyObjectPropUtil.getIdLongObject(addPositionDy.getDynamicObject(propName)));
                     } else {
                         values.add(addPositionDy.get(propName));
                     }

+ 32 - 27
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillConfirmCallBackService.java

@@ -18,8 +18,6 @@ import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
 import kd.hr.hbp.common.util.HRStringUtils;
-import kd.hr.homs.business.domain.orgfast.repository.AdminOrgFastChgHelper;
-import kd.hr.homs.business.utils.PatternUtil;
 import nckd.jxccl.base.common.utils.QueryFieldBuilder;
 import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
 
@@ -33,6 +31,7 @@ import java.util.stream.Collectors;
 
 /**
  * 岗位申请单确认回调服务类
+ * @from: kd.hr.homs.business.domain.batchbill.service.impl.AdminOrgBatchBillConfirmCallBackService
  * @author: jtd
  * @date: 2025/12/21 21:59
  */
@@ -50,7 +49,7 @@ public class PositionBillConfirmCallBackService extends PositionBillBaseService
                     return;
                 }
 
-                EntryGrid coopRelEntryGrid = getView().getControl(PositionBillConstant.NCKD_ENTRYENTITY_ADD_KEY);
+                EntryGrid coopRelEntryGrid = getView().getControl(String.join("_", PositionBillConstant.NCKD_ENTRYENTITY, callBackId.substring(callBackId.lastIndexOf("_")+1)));
                 int[] selectRows = coopRelEntryGrid.getSelectRows();
                 HRBaseServiceHelper hrBaseServiceHelper = new HRBaseServiceHelper(PositionBillConstant.NCKD_POSITIONBILLENTRY_ENTITY);
                 List<Long> entryIdList = Lists.newArrayListWithExpectedSize(selectRows.length);
@@ -160,16 +159,16 @@ public class PositionBillConfirmCallBackService extends PositionBillBaseService
     }
 
     private void changePositionConfirm(MessageBoxClosedEvent messageBoxClosedEvent, String callBackId) {
-        if (callBackId.startsWith("select_position_")) {
-            String suffix = callBackId.replace("select_position_", "");
+        if (callBackId.startsWith(PositionBillConstant.CB_SELECT_POSITION_UNDERLINE)) {
+            String suffix = callBackId.replace(PositionBillConstant.CB_SELECT_POSITION_UNDERLINE, "");
             String lineSuffix = "_" + suffix;
             HRBaseServiceHelper helper = new HRBaseServiceHelper(PositionBillConstant.HBPM_POSITIONHR);
             EntryGrid entryGrid = getView().getControl(PositionBillConstant.NCKD_ENTRYENTITY + lineSuffix);
-            String positionRow = getView().getPageCache().get("positionRow");
+            String positionRow = getView().getPageCache().get(PositionBillConstant.PC_POSITIONROW);
             int row = Integer.parseInt(positionRow);
             if (messageBoxClosedEvent.getResult() != MessageBoxResult.Yes) {
                 DynamicObject entryEntityDyn = getModel().getDataEntity(true).getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY + lineSuffix).get(row);
-                String positionOld = getView().getPageCache().get("positionOld");
+                String positionOld = getView().getPageCache().get(PositionBillConstant.PC_POSITIONOLD);
                 if (HRStringUtils.isNotEmpty(positionOld)) {// 461
                     QFilter filter = new QFilter(PositionBillConstant.ID_KEY, QCP.equals, Long.parseLong(positionOld));
                     DynamicObject position = helper.queryOne(String.join(",", PositionBillConstant.ID_KEY, PositionBillConstant.NAME_KEY, PositionBillConstant.NUMBER_KEY), filter.toArray());
@@ -184,49 +183,55 @@ public class PositionBillConfirmCallBackService extends PositionBillBaseService
 
             DataEntityPropertyCollection entryEntityInfo = getModel().getDataEntity(true).getDynamicObjectCollection(String.join("_", PositionBillConstant.NCKD_ENTRYENTITY, suffix)).getDynamicObjectType().getProperties();
 
-            // 获取要转换的键值,转成岗位字段
             Map<String, String> transKeyMap = new HashMap<String, String>();
-            // 单据分录字段要先转分录页面字段
+            // 获取分录要转换的键值,将单据分录字段转换转成分录页面字段
             transKeyMap.putAll(PositionBillServiceHelper.getPosBillEntryTransKeyMap());
+            // 获取岗位要转换的键值
             transKeyMap.putAll(PositionBillServiceHelper.getPositionTransKeyMap());
-            // 倒转,转成岗位字段: 单据分录字段
-            Map<String, String> reverseTransKeyMap = transKeyMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey));
-            // 获取岗位要排除的键值
+            // 排除字段
             List<String> positionExcludeKeyList = PositionBillServiceHelper.getPositionExcludeKeyList();
+            positionExcludeKeyList.forEach(transKeyMap::remove);
 
-            QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create().add(PositionBillConstant.ID_KEY);
+            QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create();
             for(IDataEntityProperty iDataEntityProperty : entryEntityInfo) {
-                if (PatternUtil.isExProperty(iDataEntityProperty.getName())) {
-                    String selectName = iDataEntityProperty.getName().substring(suffix.length() + 1);
-                    if (positionExcludeKeyList.contains(selectName)) {
-                        continue;
-                    } else if (transKeyMap.containsKey(selectName)) {
-                        queryFieldBuilder.add(reverseTransKeyMap.get(selectName));
-                    } else {
-                        queryFieldBuilder.add(selectName);
-                    }
+                String propName = iDataEntityProperty.getName();
+                if (PatternUtil.isExProperty(propName) && propName.endsWith(lineSuffix)) {
+                    String selectName = PositionBillServiceHelper.getNoLineSuffixProp(propName, lineSuffix);
+                    queryFieldBuilder.add(transKeyMap.getOrDefault(selectName, selectName));
                 }
             }
 
             DynamicObject entryEntityDyn = PositionBillServiceHelper.getFocusEntry(suffix, getView(), row);
-            long positionId = entryEntityDyn.getLong(PositionBillConstant.NCKD_POSITION + lineSuffix);
+            long positionId = entryEntityDyn.getLong(String.join(".", PositionBillConstant.NCKD_POSITION+lineSuffix, PositionBillConstant.ID_KEY));
             QFilter filter = new QFilter(PositionBillConstant.ID_KEY, QCP.equals, positionId);
             DynamicObject position = helper.queryOne(queryFieldBuilder.buildSelect(), filter.toArray());
             long entryId = ORM.create().genLongId(PositionBillConstant.NCKD_POSITIONBILLENTRY_ENTITY);
             entryEntityDyn.set(PositionBillConstant.ID_KEY, entryId);
             // 设置单据分录字段值
-            reverseTransKeyMap.forEach((key, value) -> entryEntityDyn.set(key, position.get(value)));
+            for(IDataEntityProperty iDataEntityProperty : entryEntityInfo) {
+                String propName = iDataEntityProperty.getName();
+                if (nckd.jxccl.hrmp.hbpm.business.hr.PatternUtil.isExProperty(propName) && propName.endsWith(lineSuffix)) {
+                    String selectName = PositionBillServiceHelper.getNoLineSuffixProp(propName, lineSuffix);
+                    if (positionExcludeKeyList.contains(selectName) || HRStringUtils.equals(selectName, PositionBillConstant.NCKD_POSDUTY_ENTRY_ENTITY_KEY)) {
+                        continue;
+                    }
+                    // 原上级岗位单独处理
+                    if (HRStringUtils.equals(selectName, PositionBillConstant.NCKD_PARENT)) {
+                        entryEntityDyn.set(PositionBillConstant.NCKD_ORIPARENT_KEY+lineSuffix, position.get(transKeyMap.getOrDefault(selectName, selectName)));
+                    }
+                    entryEntityDyn.set(propName, position.get(transKeyMap.getOrDefault(selectName, selectName)));
+                }
+            }
 
-            //setChangeSence(lineSuffix, entryEntityDyn, row);
             getView().updateView(PositionBillConstant.NCKD_ENTRYENTITY + lineSuffix);
         } else if (callBackId.equals(PositionBillConstant.CHANGE_TAG)) {
             String entryId = String.join("_", PositionBillConstant.NCKD_ENTRYENTITY, callBackId);
             EntryGrid entryGrid = getView().getControl(entryId);
             int row = entryGrid.getEntryState().getFocusRow();
             if (messageBoxClosedEvent.getResult() == MessageBoxResult.Yes) {
-                AdminOrgFastChgHelper.cleanOrgBaseInfoForBillEntry(getView(), row, callBackId, entryId);
+                PosBillEntryFastChgHelper.cleanOrgBaseInfoForBillEntry(getView(), row, callBackId, entryId);
             } else {
-                String oldId = getView().getPageCache().get("entry_position_value");
+                String oldId = getView().getPageCache().get(PositionBillConstant.PC_ENTRY_POSITION_VALUE);
                 getModel().beginInit();
                 getModel().setValue(callBackId, Long.parseLong(oldId), row);
                 getModel().endInit();

+ 40 - 20
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillPropertyChangedService.java

@@ -15,14 +15,15 @@ import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
 import kd.hr.hbp.common.util.HRStringUtils;
-import kd.hr.homs.business.utils.PatternUtil;
 import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
 
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
- *
- * @entity:
+ * 岗位申请单属性变更服务类
+ * @from: kd.hr.homs.business.domain.batchbill.service.impl.AdminOrgBatchBillPropertyChangedService
  * @author: jtd
  * @date: 2025/12/24 22:05
  */
@@ -58,6 +59,16 @@ public class PositionBillPropertyChangedService extends PositionBillBaseService
                 } else if (objectNew != null) {
                     showConfirmByOldValue(changedArgs, suffix, rowIndex);
                 }
+            } else if (fieldKey.equals(String.join("_", PositionBillConstant.NCKD_ORG_KEY, suffix))) {
+                DynamicObject oldObj = (DynamicObject)objectOld;// 160
+                DynamicObject newObj = (DynamicObject)objectNew;// 161
+                if (newObj != null && oldObj != null && oldObj.getLong(PositionBillConstant.ID_KEY) != newObj.getLong(PositionBillConstant.ID_KEY)) {
+                    Long orgIDOld = oldObj == null ? 0L : oldObj.getLong(PositionBillConstant.ID_KEY);
+                    getView().getPageCache().remove(PositionBillConstant.PC_ENTRY_POSITION_VALUE);
+                    getView().getPageCache().put(PositionBillConstant.PC_ENTRY_POSITION_VALUE, String.valueOf(orgIDOld));
+                    ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener(fieldKey, closeCallBackPlugin);
+                    getView().showConfirm("切换组织体系管理组织后,将清除该组织不可使用的基础资料信息,是否切换?", MessageBoxOptions.OKCancel, confirmCallBackListener);
+                }
             }
         }
 
@@ -66,24 +77,25 @@ public class PositionBillPropertyChangedService extends PositionBillBaseService
     private void entrySelectF7Change(IDataEntityProperty property, String suffix, int row) {
         String lineSuffix = "_"+suffix;
         DataEntityPropertyCollection entryEntityInfo = getModel().getDataEntity(true).getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY+lineSuffix).getDynamicObjectType().getProperties();
+
+        Map<String, String> transKeyMap = new HashMap<String, String>();
         // 获取分录要转换的键值,将单据分录字段转换转成分录页面字段
-        Map<String, String> posBillTransKeyMap = PositionBillServiceHelper.getPosBillEntryTransKeyMap();
+        transKeyMap.putAll(PositionBillServiceHelper.getPosBillEntryTransKeyMap());
         // 获取岗位要转换的键值
-        Map<String, String> positionTransKeyMap = PositionBillServiceHelper.getPositionTransKeyMap();
+        transKeyMap.putAll(PositionBillServiceHelper.getPositionTransKeyMap());
+        // 排除字段
+        List<String> positionExcludeKeyList = PositionBillServiceHelper.getPositionExcludeKeyList();
+        positionExcludeKeyList.forEach(transKeyMap::remove);
 
         StringBuilder selectSqlBuilder = new StringBuilder();
         for(IDataEntityProperty iDataEntityProperty : entryEntityInfo) {
-            if (PatternUtil.isExProperty(iDataEntityProperty.getName())) {
-                String selectName = iDataEntityProperty.getName().replace(lineSuffix, "");
-                if (posBillTransKeyMap.containsKey(selectName)) {
-                    selectSqlBuilder.append(",").append(posBillTransKeyMap.get(selectName));
-                } else if (positionTransKeyMap.containsKey(selectName)) {
-                    selectSqlBuilder.append(",").append(positionTransKeyMap.get(selectName));
-                } else {
-                    selectSqlBuilder.append(",").append(selectName);
-                }
+            String propName = iDataEntityProperty.getName();
+            if (PatternUtil.isExProperty(propName) && propName.endsWith(lineSuffix)) {
+                String selectName = PositionBillServiceHelper.getNoLineSuffixProp(propName, lineSuffix);
+                selectSqlBuilder.append(",").append(transKeyMap.getOrDefault(selectName, selectName));
             }
         }
+        selectSqlBuilder.deleteCharAt(0);
 
         BasedataProp basedataProp = (BasedataProp) property;
         String baseEntityId = basedataProp.getBaseEntityId();
@@ -107,12 +119,20 @@ public class PositionBillPropertyChangedService extends PositionBillBaseService
             entryEntityDyn.set(PositionBillConstant.ID_KEY, entryId);
 
             for(IDataEntityProperty iDataEntityProperty : entryEntityInfo) {
-                if (PatternUtil.isExProperty(iDataEntityProperty.getName())) {
-                    entryEntityDyn.set(iDataEntityProperty.getName(), position.get(iDataEntityProperty.getName().replace(lineSuffix, "")));
+                String propName = iDataEntityProperty.getName();
+                if (PatternUtil.isExProperty(propName) && propName.endsWith(lineSuffix)) {
+                    String selectName = PositionBillServiceHelper.getNoLineSuffixProp(propName, lineSuffix);
+                    if (positionExcludeKeyList.contains(selectName) || HRStringUtils.equals(selectName, PositionBillConstant.NCKD_POSDUTY_ENTRY_ENTITY_KEY)) {
+                        continue;
+                    }
+                    // 原上级岗位单独处理
+                    if (HRStringUtils.equals(selectName, PositionBillConstant.NCKD_PARENT)) {
+                        entryEntityDyn.set(PositionBillConstant.NCKD_ORIPARENT_KEY+lineSuffix, position.get(transKeyMap.getOrDefault(selectName, selectName)));
+                    }
+                    entryEntityDyn.set(propName, position.get(transKeyMap.getOrDefault(selectName, selectName)));
                 }
             }
 
-            //setChangeScene(prefixLine, entryEntityDyn, row);
             getView().updateView(PositionBillConstant.NCKD_ENTRYENTITY+lineSuffix);
         }
 
@@ -121,9 +141,9 @@ public class PositionBillPropertyChangedService extends PositionBillBaseService
     private void showConfirmByOldValue(PropertyChangedArgs e, String suffix, int rowIndex) {
         DynamicObject position = (DynamicObject) e.getChangeSet()[0].getOldValue();
         Long positionOld = position != null ? position.getLong(PositionBillConstant.ID_KEY) : null;
-        getView().getPageCache().put("positionOld", positionOld == null ? "" : String.valueOf(positionOld));
-        getView().getPageCache().put("positionRow", String.valueOf(rowIndex));
-        ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener("select_position_" + suffix, getCloseCallBackPlugin());
+        getView().getPageCache().put(PositionBillConstant.PC_POSITIONOLD, positionOld == null ? "" : String.valueOf(positionOld));
+        getView().getPageCache().put(PositionBillConstant.PC_POSITIONROW, String.valueOf(rowIndex));
+        ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener(PositionBillConstant.CB_SELECT_POSITION_UNDERLINE + suffix, getCloseCallBackPlugin());
         getView().showConfirm("切换岗位后,当前已修改的内容将会丢失,是否继续?", MessageBoxOptions.OKCancel, confirmCallBackListener);
     }
 

+ 44 - 0
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillSaveHelper.java

@@ -0,0 +1,44 @@
+package nckd.jxccl.hrmp.hbpm.business.hr;
+
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.logging.Log;
+import kd.bos.logging.LogFactory;
+import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
+import nckd.jxccl.hrmp.hbpm.common.hr.PositionChangeTypeEnum;
+
+/**
+ * 岗位申请单保存服务
+ * @from: kd.hr.homs.business.domain.orgbatch.service.impl.OrgBatchBillSaveHelper
+ * @author: jtd
+ * @date: 2025/12/27 15:04
+ */
+public class PositionBillSaveHelper {
+    private static PositionBillSaveHelper INSTANCE = new PositionBillSaveHelper();
+    private static final Log logger = LogFactory.getLog(PositionBillSaveHelper.class);
+
+    public static PositionBillSaveHelper getInstance() {
+        return INSTANCE;
+    }
+
+    public Long getPositionId(DynamicObject entryEntityDynFromPage, String suffix) {
+        String idFieldName = String.join(".", PositionBillConstant.NCKD_POSITION, PositionBillConstant.ID_KEY);
+        if (entryEntityDynFromPage.getString(spliceTwoStringByUnderLine(suffix, String.join(".", PositionBillConstant.NCKD_CHANGETYPE, PositionBillConstant.NUMBER_KEY))) == PositionChangeTypeEnum.ADD.getNumber()) {
+            idFieldName = PositionBillConstant.NCKD_POSITION;
+        }
+
+        String positionFiledName = spliceTwoStringByUnderLine(suffix, idFieldName);
+        return entryEntityDynFromPage.getLong(positionFiledName);
+    }
+
+    public String getSuffixFromEntryEntityDyn(DynamicObject entryEntityDynFromPage) {
+        String entryEntityName = entryEntityDynFromPage.getDynamicObjectType().getName();
+        int lastUnderLineIndex = entryEntityName.lastIndexOf("_");
+        return entryEntityName.substring(lastUnderLineIndex + 1);
+    }
+
+    public String spliceTwoStringByUnderLine(String oneString, String otherString) {
+        String[] str = otherString.split("\\.");
+        return str.length > 1 ? str[0] + "_" + oneString + "." + str[1] : otherString + "_" + oneString;
+    }
+
+}

+ 155 - 45
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/business/hr/PositionBillServiceHelper.java

@@ -1,5 +1,7 @@
 package nckd.jxccl.hrmp.hbpm.business.hr;
 
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.kingdee.util.StringUtils;
 import kd.bos.bill.BillShowParameter;
@@ -8,15 +10,18 @@ import kd.bos.common.enums.EnableEnum;
 import kd.bos.context.RequestContext;
 import kd.bos.dataentity.OperateOption;
 import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
 import kd.bos.dataentity.serialization.SerializationUtils;
 import kd.bos.entity.constant.StatusEnum;
 import kd.bos.entity.datamodel.IDataModel;
 import kd.bos.entity.operate.OperateOptionConst;
 import kd.bos.entity.operate.result.OperationResult;
 import kd.bos.form.CloseCallBack;
+import kd.bos.form.FormShowParameter;
 import kd.bos.form.IFormView;
 import kd.bos.form.ShowType;
 import kd.bos.form.control.EntryGrid;
+import kd.bos.form.field.events.BeforeF7SelectEvent;
 import kd.bos.list.ListShowParameter;
 import kd.bos.logging.Log;
 import kd.bos.logging.LogFactory;
@@ -37,6 +42,7 @@ import nckd.jxccl.base.common.utils.QueryFieldBuilder;
 import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
 import nckd.jxccl.hrmp.hbpm.common.hr.PositionChangeTypeEnum;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -45,6 +51,7 @@ import java.util.stream.Collectors;
 
 /**
  * 岗位申请单帮组类
+ * @from: kd.hr.homs.business.domain.batchbill.repository.AdminOrgBatchChgHelper
  * @author: jtd
  * @date: 2025-10-31 14:33
  */
@@ -52,6 +59,13 @@ public class PositionBillServiceHelper {
 
     private static final Log log = LogFactory.getLog(PositionBillServiceHelper.class);
 
+    public static String getNoLineSuffixProp(String prop, String lineSuffix) {
+        if (prop.endsWith(lineSuffix)) {
+            return prop.lastIndexOf(lineSuffix) >= 0 ? prop.substring(0, prop.lastIndexOf(lineSuffix)) : prop;
+        }
+        return prop;
+    }
+
     /**
      * 获取分录序号
      * @param iDataModel
@@ -93,31 +107,31 @@ public class PositionBillServiceHelper {
             }
 
             ListShowParameter listShowParameter = new ListShowParameter();
-            if (filter != null) {// 200
+            if (filter != null) {
                 listShowParameter.getListFilterParameter().getQFilters().add(filter);
             }
 
             switch (operation) {
                 case PositionBillConstant.ADD_TAG:
                     BillShowParameter formShowParameter = new BillShowParameter();
-                    formShowParameter.setCustomParam("position_bsed", iFormView.getModel().getValue(PositionBillConstant.NCKD_EFFDT) == null ? HRDateTimeUtils.getNowDateTime().getTime() : ((Date)iFormView.getModel().getValue(PositionBillConstant.NCKD_EFFDT)).getTime());
+                    formShowParameter.setCustomParam(PositionBillConstant.CP_POSITION_BSED, iFormView.getModel().getValue(PositionBillConstant.NCKD_EFFDT) == null ? HRDateTimeUtils.getNowDateTime().getTime() : ((Date)iFormView.getModel().getValue(PositionBillConstant.NCKD_EFFDT)).getTime());
                     formShowParameter.setFormId(PositionBillConstant.NCKD_POSBILLENTRYADD_ENTITY);
                     formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
-                    formShowParameter.setCustomParam("billid", iFormView.getModel().getDataEntity().getLong(PositionBillConstant.ID_KEY));
-                    formShowParameter.setCustomParam("billBsed", iFormView.getModel().getDataEntity().getDate(PositionBillConstant.NCKD_EFFDT));
+                    formShowParameter.setCustomParam(PositionBillConstant.CP_BILLID, iFormView.getModel().getDataEntity().getLong(PositionBillConstant.ID_KEY));
+                    formShowParameter.setCustomParam(PositionBillConstant.CP_BILLBSED, iFormView.getModel().getDataEntity().getDate(PositionBillConstant.NCKD_EFFDT));
                     formShowParameter.setCloseCallBack(new CloseCallBack(pluginName, operation));
-                    if (HRStringUtils.equals(EnableEnum.NO.getCode(), iFormView.getPageCache().get("isList"))) {
-                        formShowParameter.setCustomParam("parentId", iFormView.getPageCache().get("parentId"));
+                    if (HRStringUtils.equals(EnableEnum.NO.getCode(), iFormView.getPageCache().get(PositionBillConstant.PC_ISLIST))) {
+                        formShowParameter.setCustomParam(PositionBillConstant.CP_PARENTID, iFormView.getPageCache().get(PositionBillConstant.CP_PARENTID));
                     }
 
                     if (HRStringUtils.equals(iFormView.getFormShowParameter().getAppId(), PositionBillConstant.WFTASK_APP)) {
                         formShowParameter.setHasRight(true);
                     }
-                    formShowParameter.setCustomParam("org", iFormView.getModel().getDataEntity().getLong(String.join(".", PositionBillConstant.ORG_KEY, PositionBillConstant.ID_KEY)));
+                    formShowParameter.setCustomParam(PositionBillConstant.ORG_KEY, iFormView.getModel().getDataEntity().getLong(String.join(".", PositionBillConstant.ORG_KEY, PositionBillConstant.ID_KEY)));
                     int sequence = getEntrySeq(iFormView.getModel(), PositionChangeTypeEnum.ADD.getNumber());
-                    formShowParameter.setCustomParam("sequence", sequence);
-                    //formShowParameter.setCustomParam("OP_VALIDATOR_BILL_ORG_ALL_CHANGE_ORG_KEY", getThisBillAllValidateDataStr(dynamicObject));
-                    //formShowParameter.setCustomParam("OP_VALIDATOR_BILL_ORG_NEW_ORG_NUMBERS_KEY", getThisBillOrgNumbersStr(dynamicObject));
+                    formShowParameter.setCustomParam(PositionBillConstant.CP_SEQUENCE, sequence);
+                    formShowParameter.setCustomParam(PositionBillConstant.OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY, getThisBillAllValidateDataStr(dynamicObject));
+                    formShowParameter.setCustomParam(PositionBillConstant.OP_VALIDATOR_BILL_POSITION_NEW_POSITION_NUMBERS_KEY, getThisBillPositionNumbersStr(dynamicObject));
                     iFormView.showForm(formShowParameter);
                 default:
             }
@@ -132,6 +146,42 @@ public class PositionBillServiceHelper {
         return permResult;
     }
 
+    public static void filterF7Position(IFormView iFormView, BeforeF7SelectEvent event, QFilter filter) {
+        FormShowParameter formShowParameter = event.getFormShowParameter();
+        formShowParameter.setFormId(PositionBillConstant.NCKD_HBPM_POSORGTREELISTF_ENTITY);
+        log.info("[岗位F7过滤条件]");
+        event.getCustomQFilters().add(filter);
+        Object originalValue = event.getOriginalValue();
+        if (originalValue instanceof DynamicObject) {
+            DynamicObject originalVal = (DynamicObject) originalValue;
+            long currentPositionId = originalVal.getLong(PositionBillConstant.ID_KEY);
+            QFilter positionIdFilter = new QFilter(PositionBillConstant.ID_KEY, QCP.not_equals, currentPositionId);
+            event.getCustomQFilters().add(positionIdFilter);
+        }
+
+        QFilter currentBillPositionFilter = filterCurrentBillOrg(iFormView);
+        event.getCustomQFilters().add(currentBillPositionFilter);
+
+        event.getCustomQFilters().add(new QFilter(PositionBillConstant.ORG_KEY, QCP.equals, ((DynamicObject) iFormView.getModel().getValue(PositionBillConstant.ORG_KEY)).getLong(PositionBillConstant.ID_KEY)));
+        event.getFormShowParameter().setCaption("岗位");
+    }
+
+    public static QFilter filterCurrentBillOrg(IFormView iFormView) {
+        List<Long> list = new ArrayList();
+        DynamicObjectCollection change = new DynamicObjectCollection();
+        if (iFormView.getEntityId().equals(PositionBillConstant.NCKD_POSITIONBILL_ENTITY)) {
+            change = iFormView.getModel().getDataEntity(true).getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY_CHANGE_KEY);
+        } else if (iFormView.getEntityId().equals(PositionBillConstant.NCKD_POSBILLENTRYCHANGE_ENTITY)) {
+            change = iFormView.getParentView().getModel().getDataEntity(true).getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY_CHANGE_KEY);
+        }
+
+        if (change != null) {
+            list.addAll(change.stream().map((position) -> position.getLong(String.format("%s_%s.%s", PositionBillConstant.NCKD_POSITION, PositionBillConstant.CHANGE_TAG, PositionBillConstant.BOID_KEY))).collect(Collectors.toList()));
+        }
+
+        return list.isEmpty() ? new QFilter(PositionBillConstant.ID_KEY, QCP.not_equals, 20000L) : new QFilter(PositionBillConstant.BOID_KEY, QCP.not_in, list);
+    }
+
     /**
      * 删除岗位新设暂存数据
      * @param positionIdList
@@ -182,29 +232,12 @@ public class PositionBillServiceHelper {
      * @return 单据分录字段: 分录页面字段
      */
     public static Map<String, String> getPosBillEntryTransKeyMap() {
-        return getPosBillEntryTransKeyMap(false);
-    }
-
-    /**
-     * 获取岗位申请分录转换键值(倒转)
-     * @return 分录页面字段: 单据分录字段
-     */
-    public static Map<String, String> getPosBillEntryReverseTransKeyMap() {
-        return getPosBillEntryTransKeyMap(true);
-    }
-
-    /**
-     * 获取岗位申请分录转换键值
-     * @return
-     */
-    private static Map<String, String> getPosBillEntryTransKeyMap(Boolean isReverse) {
         String selectFields = QueryFieldBuilder.create().add(PositionBillConstant.NUMBER_KEY).add(PositionBillConstant.NAME_KEY).buildSelect();
         DynamicObject[] transKeyDyos = HRBaseServiceHelper.create(PositionBillConstant.NCKD_PBENTRY_TRANSKEY_ENTITY).queryOriginalArray(selectFields, null);
         Map<String, String> transKeyMap = Arrays.stream(transKeyDyos).collect(Collectors.toMap(
-                transKeyDyo -> isReverse ? transKeyDyo.getString(PositionBillConstant.NUMBER_KEY) : transKeyDyo.getString(PositionBillConstant.NAME_KEY),
-                transKeyDyo -> isReverse ? transKeyDyo.getString(PositionBillConstant.NAME_KEY) : transKeyDyo.getString(PositionBillConstant.NUMBER_KEY),
-                (oldValue, newValue) -> newValue)
-        );
+                transKeyDyo -> transKeyDyo.getString(PositionBillConstant.NUMBER_KEY),
+                transKeyDyo -> transKeyDyo.getString(PositionBillConstant.NAME_KEY),
+                (oldValue, newValue) -> newValue));
         return transKeyMap;
     }
 
@@ -280,7 +313,7 @@ public class PositionBillServiceHelper {
         return positionDyo;
     }
 
-    public static void entryEntityMore(IDataModel iDataModel, IFormView iFormView, String tag, OperationStatus status) {
+    public static void entryEntityMore(IDataModel iDataModel, IFormView iFormView, String tag, OperationStatus status, String pluginName) {
         EntryGrid entryEntity = iFormView.getControl(String.join("_", PositionBillConstant.NCKD_ENTRYENTITY, tag));
         int row = entryEntity.getEntryState().getFocusRow();
         DynamicObject dynamicObject = iDataModel.getDataEntity(true).getDynamicObjectCollection(String.join("_", PositionBillConstant.NCKD_ENTRYENTITY, tag)).get(row);
@@ -288,7 +321,7 @@ public class PositionBillServiceHelper {
         long id = dynamicObject.getLong(PositionBillConstant.ID_KEY);
         BillShowParameter formShowParameter = new BillShowParameter();
         Object dy = dynamicObject.get(String.join("_", PositionBillConstant.NCKD_POSITION, tag));
-        if (dy == null) {// 1977
+        if (dy == null) {
             iFormView.showTipNotification("请先选择岗位。");
         } else {
             if (PositionBillConstant.CHANGE_TAG.equals(tag)) {
@@ -301,7 +334,7 @@ public class PositionBillServiceHelper {
             if (exists) {
                 formShowParameter.setPkId(id);
             } else {
-                formShowParameter.setCustomParam("id", id);
+                formShowParameter.setCustomParam(PositionBillConstant.ID_KEY, id);
             }
 
             if (HRStringUtils.equals(iFormView.getFormShowParameter().getAppId(), PositionBillConstant.WFTASK_APP)) {
@@ -309,24 +342,101 @@ public class PositionBillServiceHelper {
             }
 
             formShowParameter.setStatus(status);
-            formShowParameter.setCustomParam("id", id);
+            formShowParameter.setCustomParam(PositionBillConstant.ID_KEY, id);
             formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
-            formShowParameter.setCustomParam("selectObject", SerializationUtils.toJsonString(map));
-            formShowParameter.setCustomParam("billid", iDataModel.getValue(PositionBillConstant.ID_KEY));
-            formShowParameter.setCustomParam("positionid", String.valueOf(dynamicObject.getLong(String.join("_", PositionBillConstant.NCKD_POSITION, tag))));
-            formShowParameter.setCustomParam("iscard", "isCardFalse");
-            formShowParameter.setCustomParam("position_bsed", iDataModel.getValue(PositionBillConstant.NCKD_EFFDT) == null ? HRDateTimeUtils.getNowDateTime().getTime() : ((Date) iDataModel.getValue(PositionBillConstant.NCKD_EFFDT)).getTime());
-            formShowParameter.setCustomParam("org", iDataModel.getDataEntity().getLong(String.join(".", PositionBillConstant.ORG_KEY, PositionBillConstant.ID_KEY)));
-            formShowParameter.setCustomParam("billstatus", iDataModel.getDataEntity().get(PositionBillConstant.BILL_STATUS_KEY));
+            formShowParameter.setCustomParam(PositionBillConstant.CP_SELECTOBJECT, SerializationUtils.toJsonString(map));
+            formShowParameter.setCustomParam(PositionBillConstant.CP_BILLID, iDataModel.getValue(PositionBillConstant.ID_KEY));
+            formShowParameter.setCustomParam(PositionBillConstant.CP_POSITIONID, String.valueOf(dynamicObject.getLong(String.format("%s_%s.%s", PositionBillConstant.NCKD_POSITION, tag, PositionBillConstant.ID_KEY))));
+            formShowParameter.setCustomParam(PositionBillConstant.CP_ISCARD, "isCardFalse");
+            formShowParameter.setCustomParam(PositionBillConstant.CP_POSITION_BSED, iDataModel.getValue(PositionBillConstant.NCKD_EFFDT) == null ? HRDateTimeUtils.getNowDateTime().getTime() : ((Date) iDataModel.getValue(PositionBillConstant.NCKD_EFFDT)).getTime());
+            formShowParameter.setCustomParam(PositionBillConstant.ORG_KEY, iDataModel.getDataEntity().getLong(String.join(".", PositionBillConstant.ORG_KEY, PositionBillConstant.ID_KEY)));
+            formShowParameter.setCustomParam(PositionBillConstant.BILL_STATUS_KEY, iDataModel.getDataEntity().get(PositionBillConstant.BILL_STATUS_KEY));
             int sequence = getEntrySeq(iFormView.getModel(), PositionChangeTypeEnum.getNumberByTag(tag));
-            formShowParameter.setCustomParam("sequence", sequence);
-            formShowParameter.setCloseCallBack(new CloseCallBack("nckd.jxccl.hrmp.hbpm.plugin.form.hr.PositionBillFormPlugin", tag));
-            //formShowParameter.setCustomParam("OP_VALIDATOR_BILL_ORG_ALL_CHANGE_ORG_KEY", getThisBillAllValidateDataStr(iDataModel.getDataEntity(true)));
-            //formShowParameter.setCustomParam("OP_VALIDATOR_BILL_ORG_NEW_ORG_NUMBERS_KEY", getThisBillOrgNumbersStr(iDataModel.getDataEntity(true)));
+            formShowParameter.setCustomParam(PositionBillConstant.CP_SEQUENCE, sequence);
+            formShowParameter.setCloseCallBack(new CloseCallBack(pluginName, tag));
+            formShowParameter.setCustomParam(PositionBillConstant.OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY, getThisBillAllValidateDataStr(iDataModel.getDataEntity(true)));
+            formShowParameter.setCustomParam(PositionBillConstant.OP_VALIDATOR_BILL_POSITION_NEW_POSITION_NUMBERS_KEY, getThisBillPositionNumbersStr(iDataModel.getDataEntity(true)));
             iFormView.showForm(formShowParameter);
         }
     }
 
+    public static String getThisBillAllValidateDataStr(DynamicObject bill) {
+        if (bill == null) {
+            return "";
+        } else {
+            DynamicObjectCollection positionEntryDys = new DynamicObjectCollection();
+            positionEntryDys.addAll(bill.getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY_ADD_KEY));
+            positionEntryDys.addAll(bill.getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY_CHANGE_KEY));
+            PositionBillSaveHelper helper = PositionBillSaveHelper.getInstance();
+            Map<Long, List<String>> positionBoIdToChangeTypeNumberMap = Maps.newHashMapWithExpectedSize(16);
+
+            for(DynamicObject entryDy : positionEntryDys) {
+                String suffix = helper.getSuffixFromEntryEntityDyn(entryDy);
+                String changeTypeNumber = PositionChangeTypeEnum.getNumberByTag(suffix);
+                Long positionBoId = null;
+                if (PositionChangeTypeEnum.ADD.getNumber().equals(changeTypeNumber)) {
+                    positionBoId = helper.getPositionId(entryDy, suffix);
+                } else {
+                    DynamicObject positionDyRef = entryDy.getDynamicObject(helper.spliceTwoStringByUnderLine(suffix, PositionBillConstant.NCKD_POSITION));
+                    if (positionDyRef != null) {
+                        positionBoId = positionDyRef.getLong(PositionBillConstant.BOID_KEY);
+                    }
+                }
+
+                if (positionBoId != null && positionBoId != 0L) {
+                    List<String> changeTypeNumbers = positionBoIdToChangeTypeNumberMap.get(positionBoId);
+                    if (changeTypeNumbers == null) {
+                        changeTypeNumbers = Lists.newArrayListWithExpectedSize(10);
+                    }
+
+                    changeTypeNumbers.add(changeTypeNumber);
+                    positionBoIdToChangeTypeNumberMap.put(positionBoId, changeTypeNumbers);
+                }
+            }
+
+            return JSONObject.toJSONString(positionBoIdToChangeTypeNumberMap);
+        }
+    }
+
+    public static String getThisBillPositionNumbersStr(DynamicObject bill) {
+        if (bill == null) {
+            return "";
+        } else {
+            DynamicObjectCollection positionNumberEntryDys = new DynamicObjectCollection();
+            positionNumberEntryDys.addAll(bill.getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY_ADD_KEY));
+            positionNumberEntryDys.addAll(bill.getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY_CHANGE_KEY));
+            PositionBillSaveHelper helper = PositionBillSaveHelper.getInstance();
+            Map<String, List<Long>> newNumberToPositionIdsMap = Maps.newHashMapWithExpectedSize(positionNumberEntryDys.size());
+
+            for(DynamicObject positionEntryDy : positionNumberEntryDys) {
+                String suffix = helper.getSuffixFromEntryEntityDyn(positionEntryDy);
+                long positionId = 0L;
+                String positionNumber = positionEntryDy.getString(helper.spliceTwoStringByUnderLine(suffix, PositionBillConstant.NCKD_NUMBER_KEY));
+                if (PositionBillConstant.NCKD_ENTRYENTITY_ADD_KEY.equals(positionEntryDy.getDynamicObjectType().getName())) {
+                    positionId = positionEntryDy.getLong(helper.spliceTwoStringByUnderLine(suffix, PositionBillConstant.NCKD_POSITION));
+                } else {
+                    DynamicObject positionDy = positionEntryDy.getDynamicObject(helper.spliceTwoStringByUnderLine(suffix, PositionBillConstant.NCKD_POSITION));
+                    if (positionDy != null) {
+                        positionId = positionDy.getLong(PositionBillConstant.BOID_KEY);
+                    }
+                }
+
+                if (HRStringUtils.isNotEmpty(positionNumber)) {
+                    List<Long> positionIds = newNumberToPositionIdsMap.computeIfAbsent(positionNumber, (key) -> Lists.newArrayListWithExpectedSize(positionNumberEntryDys.size()));
+                    positionIds.add(positionId);
+                }
+            }
+
+            return JSONObject.toJSONString(newNumberToPositionIdsMap);
+        }
+    }
+
+    /**
+     * @param operationKey
+     * @param positionDys
+     * @param option
+     * @return
+     */
     public static OperationResult executeOperateOnlyValidate(String operationKey, DynamicObject[] positionDys, OperateOption option) {
         OperateOption operateOption = option;
         if (option == null) {

+ 67 - 1
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/common/hr/PositionBillConstant.java

@@ -68,7 +68,7 @@ public class PositionBillConstant extends FormConstant {
     /** 上级岗位 */
     public static final String PARENT_KEY = "parent";
     /** 组织体系管理组织 */
-    public static final String NCKD_ORG = "nckd_org";
+    public static final String NCKD_ORG_KEY = "nckd_org";
     /** 生效日期 */
     public static final String NCKD_BSED = "nckd_bsed";
     /** 行政组织业务ID */
@@ -87,5 +87,71 @@ public class PositionBillConstant extends FormConstant {
     public static final String NCKD_NAME_KEY = "nckd_name";
     /** 签发组织 */
     public static final String NCKD_DISORG_KEY = "nckd_disorg";
+    /** 原上级岗位 */
+    public static final String NCKD_ORIPARENT_KEY = "nckd_oriparent";
+
+    /** 岗位生效时间页面自定义参数 */
+    public static final String CP_POSITION_BSED = "position_bsed";
+    /** 查询日期页面自定义参数 */
+    public static final String CP_SEARCHDATE = "searchdate";
+    /** 单据ID页面自定义参数 */
+    public static final String CP_BILLID = "billid";
+    /** 选中数据页面自定义参数 */
+    public static final String CP_SELECTOBJECT = "selectObject";
+    /** 单据生效时间页面自定义参数 */
+    public static final String CP_BILLBSED = "billBsed";
+    /** 上级ID页面自定义参数 */
+    public static final String CP_PARENTID = "parentId";
+    /** 分录顺序号页面自定义参数 */
+    public static final String CP_SEQUENCE = "sequence";
+    /** 岗位ID页面自定义参数 */
+    public static final String CP_POSITIONID = "positionId";
+    /** 是否卡片视图页面自定义参数 */
+    public static final String CP_ISCARD = "iscard";
+
+    /** 是否列表界面缓存参数 */
+    public static final String PC_ISLIST = "isList";
+    /** 新增岗位上级变更页面缓存参数 */
+    public static final String PC_ADDPOSITIONPARENTCHANGE = "addPositionParentChange";
+    /** 上级ID页面缓存参数 */
+    public static final String PC_PARENTID = "parentId";
+    /** 保存结果页面缓存参数 */
+    public static final String PC_SAVERESULT = "saveResult";
+    /** 是否关闭页面缓存参数 */
+    public static final String PC_ISCLOSE = "isclose";
+    /** 变更前上级岗位ID页面缓存参数 */
+    public static final String PC_BEFOREPARENTPOSITIONID = "beforeParentPositionId";
+    /** 编码规则编码页面缓存参数 */
+    public static final String PC_CODERULENUMBER = "codeRuleNumber";
+    /** 数据变更重置编码页面缓存参数 */
+    public static final String PC_PARAMSCHANGESETNUMBER = "paramsChangeSetNumber";
+    /** 初始化标识页面缓存参数 */
+    public static final String PC_INITFLAG = "initFlag";
+    /** 主业务组织页面缓存参数 */
+    public static final String PC_MASTERORG = "masterOrg";
+    /** 不可修改页面缓存参数 */
+    public static final String PC_NOTMODIFIABLE = "notModifiable";
+    /** 是否初始化页面缓存参数 */
+    public static final String PC_ISINIT = "isInit";
+    /** 变更前岗位ID页面缓存参数 */
+    public static final String PC_POSITIONOLD = "positionOld";
+    /** 岗位变更行页面缓存参数 */
+    public static final String PC_POSITIONROW = "positionRow";
+    /** 分录岗位信息页面缓存参数 */
+    public static final String PC_ENTRY_POSITION_VALUE = "entry_position_value";
+
+    /** 变更组织体系管理组织回调标识 */
+    public static final String CB_CHG_ORG = "chg_org";
+    /** 选中岗位数据回调标识 */
+    public static final String CB_SELECT_POSITION_UNDERLINE = "select_position_";
+
+    /** 岗位申请单同级岗位名称OP参数 */
+    public static final String OP_BILL_SIBLING_NAMES_MAP = "OP_BILL_SIBLING_NAMES_MAP";
+    /** 岗位申请单岗位编码OP参数 */
+    public static final String OP_BILL_NUMBER_MAP = "OP_BILL_NUMBER_MAP";
+    /** 所有岗位信息OP参数 */
+    public static final String OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY = "OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY";
+    /** 岗位申请单所有岗位编码OP参数 */
+    public static final String OP_VALIDATOR_BILL_POSITION_NEW_POSITION_NUMBERS_KEY = "OP_VALIDATOR_BILL_POSITION_NEW_POSITION_NUMBERS_KEY";
 
 }

+ 3 - 2
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/form/hr/ParentPositionListPlugin.java

@@ -1,5 +1,6 @@
 package nckd.jxccl.hrmp.hbpm.plugin.form.hr;
 
+import kd.bos.common.enums.EnableEnum;
 import kd.bos.form.control.SplitContainer;
 import kd.bos.form.control.SplitDirection;
 import kd.bos.form.events.PreOpenFormEventArgs;
@@ -22,7 +23,7 @@ public class ParentPositionListPlugin extends AbstractListPlugin {
 
         // 指定显示岗位数据
         Map<String, Object> customParams = e.getFormShowParameter().getCustomParams();
-        customParams.put("showBasedata", "0");
+        customParams.put("showBasedata", EnableEnum.NO.getCode());
     }
 
     @Override
@@ -30,7 +31,7 @@ public class ParentPositionListPlugin extends AbstractListPlugin {
         super.beforeBindData(e);
 
         // 默认隐藏左树
-        SplitContainer splitContainer = (SplitContainer)this.getView().getControl("splitcontainerap");
+        SplitContainer splitContainer = getView().getControl("splitcontainerap");
         if (splitContainer != null) {
             splitContainer.hidePanel(SplitDirection.left, true);
         }

+ 115 - 62
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/form/hr/PosBillEntryAddFormPlugin.java

@@ -29,6 +29,7 @@ import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
 import kd.hr.hbp.common.util.HRObjectUtils;
 import kd.hr.hbp.common.util.HRStringUtils;
 import kd.hr.homs.business.utils.PatternUtil;
+import nckd.jxccl.hrmp.hbpm.business.hr.PosBillEntryFastChgHelper;
 import nckd.jxccl.hrmp.hbpm.business.hr.PositionBillServiceHelper;
 import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
 
@@ -42,36 +43,27 @@ import java.util.stream.Stream;
 
 /**
  * 岗位申请-新增岗位表单插件
+ * @from: kd.hr.homs.formplugin.web.orgbatch.AdminOrgBatchDetailAddPlugin
  * @author: jtd
  * @date: 2025-11-05 15:32
  */
 public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
 
-    /**
-     * 编码规则的编码
-     */
-    private static final String CODERULE_NUMBER = "codeRuleNumber";
-
-    /**
-     * 保存结果标识
-     */
-    private static final String SAVE_RESULT = "saveResult";
-
     @Override
     public void beforeBindData(EventObject e) {
         super.beforeBindData(e);
 
-        getPageCache().put("paramsChangeSetNumber", "false");
+        getPageCache().put(PositionBillConstant.PC_PARAMSCHANGESETNUMBER, Boolean.FALSE.toString());
         DynamicObject positionDy = getModel().getDataEntity();
         long entityId = positionDy.getLong(PositionBillConstant.ID_KEY);
         if (entityId == 0L) {
-            Long billId = getView().getFormShowParameter().getCustomParam("billid");
+            Long billId = getView().getFormShowParameter().getCustomParam(PositionBillConstant.CP_BILLID);
             getModel().setValue(PositionBillConstant.NCKD_BILLID, billId);
-            getPageCache().put("initFlag", Boolean.TRUE.toString());
+            getPageCache().put(PositionBillConstant.PC_INITFLAG, Boolean.TRUE.toString());
         }
 
         // 设置生效时间
-        Object positionBsedStr = getView().getFormShowParameter().getCustomParam("position_bsed");
+        Object positionBsedStr = getView().getFormShowParameter().getCustomParam(PositionBillConstant.CP_POSITION_BSED);
         if (positionBsedStr != null) {
             long positionBsedTime = Long.parseLong(positionBsedStr.toString());
             getModel().setValue(PositionBillConstant.NCKD_BSED, new Date(positionBsedTime));
@@ -87,7 +79,7 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
             setPositionNumberEnable();
         }
 
-        getPageCache().put("paramsChangeSetNumber", "true");
+        getPageCache().put(PositionBillConstant.PC_PARAMSCHANGESETNUMBER, Boolean.TRUE.toString());
         // 新增的时候生成岗位ID
         String positionIdKey = String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.ID_KEY);
         long positionId = getModel().getDataEntity().getLong(positionIdKey);
@@ -96,11 +88,11 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
             getModel().setValue(positionIdKey, positionId);
         }
 
-        getPageCache().put("masterOrg", String.valueOf(positionDy.getLong(String.join(".", PositionBillConstant.NCKD_ORG, PositionBillConstant.ID_KEY))));
+        getPageCache().put(PositionBillConstant.PC_MASTERORG, String.valueOf(positionDy.getLong(String.join(".", PositionBillConstant.NCKD_ORG_KEY, PositionBillConstant.ID_KEY))));
     }
 
     private void setPositionNumberEnable() {
-        DynamicObject org = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_ORG);
+        DynamicObject org = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_ORG_KEY);
         if (org == null) {
             getView().setEnable(Boolean.valueOf(false), PositionBillConstant.NUMBER_KEY);
             return;
@@ -112,23 +104,23 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
             getView().setEnable(false, PositionBillConstant.NUMBER_KEY);
             String orgNumber = getModel().getDataEntity().getString(PositionBillConstant.NUMBER_KEY);
             if (HRStringUtils.isNotEmpty(orgNumber)) {
-                getView().getPageCache().put("codeRuleNumber", orgNumber);
-                getView().getPageCache().put("notModifiable", Boolean.TRUE.toString());
+                getView().getPageCache().put(PositionBillConstant.PC_CODERULENUMBER, orgNumber);
+                getView().getPageCache().put(PositionBillConstant.PC_NOTMODIFIABLE, Boolean.TRUE.toString());
             }
         }
     }
 
     private void setPositionNumber(DynamicObject positionHrDy, Boolean init) {
-        DynamicObject dataEntity = getModel().getDataEntity();// 157
+        DynamicObject dataEntity = getModel().getDataEntity();
         // 组织体系管理组织
-        DynamicObject org = dataEntity.getDynamicObject(PositionBillConstant.NCKD_ORG);
+        DynamicObject org = dataEntity.getDynamicObject(PositionBillConstant.NCKD_ORG_KEY);
         if (org == null) {
             getView().setEnable(Boolean.FALSE, PositionBillConstant.NUMBER_KEY);
             return;
         }
 
         String number = dataEntity.getString(PositionBillConstant.NUMBER_KEY);
-        if (HRStringUtils.isNotEmpty(number) && !HRStringUtils.equals(number, getView().getPageCache().get("codeRuleNumber"))) {
+        if (HRStringUtils.isNotEmpty(number) && !HRStringUtils.equals(number, getView().getPageCache().get(PositionBillConstant.PC_CODERULENUMBER))) {
             return;
         }
 
@@ -143,7 +135,7 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
                 QFilter qFilter = new QFilter(PositionBillConstant.NUMBER_KEY, QCP.equals, positionNumber);
                 if (!hrBaseServiceHelper.isExists(qFilter)) {
                     getModel().setValue(PositionBillConstant.NUMBER_KEY, positionNumber);
-                    getView().getPageCache().put("codeRuleNumber", positionNumber);
+                    getView().getPageCache().put(PositionBillConstant.PC_CODERULENUMBER, positionNumber);
                 } else {
                     setPositionNumber(positionHrDy, init);
                 }
@@ -152,7 +144,7 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
             }
         } else {
             getModel().setValue(PositionBillConstant.NUMBER_KEY, null);
-            getView().getPageCache().put("codeRuleNumber", "");
+            getView().getPageCache().put(PositionBillConstant.PC_CODERULENUMBER, "");
             getView().setEnable(Boolean.TRUE, PositionBillConstant.NUMBER_KEY);
         }
     }
@@ -161,10 +153,10 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
     public void beforeClosed(BeforeClosedEvent event) {
         super.beforeClosed(event);
 
-        String isCancelOverFlag = getView().getPageCache().get("isclose");
+        String isCancelOverFlag = getView().getPageCache().get(PositionBillConstant.PC_ISCLOSE);
         if (HRStringUtils.isNotEmpty(isCancelOverFlag) && Boolean.TRUE.toString().equals(isCancelOverFlag)) {
             getModel().setDataChanged(false);
-            getView().getPageCache().put("isclose", Boolean.FALSE.toString());
+            getView().getPageCache().put(PositionBillConstant.PC_ISCLOSE, Boolean.FALSE.toString());
         } else {
             boolean dataChanged = getModel().getDataChanged();
             if (dataChanged) {
@@ -177,15 +169,15 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
                 String msg = "检测到您有更改内容,是否不保存直接退出?若不保存,将丢失这些更改。";
                 getView().showConfirm(msg, getModel().getChangeDesc(), options, ConfirmTypes.Save, confirmCallBacks, btnNameMaps);
             } else {
-                String codeRuleNumber = getView().getPageCache().get("codeRuleNumber");
-                String notModifiable = getView().getPageCache().get("notModifiable");
+                String codeRuleNumber = getView().getPageCache().get(PositionBillConstant.PC_CODERULENUMBER);
+                String notModifiable = getView().getPageCache().get(PositionBillConstant.PC_NOTMODIFIABLE);
                 if (!StringUtils.isEmpty(codeRuleNumber) && !Boolean.TRUE.toString().equals(notModifiable)) {
-                    DynamicObject org = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_ORG);
+                    DynamicObject org = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_ORG_KEY);
                     if (org == null) {
                         return;
                     }
 
-                    String saveResult = getView().getPageCache().get("saveResult");
+                    String saveResult = getView().getPageCache().get(PositionBillConstant.PC_SAVERESULT);
                     if (!Boolean.TRUE.toString().equals(saveResult)) {
                         long orgId = org.getLong(PositionBillConstant.ID_KEY);
                         DynamicObject positionHrDy = PositionBillServiceHelper.getPositionHrDy(getModel().getDataEntity());
@@ -210,13 +202,14 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
         // 设置上级岗位变更前的数据到页面缓存中
         DynamicObject parentPosition = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_PARENT);
         if (parentPosition != null) {
-            getView().getPageCache().put("beforeParentPositionId", parentPosition.getString(PositionBillConstant.ID_KEY));
+            getView().getPageCache().put(PositionBillConstant.PC_BEFOREPARENTPOSITIONID, parentPosition.getString(PositionBillConstant.ID_KEY));
         }
 
-        Object selectObject = getView().getFormShowParameter().getCustomParam("selectObject");
+        Object selectObject = getView().getFormShowParameter().getCustomParam(PositionBillConstant.CP_SELECTOBJECT);
         if (selectObject != null) {
+            String lineSuffix = "_"+PositionBillConstant.ADD_TAG;
             Map<String, Object> map = SerializationUtils.fromJsonString(selectObject.toString(), Map.class);
-            Map<String, Object> noPrefixMap = map.entrySet().stream().collect(HashMap::new, (m, v) -> m.put((v.getKey()).replace("_"+PositionBillConstant.ADD_TAG, ""), v.getValue()), HashMap::putAll);
+            Map<String, Object> noPrefixMap = map.entrySet().stream().collect(HashMap::new, (m, v) -> m.put(PositionBillServiceHelper.getNoLineSuffixProp(v.getKey(), lineSuffix), v.getValue()), HashMap::putAll);
             List<String> props = new ArrayList();
 
             for(String prop : noPrefixMap.keySet()) {
@@ -248,7 +241,7 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
             if (value != null) {
                 if (propertyType.equals(DynamicObject.class) && dynamicProperty instanceof BasedataProp) {
                     // 岗位特殊处理
-                    Object id = PositionBillConstant.NCKD_POSITION.equals(key) ? value : ((Map)value).get(PositionBillConstant.ID_KEY);
+                    Object id = PositionBillConstant.NCKD_POSITION.equals(key) ? value : ((Map) value).get(PositionBillConstant.ID_KEY);
                     if (id != null && !HRStringUtils.equals(value.toString(), "0")) {
                         getModel().setValue(key, id);
                     }
@@ -256,11 +249,11 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
                     MulBasedataProp property = (MulBasedataProp) getModel().getDataEntityType().getProperty(key);
                     DynamicObjectCollection dynamicObjectCollection = new DynamicObjectCollection();
                         HRBaseServiceHelper serviceHelper = new HRBaseServiceHelper(property.getBaseEntityId());
-                    ((List)value).forEach((map) -> {
+                    ((List) value).forEach((map) -> {
                         DynamicObject dy = new DynamicObject(property.getDynamicCollectionItemPropertyType());
-                        dy.set("fbasedataid_id", ((Map)map).get("fbasedataid_id"));
+                        dy.set("fbasedataid_id", ((Map) map).get("fbasedataid_id"));
                         DynamicObject emptyDynamicObject = serviceHelper.generateEmptyDynamicObject();
-                        emptyDynamicObject.set(PositionBillConstant.ID_KEY, ((Map)map).get("fbasedataid_id"));
+                        emptyDynamicObject.set(PositionBillConstant.ID_KEY, ((Map) map).get("fbasedataid_id"));
                         dy.set("fbasedataid", emptyDynamicObject);
                         dynamicObjectCollection.add(dy);
                     });
@@ -276,9 +269,21 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
     @Override
     public void propertyChanged(PropertyChangedArgs changedArgs) {
         String fieldKey = changedArgs.getProperty().getName();
-        if (PositionBillConstant.NCKD_ESTDATE.equals(fieldKey)) {
-            setEstablishmentDateToBsed((Date)changedArgs.getChangeSet()[0].getNewValue());
+        boolean isGetNumber = true;
+        switch (fieldKey) {
+            case PositionBillConstant.NCKD_ESTDATE:
+                setEstablishmentDateToBsed((Date)changedArgs.getChangeSet()[0].getNewValue());
+                break;
+            case PositionBillConstant.NCKD_POSITION:
+                break;
+            case PositionBillConstant.NCKD_ORG_KEY:
+                PosBillEntryFastChgHelper.orgPropertyChanged(changedArgs, getView(), this);
+        }
+
+        if (HRStringUtils.equals(Boolean.TRUE.toString(), getPageCache().get(PositionBillConstant.PC_PARAMSCHANGESETNUMBER)) && isGetNumber) {
+            propertyChangedGetNumber(fieldKey, changedArgs.getChangeSet()[0].getOldValue());
         }
+
     }
 
     /**
@@ -299,9 +304,35 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
         super.confirmCallBack(event);
 
         if (String.join("_", PositionBillConstant.CLOSE_OP, PositionBillConstant.ADD_TAG).equals(event.getCallBackId()) && event.getResult() != MessageBoxResult.Cancel) {
-            recycleNumber();
-            getView().getPageCache().put("isclose", Boolean.TRUE.toString());
+            String codeRuleNumber = getView().getPageCache().get(PositionBillConstant.PC_CODERULENUMBER);
+            if (!StringUtils.isEmpty(codeRuleNumber)) {
+                DynamicObject org = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_ORG_KEY);
+                if (HRObjectUtils.isEmpty(org)) {
+                    return;
+                }
+                String saveResult = getView().getPageCache().get(PositionBillConstant.PC_SAVERESULT);
+                if (!Boolean.TRUE.toString().equals(saveResult)) {
+                    long orgId = org.getLong(PositionBillConstant.ID_KEY);
+                    DynamicObject positionHrDy = PositionBillServiceHelper.getPositionHrDy(getModel().getDataEntity());
+                    CodeRuleServiceHelper.recycleNumber(PositionBillConstant.HBPM_POSITIONHR, positionHrDy, String.valueOf(orgId), codeRuleNumber);
+                }
+            }
+
+            getView().getPageCache().put(PositionBillConstant.PC_ISCLOSE, Boolean.TRUE.toString());
             getView().invokeOperation(PositionBillConstant.CLOSE_OP);
+        } else if (PositionBillConstant.CB_CHG_ORG.equals(event.getCallBackId())) {
+            if (event.getResult().getValue() == MessageBoxResult.Yes.getValue()) {
+                getView().getPageCache().put(PositionBillConstant.PC_MASTERORG, String.valueOf(getModel().getDataEntity().getLong(String.join(".", PositionBillConstant.NCKD_ORG_KEY, PositionBillConstant.ID_KEY))));
+                getModel().beginInit();
+                PosBillEntryFastChgHelper.cleanOrgBaseInfo(getModel().getDataEntity().getLong(String.join(".", PositionBillConstant.NCKD_ORG_KEY, PositionBillConstant.ID_KEY)), getView());
+                getModel().endInit();
+            } else {
+                Long masterOrgId = Long.valueOf(getPageCache().get(PositionBillConstant.PC_MASTERORG));
+                getModel().beginInit();
+                getModel().setValue(PositionBillConstant.NCKD_ORG_KEY, masterOrgId.equals(0L) ? null : masterOrgId);
+                getView().updateView(PositionBillConstant.NCKD_ORG_KEY);
+                getModel().endInit();
+            }
         }
     }
 
@@ -315,7 +346,7 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
         IPageCache parentPageCache = getView().getParentView().getPageCache();
         String operateKey = eventArgs.getOperateKey();
         if (HRStringUtils.equals(operateKey, PositionBillConstant.SAVE_AND_NEW_OP) || HRStringUtils.equals(operateKey, PositionBillConstant.SAVE_OP)) {
-            String beforeParentPositionId = getView().getPageCache().get("beforeParentPositionId");
+            String beforeParentPositionId = getView().getPageCache().get(PositionBillConstant.PC_BEFOREPARENTPOSITIONID);
             String addPositionParentChange = Boolean.FALSE.toString();
             DynamicObject parentPosition = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_PARENT);
             if (parentPosition != null) {
@@ -323,35 +354,57 @@ public class PosBillEntryAddFormPlugin extends AbstractFormPlugin {
                 if (!HRStringUtils.equals(beforeParentPositionId, afterParentPositionId)) {
                     addPositionParentChange = Boolean.TRUE.toString();
                 }
-                parentPageCache.put("addPositionParentChange", addPositionParentChange);
-                parentPageCache.put("parentId", afterParentPositionId);
+                parentPageCache.put(PositionBillConstant.PC_ADDPOSITIONPARENTCHANGE, addPositionParentChange);
+                parentPageCache.put(PositionBillConstant.PC_PARENTID, afterParentPositionId);
             }
             Map<String, String> map = new HashMap<>();
             DynamicObject dataEntity = getModel().getDataEntity();
-            map.put("positionId", dataEntity.getString(String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.ID_KEY)));
-            map.put("name", dataEntity.getString(PositionBillConstant.NAME_KEY));
-            map.put("id", dataEntity.getString(PositionBillConstant.ID_KEY));
-            getView().getPageCache().put("saveResult", Boolean.TRUE.toString());
+            map.put(PositionBillConstant.CP_POSITIONID, dataEntity.getString(String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.ID_KEY)));
+            map.put(PositionBillConstant.NAME_KEY, dataEntity.getString(PositionBillConstant.NAME_KEY));
+            map.put(PositionBillConstant.ID_KEY, dataEntity.getString(PositionBillConstant.ID_KEY));
+            getView().getPageCache().put(PositionBillConstant.PC_SAVERESULT, Boolean.TRUE.toString());
             getView().returnDataToParent(map);
         }
     }
 
-    private void recycleNumber() {
-        String codeRuleNumber = getView().getPageCache().get(CODERULE_NUMBER);
-        if (!StringUtils.isEmpty(codeRuleNumber)) {
-            DynamicObject org = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_ORG);
-            if (HRObjectUtils.isEmpty(org)) {
-                return;
-            }
-            String saveResult = getView().getPageCache().get(SAVE_RESULT);
-            if (!Boolean.TRUE.toString().equals(saveResult)) {
-                long orgId = org.getLong(PositionBillConstant.ID_KEY);
-                DynamicObject positionHrDy = PositionBillServiceHelper.getPositionHrDy(getModel().getDataEntity());
-                CodeRuleServiceHelper.recycleNumber(PositionBillConstant.HBPM_POSITIONHR, positionHrDy, String.valueOf(orgId), codeRuleNumber);
+    private void propertyChangedGetNumber(String fieldKey, Object oldValue) {
+        switch (fieldKey) {// 549
+            case PositionBillConstant.NCKD_POSITION:
+                String codeRuleNumber = getView().getPageCache().get(PositionBillConstant.PC_CODERULENUMBER);
+                if (!StringUtils.isEmpty(codeRuleNumber)) {
+                    DynamicObject org = getModel().getDataEntity().getDynamicObject(PositionBillConstant.NCKD_ORG_KEY);
+                    if (org == null) {
+                        return;
+                    }
+
+                    long orgId = org.getLong(PositionBillConstant.ID_KEY);
+                    recycleNumber(orgId, codeRuleNumber, Boolean.TRUE, fieldKey, oldValue);
+                }
+
+                setPositionNumber(PositionBillServiceHelper.getPositionHrDy(getModel().getDataEntity()), false);
+            default:
+        }
+    }
+
+
+    private void recycleNumber(Long orgId, String codeRuleNumber, Boolean paramsChg, String numberParams, Object numberParamsOb) {
+        DynamicObject positionHrDy = PositionBillServiceHelper.getPositionHrDy(getModel().getDataEntity());
+        if (paramsChg) {
+            if (positionHrDy.get(numberParams) instanceof DynamicObject && numberParamsOb instanceof Long) {
+                String baseName = positionHrDy.getDynamicObject(numberParams).getDataEntityType().getName();
+                HRBaseServiceHelper hrBaseServiceHelper = new HRBaseServiceHelper(baseName);
+                DynamicObject paramDy = hrBaseServiceHelper.loadSingle(numberParamsOb);
+                positionHrDy.set(numberParams, paramDy);
+            } else {
+                positionHrDy.set(numberParams, numberParamsOb);
             }
         }
-        getView().getPageCache().put("isclose", Boolean.TRUE.toString());
-        getView().invokeOperation(PositionBillConstant.CLOSE_OP);
+
+        String number = getModel().getDataEntity().getString(PositionBillConstant.NUMBER_KEY);
+        if (HRStringUtils.equals(number, codeRuleNumber)) {
+            CodeRuleServiceHelper.recycleNumber(PositionBillConstant.HBPM_POSITIONHR, positionHrDy, String.valueOf(orgId), codeRuleNumber);
+        }
+
     }
 
 }

+ 29 - 26
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/form/hr/PositionBillEntryFormPlugin.java

@@ -26,6 +26,7 @@ import java.util.Map;
 
 /**
  * 岗位申请单分录表单插件
+ * @from: kd.hr.homs.formplugin.web.orgbatch.AdminOrgBatchDetailPlugin
  * @author: jtd
  * @date: 2025-11-04 9:35
  */
@@ -38,8 +39,8 @@ public class PositionBillEntryFormPlugin extends AbstractFormPlugin implements B
         FormShowParameter formShowParameter = getView().getFormShowParameter();
         setOrg();
         setDefaultValue();
-        if (formShowParameter.getCustomParam("sequence") != null && getModel().getDataEntity(true).getInt(PositionBillConstant.NCKD_SEQUENCE) == 0) {
-            getModel().setValue(PositionBillConstant.NCKD_SEQUENCE, formShowParameter.getCustomParam("sequence"));
+        if (formShowParameter.getCustomParam(PositionBillConstant.CP_SEQUENCE) != null && getModel().getDataEntity(true).getInt(PositionBillConstant.NCKD_SEQUENCE) == 0) {
+            getModel().setValue(PositionBillConstant.NCKD_SEQUENCE, formShowParameter.getCustomParam(PositionBillConstant.CP_SEQUENCE));
         }
     }
 
@@ -49,7 +50,7 @@ public class PositionBillEntryFormPlugin extends AbstractFormPlugin implements B
         getModel().setDataChanged(false);
         OperationStatus status = getView().getFormShowParameter().getStatus();
         if (OperationStatus.ADDNEW.equals(status) || OperationStatus.EDIT.equals(status)) {
-            getView().setEnable(Boolean.TRUE, PositionBillConstant.ORG_KEY);
+            getView().setEnable(Boolean.TRUE, PositionBillConstant.NCKD_ORG_KEY);
         }
     }
 
@@ -57,8 +58,8 @@ public class PositionBillEntryFormPlugin extends AbstractFormPlugin implements B
      * 设置单头ID
      */
     private void setDefaultValue() {
-        Object billId = getView().getFormShowParameter().getCustomParam("billid");
-        if (billId != null) {// 135
+        Object billId = getView().getFormShowParameter().getCustomParam(PositionBillConstant.CP_BILLID);
+        if (billId != null) {
             getModel().setValue(PositionBillConstant.NCKD_BILLID, Long.parseLong(String.valueOf(billId)));
         }
     }
@@ -122,12 +123,12 @@ public class PositionBillEntryFormPlugin extends AbstractFormPlugin implements B
         String entityId = getView().getEntityId();
         if (PositionBillConstant.NCKD_POSBILLENTRYADD_ENTITY.equals(entityId) || PositionBillConstant.NCKD_POSBILLENTRYCHANGE_ENTITY.equals(entityId)) {
             Object orgParam = getView().getFormShowParameter().getCustomParam(PositionBillConstant.ORG_KEY);
-            String isInit = getPageCache().get("isInit");
+            String isInit = getPageCache().get(PositionBillConstant.PC_ISINIT);
             if (orgParam != null && HRStringUtils.isEmpty(isInit)) {
                 getModel().beginInit();
-                getModel().setValue(PositionBillConstant.NCKD_ORG, orgParam);
+                getModel().setValue(PositionBillConstant.NCKD_ORG_KEY, orgParam);
                 getModel().endInit();
-                getPageCache().put("isInit", EnableEnum.YES.getCode());
+                getPageCache().put(PositionBillConstant.PC_ISINIT, EnableEnum.YES.getCode());
             }
         }
     }
@@ -151,9 +152,9 @@ public class PositionBillEntryFormPlugin extends AbstractFormPlugin implements B
                 setValidateData(parentView, PositionBillConstant.CHANGE_TAG, orgBoIdToSiblingNameMap, numberMap);
             }
 
-            operate.getOption().setVariableValue("OP_BILL_SIBLING_NAMES_MAP", JSONObject.toJSONString(orgBoIdToSiblingNameMap));
-            operate.getOption().setVariableValue("OP_BILL_NUMBER_MAP", JSONObject.toJSONString(numberMap));
-            operate.getOption().setVariableValue("OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY", getView().getFormShowParameter().getCustomParam("OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY"));
+            operate.getOption().setVariableValue(PositionBillConstant.OP_BILL_SIBLING_NAMES_MAP, JSONObject.toJSONString(orgBoIdToSiblingNameMap));
+            operate.getOption().setVariableValue(PositionBillConstant.OP_BILL_NUMBER_MAP, JSONObject.toJSONString(numberMap));
+            operate.getOption().setVariableValue(PositionBillConstant.OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY, getView().getFormShowParameter().getCustomParam(PositionBillConstant.OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY));
         }
     }
 
@@ -170,23 +171,25 @@ public class PositionBillEntryFormPlugin extends AbstractFormPlugin implements B
     private void setValidateData(IFormView parentView, String suffix, Map<String, Map<String, ILocaleString>> orgBoIdToSiblingNameMap, Map<String, String> numberMap) {
         for(DynamicObject addEntryDy : parentView.getModel().getDataEntity(true).getDynamicObjectCollection(String.join("_", PositionBillConstant.NCKD_ENTRYENTITY, suffix))) {
             DynamicObject adminOrgDy = addEntryDy.getDynamicObject(String.join("_", PositionBillConstant.NCKD_ADMINORG, suffix));
-            String positionKey = String.join("_", PositionBillConstant.NCKD_POSITION_KEY, suffix);
-            String positionIdKey = String.join(".", positionKey, PositionBillConstant.ID_KEY);
-            if (PositionBillConstant.ADD_TAG.equals(suffix)) {
-                positionIdKey = positionKey;
+            if (adminOrgDy != null) {
+                String positionKey = String.join("_", PositionBillConstant.NCKD_POSITION_KEY, suffix);
+                String positionIdKey = String.join(".", positionKey, PositionBillConstant.ID_KEY);
+                if (PositionBillConstant.ADD_TAG.equals(suffix)) {
+                    positionIdKey = positionKey;
+                }
+
+                long positionId = addEntryDy.getLong(positionIdKey);
+                long boId = adminOrgDy.getLong(PositionBillConstant.BOID_KEY);
+                Map<String, ILocaleString> siblingNameMap = orgBoIdToSiblingNameMap.get(String.valueOf(boId));
+                if (siblingNameMap == null) {
+                    siblingNameMap = Maps.newHashMapWithExpectedSize(16);
+                }
+
+                siblingNameMap.put(String.valueOf(positionId), addEntryDy.getLocaleString(String.join("_", PositionBillConstant.NCKD_NAME_KEY, suffix)));
+                orgBoIdToSiblingNameMap.put(String.valueOf(boId), siblingNameMap);
+                numberMap.put(String.valueOf(positionId), addEntryDy.getString(String.join("_", PositionBillConstant.NCKD_NUMBER_KEY, suffix)));
             }
 
-            long positionId = addEntryDy.getLong(positionIdKey);
-            long boId = adminOrgDy.getLong(PositionBillConstant.BOID_KEY);
-            Map<String, ILocaleString> siblingNameMap = orgBoIdToSiblingNameMap.get(String.valueOf(boId));
-            if (siblingNameMap == null) {
-                siblingNameMap = Maps.newHashMapWithExpectedSize(16);
-            }
-
-            siblingNameMap.put(String.valueOf(positionId), addEntryDy.getLocaleString(String.join("_", PositionBillConstant.NCKD_NAME_KEY, suffix)));
-            orgBoIdToSiblingNameMap.put(String.valueOf(boId), siblingNameMap);
-
-            numberMap.put(String.valueOf(positionId), addEntryDy.getString(String.join("_", PositionBillConstant.NCKD_NUMBER_KEY, suffix)));
         }
 
     }

+ 44 - 52
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/form/hr/PositionBillFormPlugin.java

@@ -41,22 +41,20 @@ import kd.bos.list.ListShowParameter;
 import kd.bos.logging.Log;
 import kd.bos.logging.LogFactory;
 import kd.bos.mvc.bill.BillView;
-import kd.bos.orm.ORM;
 import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.bos.orm.util.CollectionUtils;
 import kd.bos.permission.api.HasPermOrgResult;
 import kd.bos.servicehelper.basedata.BaseDataServiceHelper;
 import kd.bos.servicehelper.permission.PermissionServiceHelper;
-import kd.hr.haos.business.domain.common.service.impl.BaseDataHelper;
 import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
 import kd.hr.hbp.common.model.AuthorizedOrgResult;
 import kd.hr.hbp.common.util.HRDateTimeUtils;
 import kd.hr.hbp.common.util.HRDynamicObjectUtils;
 import kd.hr.hbp.common.util.HRStringUtils;
 import kd.hr.hbp.common.util.concurrent.NullableConcurrentHashMap;
-import kd.hr.homs.business.domain.batchbill.repository.AdminOrgBatchChgHelper;
 import kd.sdk.hr.hdm.common.enums.reg.RegBillStatusEnum;
+import nckd.jxccl.hrmp.hbpm.business.hr.PositionBillAfterBindDataService;
 import nckd.jxccl.hrmp.hbpm.business.hr.PositionBillClosedCallBackService;
 import nckd.jxccl.hrmp.hbpm.business.hr.PositionBillConfirmCallBackService;
 import nckd.jxccl.hrmp.hbpm.business.hr.PositionBillPropertyChangedService;
@@ -69,11 +67,13 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.EventObject;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
 
 /**
  * 岗位申请单表单插件
+ * @from: kd.hr.homs.formplugin.web.orgbatch.AdminOrgBatchBillPlugin
  * @author: jtd
  * @date: 2025-10-25 13:38
  */
@@ -85,20 +85,10 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
     public void afterBindData(EventObject e) {
         super.afterBindData(e);
 
-        // 生成临时单据ID
-        genBillIdIfNotExist();
-        getModel().setDataChanged(false);
-    }
-
-    /**
-     * 生成临时单据ID
-     */
-    private void genBillIdIfNotExist() {
-        long billId = getModel().getDataEntity().getLong(PositionBillConstant.ID_KEY);
-        if (billId == 0L) {
-            billId = ORM.create().genLongId(getView().getEntityId());
-            getModel().setValue(PositionBillConstant.ID_KEY, billId);
-        }
+        long startTime = System.currentTimeMillis();
+        PositionBillAfterBindDataService afterBindDataService = new PositionBillAfterBindDataService(getView());
+        afterBindDataService.afterBindData();
+        LOG.info(String.format(Locale.ROOT, "PositionBillFormPlugin afterBindData() time cost is: %s", System.currentTimeMillis() - startTime));
     }
 
     public void beforeBasedataSetValue(BeforeBasedataSetValueEvent beforeBasedataSetValueEvent) {
@@ -109,24 +99,20 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
             BasedataEdit basedataEdit = (BasedataEdit) source;
             IDataEntityProperty property = basedataEdit.getProperty();
             if (property instanceof PositionFieldProp && basedataEdit.isF7MultipleSelect()) {
-                DynamicObject billDy = getModel().getDataEntity();
-                String fieldKey = basedataEdit.getFieldKey();
                 String baseEntityId = ((BasedataProp) property).getBaseEntityId();
                 HRBaseServiceHelper helper = new HRBaseServiceHelper(baseEntityId);
                 DynamicObject[] baseDataDys = helper.loadDynamicObjectArray(rows.stream().map(ListSelectedRow::getPrimaryKeyValue).distinct().toArray());
-                //Set<Long> parentBoIds = Sets.newHashSetWithExpectedSize(baseDataDys.length);
                 Map<Object, DynamicObject> baseDataDyMap = Maps.newHashMapWithExpectedSize(baseDataDys.length);
 
-                for(DynamicObject orgDy : baseDataDys) {
-                    //parentBoIds.add(orgDy.getLong(String.join(".", PositionBillConstant.PARENT_KEY, PositionBillConstant.BOID_KEY)));
-                    baseDataDyMap.put(orgDy.getPkValue(), orgDy);
+                for(DynamicObject positionDy : baseDataDys) {
+                    baseDataDyMap.put(positionDy.getPkValue(), positionDy);
                 }
 
                 baseDataCacheMap.put(baseEntityId, baseDataDyMap);
             }
         }
 
-    }// 280
+    }
 
     @Override
     public void propertyChanged(PropertyChangedArgs e) {
@@ -165,7 +151,7 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
                 openEditAddPage(status, getModel(), getView());
                 break;
             case PositionBillConstant.EDIT_CHANGE_OP:
-                PositionBillServiceHelper.entryEntityMore(getModel(), getView(), PositionBillConstant.CHANGE_TAG, status);
+                PositionBillServiceHelper.entryEntityMore(getModel(), getView(), PositionBillConstant.CHANGE_TAG, status, getPluginName());
                 break;
             case PositionBillConstant.DELETE_ROWS_ADD_OP:
             case PositionBillConstant.DELETE_ROWS_CHANGE_OP:
@@ -205,10 +191,10 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
         boolean enableDeleteForUserPage = billstatus.equals(RegBillStatusEnum.TEMPSTORAGE.getCode()) || billstatus.equals(RegBillStatusEnum.WAITRESUBMIT.getCode());
         boolean enableDeleteForAuditPage = HRStringUtils.equals(getView().getFormShowParameter().getAppId(), PositionBillConstant.WFTASK_APP) && billstatus.equals(RegBillStatusEnum.ALREADYSUBMIT.getCode());
         if (!enableDeleteForUserPage && !enableDeleteForAuditPage) {
-            String auditStatusName = AdminOrgBatchChgHelper.getAuditstatusName(billstatus);
+            String auditStatusName = RegBillStatusEnum.getName(billstatus);
             getView().showErrorNotification(String.format("%s的单据不能删除调整明细。", auditStatusName));
         } else {
-            EntryGrid coopRelEntryGrid = getView().getControl(PositionBillConstant.NCKD_ENTRYENTITY_ADD_KEY);
+            EntryGrid coopRelEntryGrid = getView().getControl(String.join("_", PositionBillConstant.NCKD_ENTRYENTITY, callBackId.substring(callBackId.lastIndexOf("_")+1)));
             if (null == coopRelEntryGrid) {
                 getView().showTipNotification("请选中需要删除的行。");
             } else {
@@ -230,13 +216,15 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
         int row = strategyEntryGrid.getEntryState().getFocusRow();
         DynamicObject addDy = iDataModel.getDataEntity(true).getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY_ADD_KEY).get(row);
         Long adddyId = addDy.getLong(PositionBillConstant.ID_KEY);
-        Map map = HRDynamicObjectUtils.convertDynamicObjectToMap(addDy);
+        DynamicObject dataEntity = iDataModel.getDataEntity(true);
+        DynamicObject dynamicObject = dataEntity.getDynamicObjectCollection(PositionBillConstant.NCKD_ENTRYENTITY_ADD_KEY).get(row);
+        Map map = HRDynamicObjectUtils.convertDynamicObjectToMap(dynamicObject);
         BillShowParameter formShowParameter = new BillShowParameter();
         formShowParameter.setFormId(PositionBillConstant.NCKD_POSBILLENTRYADD_ENTITY);
-        formShowParameter.setCustomParam("position_bsed", iDataModel.getValue(PositionBillConstant.NCKD_EFFDT) == null ? HRDateTimeUtils.getNowDateTime().getTime() : ((Date) iDataModel.getValue(PositionBillConstant.NCKD_EFFDT)).getTime());
+        formShowParameter.setCustomParam(PositionBillConstant.CP_POSITION_BSED, iDataModel.getValue(PositionBillConstant.NCKD_EFFDT) == null ? HRDateTimeUtils.getNowDateTime().getTime() : ((Date) iDataModel.getValue(PositionBillConstant.NCKD_EFFDT)).getTime());
         formShowParameter.setPkId(adddyId);
         formShowParameter.setStatus(status);
-        formShowParameter.setCustomParam("billid", iDataModel.getDataEntity().getLong(PositionBillConstant.ID_KEY));
+        formShowParameter.setCustomParam(PositionBillConstant.CP_BILLID, iDataModel.getDataEntity().getLong(PositionBillConstant.ID_KEY));
         if (HRStringUtils.equals(iFormView.getFormShowParameter().getAppId(), PositionBillConstant.WFTASK_APP)) {
             formShowParameter.setHasRight(true);
         }
@@ -245,10 +233,10 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
             formShowParameter.setCloseCallBack(new CloseCallBack(getPluginName(), PositionBillConstant.ADD_TAG));
         }
 
-        formShowParameter.setCustomParam("selectObject", SerializationUtils.toJsonString(map));
+        formShowParameter.setCustomParam(PositionBillConstant.CP_SELECTOBJECT, SerializationUtils.toJsonString(map));
         formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
-        //formShowParameter.setCustomParam("OP_VALIDATOR_BILL_ORG_ALL_CHANGE_ORG_KEY", getThisBillAllValidateDataStr(dynamicObject));
-        //formShowParameter.setCustomParam("OP_VALIDATOR_BILL_ORG_NEW_ORG_NUMBERS_KEY", getThisBillOrgNumbersStr(dynamicObject));
+        formShowParameter.setCustomParam(PositionBillConstant.OP_VALIDATOR_BILL_POSITION_ALL_CHANGE_POSITION_KEY, PositionBillServiceHelper.getThisBillAllValidateDataStr(dataEntity));
+        formShowParameter.setCustomParam(PositionBillConstant.OP_VALIDATOR_BILL_POSITION_NEW_POSITION_NUMBERS_KEY, PositionBillServiceHelper.getThisBillPositionNumbersStr(dataEntity));
         iFormView.showForm(formShowParameter);
     }
 
@@ -257,7 +245,7 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
         super.registerListener(e);
 
         EntryGrid entryGrid = getControl(String.join("_", PositionBillConstant.NCKD_ENTRYENTITY, PositionBillConstant.CHANGE_TAG));
-        //entryGrid.addDataBindListener(this);
+        entryGrid.addDataBindListener(this);
 
         for(String registerBeforeF7Listener : getRegisterBeforeF7ListenerControlList()) {
             BasedataEdit basedataEdit = getControl(registerBeforeF7Listener);
@@ -270,7 +258,7 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
     }
 
     private List<String> getRegisterBeforeF7ListenerControlList() {
-        return Arrays.asList(PositionBillConstant.NCKD_DISORG_KEY, String.join("_", PositionBillConstant.NCKD_ORG, PositionBillConstant.CHANGE_TAG), String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.CHANGE_TAG), String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.CHANGE_TAG));
+        return Arrays.asList(PositionBillConstant.NCKD_DISORG_KEY, String.join("_", PositionBillConstant.ORG_KEY, PositionBillConstant.CHANGE_TAG), String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.CHANGE_TAG), String.join("_", PositionBillConstant.NCKD_PARENT, PositionBillConstant.CHANGE_TAG));
     }
 
     @Override
@@ -278,9 +266,9 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
         String fieldKey = beforeF7SelectEvent.getProperty().getName();
         setFuzzySearchAuthFilter(beforeF7SelectEvent);
         replaceFormIdByFieldKey(beforeF7SelectEvent);
-        if (PositionBillConstant.NCKD_DISORG_KEY.equals(fieldKey)) {// 780
+        if (PositionBillConstant.NCKD_DISORG_KEY.equals(fieldKey)) {
             beforeF7SelectEvent.getFormShowParameter().setCaption("签发组织");
-            beforeF7SelectEvent.getCustomQFilters().add(BaseDataHelper.getAdminOrgBaseDataFilter(PositionBillConstant.NCKD_POSITIONBILL_ENTITY, Collections.singletonList(((DynamicObject) getView().getModel().getValue(PositionBillConstant.ORG_KEY)).getLong(PositionBillConstant.ID_KEY))));
+            beforeF7SelectEvent.getCustomQFilters().add(new QFilter(PositionBillConstant.ORG_KEY, QCP.equals, ((DynamicObject) getView().getModel().getValue(PositionBillConstant.ORG_KEY)).getLong(PositionBillConstant.ID_KEY)));
         } else {
             int rowIndex = beforeF7SelectEvent.getRow();
             String suffix = getSuffixByFieldKey(fieldKey);
@@ -291,16 +279,15 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
             MainEntityType entityType = EntityMetadataCache.getDataEntityType(getView().getEntityId());
             IDataEntityProperty property = entityType.getAllFields().get(fieldKey);
             IDataEntityType parent = property.getParent();
-            Date effectDate = (Date) getModel().getValue(PositionBillConstant.NCKD_EFFDT);
-            if (checkOrgValue(beforeF7SelectEvent, property, parent)) {
+            if (!checkOrgValue(beforeF7SelectEvent, property, parent)) {
                 ListShowParameter showParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
                 if (fieldKey.equals(String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.CHANGE_TAG))) {
-                    showParameter.getCustomParams().put("searchdate", date);
-                    AdminOrgBatchChgHelper.filterF7Org(getView(), beforeF7SelectEvent, null);
+                    showParameter.getCustomParams().put(PositionBillConstant.CP_SEARCHDATE, date);
+                    PositionBillServiceHelper.filterF7Position(getView(), beforeF7SelectEvent, null);
                     setFilterByOrg(beforeF7SelectEvent);
                 } else if (fieldKey.equals(String.join("_", PositionBillConstant.NCKD_PARENT, PositionBillConstant.CHANGE_TAG))) {
                     // 岗位变更-上级岗位业务逻辑
-                } else if (fieldKey.equals(String.join("_", PositionBillConstant.NCKD_ORG, PositionBillConstant.CHANGE_TAG))) {
+                } else if (fieldKey.equals(String.join("_", PositionBillConstant.ORG_KEY, PositionBillConstant.CHANGE_TAG))) {
                     HasPermOrgResult permOrgResult = PermissionServiceHelper.getUserHasPermOrgs(RequestContext.get().getCurrUserId(), false);
                     if (!permOrgResult.hasAllOrgPerm()) {
                         List<Long> hasPermOrgs = permOrgResult.getHasPermOrgs();
@@ -322,15 +309,15 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
             DynamicObjectCollection dynamicObjectCollection = getModel().getDataEntity(true).getDynamicObjectCollection(parent.getName());
             DynamicObject dynamicObject = dynamicObjectCollection.get(beforeF7SelectEvent.getRow());
             String name = property.getName();
-            String suffix = name.substring(name.lastIndexOf("_") + 1);
-            String fieldKey = name.replace("_"+suffix, "");
-            if (PositionBillConstant.NCKD_ORG.equals(fieldKey)) {
+            String lineSuffix = name.substring(name.lastIndexOf("_"));
+            String fieldKey = PositionBillServiceHelper.getNoLineSuffixProp(name, lineSuffix);
+            if (PositionBillConstant.ORG_KEY.equals(fieldKey)) {
                 return false;
-            } else if (!dynamicObject.getDataEntityType().getProperties().containsKey(String.join("_", PositionBillConstant.NCKD_ORG, suffix))) {
+            } else if (!dynamicObject.getDataEntityType().getProperties().containsKey(String.join(PositionBillConstant.ORG_KEY +lineSuffix))) {
                 return false;
             } else {
-                Boolean baseDataCtrl = BaseDataServiceHelper.checkBaseDataCtrl(((BasedataProp)property).getBaseEntityId());
-                DynamicObject orgDy = dynamicObject.getDynamicObject(String.join("_", PositionBillConstant.NCKD_ORG, suffix));
+                Boolean baseDataCtrl = BaseDataServiceHelper.checkBaseDataCtrl(((BasedataProp) property).getBaseEntityId());
+                DynamicObject orgDy = dynamicObject.getDynamicObject(String.join(PositionBillConstant.ORG_KEY +lineSuffix));
                 if (orgDy == null && baseDataCtrl) {
                     getView().showTipNotification("请先选择组织体系管理组织。");
                     beforeF7SelectEvent.setCancel(true);
@@ -347,7 +334,7 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
         if (CollectionUtils.isEmpty(orgIdList)) {
             beforeF7SelectEvent.getCustomQFilters().add(new QFilter("1", QCP.not_equals, 1));
         } else {
-            beforeF7SelectEvent.getCustomQFilters().add(new QFilter(String.join(".", PositionBillConstant.ADMINORG, PositionBillConstant.ORG_KEY), QCP.in, orgIdList));
+            beforeF7SelectEvent.getCustomQFilters().add(new QFilter(PositionBillConstant.ORG_KEY, QCP.in, orgIdList));
         }
     }
 
@@ -361,15 +348,20 @@ public class PositionBillFormPlugin extends AbstractFormPlugin implements Before
             String fieldName = beforeF7SelectEvent.getProperty().getName();
             if (PositionBillConstant.NCKD_DISORG_KEY.equals(fieldName) || HRStringUtils.equals(String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.CHANGE_TAG), fieldName)) {
                 List<Long> hasPermOrgList = authorizedOrgResult.getHasPermOrgs();
-                beforeF7SelectEvent.getCustomQFilters().add(new QFilter(String.join(".", PositionBillConstant.ADMINORG, PositionBillConstant.BOID_KEY), "in", hasPermOrgList));
+                beforeF7SelectEvent.getCustomQFilters().add(new QFilter(String.join(".", PositionBillConstant.ADMINORG, PositionBillConstant.BOID_KEY), QCP.in, hasPermOrgList));
             }
         }
 
-    }// 1018
+    }
 
     private void replaceFormIdByFieldKey(BeforeF7SelectEvent beforeF7SelectEvent) {
         String fieldKey = beforeF7SelectEvent.getProperty().getName();
-        if (PositionBillConstant.NCKD_DISORG_KEY.equals(fieldKey) || HRStringUtils.equals(String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.CHANGE_TAG), fieldKey)) {
+        if (HRStringUtils.equals(fieldKey, String.join(PositionBillConstant.NCKD_DISORG_KEY))) {
+            ListShowParameter showParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
+            showParameter.setFormId(PositionBillConstant.HAOS_ORGBATCHTREELISTF7_ENTITY);
+        }
+
+        if (HRStringUtils.equals(fieldKey, String.join("_", PositionBillConstant.NCKD_POSITION, PositionBillConstant.CHANGE_TAG)) || HRStringUtils.equals(fieldKey, String.join("_", PositionBillConstant.NCKD_PARENT, PositionBillConstant.CHANGE_TAG))) {
             ListShowParameter showParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
             showParameter.setFormId(PositionBillConstant.NCKD_HBPM_POSORGTREELISTF_ENTITY);
         }

+ 1 - 1
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/operate/hr/PosBillEntryAddSaveOpPlugin.java

@@ -19,7 +19,7 @@ public class PosBillEntryAddSaveOpPlugin extends PositionBillEntrySaveOpPlugin {
         super.onAddValidators(e);
 
         OperateOption option = getOption();
-        String onlyValidate = option.getVariableValue(OperateOptionConst.ONLY_VALIDATE, Boolean.FALSE.toString());// 22
+        String onlyValidate = option.getVariableValue(OperateOptionConst.ONLY_VALIDATE, Boolean.FALSE.toString());
         if (Boolean.TRUE.toString().equals(onlyValidate)) {
             e.addValidator(new PositionAddSaveValidator());
         }

+ 1 - 1
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/operate/hr/validator/PositionBillEntryNameValidator.java

@@ -24,7 +24,7 @@ public class PositionBillEntryNameValidator extends AbstractValidator {
     public void validate() {
         OperateOption option = validateContext.getOption();
         // 获取组织下的岗位同胞数据 {orgBoid:{positionId:positionName}}
-        String billPositionNameMapStr = option.getVariableValue("OP_BILL_SIBLING_NAMES_MAP", "");
+        String billPositionNameMapStr = option.getVariableValue(PositionBillConstant.OP_BILL_SIBLING_NAMES_MAP, "");
         if (HRStringUtils.isNotEmpty(billPositionNameMapStr)) {
             JSONObject orgBoIdToSiblingNameMap = JSONObject.parseObject(billPositionNameMapStr);
             Set<String> errorIds = Sets.newHashSetWithExpectedSize(getDataEntities().length);

+ 1 - 1
code/hrmp/nckd-jxccl-hrmp/src/main/java/nckd/jxccl/hrmp/hbpm/plugin/operate/hr/validator/PositionBillEntryNumberValidator.java

@@ -18,7 +18,7 @@ public class PositionBillEntryNumberValidator extends AbstractValidator {
     public void validate() {
         OperateOption option = validateContext.getOption();
         // 获取岗位编码数据 {positionId:number}
-        String billPositionNumberMapStr = option.getVariableValue("OP_BILL_NUMBER_MAP", "");
+        String billPositionNumberMapStr = option.getVariableValue(PositionBillConstant.OP_BILL_NUMBER_MAP, "");
         if (HRStringUtils.isNotEmpty(billPositionNumberMapStr)) {
             JSONObject numberMap = JSONObject.parseObject(billPositionNumberMapStr);