From 45d420c4c0ccd6479cfcf46c0766b7849a3a7d85 Mon Sep 17 00:00:00 2001 From: zoujiangtao Date: Thu, 19 Dec 2024 19:42:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=86=85=E5=AE=B9=EF=BC=9ABI?= =?UTF-8?q?P=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8=20?= =?UTF-8?q?=E5=A4=87=E6=B3=A8=EF=BC=9ABIP=E6=8F=90=E4=BA=A4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E7=94=A8=20=E6=8F=90=E4=BA=A4=E4=BA=BA?= =?UTF-8?q?=EF=BC=9A=E9=82=B9=E6=B1=9F=E6=B6=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/plugin/form/ApiMappingBillPlugin.java | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 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 f0c7696..2839dfa 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 @@ -43,6 +43,26 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { @Override public void itemClick(ItemClickEvent evt) { String itemKey = evt.getItemKey(); + + // 获取代码编辑器控件 + CodeEdit codeEdit = this.getView().getControl("shkd_codeeditap"); + + // 解析JSON字符串 + if ("shkd_analyzejson".equals(itemKey)) { + String text = codeEdit.getText(); + Object obj = JSON.parse(text); + logger.info("解析JSON字符串 → text:{}\nJSON字符串解析为JSON", text); + if (obj instanceof JSONObject) { + logger.info("解析JSON字符串 → text:{}\nJSON字符串解析为JSONObject", text); + JSONObject jsonObject = JSON.parseObject(text); + parseJson(jsonObject, 1, null); + } else if (obj instanceof JSONArray) { + logger.info("解析JSON字符串 → text:{}\nJSON字符串解析为JSONArray", text); + JSONArray jsonArray = JSON.parseArray(text); + parseJson(jsonArray, 1, null); + } + } + DynamicObject dataEntity = this.getModel().getDataEntity(true); // 获取想要推送单据编码 String billNumber = dataEntity.getString("shkd_sourcenumber"); @@ -84,34 +104,24 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { billObject = objects3[0]; logger.info("获取银企交易明细查询推送对象 → billObject:{}", billObject); break; + // 电子回单查询 + case "bei_elecreceipt": + DynamicObject[] objects4 = BusinessDataServiceHelper.load("bei_elecreceipt", + "id" + , new QFilter("billno", QCP.equals, billNumber).toArray()); + billObject = objects4[0]; + logger.info("获取银企交易明细查询推送对象 → billObject:{}", billObject); + break; default: return; } - // 获取代码编辑器控件 - CodeEdit codeEdit = this.getView().getControl("shkd_codeeditap"); - + // 生成JSON if ("shkd_generatejson".equals(itemKey)) { String requestBody = ApiService.assembleRequestBody(billObject, dataEntity); codeEdit.setText(format(requestBody)); } - logger.info("点击按钮标识:{}", itemKey); - if ("shkd_analyzejson".equals(itemKey)) { - String text = codeEdit.getText(); - Object obj = JSON.parse(text); - logger.info("解析JSON字符串 → text:{}\nJSON字符串解析为JSON", text); - if (obj instanceof JSONObject) { - logger.info("解析JSON字符串 → text:{}\nJSON字符串解析为JSONObject", text); - JSONObject jsonObject = JSON.parseObject(text); - parseJson(jsonObject, 1, null); - } else if (obj instanceof JSONArray) { - logger.info("解析JSON字符串 → text:{}\nJSON字符串解析为JSONArray", text); - JSONArray jsonArray = JSON.parseArray(text); - parseJson(jsonArray, 1, null); - } - } - List dynamicObjects = new ArrayList<>(); if ("shkd_testapi".equals(itemKey)) { @@ -211,7 +221,7 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { /** * 格式化JSON字符串 -> 添加缩进 * - * @param sb 待添加缩进的StringBuilder对象 + * @param sb 待添加缩进的StringBuilder对象 * @param indentLevel 添加空格的字符串坐标 */ private void addIndent(StringBuilder sb, int indentLevel) {