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();