fix: 霸王餐扣减优惠券金额

This commit is contained in:
2024-10-30 09:38:49 +08:00
parent 270c274d63
commit 250f751e64
4 changed files with 9 additions and 1 deletions

View File

@@ -2,11 +2,14 @@ package com.chaozhanggui.system.cashierservice.entity.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class TbUserCouponVo {
private Integer id;
private BigDecimal fullAmount;
private BigDecimal discountAmount;
private Integer couponId;
private Integer proId;
//优惠券名称

View File

@@ -423,6 +423,8 @@ public class PayService {
if (userCouponVo == null) {
throw new MsgException("存在不可用优惠券");
}
shouldPayAmount = shouldPayAmount.subtract(userCouponVo.getDiscountAmount());
ActivateInInfoVO activateInInfoVO = new ActivateInInfoVO()
.setId(userCouponVo.getId())
.setCouponId(userCouponVo.getCouponId())

View File

@@ -54,7 +54,8 @@ public class TbShopCouponServiceImpl implements TbShopCouponService {
//券id 券使用描述
Map<Integer, JsonObject> coupons = new HashMap<>();
for (TbUserCouponVo tbUserCouponVo : tbUserCouponVos) {
if (tbUserCouponVo.getType() != null && tbUserCouponVo.getType() == 1) {
if (tbUserCouponVo.getType() != null && tbUserCouponVo.getType() == 1 &&
tbUserCouponVo.getFullAmount().compareTo(amount) <= 0) {
if (!coupons.containsKey(tbUserCouponVo.getCouponId())) {
setCouponInfo(coupons, tbUserCouponVo, amount, week, now, formatter);
}