修改表名为mk_shop_coupon
This commit is contained in:
parent
a8c34e628a
commit
bb0ef6e778
|
|
@ -1,15 +1,8 @@
|
|||
|
||||
package com.czg.market.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import java.io.Serial;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
|
|
@ -20,6 +13,12 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 优惠券信息表 实体类。
|
||||
*
|
||||
|
|
@ -241,7 +240,6 @@ public class ShopCouponDTO implements Serializable {
|
|||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据优惠券类型执行不同的校验规则
|
||||
*/
|
||||
|
|
@ -259,20 +257,24 @@ public class ShopCouponDTO implements Serializable {
|
|||
// return false;
|
||||
// }
|
||||
// 校验满多少和减多少金额
|
||||
return fullAmount != null && discountAmount != null;
|
||||
return fullAmount != null && discountAmount != null
|
||||
&& discountAmount.compareTo(BigDecimal.ZERO) > 0
|
||||
&& fullAmount.compareTo(BigDecimal.ZERO) > 0
|
||||
&& fullAmount.compareTo(discountAmount) > 0;
|
||||
}
|
||||
|
||||
// 折扣券(3)校验
|
||||
if (couponType == 3) {
|
||||
// 校验折扣率、满多少可用和最大抵扣金额
|
||||
return discountRate != null && discountRate > 0 && discountRate <= 100
|
||||
&& fullAmount != null && maxDiscountAmount != null;
|
||||
&& fullAmount != null && fullAmount.compareTo(BigDecimal.ZERO) > 0
|
||||
&& maxDiscountAmount != null && maxDiscountAmount.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
// 第二件半价券(4)、买一送一券(6)、商品兑换券(2)校验
|
||||
if (couponType == 2 || couponType == 4 || couponType == 6) {
|
||||
// 校验可用商品不为空且不为空字符串
|
||||
if (foods == null || foods.trim().isEmpty()) {
|
||||
if (StrUtil.isBlank(foods)) {
|
||||
return false;
|
||||
}
|
||||
// 校验使用规则不为空
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_coupon")
|
||||
@Table("mk_shop_coupon")
|
||||
public class ShopCoupon implements Serializable {
|
||||
|
||||
@Serial
|
||||
|
|
|
|||
Loading…
Reference in New Issue