From ae40432d02f5a698994c0b0847ef1b3f3f31451b Mon Sep 17 00:00:00 2001
From: Cui Zhi Feng <7426394+wuxixiaocui@user.noreply.gitee.com>
Date: 星期二, 08 十月 2024 17:13:27 +0800
Subject: [PATCH] Merge branch 'master-v3' of http://47.96.225.205:8888/r/flowerbackend-v2 into master-v3
---
src/main/java/com/mzl/flower/web/v2/coupon/CouponTemplatePointController.java | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/mzl/flower/web/v2/coupon/CouponTemplatePointController.java b/src/main/java/com/mzl/flower/web/v2/coupon/CouponTemplatePointController.java
index 9817a86..b9dddbe 100644
--- a/src/main/java/com/mzl/flower/web/v2/coupon/CouponTemplatePointController.java
+++ b/src/main/java/com/mzl/flower/web/v2/coupon/CouponTemplatePointController.java
@@ -76,6 +76,7 @@
}
CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO();
+ BeanUtils.copyProperties(couponTemplateDO,couponTemplateBO);
BeanUtils.copyProperties(dto, couponTemplateBO);
// 设置成积分优惠券
@@ -215,11 +216,17 @@
private void valid(CreateCouponTemplatePointDTO dto){
- if (StringUtils.isNotBlank(dto.getCouponDiscountType())
- && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())
- && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) {
- throw new ValidationException("订单金额不能小于折扣金额");
+ if (StringUtils.isNotBlank(dto.getCouponDiscountType()) && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())) {
+
+ if(dto.getMinOrderAmount().compareTo(BigDecimal.ZERO)<=0){
+ throw new ValidationException("优惠券使用条件不能小于0");
+ }
+ if(dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0){
+ throw new ValidationException("优惠券使用条件不能小于面值金额");
+ }
+
}
+
if (StringUtils.isNotBlank(dto.getCouponDiscountType())
&& dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())
&& dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) {
--
Gitblit v1.9.3