From afa61267844723f906a632e4ac8b30f91cf4a3c0 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期一, 21 九月 2026 11:56:04 +0800
Subject: [PATCH] bug:获取优惠券接口问题
---
cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java | 3 ++-
1 files changed, 2 insertions(+), 1 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 0ed403f..f33edaf 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
@@ -1611,9 +1611,10 @@
.divide(BigDecimal.valueOf(exchangeType.getNums() == null ? 1 : exchangeType.getNums()), 2, java.math.RoundingMode.HALF_UP);
} else if (Integer.valueOf(2).equals(coupon.getType())) {
BigDecimal deduction = rule.getBigDecimal("conditionalAmount");
- if (deduction == null || orderCash.compareTo(deduction) < 0) {
+ if (deduction == null || deduction.compareTo(BigDecimal.ZERO) <= 0) {
return ResultUtil.error("该优惠券无法使用");
}
+ // 代金券可覆盖全部订单金额,超出订单金额的部分不找零。
ticketPayableCashAmount = orderCash.subtract(deduction).max(BigDecimal.ZERO);
cashAmount = ticketPayableCashAmount
.divide(BigDecimal.valueOf(exchangeType.getNums() == null ? 1 : exchangeType.getNums()), 2, java.math.RoundingMode.HALF_UP);
--
Gitblit v1.7.1