From fd71964a2c4d740612f05f58dd29de4b0ce8991b Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期一, 21 九月 2026 11:22:35 +0800
Subject: [PATCH] bug:优惠券选择bug

---
 cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java |   35 +++++++++++++++++++++++++++--------
 1 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
index 81351fc..0ed403f 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -1481,6 +1481,10 @@
     @Override
     @Transactional
     public synchronized ResultUtil productRedemptionOperation(Integer userIdFormRedis, GoodsExchangeVo exchangeType) {
+        // 兼容前端历史参数 chooseCouponId,内部统一使用 couponId。
+        if (exchangeType.getCouponId() == null && exchangeType.getChooseCouponId() != null) {
+            exchangeType.setCouponId(exchangeType.getChooseCouponId());
+        }
         ReturnModel returnModel = new ReturnModel();
         Long returnId = null;
         //如果是兑换优惠卷
@@ -1750,6 +1754,7 @@
                     return ResultUtil.error("用户积分不足!");
                 }
                 returnModel.setReturnId(returnId);
+                returnModel.setPaySuccess(true);
                 return ResultUtil.success(returnModel);
             }
 
@@ -1899,6 +1904,7 @@
             }
 
             returnModel.setReturnId(returnId);
+            returnModel.setPaySuccess(pointsMerchandise.getPayStatus() == 2);
             return ResultUtil.success(returnModel);
         } catch (Exception e) {
             e.printStackTrace();
@@ -2253,7 +2259,20 @@
                 }
             }).start();
         }
-        return alipay;
+        return appendPaySuccess(alipay);
+    }
+
+    /**
+     * 支付宝、微信的成功响应仅表示已生成支付单,客户端仍需拉起第三方支付。
+     */
+    private ResultUtil appendPaySuccess(ResultUtil paymentResult) {
+        JSONObject data = paymentResult.getData() == null ? new JSONObject()
+                : JSON.parseObject(JSON.toJSONString(paymentResult.getData()));
+        if (data == null) {
+            data = new JSONObject();
+        }
+        data.put("paySuccess", false);
+        return ResultUtil.getResult(paymentResult.getCode(), paymentResult.getMsg(), data);
     }
 
 
@@ -2275,7 +2294,7 @@
                         // 平台门票
                         ResultUtil weixinpay = payMoneyUtil.weixinpay(name, "", code, cash.toString(),
                                 "/base/pointMer/exchangeGoodPaymentWeChatCallback", "APP", "");
-                        return weixinpay;
+                        return appendPaySuccess(weixinpay);
                     } else {
                         String s2 = storeClient.getmerchantNumberByOperatorId(store1.getOperatorId());
                         System.err.println("微信商户号" + s2);
@@ -2286,7 +2305,7 @@
                         ResultUtil weixinpay = payMoneyUtil.weixinpayV3(s2, name, code,
                                 "/base/pointMer/exchangeGoodPaymentWeChatCallback1",
                                 cash.toString());
-                        return weixinpay;
+                        return appendPaySuccess(weixinpay);
                     }
                 }
                 break;
@@ -2298,7 +2317,7 @@
                     // 平台课包
                     ResultUtil weixinpay = payMoneyUtil.weixinpay(name, "", code, cash.toString(),
                             "/base/pointMer/exchangeGoodPaymentWeChatCallback", "APP", "");
-                    return weixinpay;
+                    return appendPaySuccess(weixinpay);
                 } else {
                     String s2 = storeClient.getmerchantNumberByOperatorId(store.getOperatorId());
                     System.err.println("微信商户号" + s2);
@@ -2309,7 +2328,7 @@
                     ResultUtil weixinpay = payMoneyUtil.weixinpayV3(s2, name, code,
                             "/base/pointMer/exchangeGoodPaymentWeChatCallback1",
                             cash.toString());
-                    return weixinpay;
+                    return appendPaySuccess(weixinpay);
                 }
             case 3:
                 if (!integers.isEmpty()) {
@@ -2318,7 +2337,7 @@
                         // 平台门票
                         ResultUtil weixinpay = payMoneyUtil.weixinpay(name, "", code, cash.toString(),
                                 "/base/pointMer/exchangeGoodPaymentWeChatCallback", "APP", "");
-                        return weixinpay;
+                        return appendPaySuccess(weixinpay);
                     } else {
                         String s2 = storeClient.getmerchantNumberByOperatorId(store1.getOperatorId());
                         System.err.println("微信商户号" + s2);
@@ -2329,13 +2348,13 @@
                         ResultUtil weixinpay = payMoneyUtil.weixinpayV3(s2, name, code,
                                 "/base/pointMer/exchangeGoodPaymentWeChatCallback1",
                                 cash.toString());
-                        return weixinpay;
+                        return appendPaySuccess(weixinpay);
                     }
                 } else {
                     // 平台门票
                     ResultUtil weixinpay = payMoneyUtil.weixinpay(name, "", code, cash.toString(),
                             "/base/pointMer/exchangeGoodPaymentWeChatCallback", "APP", "");
-                    return weixinpay;
+                    return appendPaySuccess(weixinpay);
 
                 }
         }

--
Gitblit v1.7.1