fllmoyu 4 лет назад
Родитель
Сommit
f83cba0707

+ 2 - 1
web/src/main/java/com/jpsoft/enterprise/modules/pay/alipay/AlipayController.java

@@ -164,7 +164,7 @@ public class AlipayController {
 
     @ApiOperation(value = "支付宝扫码支付")
     @GetMapping("/tradePrecreatePay")
-    public MessageResult tradePrecreatePay(String orderId) {
+    public MessageResult tradePrecreatePay(String orderId,String openId) {
 
         MessageResult result = new MessageResult();
 
@@ -185,6 +185,7 @@ public class AlipayController {
                 throw new Exception("订单状态有误");
             }
 
+            orderInfo.setOpenId(openId);
             orderInfoService.update(orderInfo);
 
             String appAuthToken = aliPayJpsoftConfig.getAppAuthToken();

+ 7 - 4
web/src/main/java/com/jpsoft/enterprise/modules/pay/weixin/WxPayController.java

@@ -61,7 +61,7 @@ public class WxPayController {
 
     @ApiOperation(value = "微信JSAPI支付公用方法")
     @GetMapping("/wxJsapiPay")
-    public MessageResult wxJsapiPay(String orderId) {
+    public MessageResult wxJsapiPay(String orderId,String openId) {
         MessageResult msgResult = new MessageResult<>();
         try {
             OrderInfo orderInfo = orderInfoService.get(orderId);
@@ -69,11 +69,15 @@ public class WxPayController {
             if (orderInfo == null) {
                 throw new Exception("订单不存在");
             }
+            if (StringUtils.isBlank(openId)){
+                throw new Exception("openId为空");
+            }
 
+            orderInfo.setOpenId(openId);
 
             String subMchId = wxJpsoftConfig.getSubMchId();
 
-            PersonInfo personInfo = personInfoService.findByOpenId(orderInfo.getOpenId());
+            PersonInfo personInfo = personInfoService.findByOpenId(openId);
 
             if (personInfo == null) {
                 throw new Exception("订单支付人不存在");
@@ -92,9 +96,8 @@ public class WxPayController {
             if (StringUtils.isNotBlank(wxJpsoftConfig.getUrlKey()) && !outOrderNo.contains(wxJpsoftConfig.getUrlKey())) {
                 outOrderNo = wxJpsoftConfig.getUrlKey() + outOrderNo;
                 orderInfo.setOutOrderNo(outOrderNo);
-                orderInfoService.update(orderInfo);
             }
-
+            orderInfoService.update(orderInfo);
             //金额处理
             int wxTotalTee = orderInfo.getTotalFee().multiply(new BigDecimal(100)).intValue();
             Map<String, String> params = UnifiedOrderModel