|
@@ -1,61 +1,29 @@
|
|
|
package nckd.jxccl.swc.mas.plugin.form.structappr;
|
|
package nckd.jxccl.swc.mas.plugin.form.structappr;
|
|
|
|
|
|
|
|
-import kd.bos.bill.BillShowParameter;
|
|
|
|
|
-import kd.bos.dataentity.OperateOption;
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
-import kd.bos.dataentity.metadata.IDataEntityProperty;
|
|
|
|
|
-import kd.bos.dataentity.metadata.clr.DataEntityPropertyCollection;
|
|
|
|
|
import kd.bos.entity.constant.StatusEnum;
|
|
import kd.bos.entity.constant.StatusEnum;
|
|
|
import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
|
|
import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
|
|
|
-import kd.bos.entity.datamodel.events.ChangeData;
|
|
|
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
-import kd.bos.entity.operate.result.OperationResult;
|
|
|
|
|
-import kd.bos.entity.validate.BillStatus;
|
|
|
|
|
-import kd.bos.form.ConfirmCallBackListener;
|
|
|
|
|
-import kd.bos.form.ConfirmTypes;
|
|
|
|
|
-import kd.bos.form.IFormView;
|
|
|
|
|
-import kd.bos.form.IPageCache;
|
|
|
|
|
-import kd.bos.form.MessageBoxOptions;
|
|
|
|
|
-import kd.bos.form.MessageBoxResult;
|
|
|
|
|
-import kd.bos.form.ShowType;
|
|
|
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
-import kd.bos.form.events.MessageBoxClosedEvent;
|
|
|
|
|
-import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
|
|
-import kd.bos.mvc.SessionManager;
|
|
|
|
|
import kd.bos.orm.query.QCP;
|
|
import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.orm.query.QFilter;
|
|
|
-import kd.bos.servicehelper.AttachmentServiceHelper;
|
|
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
-import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
|
|
-import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
|
|
-import kd.drp.mem.er.BillStatusEnum;
|
|
|
|
|
-import kd.hr.hbp.common.util.HRDynamicObjectUtils;
|
|
|
|
|
import kd.sdk.plugin.Plugin;
|
|
import kd.sdk.plugin.Plugin;
|
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
|
import nckd.jxccl.base.common.enums.mas.ProjectCategoryEnum;
|
|
import nckd.jxccl.base.common.enums.mas.ProjectCategoryEnum;
|
|
|
-import nckd.jxccl.base.common.exception.ValidationException;
|
|
|
|
|
import nckd.jxccl.base.common.utils.ConvertUtil;
|
|
import nckd.jxccl.base.common.utils.ConvertUtil;
|
|
|
import nckd.jxccl.base.common.utils.DateUtil;
|
|
import nckd.jxccl.base.common.utils.DateUtil;
|
|
|
import nckd.jxccl.base.common.utils.QueryFieldBuilder;
|
|
import nckd.jxccl.base.common.utils.QueryFieldBuilder;
|
|
|
-import nckd.jxccl.base.common.utils.ShowOperExecuteResult;
|
|
|
|
|
-import nckd.jxccl.base.common.utils.StrFormatter;
|
|
|
|
|
-import nckd.jxccl.base.entity.helper.EntityHelper;
|
|
|
|
|
import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
|
|
import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
|
|
|
import nckd.jxccl.swc.mas.common.MasConstant;
|
|
import nckd.jxccl.swc.mas.common.MasConstant;
|
|
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
|
-import java.math.RoundingMode;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
-import java.util.EventObject;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 企业负责人个人年度薪酬标准核定表-表单插件
|
|
* 企业负责人个人年度薪酬标准核定表-表单插件
|
|
@@ -64,10 +32,10 @@ import java.util.stream.Stream;
|
|
|
* @date 2025/11/30 14:54
|
|
* @date 2025/11/30 14:54
|
|
|
* @version 1.0
|
|
* @version 1.0
|
|
|
*/
|
|
*/
|
|
|
-public class EntleaderAnlSalStdFormPlugin extends AbstractFormPlugin implements Plugin {
|
|
|
|
|
|
|
+public class EntleaderAnlSalStdFormPlugin extends AbstractStructApprFormPlugin implements Plugin {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void afterBindData(EventObject e) {
|
|
|
|
|
|
|
+ public void afterBindData(java.util.EventObject e) {
|
|
|
DynamicObjectCollection entryCollection = this.getModel().getEntryEntity(FormConstant.NCKD_ENTRYENTITY);
|
|
DynamicObjectCollection entryCollection = this.getModel().getEntryEntity(FormConstant.NCKD_ENTRYENTITY);
|
|
|
for (int rowIndex = 0; rowIndex < entryCollection.size(); rowIndex++) {
|
|
for (int rowIndex = 0; rowIndex < entryCollection.size(); rowIndex++) {
|
|
|
DynamicObject entry = entryCollection.get(rowIndex);
|
|
DynamicObject entry = entryCollection.get(rowIndex);
|
|
@@ -78,126 +46,21 @@ public class EntleaderAnlSalStdFormPlugin extends AbstractFormPlugin implements
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void afterAddRow(AfterAddRowEventArgs e) {
|
|
public void afterAddRow(AfterAddRowEventArgs e) {
|
|
|
- initOperateOption(0,e.getInsertRow());
|
|
|
|
|
|
|
+ super.afterAddRow(e);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void propertyChanged(PropertyChangedArgs e) {
|
|
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(MasConstant.NCKD_INSTALLMENTYEARS.equalsIgnoreCase(fieldKey)){
|
|
|
|
|
- if(!Objects.equals(oldValue, newValue)){
|
|
|
|
|
- initOperateOption(ConvertUtil.toInt(newValue),rowIndex);
|
|
|
|
|
- }
|
|
|
|
|
- }else if(Stream.of(MasConstant.NCKD_PAYUNIT, MasConstant.NCKD_LAWENTITY, MasConstant.NCKD_YEAR)
|
|
|
|
|
- .anyMatch(op -> op.equalsIgnoreCase(fieldKey))){
|
|
|
|
|
- if(!Objects.equals(oldValue, newValue)){
|
|
|
|
|
- DynamicObjectCollection entryEntities = getModel().getEntryEntity(FormConstant.NCKD_ENTRYENTITY);
|
|
|
|
|
- load();
|
|
|
|
|
- }
|
|
|
|
|
- }else if(MasConstant.NCKD_APPRSTD.equalsIgnoreCase(fieldKey)){
|
|
|
|
|
- DynamicObject payUnit = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_PAYUNIT));
|
|
|
|
|
- DynamicObject lawEntity = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_LAWENTITY));
|
|
|
|
|
- DynamicObject projectCategory = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_PROJECTCATEGORY));
|
|
|
|
|
- Date year = ConvertUtil.toDate(this.getModel().getValue(MasConstant.NCKD_YEAR));
|
|
|
|
|
- //判断“核定标准”是否大于0
|
|
|
|
|
- BigDecimal apprStd = ConvertUtil.toBigDecimal(newValue);
|
|
|
|
|
- if(apprStd != null && apprStd.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
- if (payUnit != null && lawEntity != null && year != null && projectCategory != null) {
|
|
|
|
|
- if (!Objects.equals(oldValue, newValue)) {
|
|
|
|
|
- //计算:延期支付总金额、支付年份1、支付年份1....
|
|
|
|
|
- //====================================== 获取延期支付比例 begin ======================================
|
|
|
|
|
- LocalDateTime localDateTime = DateUtil.toLocalDateTime(year);
|
|
|
|
|
- LocalDateTime beginOfYear = DateUtil.beginOfYear(localDateTime);
|
|
|
|
|
- LocalDateTime endOfYear = DateUtil.endOfYear(localDateTime);
|
|
|
|
|
-
|
|
|
|
|
- QueryFieldBuilder deferPayRatoConfQueryFieldBuilder = QueryFieldBuilder.create()
|
|
|
|
|
- .add(MasConstant.NCKD_PROJECTCATEGORY)
|
|
|
|
|
- .addIdNumberName(MasConstant.NCKD_PAYUNIT)
|
|
|
|
|
- .addIdNumberName(MasConstant.NCKD_DEFERPAYMONEY)
|
|
|
|
|
- .add(MasConstant.NCKD_DEFERPAYRATIO)
|
|
|
|
|
- .add(MasConstant.NCKD_DEFERPAYRATIO)
|
|
|
|
|
- .add(MasConstant.NCKD_PAYOUTTIMES)
|
|
|
|
|
- .add(MasConstant.NCKD_YEAR)
|
|
|
|
|
- .add(FormConstant.NCKD_ENTRYENTITY)
|
|
|
|
|
- .add(FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_TIMES)
|
|
|
|
|
- .add(FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_PAYOUTRATIO)
|
|
|
|
|
- .add(FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_PAYOUTMONEY)
|
|
|
|
|
- .add(FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_DEFERREDPAYITEM)
|
|
|
|
|
- .add(FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_DEFERREDPAYDESC)
|
|
|
|
|
- .add(FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_TERMPAYDESC)
|
|
|
|
|
- .orderDesc(MasConstant.CREATE_TIME_KEY)
|
|
|
|
|
- .orderAsc(String.join(".",FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_TIMES));
|
|
|
|
|
- QFilter deferPayRatoConfFilter = 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_YEAR, QCP.large_equals, DateUtil.toDate(beginOfYear))
|
|
|
|
|
- .and(MasConstant.NCKD_YEAR, QCP.less_equals, DateUtil.toDate(endOfYear))
|
|
|
|
|
- .and(QFilterCommonHelper.getEnableFilter());
|
|
|
|
|
- DynamicObject[] dbDeferPayRatoConfArray = BusinessDataServiceHelper.load(MasConstant.DEFERPAYRATOCONF_ENTITYID, deferPayRatoConfQueryFieldBuilder.buildSelect(), new QFilter[]{deferPayRatoConfFilter});
|
|
|
|
|
- Map<String, List<DynamicObject>> dbDeferPayRatoConfMap = Arrays.stream(dbDeferPayRatoConfArray)
|
|
|
|
|
- .collect(Collectors.groupingBy(obj -> {
|
|
|
|
|
- DynamicObject dbProjectCategory = obj.getDynamicObject(MasConstant.NCKD_PROJECTCATEGORY);
|
|
|
|
|
- if (dbProjectCategory != null) {
|
|
|
|
|
- return dbProjectCategory.getString(FormConstant.NUMBER_KEY);
|
|
|
|
|
- }
|
|
|
|
|
- return ""; // 处理无项目分类的情况
|
|
|
|
|
- }));
|
|
|
|
|
- List<DynamicObject> dbDeferPayRatoConfList = dbDeferPayRatoConfMap.get(projectCategory.getString(FormConstant.NUMBER_KEY));
|
|
|
|
|
-
|
|
|
|
|
- if (dbDeferPayRatoConfList != null && !dbDeferPayRatoConfList.isEmpty()) {
|
|
|
|
|
- DynamicObject deferPayRatoConf = dbDeferPayRatoConfList.get(0);
|
|
|
|
|
- //延期支付比例(%)
|
|
|
|
|
- BigDecimal deferPayRatio = deferPayRatoConf.getBigDecimal(MasConstant.NCKD_DEFERPAYRATIO);
|
|
|
|
|
- //延期支付金额
|
|
|
|
|
- BigDecimal deferPayMoney = deferPayRatoConf.getBigDecimal(MasConstant.NCKD_DEFERPAYMONEY);
|
|
|
|
|
- LocalDateTime beginYear = DateUtil.toLocalDateTime(deferPayRatoConf.getDate(MasConstant.NCKD_YEAR));
|
|
|
|
|
- BigDecimal deferPayTotalAmt;
|
|
|
|
|
- if(deferPayMoney != null && deferPayMoney.compareTo(BigDecimal.ZERO) > 0){
|
|
|
|
|
- //优先使用【延期支付金额】
|
|
|
|
|
- deferPayTotalAmt = deferPayMoney;
|
|
|
|
|
- }else {
|
|
|
|
|
- //核算标准*延期支付比例/100
|
|
|
|
|
- deferPayTotalAmt = apprStd.multiply(deferPayRatio.divide(new BigDecimal(100), 2, RoundingMode.DOWN));
|
|
|
|
|
- }
|
|
|
|
|
- this.getModel().setValue(MasConstant.NCKD_DEFERPAYTOTALAMT, deferPayTotalAmt,rowIndex);
|
|
|
|
|
- DynamicObjectCollection entryColl = deferPayRatoConf.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
|
|
|
|
|
- int i = 0;
|
|
|
|
|
- for (DynamicObject entry : entryColl) {
|
|
|
|
|
- int times = entry.getInt(MasConstant.NCKD_TIMES);
|
|
|
|
|
- //兑现比例(%)
|
|
|
|
|
- BigDecimal payoutRatio = entry.getBigDecimal(MasConstant.NCKD_PAYOUTRATIO);
|
|
|
|
|
- //兑现金额
|
|
|
|
|
- BigDecimal payoutMoney = entry.getBigDecimal(MasConstant.NCKD_PAYOUTMONEY);
|
|
|
|
|
- BigDecimal payaMount;
|
|
|
|
|
- if(payoutMoney != null && payoutMoney.compareTo(BigDecimal.ZERO) > 0){
|
|
|
|
|
- //优先使用【兑现金额】
|
|
|
|
|
- payaMount = payoutMoney;
|
|
|
|
|
- }else{
|
|
|
|
|
- //延期支付总金额*兑现比例
|
|
|
|
|
- payaMount = deferPayTotalAmt.multiply(payoutRatio.divide(new BigDecimal(100), 2, RoundingMode.DOWN));
|
|
|
|
|
- }
|
|
|
|
|
- if(i != 0){
|
|
|
|
|
- beginYear = DateUtil.addYears(beginYear, 1);
|
|
|
|
|
- }
|
|
|
|
|
- this.getModel().setValue(MasConstant.NCKD_PAYYEAR+(i+1), DateUtil.toDate(beginYear),rowIndex);
|
|
|
|
|
- this.getModel().setValue(MasConstant.NCKD_PAYAMOUNT+(i+1), payaMount,rowIndex);
|
|
|
|
|
- i++;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- //====================================== 获取延期支付比例 end ======================================
|
|
|
|
|
|
|
+ super.propertyChanged(e);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }else{
|
|
|
|
|
- this.getModel().setValue(MasConstant.NCKD_DEFERPAYTOTALAMT, null);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected String getChangeEntityFormId() {
|
|
|
|
|
+ return MasConstant.ENTLDRANLSALSTDCHG_ENTITYID;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void load(){
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void load(){
|
|
|
DynamicObject payUnit = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_PAYUNIT));
|
|
DynamicObject payUnit = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_PAYUNIT));
|
|
|
DynamicObject lawEntity = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_LAWENTITY));
|
|
DynamicObject lawEntity = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(MasConstant.NCKD_LAWENTITY));
|
|
|
Date year = ConvertUtil.toDate(this.getModel().getValue(MasConstant.NCKD_YEAR));
|
|
Date year = ConvertUtil.toDate(this.getModel().getValue(MasConstant.NCKD_YEAR));
|
|
@@ -224,7 +87,7 @@ public class EntleaderAnlSalStdFormPlugin extends AbstractFormPlugin implements
|
|
|
.add(MasConstant.NCKD_SALNEGOT);
|
|
.add(MasConstant.NCKD_SALNEGOT);
|
|
|
DynamicObject[] dbSubCoHeadServiceArray = BusinessDataServiceHelper.load(MasConstant.SUBCOHEADSERVICE_ENTITYID, subCoHeadServiceQueryFieldBuilder.buildSelect(), new QFilter[]{filter});
|
|
DynamicObject[] dbSubCoHeadServiceArray = BusinessDataServiceHelper.load(MasConstant.SUBCOHEADSERVICE_ENTITYID, subCoHeadServiceQueryFieldBuilder.buildSelect(), new QFilter[]{filter});
|
|
|
if(dbSubCoHeadServiceArray == null || dbSubCoHeadServiceArray.length == 0){
|
|
if(dbSubCoHeadServiceArray == null || dbSubCoHeadServiceArray.length == 0){
|
|
|
- this.getView().showTipNotification("未加载到数据,根据【所属二级单位】、【法人组织】及【年度】未加载到对应“子企业负责人任职情况”数据!");
|
|
|
|
|
|
|
+ this.getView().showTipNotification("未加载到数据,根据【所属二级单位】、【法人组织】及【年度】未加载到对应\"子企业负责人任职情况\"数据!");
|
|
|
}
|
|
}
|
|
|
//====================================== 获取子企业负责人任职情况 end ======================================
|
|
//====================================== 获取子企业负责人任职情况 end ======================================
|
|
|
|
|
|
|
@@ -242,7 +105,7 @@ public class EntleaderAnlSalStdFormPlugin extends AbstractFormPlugin implements
|
|
|
.add(FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_TERMPAYDESC);
|
|
.add(FormConstant.NCKD_ENTRYENTITY, MasConstant.NCKD_TERMPAYDESC);
|
|
|
DynamicObject[] dbSubCorpSalaryArray = BusinessDataServiceHelper.load(MasConstant.SUBCORPSALARY_ENTITYID, queryFieldBuilder.buildSelect(), new QFilter[]{filter});
|
|
DynamicObject[] dbSubCorpSalaryArray = BusinessDataServiceHelper.load(MasConstant.SUBCORPSALARY_ENTITYID, queryFieldBuilder.buildSelect(), new QFilter[]{filter});
|
|
|
if(dbSubCorpSalaryArray == null || dbSubCorpSalaryArray.length == 0){
|
|
if(dbSubCorpSalaryArray == null || dbSubCorpSalaryArray.length == 0){
|
|
|
- this.getView().showTipNotification("未加载到数据,根据【所属二级单位】、【法人组织】及【年度】未加载到对应“子企业负责人薪酬结构”数据!");
|
|
|
|
|
|
|
+ this.getView().showTipNotification("未加载到数据,根据【所属二级单位】、【法人组织】及【年度】未加载到对应\"子企业负责人薪酬结构\"数据!");
|
|
|
}
|
|
}
|
|
|
//====================================== 获取子企业负责人薪酬结构 end ======================================
|
|
//====================================== 获取子企业负责人薪酬结构 end ======================================
|
|
|
//====================================== 获取延期支付比例 begin ======================================
|
|
//====================================== 获取延期支付比例 begin ======================================
|
|
@@ -321,114 +184,10 @@ public class EntleaderAnlSalStdFormPlugin extends AbstractFormPlugin implements
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
|
|
- if(afterDoOperationEventArgs.getOperationResult() != null && afterDoOperationEventArgs.getOperationResult().isSuccess()){
|
|
|
|
|
- String operateKey = afterDoOperationEventArgs.getOperateKey();
|
|
|
|
|
- if(operateKey.equalsIgnoreCase("change")){
|
|
|
|
|
- DynamicObject data = this.getModel().getDataEntity();
|
|
|
|
|
- //校验有没有暂存或进行中的审批单
|
|
|
|
|
- QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
|
|
|
|
|
- .add(FormConstant.BILL_NO_KEY);
|
|
|
|
|
- QFilter filter = new QFilter(FormConstant.BILL_STATUS_KEY, QCP.not_equals, BillStatus.C.toString())
|
|
|
|
|
- .and(String.join(".", MasConstant.SUBCORPCHIEFSALSTD_ENTITYID, FormConstant.ID_KEY), QCP.in, data.getLong(FormConstant.ID_KEY));
|
|
|
|
|
- DynamicObjectCollection query = QueryServiceHelper.query(MasConstant.SUBCPCHFSALSTDCHG_ENTITYID, queryFieldBuilder.buildSelect(), new QFilter[]{filter});
|
|
|
|
|
- if(!query.isEmpty()){
|
|
|
|
|
- String number = query.get(0).getString(FormConstant.BILL_NO_KEY);
|
|
|
|
|
- throw new ValidationException(StrFormatter.format("已存在暂存或进行中的变更单【单据号:{}】,请勿重复申请。", number));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- DynamicObjectCollection entryColl = data.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
|
|
|
|
|
- DynamicObject newSubcpChfSalStdChg = EntityHelper.newEntity(MasConstant.ENTLDRANLSALSTDCHG_ENTITYID);
|
|
|
|
|
- HRDynamicObjectUtils.copy(data,newSubcpChfSalStdChg);
|
|
|
|
|
- newSubcpChfSalStdChg.set(FormConstant.NCKD_DESCRIPTION,data.getString(FormConstant.DESCRIPTION_KEY));
|
|
|
|
|
- newSubcpChfSalStdChg.set(MasConstant.ENTLEADERANLSALSTD_ENTITYID,data);
|
|
|
|
|
- newSubcpChfSalStdChg.set(FormConstant.BILL_STATUS_KEY, BillStatusEnum.SAVED.getValue());
|
|
|
|
|
- List<Map<String, Object>> attachments = AttachmentServiceHelper.getAttachments("nckd_subcorpchiefsalstd", data.getLong(FormConstant.ID_KEY), "nckd_attachmentpanelap");
|
|
|
|
|
-
|
|
|
|
|
- //变更前
|
|
|
|
|
- DynamicObjectCollection newEntryColl = newSubcpChfSalStdChg.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
|
|
|
|
|
- DynamicObjectCollection newOldEntryColl = newSubcpChfSalStdChg.getDynamicObjectCollection("nckd_oldentryentity");
|
|
|
|
|
- for (DynamicObject newEntry : newEntryColl) {
|
|
|
|
|
- //设置源id
|
|
|
|
|
- int seq = newEntry.getInt(FormConstant.SEQ_KEY);
|
|
|
|
|
- List<DynamicObject> filteredEntries = entryColl.stream().filter(entry -> entry.getInt(FormConstant.SEQ_KEY) == seq).collect(Collectors.toList());
|
|
|
|
|
- long originId = 0L;
|
|
|
|
|
- if(!filteredEntries.isEmpty()){
|
|
|
|
|
- originId = filteredEntries.get(0).getLong(FormConstant.ID_KEY);
|
|
|
|
|
- }
|
|
|
|
|
- newEntry.set("nckd_originid", originId);
|
|
|
|
|
-
|
|
|
|
|
- DynamicObject newOldEntry = newOldEntryColl.addNew();
|
|
|
|
|
- DataEntityPropertyCollection properties = newOldEntry.getDynamicObjectType().getProperties();
|
|
|
|
|
- for (IDataEntityProperty property : properties) {
|
|
|
|
|
- String oldName = property.getName();
|
|
|
|
|
- String name = oldName.replace("old","");
|
|
|
|
|
- newOldEntry.set(oldName, newEntry.get(name));
|
|
|
|
|
- }
|
|
|
|
|
- newOldEntry.set("nckd_originidold", originId);
|
|
|
|
|
- }
|
|
|
|
|
- OperationResult operationResult = SaveServiceHelper.saveOperate(MasConstant.ENTLDRANLSALSTDCHG_ENTITYID, new DynamicObject[]{newSubcpChfSalStdChg}, OperateOption.create());
|
|
|
|
|
- if (!operationResult.isSuccess()) {
|
|
|
|
|
- String parentPageId = this.getView().getFormShowParameter().getPageId();
|
|
|
|
|
- IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
|
|
|
|
|
- IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
|
|
|
|
|
- Map<String, String> customData = operationResult.getCustomData();
|
|
|
|
|
- //成功的记录
|
|
|
|
|
- Map<Object, Object> successMap = new HashMap<>();
|
|
|
|
|
- for (Object successPkId : operationResult.getSuccessPkIds()) {
|
|
|
|
|
- successMap.put(successPkId, customData.get(successPkId.toString()));
|
|
|
|
|
- }
|
|
|
|
|
- this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", successMap, pageCache, operationResult));
|
|
|
|
|
- this.getView().invokeOperation(FormConstant.REFRESH_OP);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 自定义确认框按钮名称
|
|
|
|
|
- Map<Integer, String> btnNameMaps = new HashMap<Integer, String>();
|
|
|
|
|
- btnNameMaps.put(2, "我知道了");
|
|
|
|
|
- btnNameMaps.put(6, "进入变更单");
|
|
|
|
|
- ConfirmCallBackListener confirmCallBackListener =
|
|
|
|
|
- new ConfirmCallBackListener("openchange", this);
|
|
|
|
|
- List<Object> successPkIds = operationResult.getSuccessPkIds();
|
|
|
|
|
- this.getPageCache().put("changeid", ConvertUtil.toStr(successPkIds.get(0)));
|
|
|
|
|
- this.getView().showConfirm("提示","发起暂存状态「变更单」成功,点击“进入变更单”按钮或在列表页面点击“查看变更单”即可进行数据变更并提交审批。", MessageBoxOptions.OKCancel, ConfirmTypes.Default, confirmCallBackListener,btnNameMaps);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) {
|
|
|
|
|
- if ("openchange".equals(messageBoxClosedEvent.getCallBackId())
|
|
|
|
|
- && messageBoxClosedEvent.getResult() == MessageBoxResult.Yes) {
|
|
|
|
|
- BillShowParameter billShowParameter = new BillShowParameter();
|
|
|
|
|
- billShowParameter.setFormId(MasConstant.ENTLDRANLSALSTDCHG_ENTITYID);
|
|
|
|
|
- billShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
|
|
|
|
- String id = this.getPageCache().get("changeid");
|
|
|
|
|
- // 设置单据主键ID(关键步骤)
|
|
|
|
|
- billShowParameter.setPkId(id);
|
|
|
|
|
- this.getView().showForm(billShowParameter);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 设置支付N锁定或解锁
|
|
|
|
|
- * @param installmentYears 分期支付年
|
|
|
|
|
- * @param rowIndex 行索引
|
|
|
|
|
- * @return: void
|
|
|
|
|
- * @author W.Y.C
|
|
|
|
|
- * @date: 2025/11/29 20:48
|
|
|
|
|
- */
|
|
|
|
|
- private void initOperateOption(int installmentYears, int rowIndex) {
|
|
|
|
|
- if(rowIndex > -1) {
|
|
|
|
|
- for (int i = 1; i <= 10; i++) {
|
|
|
|
|
- this.getView().setEnable(false, rowIndex, MasConstant.NCKD_PAYYEAR + i);
|
|
|
|
|
- this.getView().setEnable(false, rowIndex, MasConstant.NCKD_PAYAMOUNT + i);
|
|
|
|
|
- }
|
|
|
|
|
- for (int i = 1; i <= installmentYears; i++) {
|
|
|
|
|
- this.getView().setEnable(true, rowIndex, MasConstant.NCKD_PAYYEAR + i);
|
|
|
|
|
- this.getView().setEnable(true, rowIndex, MasConstant.NCKD_PAYAMOUNT + i);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ handleDoChangeOperation(afterDoOperationEventArgs,
|
|
|
|
|
+ MasConstant.ENTLEADERANLSALSTD_ENTITYID,
|
|
|
|
|
+ MasConstant.ENTLEADERANLSALSTD_ENTITYID,
|
|
|
|
|
+ MasConstant.ENTLDRANLSALSTDCHG_ENTITYID,
|
|
|
|
|
+ MasConstant.ENTLDRANLSALSTDCHG_ENTITYID);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|