Browse Source

fix 设备管理

Administrator 1 year ago
parent
commit
c3450ec8bb

+ 2 - 2
ruoyi-admin/src/main/resources/application.yml

@@ -79,13 +79,13 @@ wx:
   # 微信小程序appid
   app-id: wx4492fe7554b0cb0a
   # 商户号
-  mch-id: xxxx
+  mch-id: 1631832354
   # 证书序列号
   mch-serial-no: xxxxx
   # 小程序密钥
   app-secret: 4b0d27de8fe102c788acaa757e421f78
   # api密钥
-  api-key: xxxxxxxx
+  api-key: tzsdmgtxcx1937879258888125555541
   # 回调接口地址
   notify-url: https://xxxx/a/biz/wxpay/payNotify
   # 证书地址

+ 4 - 3
ruoyi-system/src/main/java/com/ruoyi/system/domain/wx/WxPayOrderReqVo.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.domain.wx;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
 
 /**
  * 预支付请求类
@@ -17,7 +18,7 @@ public class WxPayOrderReqVo {
     private String orderType;
 
     @NotNull(message = "总金额不能为空!")
-    private Integer totalPrice;
+    private BigDecimal totalPrice;
 
     @NotBlank(message = "商品名称不能为空!")
     private String goodsName;
@@ -36,11 +37,11 @@ public class WxPayOrderReqVo {
         this.orderType = orderType;
     }
 
-    public Integer getTotalPrice() {
+    public BigDecimal getTotalPrice() {
         return totalPrice;
     }
 
-    public void setTotalPrice(Integer totalPrice) {
+    public void setTotalPrice(BigDecimal totalPrice) {
         this.totalPrice = totalPrice;
     }
 

+ 9 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/wx/WxPayV3Bean.java

@@ -14,14 +14,23 @@ import org.springframework.stereotype.Component;
 public class WxPayV3Bean {
     private String appId;
 
+    /**
+     *  商户号
+     */
     private String mchId;
 
+    /**
+     * 证书序列号
+     */
     private String mchSerialNo;
 
     private String appSecret;
 
     private String apiKey;
 
+    /**
+     * 回调接口地址
+     */
     private String notifyUrl;
 
     private String keyPath;

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WxPayServiceImpl.java

@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -102,7 +103,7 @@ public class WxPayServiceImpl implements IWxPayService {
             PrepayRequest request = new PrepayRequest();
             Amount amount = new Amount();
             //元转分
-            amount.setTotal(req.getTotalPrice() * 100);
+            amount.setTotal((req.getTotalPrice().multiply(new BigDecimal(100))).intValue());
             request.setAmount(amount);
             request.setAppid(wxPayV3Bean.getAppId());
             request.setMchid(wxPayV3Bean.getMchId());