lhy 10 месяцев назад
Родитель
Сommit
9bea81cb52

+ 4 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/validate/dataSource/KeyStoreLoader.java

@@ -7,6 +7,8 @@ import org.eclipse.milo.opcua.stack.core.util.SelfSignedCertificateBuilder;
 import org.eclipse.milo.opcua.stack.core.util.SelfSignedCertificateGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
 
 import java.io.File;
 import java.io.IOException;
@@ -37,7 +39,8 @@ public class KeyStoreLoader {
     public KeyStoreLoader getKeyStoreLoader(OpcuaClientConfig opcuaClientConfig) throws Exception {
         String certificateAlias = opcuaClientConfig.getCertAlias();
         char[] certificateKey = opcuaClientConfig.getCertKeystorePassword().toCharArray();
-        String certificateDir = new File(this.getClass().getClassLoader().getResource("").toURI()).getAbsolutePath() + "\\" + opcuaClientConfig.getCertPath();
+
+        String certificateDir = opcuaClientConfig.getCertPath();
         if(!FileUtil.exist(certificateDir)){
             FileUtil.mkdir(certificateDir);
         }

+ 7 - 2
industry-system/industry-da/src/main/resources/application-dev.yml

@@ -6,6 +6,11 @@ file:
   # 清理间隔时间段前的pdf打印临时文件,单位:天
   # 默认清理1天前的pdf打印临时文件
   pdf-delete-days: 1
+#opcua客户端配置参数
+opcua:
+  client:
+    cert:
+      path: "D:/security"
 
 spring:
   servlet:
@@ -50,8 +55,8 @@ spring:
 
 #mybatis:
 #  configuration:
-#    开启sql日志文件
+#    #开启sql日志文件
 #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #logging:
 #  level:
-#    root: error
+#    root: info

+ 5 - 0
industry-system/industry-da/src/main/resources/application-prod.yml

@@ -6,6 +6,11 @@ file:
   # 清理间隔时间段前的pdf打印临时文件,单位:天
   # 默认清理1天前的pdf打印临时文件
   pdf-delete-days: 1
+#opcua客户端配置参数
+opcua:
+  client:
+    cert:
+      path: "/home/security"
 
 spring:
   servlet:

+ 7 - 2
industry-system/industry-da/src/main/resources/application-test.yml

@@ -1,11 +1,16 @@
 server:
   port: 8089
 file:
-  path: E:/EI_Report/upload/chuanyi/
-  commonPath: E:/EI_Report/upload/file/
+  path: /EI_Report/upload/chuanyi/
+  commonPath: /EI_Report/upload/file/
   # 清理间隔时间段前的pdf打印临时文件,单位:天
   # 默认清理1天前的pdf打印临时文件
   pdf-delete-days: 1
+#opcua客户端配置参数
+opcua:
+  client:
+    cert:
+      path: "/EI_Report/security"
 
 spring:
   servlet:

+ 2 - 1
industry-system/industry-da/src/main/resources/application.yml

@@ -37,7 +37,8 @@ opcua:
       name: "UaClient@cydcs"
       uri: "urn:cydcs:UnifiedAutomation:UaExpert@cydcs"
     cert:
-      path: "security"
+      # 在子配置文件中配置
+      path: ""
       file: "cydcs-uaclient.pfx"
       alias: "cydcs-uaclient"
       commonName: "UaClient@cydcs"