From d8a12ec6a71a138247561daecd224b354e633fd2 Mon Sep 17 00:00:00 2001 From: zoujiangtao Date: Tue, 3 Dec 2024 18:00: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=E6=98=A0=E5=B0=84=E5=85=AC=E5=85=B1=E5=8D=95?= =?UTF-8?q?=E6=8D=AE=20=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=EF=BC=9A2024/1?= =?UTF-8?q?2/03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/plugin/form/ApiMappingBillPlugin.java | 107 ++++++++++++++++-- 1 file changed, 100 insertions(+), 7 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java index 8056840..9d82995 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java @@ -54,9 +54,38 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { // 获取想要推送单据类型 String billMark = dataEntity.getDynamicObject("shkd_sourcebill").getString("number"); logger.info("获取推送单据类型 → billMark:{}", billMark); - // 获取推送单据对象 - DynamicObject billObject = BusinessDataServiceHelper.loadSingle(billMark, new QFilter("billno", QCP.equals, billNumber).toArray()); - logger.info("获取推送对象 → billObject:{}", billObject); + + + DynamicObject billObject; + switch (billMark) { + // 付款处理 + case "cas_paybill": + DynamicObject[] objects1 = BusinessDataServiceHelper.load("cas_paybill", + "id,actpayamt,entry,entry.e_expenseitem,settletype,payeebanknum,payeetype,payeenumber,payeracctbank," + + "payeebank,payeebankname,paymenttype,org,bizdate" + , new QFilter("billno", QCP.equals, billNumber).toArray()); + billObject = objects1[0]; + logger.info("获取付款处理推送对象 → billObject:{}", billObject); + break; + // 收款处理 + case "cas_recbill": + DynamicObject[] objects2 = BusinessDataServiceHelper.load("cas_recbill", + "" + , new QFilter("billno", QCP.equals, billNumber).toArray()); + billObject = objects2[0]; + logger.info("获取收款处理推送对象 → billObject:{}", billObject); + break; + // 银企交易明细查询 + case "aqap_bank_acnt_detail": + DynamicObject[] objects3 = BusinessDataServiceHelper.load("aqap_bank_acnt_detail", + "" + , new QFilter("billno", QCP.equals, billNumber).toArray()); + billObject = objects3[0]; + logger.info("获取银企交易明细查询推送对象 → billObject:{}", billObject); + break; + default: + return; + } // 生成JSON DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("entryentity"); @@ -95,7 +124,29 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { if (shkd_soufield != null) { String[] parts = shkd_soufield.toString().split("\\."); if (parts.length == 1) { - value = billObject.get(parts[0]); + if ("payeetype".equals(parts[0]) || "payertype".equals(parts[0])) { + String objectType = billObject.getString(parts[0]); + switch (objectType) { + case "bos_org": + value = "4"; + break; + case "bd_supplier": + value = "2"; + break; + case "bd_customer": + value = "1"; + break; + case "bos_user": + value = "3"; + break; + case "other": + value = "4"; + break; + } + } else { + value = billObject.get(parts[0]); + } + } else if (parts.length == 2) { if ("entry".equals(parts[0])) { DynamicObjectCollection dynamicObjectCollection1 = billObject.getDynamicObjectCollection(parts[0]); @@ -172,7 +223,7 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { headMap.put("Content-Type", "application/json"); apiEntity.setHeaders(headMap); Map paramsMap = new HashMap<>(); - Map resultMap = ApiService.getBIPToken(domainName); + Map resultMap = ApiService.getBIPToken(domainName); paramsMap.put("access_token", resultMap.get("token")); apiEntity.setQueryParams(paramsMap); apiEntity.setRequestBody(codeEdit.getText()); @@ -203,7 +254,28 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { if (shkd_soufield != null) { String[] parts = shkd_soufield.toString().split("\\."); if (parts.length == 1) { - value = dynamic.get(parts[0]); + if ("payeetype".equals(parts[0]) || "payertype".equals(parts[0])) { + String objectType = dynamic.getString(parts[0]); + switch (objectType) { + case "bos_org": + value = "4"; + break; + case "bd_supplier": + value = "2"; + break; + case "bd_customer": + value = "1"; + break; + case "bos_user": + value = "3"; + break; + case "other": + value = "4"; + break; + } + } else { + value = dynamic.get(parts[0]); + } } else if (parts.length == 2) { if ("entry".equals(parts[0])) { DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]); @@ -253,7 +325,28 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { if (shkd_soufield != null) { String[] parts = shkd_soufield.toString().split("\\."); if (parts.length == 1) { - value = dynamic.get(parts[0]); + if ("payeetype".equals(parts[0]) || "payertype".equals(parts[0])) { + String objectType = dynamic.getString(parts[0]); + switch (objectType) { + case "bos_org": + value = "4"; + break; + case "bd_supplier": + value = "2"; + break; + case "bd_customer": + value = "1"; + break; + case "bos_user": + value = "3"; + break; + case "other": + value = "4"; + break; + } + } else { + value = dynamic.get(parts[0]); + } } else if (parts.length == 2) { if ("entry".equals(parts[0])) { DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]);