From c387fd4168d2820d48a27a9e08d690bbdd5e7fad Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Thu, 2 Jan 2025 13:43:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hfkj/service/order/impl/BsOrderServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index 48c1ebf..225c525 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -338,7 +338,10 @@ public class BsOrderServiceImpl implements BsOrderService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知优惠券"); } if (discountUserRel.getStatus() != 1) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券状态不处于待使用"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券已失效"); + } + if (new Date().compareTo(discountUserRel.getUseEndTime()) >= 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券已过期,无法使用"); } discountUserRel.setStatus(2); discountUserRel.setUseTime(new Date());