Browse Source

逻辑优化

lighter 4 months ago
parent
commit
2e807fe610

+ 3 - 0
src/main/java/thyyxxk/wxservice_server/service/SavePayResultService.java

@@ -267,6 +267,9 @@ public class SavePayResultService {
     public String saveWxMallPackage(WxPayOrder order, String payTime) {
         String save = packageMallService.savePurchase(order);
         if (Objects.equals(save, "SUCCESS")) {
+            if (StringUtil.notBlank(order.getCouponId())) {
+                dao.couponUsed(order.getCouponId());
+            }
             return payTime;
         }
         return save;

+ 2 - 1
src/main/java/thyyxxk/wxservice_server/service/WxApiService.java

@@ -67,7 +67,8 @@ public class WxApiService {
     public ResultVo<WxPayOrder> createPayOrder(WxPayOrder order) {
         WxPayOrder existOrder = getExistOrder(order);
         if (null != existOrder) {
-            if (existOrder.getTradeState() == Transaction.TradeStateEnum.SUCCESS) {
+            if (existOrder.getTradeState() == Transaction.TradeStateEnum.SUCCESS
+                && existOrder.getCashpayAmt().compareTo(BigDecimal.ZERO) > 0) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR,
                         "您已支付过一笔相同金额的订单,请勿重复支付。");
             }