From 9a1173507d06c59a7c02e92ad083073e0036eadc Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 26 九月 2024 18:52:35 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/V3.java |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/V3.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/V3.java
index 71eb21c..68aa7ec 100644
--- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/V3.java
+++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/V3.java
@@ -5,6 +5,7 @@
 import org.apache.poi.util.IOUtils;
 
 import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -54,16 +55,21 @@
     public InputStream getPrivateKeyStream() {
         // 需要证书释放
         byte[] certData;
-        InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(this.privateKeyPath);
+//        InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(this.privateKeyPath);
+        InputStream certStream = null;
         try {
+            certStream = new FileInputStream(this.privateKeyPath);
             certData = IOUtils.toByteArray(certStream);
         } catch (IOException e) {
+            e.printStackTrace();
             throw new RuntimeException("私钥文件未找到");
         }finally {
-            try {
-                certStream.close();
-            } catch (IOException e) {
-                log.error("私钥流关闭异常");
+            if(null != certStream){
+                try {
+                    certStream.close();
+                } catch (IOException e) {
+                    log.error("私钥流关闭异常");
+                }
             }
         }
         return new ByteArrayInputStream(certData);

--
Gitblit v1.7.1