From 5cb4f68fbeebf11ea5145b6d3c3f899b32254850 Mon Sep 17 00:00:00 2001 From: zzs Date: Mon, 24 Feb 2025 16:07:31 +0800 Subject: [PATCH] feat:use all config file --- .../collaboraonline/kingdee/AuthService.java | 26 +++++++++---------- .../service/KingdeeService.java | 12 ++++++--- src/main/resources/application-cmoc.yml | 26 +++++++++++++++++++ src/main/resources/application-dev.yaml | 5 ---- src/main/resources/application-ensign.yml | 26 +++++++++++++++++++ src/main/resources/application-local.yaml | 25 +++++++++++++++--- src/main/resources/application-yem.yml | 26 +++++++++++++++++++ src/main/resources/application.yaml | 23 ++-------------- 8 files changed, 124 insertions(+), 45 deletions(-) create mode 100644 src/main/resources/application-cmoc.yml delete mode 100644 src/main/resources/application-dev.yaml create mode 100644 src/main/resources/application-ensign.yml create mode 100644 src/main/resources/application-yem.yml diff --git a/src/main/java/vin/vio/collaboraonline/kingdee/AuthService.java b/src/main/java/vin/vio/collaboraonline/kingdee/AuthService.java index cd390d4..6996bd1 100644 --- a/src/main/java/vin/vio/collaboraonline/kingdee/AuthService.java +++ b/src/main/java/vin/vio/collaboraonline/kingdee/AuthService.java @@ -37,43 +37,43 @@ import java.util.concurrent.TimeUnit; public class AuthService { - @Value("${ensign.kingdee.is-public}") + @Value("${kingdee.is-public}") private Boolean isPublic; - @Value("${ensign.kingdee.test-public-end-point}") + @Value("${kingdee.test-public-end-point}") private String testPublicEndPoint; - @Value("${ensign.kingdee.test-inner-end-point}") + @Value("${kingdee.test-inner-end-point}") private String testInnerEndPoint; - @Value("${ensign.kingdee.prod-public-end-point}") + @Value("${kingdee.prod-public-end-point}") private String prodPublicEndPoint; - @Value("${ensign.kingdee.prod-inner-end-point}") + @Value("${kingdee.prod-inner-end-point}") private String prodInnerEndPoint; - @Value("${ensign.kingdee.env}") + @Value("${kingdee.env}") private String env; - @Value("${ensign.kingdee.appToken.appId}") + @Value("${kingdee.appToken.appId}") private String appId; - @Value("${ensign.kingdee.appToken.appSecuret}") + @Value("${kingdee.appToken.appSecuret}") private String appSecuret; - @Value("${ensign.kingdee.appToken.tenantid}") + @Value("${kingdee.appToken.tenantid}") private String tenantid; - @Value("${ensign.kingdee.appToken.accountId}") + @Value("${kingdee.appToken.accountId}") private String accountId; - @Value("${ensign.kingdee.appToken.language}") + @Value("${kingdee.appToken.language}") private String language; - @Value("${ensign.kingdee.accessToken.user}") + @Value("${kingdee.accessToken.user}") private String user; - @Value("${ensign.kingdee.accessToken.usertype}") + @Value("${kingdee.accessToken.usertype}") private String usertype; public String initBasePath() { diff --git a/src/main/java/vin/vio/collaboraonline/service/KingdeeService.java b/src/main/java/vin/vio/collaboraonline/service/KingdeeService.java index 327b44c..ef2de53 100644 --- a/src/main/java/vin/vio/collaboraonline/service/KingdeeService.java +++ b/src/main/java/vin/vio/collaboraonline/service/KingdeeService.java @@ -37,9 +37,15 @@ public class KingdeeService { @Value("${collabora.file-storage-path}") private String BASE_DIR; - @Value("${ensign.kingdee.attachment-query-uri}") + @Value("${kingdee.attachment-query-uri}") private String attachmentQueryURI; + @Value("${kingdee.bill.formId}") + private String fromId; + + @Value("${kingdee.bill.attachKey}") + private String attachKey; + @Autowired private AuthService authService; @@ -52,9 +58,9 @@ public class KingdeeService { delegate.getHeaders().add("access_token", accessToken); delegate.getHeaders().add("Content-Type", "application/json;charset=UTF-8"); Map requestBody = new HashMap<>(); - requestBody.put("formId", "yem_testbill"); + requestBody.put("formId", fromId); requestBody.put("pkId", attPkId); - requestBody.put("attachKey", "attachmentpanel"); + requestBody.put("attachKey", attachKey); String jsonBody = JSON.toJSONString(requestBody); // 设置请求体 try (OutputStream os = delegate.getBody()) { diff --git a/src/main/resources/application-cmoc.yml b/src/main/resources/application-cmoc.yml new file mode 100644 index 0000000..a02cb0a --- /dev/null +++ b/src/main/resources/application-cmoc.yml @@ -0,0 +1,26 @@ +kingdee: + env: test + test-public-end-point: 'https://srm-dev.cmoc.cloud:8022' + test-inner-end-point: '' + prod-public-end-point: '' + prod-inner-end-point: '' + is-public: true + appToken: + appId: 'OA' + appSecuret: 'Cmoc@OA2024!#@..' + tenantid: 'cmocdev' + accountId: '2117884374501299200' + language: 'zh_CN' + accessToken: + user: '18791337254' + usertype: 'Mobile' + + attachment-query-uri: /ierp/kapi/v2/yem/yem_base/AttachmentsQueryAPI/Query + + bill: + formId: 'yem_webofficemodel2' + attachKey: 'yem_attachmentpanelap' + +collabora: + host-server-addr: https://web-api.wmyun.com/cmoc + file-storage-path: /work/projects/collabora-api/cmoc/file \ No newline at end of file diff --git a/src/main/resources/application-dev.yaml b/src/main/resources/application-dev.yaml deleted file mode 100644 index 56adbfa..0000000 --- a/src/main/resources/application-dev.yaml +++ /dev/null @@ -1,5 +0,0 @@ - -collabora: - # 本机局域网ip,注意 CollaboraOnline容器需要访问该地址,,最后不要加/ - host-server-addr: https://web-api.wmyun.com - file-storage-path: /work/projects/collabora-api/file \ No newline at end of file diff --git a/src/main/resources/application-ensign.yml b/src/main/resources/application-ensign.yml new file mode 100644 index 0000000..127544d --- /dev/null +++ b/src/main/resources/application-ensign.yml @@ -0,0 +1,26 @@ +kingdee: + env: test + test-public-end-point: 'http://122.4.221.133:8022' + test-inner-end-point: 'http://10.64.112.152:8022' + prod-public-end-point: 'http://122.4.221.130:8022' + prod-inner-end-point: 'http://10.64.111.134:8022' + is-public: true + appToken: + appId: 'CRM' + appSecuret: 'yx.CRM.tksecurit@240924' + tenantid: 'yxzg-topview-dev' + accountId: '1878420900609526784' + language: 'zh_CN' + accessToken: + user: 'COSMIC' + usertype: 'UserName' + + attachment-query-uri: /ierp/kapi/v2/yem/yem_receipt/AttachmentsQueryAPI/Query + + bill: + formId: 'yem_testbill' + attachKey: 'attachmentpanel' + +collabora: + host-server-addr: https://web-api.wmyun.com/ensign + file-storage-path: /work/projects/collabora-api/ensign/file \ No newline at end of file diff --git a/src/main/resources/application-local.yaml b/src/main/resources/application-local.yaml index 62b765e..7dca971 100644 --- a/src/main/resources/application-local.yaml +++ b/src/main/resources/application-local.yaml @@ -1,7 +1,26 @@ +kingdee: + env: test + test-public-end-point: 'http://122.4.221.133:8022' + test-inner-end-point: 'http://10.64.112.152:8022' + prod-public-end-point: 'http://122.4.221.130:8022' + prod-inner-end-point: 'http://10.64.111.134:8022' + is-public: true + appToken: + appId: 'CRM' + appSecuret: 'yx.CRM.tksecurit@240924' + tenantid: 'yxzg-topview-dev' + accountId: '1878420900609526784' + language: 'zh_CN' + accessToken: + user: 'COSMIC' + usertype: 'UserName' + + attachment-query-uri: /ierp/kapi/v2/yem/yem_receipt/AttachmentsQueryAPI/Query + + bill: + formId: 'yem_testbill' + attachKey: 'attachmentpanel' collabora: - # 本机局域网ip,注意 CollaboraOnline容器需要访问该地址,,最后不要加/ host-server-addr: http://192.168.3.104:8080 - - # 文件保存路径 file-storage-path: E:\Code\CollaboraOnline\files \ No newline at end of file diff --git a/src/main/resources/application-yem.yml b/src/main/resources/application-yem.yml new file mode 100644 index 0000000..34c0f9d --- /dev/null +++ b/src/main/resources/application-yem.yml @@ -0,0 +1,26 @@ +kingdee: + env: test + test-public-end-point: '' + test-inner-end-point: '' + prod-public-end-point: '' + prod-inner-end-point: '' + is-public: true + appToken: + appId: '' + appSecuret: '' + tenantid: '' + accountId: '' + language: 'zh_CN' + accessToken: + user: '' + usertype: 'UserName' + + attachment-query-uri: '' + + bill: + formId: '' + attachKey: '' + +collabora: + host-server-addr: https://web-api.wmyun.com/yem + file-storage-path: /work/projects/collabora-api/yem/file \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 3434f15..c82b269 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -2,7 +2,7 @@ spring: application: name: CollaboraOnline profiles: - active: dev + active: ensign # http://192.168.3.211:9980/browser/dist/cool.html?WOPISrc=http://192.168.3.104:8080/wopi/files/2087131858671270912&lang=zh-cn @@ -13,23 +13,4 @@ spring: # http://:<端口>/browser/dist/cool.html?WOPISrc=http://<本机IP>:<服务端口>/wopi/files/<文件名>&lang=zh-cn -# http://192.168.3.211:9980/browser/dist/cool.html?lang=zh-cn&WOPISrc=http://192.168.3.104:8080/wopi/files/2087131858671270912 -ensign: - kingdee: - env: test - test-public-end-point: 'http://122.4.221.133:8022' - test-inner-end-point: 'http://10.64.112.152:8022' - prod-public-end-point: 'http://122.4.221.130:8022' - prod-inner-end-point: 'http://10.64.111.134:8022' - is-public: true - appToken: - appId: 'CRM' - appSecuret: 'yx.CRM.tksecurit@240924' - tenantid: 'yxzg-topview-dev' - accountId: '1878420900609526784' - language: 'zh_CN' - accessToken: - user: 'COSMIC' - usertype: 'UserName' - - attachment-query-uri: /ierp/kapi/v2/yem/yem_receipt/AttachmentsQueryAPI/Query \ No newline at end of file +# http://192.168.3.211:9980/browser/dist/cool.html?lang=zh-cn&WOPISrc=http://192.168.3.104:8080/wopi/files/2087131858671270912 \ No newline at end of file