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