浏览代码

Merge branch 'refs/heads/feat-swc-mas_1.0'

wyc 2 天之前
父节点
当前提交
8765a59564

+ 5 - 2
code/base/nckd-jxccl-base-common/build.gradle

@@ -37,7 +37,10 @@ dependencies {
 	//编译阶段不需要依赖的jar包,则统一配置为运行时依赖
 	//runtimeOnly fileTree(biz) { include '*.jar' exclude '*sdk*.jar' }
 
-	api fileTree(dir: cus, include: '*.jar')
-	
+    api fileTree(cus) {
+        include '*.jar'
+        exclude 'nckd-jxccl-hr*.jar','nckd-jxccl-opmc*.jar','nckd-jxccl-base*.jar','nckd-jxccl-rpt*.jar','nckd-jxccl-swc*.jar','nckd-jxccl-wtc*.jar'
+    }
+
 	api fileTree(dir: lib, include: '*.jar')
 }

+ 17 - 0
code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/utils/ConvertUtil.java

@@ -1,6 +1,7 @@
 package nckd.jxccl.base.common.utils;
 
 import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
 
 import java.lang.reflect.Array;
 import java.math.BigDecimal;
@@ -709,6 +710,22 @@ public class ConvertUtil {
         }
         return null;
     }
+    /**
+     * 将对象转换为DynamicObject类型,为空时返回null
+     * @param value 要转换的对象
+     * @return 转换后的DynamicObject值,输入为null时返回null
+     * @author W.Y.C
+     * @date: 2025/08/04 12:05
+     */
+    public static DynamicObjectCollection toDynamicObjectCollectionOrNull(Object value) {
+        if (value == null) {
+            return null;
+        }
+        if (value instanceof DynamicObjectCollection) {
+            return (DynamicObjectCollection) value;
+        }
+        return null;
+    }
 
     /**
      * 将对象转换为DynamicObject类型

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

@@ -627,7 +627,7 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
                             Long dbPersonId = obj.getDynamicObject(FormConstant.NCKD_PERSON).getLong(FormConstant.ID_KEY);
                             Long dbId = obj.getLong(FormConstant.ID_KEY);
                             String theStatus = obj.getString(PerfManagerFormConstant.NCKD_THESTATUS);
-                            return dbBeginYear != null && dbBeginYear.compareTo(DateUtil.toDate(beginYear)) <= 0 && dbPersonId.equals(personId) && !dbId.equals(id) && theStatus.equalsIgnoreCase(EnableEnum.YES.getCode());
+                            return dbBeginYear != null && dbBeginYear.compareTo(DateUtil.toDate(beginYear)) <= 0 && dbPersonId.equals(personId) && !dbId.equals(id) && (theStatus.equalsIgnoreCase(EnableEnum.YES.getCode()));
                         })
                         .collect(Collectors.toList());
                 if (!beforeBeginYear.isEmpty()) {
@@ -683,6 +683,18 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
             SaveServiceHelper.update(lastPerfManagerArray);
         }
         if(!updateDataEntity.isEmpty()) {
+            //如果跟上面更新的是同一条,则需要将上面更新的字段赋给当前数据实体。不然上面更新的字段将丢失
+            for (DynamicObject dynamicObject : updateDataEntity) {
+                long id = dynamicObject.getLong(FormConstant.ID_KEY);
+                for (DynamicObject object : updatePerManager) {
+                    long id1 = object.getLong(FormConstant.ID_KEY);
+                    if(id == id1){
+                        dynamicObject.set(PerfManagerFormConstant.NCKD_THESTATUS, object.get(PerfManagerFormConstant.NCKD_THESTATUS));
+                        dynamicObject.set(PerfManagerFormConstant.NCKD_ACTENDYEAR, object.get(PerfManagerFormConstant.NCKD_ACTENDYEAR));
+                        dynamicObject.set(PerfManagerFormConstant.NCKD_WHYEND, object.get(PerfManagerFormConstant.NCKD_WHYEND));
+                    }
+                }
+            }
             SaveServiceHelper.update(updateDataEntity.toArray(new DynamicObject[0]));
         }
         //上一周期标记为“已结束”并设置“实际结束时间” end

+ 2 - 1
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/plugin/operate/salary/PushAdjustOpPlugin.java

@@ -115,7 +115,7 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                 //国家
                 applyBill.put("billcountry", 1000001L);
                 //定调薪类型
-                applyBill.put("salaryadjrsn", 2352340656979984384L);
+                applyBill.put("salaryadjrsn", 2352337648716103680L);
                 //默认币种
                 applyBill.put("billcurrency", 1L);
                 //定调薪方案
@@ -132,6 +132,7 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                 applyBill.put("auditstatus", "A");
                 //申请单数据来源   //1:手工新增  2:接口写入
                 applyBill.put("datasource", "2");
+                applyBill.put("description", pushAdjust.getString(SalAdjTrackerConstant.NCKD_WAGEEXPLAIN));
                 List<Map<String, Object>> applyBillEntryData = new ArrayList<>();
                 Map<String, Object> applyBillEntry = new HashMap<>();
                 Long employeeId = pushAdjust.getDynamicObject(SalAdjTrackerConstant.NCKD_PERFMANAGER).getDynamicObject(FormConstant.NCKD_PERSON).getLong(FormConstant.ID_KEY);

+ 2 - 2
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/task/PromotionCycleGeneratorTask.java

@@ -85,7 +85,7 @@ public class PromotionCycleGeneratorTask extends AbstractTask implements Plugin
                     .add("b_effectivedate");
 
             Integer month = ConvertUtil.toInt(map.get("month"));
-            if (month == null) {
+            if (month == null || month < 1) {
                 month = 2; // 默认值
                 logger.warn("未设置month参数,默认使用2个月前的数据");
             }
@@ -94,7 +94,7 @@ public class PromotionCycleGeneratorTask extends AbstractTask implements Plugin
 
 
             // 计算前两个月的开始和结束日期(不包括本月)
-            LocalDateTime startDate = DateUtil.minusMonths(now, 2);
+            LocalDateTime startDate = DateUtil.minusMonths(now, month);
             startDate = DateUtil.beginOfMonth(startDate); // 设置为月份第一天
 
             LocalDateTime endDate = DateUtil.minusMonths(now, 1);

+ 4 - 2
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/common/MasConstant.java

@@ -16,6 +16,8 @@ public class MasConstant extends FormConstant {
     public static final String NCKD_YEAR = "nckd_year";
     /** 所属二级单位 */
     public static final String NCKD_PAYUNIT = "nckd_payunit";
+    /** 所属二级单位 */
+    public static final String NCKD_MULPAYUNIT = "nckd_mulpayunit";
     /** 法人单位 */
     public static final String NCKD_LAWENTITY = "nckd_lawentity";
     /** 员工 */
@@ -145,8 +147,7 @@ public class MasConstant extends FormConstant {
     public static final String NCKD_PAYAMOUNT9 = "nckd_payamount9";
     /** 支付年份10 */
     public static final String NCKD_PAYYEAR10 = "nckd_payyear10";
-    /** 支付金额10 */
-    public static final String NCKD_PAYAMOUNT10 = "nckd_payamount10";
+    /** 支付金额10 */    public static final String NCKD_PAYAMOUNT10 = "nckd_payamount10";
     /** 子企业负责人薪酬结构(分录) */
     public static final String NCKD_SUBCORPSALARYENTRY = "nckd_subcorpsalaryentry";
     /*-------------------------------------- 子企业负责人薪酬结构常量类 begin --------------------------------------*/
@@ -155,6 +156,7 @@ public class MasConstant extends FormConstant {
     /*-------------------------------------- 载入党政职务履历弹窗 begin --------------------------------------*/
     /** 载入党政职务履历弹窗-实体标识 */
     public static final String LOADPARTYPOSTPOPUP_ENTITYID = "nckd_loadpartypostpopup";
+    public static final String LOADPPDATEPOPUP_ENTITYID = "nckd_loadppdatepopup";
     /*-------------------------------------- 载入党政职务履历弹窗 end --------------------------------------*/
 
 

+ 35 - 0
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/empmgt/LoadppDatePopupFormPlugin.java

@@ -0,0 +1,35 @@
+package nckd.jxccl.swc.mas.plugin.form.empmgt;
+
+import kd.bos.form.events.AfterDoOperationEventArgs;
+import kd.bos.form.plugin.AbstractFormPlugin;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.swc.mas.common.MasConstant;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+* 载入党政职务履历弹窗
+* 实体标识:nckd_loadppdatepopup
+* @author W.Y.C
+* @date 2025/11/30 20:18
+* @version 1.0
+*/
+public class LoadppDatePopupFormPlugin extends AbstractFormPlugin implements Plugin {
+
+    @Override
+    public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
+        String operateKey = afterDoOperationEventArgs.getOperateKey();
+        boolean success = afterDoOperationEventArgs.getOperationResult() != null && afterDoOperationEventArgs.getOperationResult().isSuccess();
+        if (success && FormConstant.AFFIRM_OP.equalsIgnoreCase(operateKey)) {
+            Object value = this.getModel().getValue("nckd_date");
+            Object payUnit = this.getModel().getValue(MasConstant.NCKD_MULPAYUNIT);
+            Map<String,Object> map = new HashMap(2);
+            map.put("date",value);
+            map.put(MasConstant.NCKD_MULPAYUNIT,payUnit);
+            this.getView().returnDataToParent(map);
+            this.getView().close();
+        }
+    }
+}

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

@@ -10,10 +10,14 @@ import kd.bos.entity.EntityMetadataCache;
 import kd.bos.entity.MainEntityType;
 import kd.bos.entity.constant.StatusEnum;
 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.IPageCache;
 import kd.bos.form.MessageBoxOptions;
+import kd.bos.form.ShowType;
 import kd.bos.form.events.AfterDoOperationEventArgs;
+import kd.bos.form.events.ClosedCallBackEvent;
 import kd.bos.list.plugin.AbstractListPlugin;
 import kd.bos.mvc.SessionManager;
 import kd.bos.orm.query.QCP;
@@ -25,6 +29,7 @@ import kd.hr.hbp.common.model.AuthorizedOrgResultWithSub;
 import kd.sdk.hr.hbp.business.helper.permission.HRPermissionServiceHelper;
 import kd.sdk.plugin.Plugin;
 import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.utils.ConvertUtil;
 import nckd.jxccl.base.common.utils.DateUtil;
 import nckd.jxccl.base.common.utils.QueryFieldBuilder;
 import nckd.jxccl.base.common.utils.ShowOperExecuteResult;
@@ -55,7 +60,7 @@ import java.util.stream.Collectors;
 */
 public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Plugin {
 
-    @Override
+   /* @Override
     public void afterDoOperation(AfterDoOperationEventArgs e) {
         String operateKey = e.getOperateKey();
         if(e.getOperationResult() != null && e.getOperationResult().isSuccess()){
@@ -64,6 +69,38 @@ public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Pl
                 loadParTyPosition();
             }
         }
+    }*/
+
+
+    @Override
+    public void afterDoOperation(AfterDoOperationEventArgs e) {
+        String operateKey = e.getOperateKey();
+        if(e.getOperationResult() != null && e.getOperationResult().isSuccess()){
+            if(MasConstant.LOADPARTYPOSITION_OP.equals(operateKey)){
+                //载入党政职务履历
+                FormShowParameter showParameter = new FormShowParameter();
+                showParameter.setFormId(MasConstant.LOADPPDATEPOPUP_ENTITYID);
+                showParameter.getOpenStyle().setShowType(ShowType.Modal);
+                showParameter.setCaption("载入党政职务履历");
+                showParameter.setSendToClient(true);
+                showParameter.setCloseCallBack(new CloseCallBack(this, MasConstant.LOADPPDATEPOPUP_ENTITYID));
+                this.getView().showForm(showParameter);
+            }
+        }
+    }
+
+    @Override
+    public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
+        String actionId = closedCallBackEvent.getActionId();
+        if(MasConstant.LOADPPDATEPOPUP_ENTITYID.equalsIgnoreCase(actionId)){
+            Object returnData = closedCallBackEvent.getReturnData();
+            if(returnData != null) {
+                Map<String, Object> map = ConvertUtil.toMap(returnData);
+                Date date = ConvertUtil.toDate(map.get("date"));
+                DynamicObjectCollection mulPayUnit = ConvertUtil.toDynamicObjectCollectionOrNull(map.get(MasConstant.NCKD_MULPAYUNIT));
+                loadParTyPosition(date,mulPayUnit);
+            }
+        }
     }
     
     /**
@@ -72,7 +109,7 @@ public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Pl
      * @author W.Y.C
      * @date: 2025/11/27 18:40
      */
-    private void loadParTyPosition(){
+    private void loadParTyPosition(Date date,DynamicObjectCollection payUnitColl){
         /*假设今年是2025年,那么符合查询条件的数据应该满足:
         开始日期 <= 2025-12-31 且 结束日期 >= 2025-01-01
        符合条件的例子:
@@ -88,7 +125,15 @@ public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Pl
             开始日期: 2020-01-01, 结束日期: 2030-12-31
             长期有效,覆盖今年全年
          */
-        LocalDateTime now = DateUtil.now();
+        List<Long> payUnitIdList = new ArrayList<>();
+        if(payUnitColl != null && !payUnitColl.isEmpty()){
+            for (DynamicObject item : payUnitColl) {
+                // 获取基础资料的动态对象(包含基础资料的详细信息,如名称、编码等)
+                long id = item.getLong(FormConstant.FBASEDATAID_ID_KEY);
+                payUnitIdList.add(id);
+            }
+        }
+        LocalDateTime now = ConvertUtil.toLocalDateTime(date);
 
         LocalDateTime beginYear = DateUtil.beginOfYear(now);
         LocalDateTime endYear = DateUtil.endOfYear(now);
@@ -129,10 +174,11 @@ public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Pl
                 .add(MasConstant.NCKD_ISDIRCADRE)
                 .addIdNumberName(MasConstant.NCKD_ORGPOSGRD)
                 .addIdNumberName(MasConstant.EMPLOYEE_KEY)
-                .addIdNumberName(MasConstant.NCKD_ORG)
                 .orderDesc(MasConstant.STARTDATE, MasConstant.ENDDATE);
         QFilter allPartyPoshFilter = new QFilter(MasConstant.EMPLOYEE_KEY, QCP.not_in, employeeIds);
-                //TODO 法人岗位层级为高管;
+        if(!payUnitIdList.isEmpty()){
+            allPartyPoshFilter.and(String.join(MasConstant.NCKD_PAYUNIT,FormConstant.ID_KEY), QCP.in, payUnitIdList);
+        }
         DynamicObjectCollection allPartyPoshQuery = QueryServiceHelper.query(FormConstant.NCKD_HRPI_PARTYPOSH, partyPoshFieldBuilder.buildSelect(), new QFilter[]{allPartyPoshFilter});
         //按员工ID分组
         Map<Long, List<DynamicObject>> groupedPartyPoshQuery = allPartyPoshQuery.stream()
@@ -302,7 +348,7 @@ public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Pl
                     employee.set(FormConstant.NAME_KEY, partyPosh.getString(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.NAME_KEY)));
                 }
                 //所属二级单位(发薪单位)
-                long payOrgId = partyPosh.getLong(String.join(".", FormConstant.NCKD_ORG, FormConstant.ID_KEY));
+                long payOrgId = partyPosh.getLong(String.join(".", MasConstant.NCKD_PAYUNIT, FormConstant.ID_KEY));
                 DynamicObject payOrg = EntityHelper.newEntity(FormConstant.ADMINORGHR_ENTITYID, payOrgId);
                 newSubCoHeadService.set(MasConstant.NCKD_PAYUNIT, payOrg);
                 //职务

+ 91 - 0
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/mas/plugin/form/incentivemgmt/EntldrMidlongApprFormPlugin.java

@@ -0,0 +1,91 @@
+package nckd.jxccl.swc.mas.plugin.form.incentivemgmt;
+
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.entity.constant.StatusEnum;
+import kd.bos.entity.datamodel.RowDataEntity;
+import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
+import kd.bos.entity.datamodel.events.ChangeData;
+import kd.bos.entity.datamodel.events.PropertyChangedArgs;
+import kd.bos.form.plugin.AbstractFormPlugin;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.BusinessDataServiceHelper;
+import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.utils.ConvertUtil;
+import nckd.jxccl.base.common.utils.QueryFieldBuilder;
+import nckd.jxccl.swc.mas.common.MasConstant;
+
+import java.util.EventObject;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+* 企业负责人中长期激励核定表
+* 实体标识:nckd_entldrmidlongappr
+* @author W.Y.C
+* @date 2025/12/1 9:30
+* @version 1.0
+*/
+public class EntldrMidlongApprFormPlugin extends AbstractFormPlugin implements Plugin {
+
+
+    @Override
+    public void propertyChanged(PropertyChangedArgs e) {
+        String fieldKey = e.getProperty().getName();
+        ChangeData[] changeSet = e.getChangeSet();
+        int rowIndex = changeSet[0].getRowIndex();
+        Object oldValue = changeSet[0].getOldValue();
+        Object newValue = changeSet[0].getNewValue();
+        if(Stream.of(MasConstant.NCKD_PAYUNIT, MasConstant.NCKD_LAWENTITY, MasConstant.NCKD_TERM)
+                .anyMatch(op -> op.equalsIgnoreCase(fieldKey))){
+            if(!Objects.equals(oldValue, newValue)){
+                DynamicObjectCollection entryEntities = getModel().getEntryEntity(FormConstant.NCKD_ENTRYENTITY);
+                load();
+            }
+        }
+    }
+
+    private void load(){
+        DynamicObject payUnit = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_PAYUNIT));
+        DynamicObject lawEntity =  ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_LAWENTITY));
+        DynamicObject term =  ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_TERM));
+        if(payUnit != null && lawEntity != null && term != null){
+            QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
+                    .addIdNumberName(MasConstant.NCKD_PAYUNIT)
+                    .addIdNumberName(MasConstant.NCKD_LAWENTITY)
+                    .addIdNumberName(MasConstant.NCKD_TERM)
+                    .addIdNumberName(MasConstant.NCKD_EMPLOYEE)
+                    .add(FormConstant.NCKD_STARTDATE)
+                    .add(FormConstant.NCKD_ENDDATE)
+                    .add(MasConstant.NCKD_POSNAME)
+                    .add(MasConstant.NCKD_SERVICEMONTHS);
+
+            QFilter qFilter = new QFilter(MasConstant.NCKD_PAYUNIT, QCP.equals, payUnit.getLong(FormConstant.ID_KEY))
+                    .and(MasConstant.NCKD_LAWENTITY, QCP.equals, lawEntity.getLong(FormConstant.ID_KEY))
+                    .and(MasConstant.NCKD_TERM, QCP.equals, term.getLong(FormConstant.ID_KEY))
+                    .and(FormConstant.STATUS, QCP.in, new String[]{StatusEnum.C.toString(), StatusEnum.B.toString()});
+            DynamicObject[] dbSubCorpSalaryArray = BusinessDataServiceHelper.load(MasConstant.TENUREPERSONLIST_ENTITYID, queryFieldBuilder.buildSelect(), new QFilter[]{qFilter});
+            DynamicObjectCollection entryEntities = getModel().getEntryEntity(FormConstant.NCKD_ENTRYENTITY);
+            entryEntities.clear();
+            if(dbSubCorpSalaryArray != null && dbSubCorpSalaryArray.length > 0) {
+                for (DynamicObject dbSubCorpSalary : dbSubCorpSalaryArray) {
+                    DynamicObject entry = entryEntities.addNew();
+                    entry.set(MasConstant.NCKD_EMPLOYEE, dbSubCorpSalary.get(MasConstant.NCKD_EMPLOYEE));
+                    entry.set(MasConstant.NCKD_POSNAME, dbSubCorpSalary.get(MasConstant.NCKD_POSNAME));
+                    entry.set(MasConstant.NCKD_STARTDATE, dbSubCorpSalary.get(MasConstant.NCKD_STARTDATE));
+                    entry.set(MasConstant.NCKD_ENDDATE, dbSubCorpSalary.get(MasConstant.NCKD_ENDDATE));
+                    entry.set(MasConstant.NCKD_SERVICEMONTHS, dbSubCorpSalary.get(MasConstant.NCKD_SERVICEMONTHS));
+                }
+                this.getView().showSuccessNotification("数据加载成功!");
+            }else{
+                this.getView().showTipNotification("未加载到数据,根据【所属二级单位】、【法人组织】及【任期区间】未加载到对应“子企业负责人薪酬结构”数据!");
+            }
+            getModel().updateEntryCache(entryEntities);
+            getView().updateView(FormConstant.NCKD_ENTRYENTITY);
+
+        }
+    }
+
+}