From cc3803958972193a70b05a1433821f57a0b1af58 Mon Sep 17 00:00:00 2001 From: zoujiangtao Date: Thu, 28 Nov 2024 15:48:02 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?=E9=82=B9=E6=B1=9F=E6=B6=9B=20=E4=BF=AE=E6=94=B9=E5=86=85?= =?UTF-8?q?=E5=AE=B9=EF=BC=9AAPI=E6=98=A0=E5=B0=84=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E5=8D=95=E6=8D=AE=20=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=9A2024/11/28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) 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 1258939..67a51c7 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 @@ -50,8 +50,10 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { if ("shkd_generatejson".equals(itemKey)) { // 获取想要推送单据编码 String billNumber = dataEntity.getString("shkd_sourcenumber"); + logger.info("获取推送单据编码 → billNumber:{}", billNumber); // 获取想要推送单据类型 String billMark = dataEntity.getDynamicObject("shkd_sourcebill").getDataEntityType().getName(); + logger.info("获取推送单据类型 → billMark:{}", billMark); // 获取推送单据对象 DynamicObject billObject = BusinessDataServiceHelper.loadSingle(billMark, new QFilter("billno", QCP.equals, billNumber).toArray()); logger.info("获取推送对象 → billObject:{}", billObject); @@ -138,10 +140,12 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { } jsonArray.add(json); codeEdit.setText(jsonArray.toJSONString()); + logger.info("JSON:{}", jsonArray.toJSONString()); } else { JSONObject resultJson = new JSONObject(); processFloor(resultJson, "data", floors.get(0), floors, billObject); codeEdit.setText(resultJson.toJSONString()); + logger.info("JSON:{}", resultJson.toJSONString()); } } From 6353c79f8f47f5b698bb4e97026b73d6e8d58550 Mon Sep 17 00:00:00 2001 From: zoujiangtao Date: Thu, 28 Nov 2024 16:42:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?=E9=82=B9=E6=B1=9F=E6=B6=9B=20=E4=BF=AE=E6=94=B9=E5=86=85?= =?UTF-8?q?=E5=AE=B9=EF=BC=9AAPI=E6=98=A0=E5=B0=84=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E5=8D=95=E6=8D=AE=20=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=9A2024/11/28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 67a51c7..c3c677b 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 @@ -52,7 +52,7 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { String billNumber = dataEntity.getString("shkd_sourcenumber"); logger.info("获取推送单据编码 → billNumber:{}", billNumber); // 获取想要推送单据类型 - String billMark = dataEntity.getDynamicObject("shkd_sourcebill").getDataEntityType().getName(); + String billMark = dataEntity.getDynamicObject("shkd_sourcebill").getString("number"); logger.info("获取推送单据类型 → billMark:{}", billMark); // 获取推送单据对象 DynamicObject billObject = BusinessDataServiceHelper.loadSingle(billMark, new QFilter("billno", QCP.equals, billNumber).toArray()); From 2dfab2fd22f224cc3dd032a2f9c388b132c86a5f Mon Sep 17 00:00:00 2001 From: zoujiangtao Date: Fri, 29 Nov 2024 09:49:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?=E9=82=B9=E6=B1=9F=E6=B6=9B=20=E4=BF=AE=E6=94=B9=E5=86=85?= =?UTF-8?q?=E5=AE=B9=EF=BC=9AAPI=E6=98=A0=E5=B0=84=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E5=8D=95=E6=8D=AE=20=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=9A2024/11/28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/shkd/sys/sys/mservice/ApiService.java | 4 ++-- .../shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java | 8 ++++++-- .../java/shkd/sys/sys/plugin/form/ApiTestBillPlugin.java | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java index 52702c5..ddde14c 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java @@ -31,7 +31,7 @@ import java.util.*; public class ApiService { private static final Log logger = LogFactory.getLog(ApiService.class); - public static String getBIPToken() { + public static String getBIPToken(String domainName) { String access_token = null; long currentTimeMillis = System.currentTimeMillis(); try { @@ -43,7 +43,7 @@ public class ApiService { String signature = generateSignature("appKey" + appKey + "timestamp" + timestamp); // 构建URL - String urlString = "https://biptest.ctny.com.cn/iuap-api-auth/open-auth/selfAppAuth/getAccessToken" + + String urlString = domainName + "/iuap-api-auth/open-auth/selfAppAuth/getAccessToken" + "?appKey=22564a240d3140d0b15582aca71a748c" + "×tamp=" + currentTimeMillis + "&signature=" + signature; 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 c3c677b..fa04893 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 @@ -162,15 +162,19 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { } if ("shkd_testapi".equals(itemKey)) { + String domainName = dataEntity.getString("shkd_domainname"); String url = dataEntity.getString("shkd_url"); ApiEntity apiEntity = new ApiEntity(); - apiEntity.setURL(url); + apiEntity.setURL(domainName + url); apiEntity.setMethod("POST"); Map headMap = new HashMap<>(); headMap.put("Content-Type", "application/json"); apiEntity.setHeaders(headMap); Map paramsMap = new HashMap<>(); - paramsMap.put("access_token", ApiService.getBIPToken()); + + String old_url = "https://biptest.ctny.com.cn"; + + paramsMap.put("access_token", ApiService.getBIPToken(domainName)); apiEntity.setQueryParams(paramsMap); apiEntity.setRequestBody(codeEdit.getText()); JSONObject responseBody = ApiEntity.getResponseBody(apiEntity); diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiTestBillPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiTestBillPlugin.java index a397524..73d5f47 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiTestBillPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiTestBillPlugin.java @@ -32,7 +32,8 @@ public class ApiTestBillPlugin extends AbstractBillPlugIn implements Plugin { String key = evt.getItemKey(); if ("shkd_token".equals(key)) { - String bipToken = ApiService.getBIPToken(); + String url = this.getModel().getValue("shkd_url").toString(); + String bipToken = ApiService.getBIPToken(url); this.getView().showTipNotification(bipToken); }