From c612e0c417d10cbddf0e2a0c8aeda1c8f8ca4880 Mon Sep 17 00:00:00 2001 From: zoujiangtao Date: Wed, 18 Dec 2024 15:41:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=86=85=E5=AE=B9=EF=BC=9A?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=EF=BC=8C=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=8C=E8=8E=B7=E5=8F=96token=20=E5=A4=87?= =?UTF-8?q?=E6=B3=A8=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=EF=BC=8C=E6=93=8D=E4=BD=9C=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E8=8E=B7=E5=8F=96token=20=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?=E9=82=B9=E6=B1=9F=E6=B6=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shkd/sys/sys/mservice/ApiService.java | 2 + .../HitBackOperationServicePlugin.java | 45 +++++++++++++++++++ .../sys/sys/plugin/task/PushTaskPlugin.java | 2 +- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/HitBackOperationServicePlugin.java diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java index db5e4b3..2a3f561 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java @@ -248,6 +248,8 @@ public class ApiService { dynamic.set("shkd_pushstatus", "结算失败"); } else if ("TS".equals(objects[0].getString("bankpaystatus"))) { dynamic.set("shkd_pushstatus", "已结算"); + } else { + dynamic.set("shkd_pushstatus", "结算失败"); } dynamicObjects.add(dynamic); diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/HitBackOperationServicePlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/HitBackOperationServicePlugin.java new file mode 100644 index 0000000..d587754 --- /dev/null +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/HitBackOperationServicePlugin.java @@ -0,0 +1,45 @@ +package shkd.sys.sys.plugin.operation; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.AfterOperationArgs; +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.operation.SaveServiceHelper; +import kd.sdk.plugin.Plugin; +import shkd.sys.sys.mservice.ApiService; +import shkd.sys.sys.plugin.form.ApiMappingBillPlugin; + +import java.util.ArrayList; +import java.util.List; + +/** + * 单据操作插件 + */ +public class HitBackOperationServicePlugin extends AbstractOperationServicePlugIn implements Plugin { + private static final Log logger = LogFactory.getLog(ApiMappingBillPlugin.class); + @Override + public void afterExecuteOperationTransaction(AfterOperationArgs args) { + super.afterExecuteOperationTransaction(args); + List dynamicObjectList = new ArrayList<>(); + DynamicObject[] entities = args.getDataEntities(); + for (DynamicObject dynamicObject : entities) { + BusinessDataServiceHelper.load(dynamicObject.getDataEntityType().getName(), "id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,payeebanknum," + + "payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype,org,bizdate,description," + + "shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname,billstatus,bankpaystatus" + , new QFilter("id", QCP.equals, dynamicObject.getPkValue()) + .and("billstatus", QCP.equals, "C")//已审核 + .and("shkd_pushstatus", QCP.equals, "未结算").toArray()); + try { + ApiService.paymentSlipsJson(dynamicObject, "BIPNO", dynamicObjectList); + SaveServiceHelper.save(dynamicObjectList.toArray(new DynamicObject[0])); + logger.info("执行打回操作成功,单据编号:{}", dynamicObject.getString("billno")); + } catch (Exception e) { + logger.info("执行打回操作失败,错误信息 → \n{}", e); + } + } + } +} \ No newline at end of file diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/task/PushTaskPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/task/PushTaskPlugin.java index 0514793..920fb82 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/task/PushTaskPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/task/PushTaskPlugin.java @@ -100,7 +100,7 @@ public class PushTaskPlugin extends AbstractTask implements Plugin { "id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,payeebanknum," + "payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype,org,bizdate,description," + "shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname,billstatus,bankpaystatus" - , new QFilter("bankpaystatus", QCP.equals, "TS") + , new QFilter("bankpaystatus", QCP.equals, "TS")//付款成功 .and("shkd_pushstatus", QCP.equals, "结算失败").toArray()); dynamicObjects = Arrays.asList(objects4); dynamicObjects.addAll(Arrays.asList(objects5));