From af77e5de723066ac57f2c2c1863fb455ad4e58f5 Mon Sep 17 00:00:00 2001 From: chenshaoxin <1981897232@qq.com> Date: Mon, 16 Jun 2025 11:27:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A=E9=99=88?= =?UTF-8?q?=E7=BB=8D=E9=91=AB=20=E6=97=A5=E6=9C=9F=EF=BC=9A2025/6/16=2012?= =?UTF-8?q?=EF=BC=9A30=20=E5=86=85=E5=AE=B9:=E6=94=B6=E7=A5=A8=E7=99=BB?= =?UTF-8?q?=E8=AE=B0=E8=87=AA=E5=8A=A8=E4=B8=8B=E6=8E=A8=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E6=94=B6=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/plugin/list/ReceivableListPlugin.java | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/list/ReceivableListPlugin.java diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/list/ReceivableListPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/list/ReceivableListPlugin.java new file mode 100644 index 0000000..4689818 --- /dev/null +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/list/ReceivableListPlugin.java @@ -0,0 +1,102 @@ +package shkd.sys.sys.plugin.list; + +import com.alibaba.druid.util.StringUtils; +import kd.bos.dataentity.OperateOption; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.operate.result.OperateErrorInfo; +import kd.bos.entity.operate.result.OperationResult; +import kd.bos.form.ConfirmTypes; +import kd.bos.form.MessageBoxOptions; +import kd.bos.form.events.AfterDoOperationEventArgs; +import kd.bos.list.plugin.AbstractListPlugin; +import kd.bos.logging.Log; +import kd.bos.logging.LogFactory; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.botp.BFTrackerServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; +import kd.tmc.cdm.common.constant.CdmEntityConst; +import shkd.sys.sys.plugin.report.FinanceReportPlugin; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +public class ReceivableListPlugin extends AbstractListPlugin { + + private static final Log logger = LogFactory.getLog(ReceivableListPlugin.class); + + @Override + public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { + super.afterDoOperation(afterDoOperationEventArgs); + String operateKey = afterDoOperationEventArgs.getOperateKey(); + if ("autogenrecbill".equals(operateKey)){ + OperationResult operationResult = afterDoOperationEventArgs.getOperationResult(); + if (operationResult.getSuccessPkIds().size()!=0){ + List successPkIds = operationResult.getSuccessPkIds(); + for (Object successPkId : successPkIds) { + Map> cdm_receivablebill = BFTrackerServiceHelper.findTargetBills("cdm_receivablebill", new Long[]{(Long) successPkId}); + System.out.println(cdm_receivablebill); + HashSet cas_recbill = cdm_receivablebill.get("cas_recbill"); + QFilter filter = new QFilter("shkd_zdxtid", QCP.equals, "true"); + filter.and(new QFilter("id", QCP.in, cas_recbill)); + DynamicObject[] CDM_PAYABLEBILLs = BusinessDataServiceHelper.load("cas_recbill", "id,billno,org", filter.toArray()); + List list = new ArrayList<>(); + for (int i = 0; i < CDM_PAYABLEBILLs.length; i++) { + DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(CDM_PAYABLEBILLs[i].get("id"), "cas_recbill"); + list.add(dynamicObject.getLong("id")); + } + StringBuilder Builder = new StringBuilder(""); + //调用方法执行数据 - 自动兑付下推 + OperationResult operationResult1 = OperationServiceHelper.executeOperate("submit", + "cas_recbill", + list.toArray(), OperateOption.create()); + logger.info("operationResult1:"+operationResult1); +// if (operationResult1.getAllErrorInfo().size()!=0){ +// List allErrorInfo = operationResult1.getAllErrorInfo(); +// for (int i = 0; i < allErrorInfo.size(); i++) { +// String message = allErrorInfo.get(i).getMessage(); +// Builder.append(message+"\n"); +// } +// } + + OperationResult operationResult2=null; + if ( operationResult1.getSuccessPkIds().size()!=0){ + operationResult2 = OperationServiceHelper.executeOperate("audit", + "cas_recbill", + operationResult1.getSuccessPkIds().toArray(), OperateOption.create()); +// if (operationResult2.getAllErrorInfo().size()!=0){ +// List allErrorInfo = operationResult2.getAllErrorInfo(); +// for (int i = 0; i < allErrorInfo.size(); i++) { +// String message = allErrorInfo.get(i).getMessage(); +// Builder.append(message+"\n"); +// } +// } + } + logger.info("operationResult2:"+operationResult2); + + OperationResult operationResult3=null; + if ( operationResult2.getSuccessPkIds().size()!=0){ + operationResult3 = OperationServiceHelper.executeOperate("receivingrec", + "cas_recbill", + operationResult2.getSuccessPkIds().toArray(), OperateOption.create()); +// if (operationResult3.getAllErrorInfo().size()!=0){ +// List allErrorInfo = operationResult3.getAllErrorInfo(); +// for (int i = 0; i < allErrorInfo.size(); i++) { +// String message = allErrorInfo.get(i).getMessage(); +// Builder.append(message+"\n"); +// } +// } + } + logger.info("operationResult3:"+operationResult3); + +// if (StringUtils.isEmpty(Builder.toString())){ +// this.getView().showConfirm("操作失败",Builder.toString() , MessageBoxOptions.None, ConfirmTypes.Default, null); +// } + } + } + } + } +}