From 8a85fc834d98b2c14c5b886a957ccf3197aad293 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期日, 20 九月 2026 17:12:28 +0800
Subject: [PATCH] feat:优惠券使用入口:购买门票、预定场地、购买惠民卡
---
cloud-server-activity/src/main/java/com/dsh/activity/service/impl/UserCouponServiceImpl.java | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/service/impl/UserCouponServiceImpl.java b/cloud-server-activity/src/main/java/com/dsh/activity/service/impl/UserCouponServiceImpl.java
index 6bb6d60..047b47c 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/service/impl/UserCouponServiceImpl.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/service/impl/UserCouponServiceImpl.java
@@ -128,7 +128,10 @@
}
try {
JSONObject content = JSON.parseObject(coupon.getContent());
- BigDecimal deductionAmount = content.getBigDecimal("deductionAmount");
+ // 满减券使用 deductionAmount,代金券历史规则将抵扣额存放在 conditionalAmount。
+ BigDecimal deductionAmount = Integer.valueOf(2).equals(coupon.getType())
+ ? content.getBigDecimal("conditionalAmount")
+ : content.getBigDecimal("deductionAmount");
return deductionAmount == null ? BigDecimal.ZERO : deductionAmount.max(BigDecimal.ZERO);
} catch (Exception e) {
LOGGER.warn("解析优惠券抵扣规则失败,couponId={}", coupon.getId(), e);
@@ -155,6 +158,10 @@
List<CouponListVo> listVos = new ArrayList<>();
for (Map<String, Object> userCoupon : userCoupons) {
Integer type = Integer.valueOf(userCoupon.get("type").toString());
+ // 支付减免只支持满减券和代金券;体验券/抵扣券不能用于订单金额计算。
+ if (type != 1 && type != 2) {
+ continue;
+ }
CouponListVo couponListVo = new CouponListVo();
couponListVo.setId(Long.valueOf(userCoupon.get("id").toString()));
couponListVo.setName(userCoupon.get("name").toString());
@@ -204,7 +211,11 @@
@Override
public List<CouponListVo> querySiteCouponList(Integer uid, Integer siteId, Double price, String lon, String lat) throws Exception {
Site site = siteClient.querySiteById(siteId);
- Integer storeId = site.getStoreId();
+ return queryStoreCouponList(uid, site.getStoreId(), price, lon, lat);
+ }
+
+ @Override
+ public List<CouponListVo> queryStoreCouponList(Integer uid, Integer storeId, Double price, String lon, String lat) throws Exception {
Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat);
String provinceCode = geocode.get("provinceCode");
String cityCode = geocode.get("cityCode");
@@ -212,6 +223,9 @@
List<CouponListVo> listVos = new ArrayList<>();
for (Map<String, Object> userCoupon : userCoupons) {
Integer type = Integer.valueOf(userCoupon.get("type").toString());
+ if (type != 1 && type != 2) {
+ continue;
+ }
CouponListVo couponListVo = new CouponListVo();
couponListVo.setId(Long.valueOf(userCoupon.get("id").toString()));
couponListVo.setName(userCoupon.get("name").toString());
--
Gitblit v1.7.1