|
@@ -1,6 +1,7 @@
|
|
|
package shop.alien.dining.service.impl;
|
|
package shop.alien.dining.service.impl;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -39,10 +40,10 @@ public class DiningCouponServiceImpl implements DiningCouponService {
|
|
|
private final LifeDiscountCouponMapper lifeDiscountCouponMapper;
|
|
private final LifeDiscountCouponMapper lifeDiscountCouponMapper;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public R<List<LifeDiscountCouponVo>> getUserCouponList(String authorization, int page, int size, String tabType) {
|
|
|
|
|
- log.info("DiningCouponService.getUserCouponList page={}, size={}, tabType={}", page, size, tabType);
|
|
|
|
|
|
|
+ public R<List<LifeDiscountCouponVo>> getUserCouponList(String authorization, int page, int size, String tabType, Integer type, Integer couponType) {
|
|
|
|
|
+ log.info("DiningCouponService.getUserCouponList page={}, size={}, tabType={}, type={}, couponType={}", page, size, tabType, type, couponType);
|
|
|
try {
|
|
try {
|
|
|
- R<List<LifeDiscountCouponVo>> result = alienStoreFeign.getUserCouponList(authorization, page, size, tabType);
|
|
|
|
|
|
|
+ R<List<LifeDiscountCouponVo>> result = alienStoreFeign.getUserCouponList(authorization, page, size, tabType, type, couponType);
|
|
|
if (result == null) {
|
|
if (result == null) {
|
|
|
return R.fail("获取优惠券列表失败");
|
|
return R.fail("获取优惠券列表失败");
|
|
|
}
|
|
}
|
|
@@ -69,10 +70,10 @@ public class DiningCouponServiceImpl implements DiningCouponService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public R<Map<String, Object>> getStoreUserUsableCouponList(String authorization, String storeId, BigDecimal amount) {
|
|
|
|
|
- log.info("DiningCouponService.getStoreUserUsableCouponList storeId={}, amount={}", storeId, amount);
|
|
|
|
|
|
|
+ public R<Map<String, Object>> getStoreUserUsableCouponList(String authorization, String storeId, BigDecimal amount, Integer couponType) {
|
|
|
|
|
+ log.info("DiningCouponService.getStoreUserUsableCouponList storeId={}, amount={}, couponType={}", storeId, amount, couponType);
|
|
|
try {
|
|
try {
|
|
|
- R<Map<String, Object>> result = alienStoreFeign.getStoreUserUsableCouponList(authorization, storeId, amount);
|
|
|
|
|
|
|
+ R<Map<String, Object>> result = alienStoreFeign.getStoreUserUsableCouponList(authorization, storeId, amount, couponType);
|
|
|
if (result == null) {
|
|
if (result == null) {
|
|
|
return R.fail("获取门店可用优惠券列表失败");
|
|
return R.fail("获取门店可用优惠券列表失败");
|
|
|
}
|
|
}
|
|
@@ -126,7 +127,8 @@ public class DiningCouponServiceImpl implements DiningCouponService {
|
|
|
return R.data(new ArrayList<>());
|
|
return R.data(new ArrayList<>());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 转换为VO并设置用户券ID
|
|
|
|
|
|
|
+ // 转换为VO并设置用户券ID,同时过滤掉已过期和未在使用时间内的优惠券
|
|
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
List<LifeDiscountCouponVo> couponVos = new ArrayList<>();
|
|
List<LifeDiscountCouponVo> couponVos = new ArrayList<>();
|
|
|
for (LifeDiscountCoupon coupon : coupons) {
|
|
for (LifeDiscountCoupon coupon : coupons) {
|
|
|
// 找到对应的用户券
|
|
// 找到对应的用户券
|
|
@@ -139,6 +141,39 @@ public class DiningCouponServiceImpl implements DiningCouponService {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 过滤1:检查用户券的过期时间(expirationTime)
|
|
|
|
|
+ if (userCoupon.getExpirationTime() != null && now.isAfter(userCoupon.getExpirationTime())) {
|
|
|
|
|
+ log.debug("过滤已过期的用户券, couponId={}, expirationTime={}, now={}",
|
|
|
|
|
+ coupon.getId(), userCoupon.getExpirationTime(), now);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 过滤2:检查优惠券的使用时间范围(startDate 和 endDate)
|
|
|
|
|
+ // 如果优惠券有设置使用时间范围,则检查当前日期是否在范围内
|
|
|
|
|
+ if (coupon.getStartDate() != null || coupon.getEndDate() != null) {
|
|
|
|
|
+ boolean inTimeRange = true;
|
|
|
|
|
+ if (coupon.getStartDate() != null && now.isBefore(coupon.getStartDate())) {
|
|
|
|
|
+ // 当前日期早于开始日期,未在使用时间内
|
|
|
|
|
+ inTimeRange = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (coupon.getEndDate() != null && now.isAfter(coupon.getEndDate())) {
|
|
|
|
|
+ // 当前日期晚于结束日期,未在使用时间内
|
|
|
|
|
+ inTimeRange = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!inTimeRange) {
|
|
|
|
|
+ log.debug("过滤未在使用时间内的优惠券, couponId={}, startDate={}, endDate={}, now={}",
|
|
|
|
|
+ coupon.getId(), coupon.getStartDate(), coupon.getEndDate(), now);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 过滤3:检查优惠券的有效期(validDate)
|
|
|
|
|
+ if (coupon.getValidDate() != null && now.isAfter(coupon.getValidDate())) {
|
|
|
|
|
+ log.debug("过滤已过期的优惠券(validDate), couponId={}, validDate={}, now={}",
|
|
|
|
|
+ coupon.getId(), coupon.getValidDate(), now);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
LifeDiscountCouponVo vo = convertToVo(coupon, userCoupon);
|
|
LifeDiscountCouponVo vo = convertToVo(coupon, userCoupon);
|
|
|
couponVos.add(vo);
|
|
couponVos.add(vo);
|
|
|
}
|
|
}
|
|
@@ -160,13 +195,14 @@ public class DiningCouponServiceImpl implements DiningCouponService {
|
|
|
return 1; // vo2 排在前面
|
|
return 1; // vo2 排在前面
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 第二优先级:优惠力度大的优先(nominalValue 大的)
|
|
|
|
|
- BigDecimal nominalValue1 = vo1.getNominalValue() != null ? vo1.getNominalValue() : BigDecimal.ZERO;
|
|
|
|
|
- BigDecimal nominalValue2 = vo2.getNominalValue() != null ? vo2.getNominalValue() : BigDecimal.ZERO;
|
|
|
|
|
- return nominalValue2.compareTo(nominalValue1); // 降序排列
|
|
|
|
|
|
|
+ // 第二优先级:优惠力度大的优先(根据优惠券类型计算实际优惠金额)
|
|
|
|
|
+ BigDecimal discountAmount1 = calculateDiscountAmountForVO(vo1, amount);
|
|
|
|
|
+ BigDecimal discountAmount2 = calculateDiscountAmountForVO(vo2, amount);
|
|
|
|
|
+ return discountAmount2.compareTo(discountAmount1); // 降序排列
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- // 如果没有提供金额,只按优惠力度排序
|
|
|
|
|
|
|
+ // 如果没有提供金额,无法计算折扣券的实际优惠金额,只按面值排序(满减券)
|
|
|
|
|
+ // 注意:这种情况下折扣券无法准确排序,建议前端传入订单金额
|
|
|
couponVos.sort((vo1, vo2) -> {
|
|
couponVos.sort((vo1, vo2) -> {
|
|
|
BigDecimal nominalValue1 = vo1.getNominalValue() != null ? vo1.getNominalValue() : BigDecimal.ZERO;
|
|
BigDecimal nominalValue1 = vo1.getNominalValue() != null ? vo1.getNominalValue() : BigDecimal.ZERO;
|
|
|
BigDecimal nominalValue2 = vo2.getNominalValue() != null ? vo2.getNominalValue() : BigDecimal.ZERO;
|
|
BigDecimal nominalValue2 = vo2.getNominalValue() != null ? vo2.getNominalValue() : BigDecimal.ZERO;
|
|
@@ -183,6 +219,165 @@ public class DiningCouponServiceImpl implements DiningCouponService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R<List<LifeDiscountCouponVo>> getStoreUserCouponList(String authorization, String storeId, Integer couponType) {
|
|
|
|
|
+ log.info("DiningCouponService.getStoreUserCouponList storeId={}, couponType={}", storeId, couponType);
|
|
|
|
|
+ try {
|
|
|
|
|
+ R<List<LifeDiscountCouponVo>> result = alienStoreFeign.getStoreUserCouponList(authorization, storeId, couponType);
|
|
|
|
|
+ if (result == null) {
|
|
|
|
|
+ return R.fail("获取该用户该店铺优惠券列表失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("DiningCouponService.getStoreUserCouponList ERROR Msg={}", e.getMessage());
|
|
|
|
|
+ return R.fail("获取该用户该店铺优惠券列表失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R<IPage<LifeDiscountCouponVo>> getStoreAllCouponList(String authorization, int page, int size, String storeId,
|
|
|
|
|
+ String couponName, String tab, int couponsFromType,
|
|
|
|
|
+ int couponStatus, Integer couponType) {
|
|
|
|
|
+ log.info("DiningCouponService.getStoreAllCouponList storeId={}, page={}, size={}, couponName={}, tab={}, couponsFromType={}, couponStatus={}, couponType={}",
|
|
|
|
|
+ storeId, page, size, couponName, tab, couponsFromType, couponStatus, couponType);
|
|
|
|
|
+ try {
|
|
|
|
|
+ // Feign 返回 Page 类型(具体实现类),但 Service 接口使用 IPage(接口类型)
|
|
|
|
|
+ // Page 实现了 IPage,所以可以直接返回
|
|
|
|
|
+ R<com.baomidou.mybatisplus.extension.plugins.pagination.Page<LifeDiscountCouponVo>> result = alienStoreFeign.getStoreAllCouponList(
|
|
|
|
|
+ authorization, page, size, storeId, couponName, tab, couponsFromType, couponStatus, couponType);
|
|
|
|
|
+ if (result == null) {
|
|
|
|
|
+ return R.fail("获取该店铺所有优惠券列表失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ // Page 实现了 IPage 接口,可以直接转换
|
|
|
|
|
+ return R.data(result.getData());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("DiningCouponService.getStoreAllCouponList ERROR Msg={}", e.getMessage(), e);
|
|
|
|
|
+ return R.fail("获取该店铺所有优惠券列表失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R<List<LifeDiscountCouponVo>> getUserOwnedCouponsByStore(String storeId, Integer couponType) {
|
|
|
|
|
+ log.info("查询用户目前所拥有的优惠券, storeId={}, couponType={}", storeId, couponType);
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 获取当前用户ID
|
|
|
|
|
+ Integer userId = TokenUtil.getCurrentUserId();
|
|
|
|
|
+ if (userId == null) {
|
|
|
|
|
+ return R.fail("用户未登录");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询用户拥有的优惠券(未使用且未过期的)
|
|
|
|
|
+ LambdaQueryWrapper<LifeDiscountCouponUser> userWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ userWrapper.eq(LifeDiscountCouponUser::getUserId, userId);
|
|
|
|
|
+ userWrapper.eq(LifeDiscountCouponUser::getStatus, 0); // 0:待使用
|
|
|
|
|
+ userWrapper.eq(LifeDiscountCouponUser::getDeleteFlag, 0);
|
|
|
|
|
+ userWrapper.ge(LifeDiscountCouponUser::getExpirationTime, LocalDate.now()); // 未过期
|
|
|
|
|
+ List<LifeDiscountCouponUser> userCoupons = lifeDiscountCouponUserMapper.selectList(userWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if (userCoupons == null || userCoupons.isEmpty()) {
|
|
|
|
|
+ log.info("用户没有可用的优惠券, userId={}", userId);
|
|
|
|
|
+ return R.data(new ArrayList<>());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取优惠券ID列表
|
|
|
|
|
+ List<Integer> couponIds = userCoupons.stream()
|
|
|
|
|
+ .map(LifeDiscountCouponUser::getCouponId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ // 查询优惠券详情
|
|
|
|
|
+ LambdaQueryWrapper<LifeDiscountCoupon> couponWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ couponWrapper.in(LifeDiscountCoupon::getId, couponIds);
|
|
|
|
|
+ couponWrapper.eq(LifeDiscountCoupon::getDeleteFlag, 0);
|
|
|
|
|
+ // 如果提供了商铺ID,则只查询该商铺的优惠券
|
|
|
|
|
+ if (StringUtils.hasText(storeId)) {
|
|
|
|
|
+ couponWrapper.eq(LifeDiscountCoupon::getStoreId, storeId);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 如果提供了优惠券类型,则只查询该类型的优惠券
|
|
|
|
|
+ if (couponType != null) {
|
|
|
|
|
+ couponWrapper.eq(LifeDiscountCoupon::getCouponType, couponType);
|
|
|
|
|
+ }
|
|
|
|
|
+ List<LifeDiscountCoupon> coupons = lifeDiscountCouponMapper.selectList(couponWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if (coupons == null || coupons.isEmpty()) {
|
|
|
|
|
+ log.info("未找到优惠券详情, userId={}, storeId={}, couponIds={}", userId, storeId, couponIds);
|
|
|
|
|
+ return R.data(new ArrayList<>());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 转换为VO并设置用户券ID,同时过滤掉已过期和未在使用时间内的优惠券
|
|
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
|
|
+ List<LifeDiscountCouponVo> couponVos = new ArrayList<>();
|
|
|
|
|
+ for (LifeDiscountCoupon coupon : coupons) {
|
|
|
|
|
+ // 找到对应的用户券
|
|
|
|
|
+ LifeDiscountCouponUser userCoupon = userCoupons.stream()
|
|
|
|
|
+ .filter(uc -> uc.getCouponId().equals(coupon.getId()))
|
|
|
|
|
+ .findFirst()
|
|
|
|
|
+ .orElse(null);
|
|
|
|
|
+
|
|
|
|
|
+ if (userCoupon == null) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 过滤1:检查用户券的过期时间(expirationTime)
|
|
|
|
|
+ if (userCoupon.getExpirationTime() != null && now.isAfter(userCoupon.getExpirationTime())) {
|
|
|
|
|
+ log.debug("过滤已过期的用户券, couponId={}, expirationTime={}, now={}",
|
|
|
|
|
+ coupon.getId(), userCoupon.getExpirationTime(), now);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 过滤2:检查优惠券的使用时间范围(startDate 和 endDate)
|
|
|
|
|
+ // 如果优惠券有设置使用时间范围,则检查当前日期是否在范围内
|
|
|
|
|
+ if (coupon.getStartDate() != null || coupon.getEndDate() != null) {
|
|
|
|
|
+ boolean inTimeRange = true;
|
|
|
|
|
+ if (coupon.getStartDate() != null && now.isBefore(coupon.getStartDate())) {
|
|
|
|
|
+ // 当前日期早于开始日期,未在使用时间内
|
|
|
|
|
+ inTimeRange = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (coupon.getEndDate() != null && now.isAfter(coupon.getEndDate())) {
|
|
|
|
|
+ // 当前日期晚于结束日期,未在使用时间内
|
|
|
|
|
+ inTimeRange = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!inTimeRange) {
|
|
|
|
|
+ log.debug("过滤未在使用时间内的优惠券, couponId={}, startDate={}, endDate={}, now={}",
|
|
|
|
|
+ coupon.getId(), coupon.getStartDate(), coupon.getEndDate(), now);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 过滤3:检查优惠券的有效期(validDate)
|
|
|
|
|
+ if (coupon.getValidDate() != null && now.isAfter(coupon.getValidDate())) {
|
|
|
|
|
+ log.debug("过滤已过期的优惠券(validDate), couponId={}, validDate={}, now={}",
|
|
|
|
|
+ coupon.getId(), coupon.getValidDate(), now);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ LifeDiscountCouponVo vo = convertToVo(coupon, userCoupon);
|
|
|
|
|
+ couponVos.add(vo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 按创建时间倒序排列(最新的在前)
|
|
|
|
|
+ couponVos.sort((vo1, vo2) -> {
|
|
|
|
|
+ if (vo1.getCreatedTime() == null && vo2.getCreatedTime() == null) {
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (vo1.getCreatedTime() == null) {
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (vo2.getCreatedTime() == null) {
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ return vo2.getCreatedTime().compareTo(vo1.getCreatedTime()); // 降序排列
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ log.info("查询用户拥有的优惠券成功, userId={}, storeId={}, count={}", userId, storeId, couponVos.size());
|
|
|
|
|
+ return R.data(couponVos);
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("查询用户拥有的优惠券失败: {}", e.getMessage(), e);
|
|
|
|
|
+ return R.fail("查询用户拥有的优惠券失败: " + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 将优惠券实体转换为VO
|
|
* 将优惠券实体转换为VO
|
|
|
*/
|
|
*/
|
|
@@ -211,4 +406,48 @@ public class DiningCouponServiceImpl implements DiningCouponService {
|
|
|
vo.setDiscountRate(coupon.getDiscountRate());
|
|
vo.setDiscountRate(coupon.getDiscountRate());
|
|
|
return vo;
|
|
return vo;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 计算优惠券的实际优惠金额(用于排序)
|
|
|
|
|
+ * 根据优惠券类型(满减券或折扣券)计算实际优惠金额
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param vo 优惠券VO
|
|
|
|
|
+ * @param orderAmount 订单金额(用于计算折扣券的优惠金额)
|
|
|
|
|
+ * @return 实际优惠金额
|
|
|
|
|
+ */
|
|
|
|
|
+ private BigDecimal calculateDiscountAmountForVO(LifeDiscountCouponVo vo, BigDecimal orderAmount) {
|
|
|
|
|
+ if (vo == null) {
|
|
|
|
|
+ return BigDecimal.ZERO;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Integer couponType = vo.getCouponType();
|
|
|
|
|
+ BigDecimal discountAmount = BigDecimal.ZERO;
|
|
|
|
|
+
|
|
|
|
|
+ if (couponType != null && couponType == 2) {
|
|
|
|
|
+ // 折扣券:根据折扣率计算优惠金额
|
|
|
|
|
+ // discountRate: 0-100,例如80表示8折,优惠金额 = 订单金额 * (100 - discountRate) / 100
|
|
|
|
|
+ BigDecimal discountRate = vo.getDiscountRate();
|
|
|
|
|
+ if (discountRate != null && discountRate.compareTo(BigDecimal.ZERO) > 0
|
|
|
|
|
+ && discountRate.compareTo(new BigDecimal(100)) <= 0 && orderAmount != null
|
|
|
|
|
+ && orderAmount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
+ // 计算折扣后的金额
|
|
|
|
|
+ BigDecimal discountedAmount = orderAmount.multiply(discountRate)
|
|
|
|
|
+ .divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ // 优惠金额 = 原价 - 折扣后价格
|
|
|
|
|
+ discountAmount = orderAmount.subtract(discountedAmount);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 满减券(默认或couponType=1):使用nominalValue
|
|
|
|
|
+ discountAmount = vo.getNominalValue();
|
|
|
|
|
+ if (discountAmount == null) {
|
|
|
|
|
+ discountAmount = BigDecimal.ZERO;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 优惠金额不能超过订单总金额
|
|
|
|
|
+ if (orderAmount != null && discountAmount.compareTo(orderAmount) > 0) {
|
|
|
|
|
+ discountAmount = orderAmount;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return discountAmount;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|