Bläddra i källkod

feat(opmc): 调整促销周期生成逻辑以支持动态月份参数

- 修改 PromotionCycleGeneratorTask 中月份参数判断逻辑,防止小于1的情况
- 根据实际传入的 month 参数计算起始日期,而非固定前两个月
- 新增企业负责人中长期激励核定表单插件 EntldrMidlongApprFormPlugin
- 表单插件支持根据支付单位、法人实体和任期自动加载相关员工数据
- 数据加载时增加成功提示和无数据情况下的提醒通知
wyc 2 dagar sedan
förälder
incheckning
f43287c44b

+ 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);

+ 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);
+
+        }
+    }
+
+}