fix: 霸王餐扣减优惠券金额
This commit is contained in:
@@ -2,11 +2,14 @@ package com.chaozhanggui.system.cashierservice.entity.vo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TbUserCouponVo {
|
public class TbUserCouponVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
private BigDecimal fullAmount;
|
||||||
|
private BigDecimal discountAmount;
|
||||||
private Integer couponId;
|
private Integer couponId;
|
||||||
private Integer proId;
|
private Integer proId;
|
||||||
//优惠券名称
|
//优惠券名称
|
||||||
|
|||||||
@@ -423,6 +423,8 @@ public class PayService {
|
|||||||
if (userCouponVo == null) {
|
if (userCouponVo == null) {
|
||||||
throw new MsgException("存在不可用优惠券");
|
throw new MsgException("存在不可用优惠券");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldPayAmount = shouldPayAmount.subtract(userCouponVo.getDiscountAmount());
|
||||||
ActivateInInfoVO activateInInfoVO = new ActivateInInfoVO()
|
ActivateInInfoVO activateInInfoVO = new ActivateInInfoVO()
|
||||||
.setId(userCouponVo.getId())
|
.setId(userCouponVo.getId())
|
||||||
.setCouponId(userCouponVo.getCouponId())
|
.setCouponId(userCouponVo.getCouponId())
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ public class TbShopCouponServiceImpl implements TbShopCouponService {
|
|||||||
//券id 券使用描述
|
//券id 券使用描述
|
||||||
Map<Integer, JsonObject> coupons = new HashMap<>();
|
Map<Integer, JsonObject> coupons = new HashMap<>();
|
||||||
for (TbUserCouponVo tbUserCouponVo : tbUserCouponVos) {
|
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())) {
|
if (!coupons.containsKey(tbUserCouponVo.getCouponId())) {
|
||||||
setCouponInfo(coupons, tbUserCouponVo, amount, week, now, formatter);
|
setCouponInfo(coupons, tbUserCouponVo, amount, week, now, formatter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, nu
|
|||||||
<select id="queryByVipIdAndShopId" resultType="com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo">
|
<select id="queryByVipIdAndShopId" resultType="com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo">
|
||||||
SELECT
|
SELECT
|
||||||
inRecord.id as id,
|
inRecord.id as id,
|
||||||
|
inRecord.full_amount as fullAmount,
|
||||||
|
inRecord.discount_amount as discountAmount,
|
||||||
inRecord.coupon_id as couponId,
|
inRecord.coupon_id as couponId,
|
||||||
pro.id as proId,
|
pro.id as proId,
|
||||||
CASE
|
CASE
|
||||||
|
|||||||
Reference in New Issue
Block a user