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) {