From be37284df76fc30668e00c84584cdc43e6f38a38 Mon Sep 17 00:00:00 2001 From: huangyawei Date: Sat, 19 Oct 2024 08:28:13 +0800 Subject: [PATCH] =?UTF-8?q?release-=20=E6=8A=A5=E5=90=8D=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=BF=85=E9=A1=BB=E5=9C=A8=E5=BC=80=E5=A5=96?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B9=8B=E5=89=8D5min=E4=BB=A5=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luoo_common/src/main/java/constants/ErrorConstants.java | 1 + .../main/java/com/luoo/user/service/LotteryService.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/luoo_common/src/main/java/constants/ErrorConstants.java b/luoo_common/src/main/java/constants/ErrorConstants.java index 3ae2bee..4c271cc 100644 --- a/luoo_common/src/main/java/constants/ErrorConstants.java +++ b/luoo_common/src/main/java/constants/ErrorConstants.java @@ -63,6 +63,7 @@ public class ErrorConstants { public static final String POINT_NOT_ENOUGH = "积分不足"; public static final String ONLY_ONE_CITY = "只能填写一个城市"; public static final String SHIPPING_ADDRESS_IS_REQUIRED = "请先填写收货地址再参与抽奖"; + public static final String APPLY_END_TIME_MUST_BE_MORE_THAN_5_MINUTES_BEFORE_DRAW_TIME = "报名结束时间必须在开奖时间之前5min以上"; // 积分部分 public static final String DAILY_SIGN_ALREADY = "今日已签到"; diff --git a/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java b/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java index b0629cc..760090b 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java @@ -127,6 +127,10 @@ public class LotteryService { if (lottery.getApplyEndTime().isBefore(lottery.getApplyStartTime())) { throw new BizException(ErrorConstants.APPLY_END_TIME_CANNOT_BE_BEFORE_APPLY_START_TIME); } + // 报名结束时间必须在开奖时间之前5min以上 + if (lottery.getDrawTime().minusMinutes(5).isBefore(lottery.getApplyEndTime())) { + throw new BizException(ErrorConstants.APPLY_END_TIME_MUST_BE_MORE_THAN_5_MINUTES_BEFORE_DRAW_TIME); + } StringBuilder regionCode = new StringBuilder(); StringBuilder regionName = new StringBuilder(); @@ -197,6 +201,10 @@ public class LotteryService { if (lottery.getApplyEndTime().isBefore(lottery.getApplyStartTime())) { throw new BizException(ErrorConstants.APPLY_END_TIME_CANNOT_BE_BEFORE_APPLY_START_TIME); } + // 报名结束时间必须在开奖时间之前5min以上 + if (lottery.getDrawTime().minusMinutes(5).isBefore(lottery.getApplyEndTime())) { + throw new BizException(ErrorConstants.APPLY_END_TIME_MUST_BE_MORE_THAN_5_MINUTES_BEFORE_DRAW_TIME); + } UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);