From 09b432d278994715cc218732d3244e14236ddfb9 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Fri, 16 Aug 2024 13:19:50 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=E5=8F=91=E5=B8=83=E6=8A=BD=E5=A5=96?= =?UTF-8?q?=E6=97=B6=E5=85=81=E8=AE=B8=E6=8A=A5=E9=94=99=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=20=E6=8A=A5=E5=90=8D=E6=9C=AA=E7=BB=93=E6=9D=9F=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E6=8A=BD=E5=A5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../luoo/user/Scheduler/DrawLotteryScheduler.java | 6 +++++- .../com/luoo/user/dto/point/LotteryUpdateDto.java | 12 ------------ .../java/com/luoo/user/service/LotteryService.java | 6 ++++-- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/luoo_user/src/main/java/com/luoo/user/Scheduler/DrawLotteryScheduler.java b/luoo_user/src/main/java/com/luoo/user/Scheduler/DrawLotteryScheduler.java index 1d73a05..cf489e8 100644 --- a/luoo_user/src/main/java/com/luoo/user/Scheduler/DrawLotteryScheduler.java +++ b/luoo_user/src/main/java/com/luoo/user/Scheduler/DrawLotteryScheduler.java @@ -57,7 +57,9 @@ public class DrawLotteryScheduler { taskScheduler.shutdown(); } - public void scheduleDraw(LocalDateTime drawTime, String id) { + public String scheduleDraw(LocalDateTime drawTime, String id) { + + String result = ""; ScheduledFuture existingFuture = scheduledFutures.get(id); if (existingFuture != null && !existingFuture.isCancelled()) { @@ -90,8 +92,10 @@ public class DrawLotteryScheduler { drawLotteryService.auto(id, null); } catch (Exception e) { e.printStackTrace(); + result = e.getMessage(); } } + return result; } // 取消任务的方法 diff --git a/luoo_user/src/main/java/com/luoo/user/dto/point/LotteryUpdateDto.java b/luoo_user/src/main/java/com/luoo/user/dto/point/LotteryUpdateDto.java index 9432dd8..12948f2 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/point/LotteryUpdateDto.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/point/LotteryUpdateDto.java @@ -27,18 +27,10 @@ public class LotteryUpdateDto implements Serializable { @NotBlank private String id; - @ApiModelProperty(value = "抽奖编码") - @NotBlank - private String code; - @ApiModelProperty(value = "标题") @NotBlank private String title; - @ApiModelProperty(value = "抽奖类型 1-门票抽奖 2-实物抽奖") - @NotNull - private Integer type; - @ApiModelProperty(value = "奖品总数量") private Integer num; @@ -86,10 +78,6 @@ public class LotteryUpdateDto implements Serializable { @NotBlank private String description; - @ApiModelProperty(value = "抽奖状态 0-编辑中 1-报名中 2-已抽奖 3-已停止") - @NotNull - private Integer status; - @ApiModelProperty(value = "停止原因") private String stopReason; 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 303cce3..cdf9f39 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 @@ -247,7 +247,10 @@ public class LotteryService { lotteryDao.save(lottery); - drawLotteryScheduler.scheduleDraw(lottery.getDrawTime(), id); + String result = drawLotteryScheduler.scheduleDraw(lottery.getDrawTime(), id); + if (StringUtils.isNotBlank(result)) { + throw new BizException(result); + } } @@ -267,7 +270,6 @@ public class LotteryService { lottery.setUpdateUser(userLoginDto.getUserId()); lottery.setUpdateUserName(userLoginDto.getNickName()); lottery.setStopReason(stopReason); - lottery.setStatus(PointEnums.LOTTERY_STATUS_SIGN.getCode()); lotteryDao.save(lottery);