Przeglądaj źródła

feature 修改key的配置文件

xiahan 4 miesięcy temu
rodzic
commit
d4d56c382a

+ 5 - 2
zhsw-common/src/main/java/com/rongwei/zhsw/system/utils/WxPayApi.java

@@ -8,6 +8,7 @@ import com.wechat.pay.java.service.payments.jsapi.model.*;
 import com.wechat.pay.java.service.payments.model.Transaction;
 import lombok.SneakyThrows;
 
+import java.net.URL;
 import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 
@@ -50,8 +51,9 @@ public class WxPayApi {
 
     @SneakyThrows
     public void initMerchant() {
-        String keyPath = WxPayApi.class.getClassLoader().getResource("").getPath() + privateKeyPath + "/apiclient_key.pem";
-        keyPath = URLDecoder.decode(keyPath, StandardCharsets.UTF_8.toString());
+        // String keyPath = WxPayApi.class.getClassLoader().getResource("").getPath() + privateKeyPath + "/apiclient_key.pem";
+        // keyPath = URLDecoder.decode(keyPath, StandardCharsets.UTF_8.toString());
+        String keyPath="weChatPayKey/"+privateKeyPath+"/apiclient_key.pem";
         Config config =
                 new RSAAutoCertificateConfig.Builder()
                         .merchantId(merchantId)
@@ -103,4 +105,5 @@ public class WxPayApi {
         return service.queryOrderByOutTradeNo(request);
     }
 
+
 }

+ 3 - 2
zhsw-common/src/main/java/com/rongwei/zhsw/system/utils/WxRefundApi.java

@@ -50,8 +50,9 @@ public class WxRefundApi {
 
     @SneakyThrows
     public void initMerchant() {
-        String keyPath = WxPayApi.class.getClassLoader().getResource("").getPath() + privateKeyPath + "/apiclient_key.pem";
-        keyPath = URLDecoder.decode(keyPath, StandardCharsets.UTF_8.toString());
+        // String keyPath = WxPayApi.class.getClassLoader().getResource("").getPath() + privateKeyPath + "/apiclient_key.pem";
+        // keyPath = URLDecoder.decode(keyPath, StandardCharsets.UTF_8.toString());
+        String keyPath="weChatPayKey/"+privateKeyPath+"/apiclient_key.pem";
         Config config =
                 new RSAAutoCertificateConfig.Builder()
                         .merchantId(merchantId)