From df62a13ac3417f4f9d82fdf84fe0afd60b9fb12f Mon Sep 17 00:00:00 2001 From: zoujiangtao Date: Thu, 14 Nov 2024 17:32:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=EF=BC=9A=E9=82=B9?= =?UTF-8?q?=E6=B1=9F=E6=B6=9B=20=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=9AAPI=E5=85=A5=E5=8F=82=E5=87=BA=E5=8F=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=EF=BC=9A2024/1?= =?UTF-8?q?1/14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/plugin/api/PayBillApiSavePlugin.java | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/api/PayBillApiSavePlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/api/PayBillApiSavePlugin.java index cdbe5e6..6c92e57 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/api/PayBillApiSavePlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/api/PayBillApiSavePlugin.java @@ -68,15 +68,21 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin logger.info("付款处理 → \nobjectType:{}\nobjectNumber:{}\nbankNumber:{}", objectType, objectNumber, bankNumber); fieldName2 = "payerbank"; - DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(objectType, "id,billno", new QFilter("billno", QCP.equals, objectNumber).toArray()); - logger.info("objectNumber:{}", objectNumber); - DynamicObject amAccountbank = BusinessDataServiceHelper.loadSingle("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray()); - logger.info("amAccountbank:{}", amAccountbank); - map.put(fieldName1, dynamicObject.getString("id")); - + DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load(objectType, "id,billno", new QFilter("billno", QCP.equals, objectNumber).toArray()); + logger.info("dynamicObjects.length:{}", dynamicObjects.length); + if (dynamicObjects.length > 0) { + map.put(fieldName1, dynamicObjects[0].getPkValue()); + logger.info("dynamicObjects[0]:{}", dynamicObjects[0]); + } + DynamicObject[] amAccountbanks = BusinessDataServiceHelper.load("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray()); + logger.info("amAccountbanks.length:{}", amAccountbanks.length); Map payerbank = new HashMap<>(); - payerbank.put("number", amAccountbank.getDynamicObject("bank").getString("number")); + if (amAccountbanks.length > 0) { + payerbank.put("number", amAccountbanks[0].getDynamicObject("bank").getString("number")); + logger.info("amAccountbanks[0]:{}", amAccountbanks[0]); + } + logger.info("payerbank:{}", payerbank); map.put(fieldName2, payerbank); } @@ -90,14 +96,20 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin bankNumber = (String) accountbank.get("number"); logger.info("收款处理 → \nobjectType:{}\nobjectNumber:{}\nbankNumber:{}", objectType, objectNumber, bankNumber); fieldName2 = "payeebank"; - DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(objectType, "id", new QFilter("billno", QCP.equals, objectNumber).toArray()); - logger.info("objectType:{},objectNumber:{}", objectType, objectNumber); - DynamicObject amAccountbank = BusinessDataServiceHelper.loadSingle("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray()); - logger.info("amAccountbank:{}", amAccountbank); - map.put(fieldName1, dynamicObject.getString("id")); + DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load(objectType, "id", new QFilter("billno", QCP.equals, objectNumber).toArray()); + logger.info("dynamicObjects.length:{}", dynamicObjects.length); + if (dynamicObjects.length > 0) { + map.put(fieldName1, dynamicObjects[0].getPkValue()); + logger.info("dynamicObjects[0]:{}", dynamicObjects[0]); + } + DynamicObject[] amAccountbanks = BusinessDataServiceHelper.load("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray()); + logger.info("amAccountbanks.length:{}", amAccountbanks.length); Map payeebank = new HashMap<>(); - payeebank.put("number", amAccountbank.getDynamicObject("bank").getString("number")); + if (amAccountbanks.length > 0) { + payeebank.put("number", amAccountbanks[0].getDynamicObject("bank").getString("number")); + } + logger.info("payerbank:{}", payeebank); map.put(fieldName2, payeebank); } shkd_businessid = map.get("shkd_businessid").toString();