From f1da3b4cb053578ad59794043529352d2d746c08 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Thu, 10 Oct 2024 09:08:49 +0800 Subject: [PATCH] =?UTF-8?q?release:=20lottery=E6=96=B0=E5=A2=9E=E9=97=A8?= =?UTF-8?q?=E7=A5=A8=E4=BB=B7=E6=A0=BC=E5=AD=97=E6=AE=B5=E5=92=8C=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=97=B6=E9=97=B4=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../luoo/user/dto/point/LotteryAddDto.java | 4 +++ .../luoo/user/dto/point/LotteryUpdateDto.java | 4 +++ .../main/java/com/luoo/user/pojo/Lottery.java | 11 +++++++ .../com/luoo/user/service/LotteryService.java | 15 +++++++-- .../com/luoo/user/vo/point/LotteryAPPVO.java | 30 +++++++++++++++++ .../user/vo/point/LotteryDetailAPPVO.java | 28 ++++++++++++++++ .../luoo/user/vo/point/LotteryDetailPCVO.java | 28 ++++++++++++++++ .../com/luoo/user/vo/point/LotteryPCVO.java | 32 +++++++++++++++++++ luoo_user/src/main/resources/sql/20240904.sql | 8 ++++- 9 files changed, 156 insertions(+), 4 deletions(-) diff --git a/luoo_user/src/main/java/com/luoo/user/dto/point/LotteryAddDto.java b/luoo_user/src/main/java/com/luoo/user/dto/point/LotteryAddDto.java index 077c74e..3ff491f 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/point/LotteryAddDto.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/point/LotteryAddDto.java @@ -14,6 +14,7 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -82,4 +83,7 @@ public class LotteryAddDto implements Serializable { @ApiModelProperty(value = "抽奖地区列表") private List lotteryRegionList; + + @ApiModelProperty(value = "抽奖物品价格") + private BigDecimal price; } \ No newline at end of file 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 98c2302..3efeca4 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 @@ -12,6 +12,7 @@ import javax.persistence.Transient; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -85,4 +86,7 @@ public class LotteryUpdateDto implements Serializable { @ApiModelProperty(value = "抽奖地区列表") private List lotteryRegionList; + + @ApiModelProperty(value = "抽奖物品价格") + private BigDecimal price; } \ No newline at end of file diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/Lottery.java b/luoo_user/src/main/java/com/luoo/user/pojo/Lottery.java index b15813b..159f8b3 100644 --- a/luoo_user/src/main/java/com/luoo/user/pojo/Lottery.java +++ b/luoo_user/src/main/java/com/luoo/user/pojo/Lottery.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; import javax.persistence.Column; @@ -149,6 +150,16 @@ public class Lottery implements Serializable { @ApiModelProperty(value = "停止原因") private String stopReason; + @Column(name = "publish_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "发布时间") + private LocalDateTime publishTime; + + @Column(name = "price") + @ApiModelProperty(value = "抽奖物品价格") + private BigDecimal price; + @Transient @ApiModelProperty(value = "抽奖地区列表") private List lotteryRegionList; 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 9db3cda..9ffc0da 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 @@ -26,6 +26,7 @@ import enums.UserVipStatusEnum; import exception.BizException; import java.io.IOException; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -266,6 +267,8 @@ public class LotteryService { if (lottery.getDrawTime() == null) { throw new BizException(ErrorConstants.DRAW_TIME_IS_REQUIRED); } + // 发布时间 + lottery.setPublishTime(LocalDateTime.now()); lottery.setUpdateUser(userLoginDto.getUserId()); lottery.setUpdateUserName(userLoginDto.getNickName()); @@ -450,7 +453,9 @@ public class LotteryService { qLottery.createTime, qLottery.createUser, qLottery.createUserName, - qLottery.stopReason + qLottery.stopReason, + qLottery.price, + qLottery.publishTime )).from(qLottery) .where(booleanBuilder) .orderBy(qLottery.createTime.desc()) @@ -484,7 +489,9 @@ public class LotteryService { qLottery.description, qLottery.status, qLottery.createTime, - qLottery.stopReason + qLottery.stopReason, + qLottery.price, + qLottery.publishTime )).from(qLottery) .where(booleanBuilder) .orderBy(qLottery.createTime.desc()) @@ -668,7 +675,9 @@ public class LotteryService { qLottery.description, qLottery.status, qLottery.createTime, - qLottery.stopReason + qLottery.stopReason, + qLottery.price, + qLottery.publishTime )) .from(qLottery) .where(qLottery.id.eq(lotteryId)) diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryAPPVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryAPPVO.java index 256368f..6f53220 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryAPPVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryAPPVO.java @@ -9,6 +9,7 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.Transient; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -83,6 +84,12 @@ public class LotteryAPPVO implements Serializable { @ApiModelProperty(value = "停止原因") private String stopReason; + @ApiModelProperty(value = "抽奖物品价格") + private BigDecimal price; + + @ApiModelProperty(value = "发布时间") + private LocalDateTime publishTime; + @Transient @ApiModelProperty(value = "本人是否参与抽奖 1-已参加 2-未参加") private Integer isParticipate; @@ -117,6 +124,29 @@ public class LotteryAPPVO implements Serializable { this.stopReason = stopReason; } + public LotteryAPPVO(String id, String code, String title, Integer type, Integer num, Integer participant, Integer point, String regionCode, String regionName, LocalDateTime applyStartTime, LocalDateTime applyEndTime, LocalDateTime drawTime, Integer way, String image, String description, Integer status, LocalDateTime createTime, String stopReason, BigDecimal price, LocalDateTime publishTime) { + this.id = id; + this.code = code; + this.title = title; + this.type = type; + this.num = num; + this.participant = participant; + this.point = point; + this.regionCode = regionCode; + this.regionName = regionName; + this.applyStartTime = applyStartTime; + this.applyEndTime = applyEndTime; + this.drawTime = drawTime; + this.way = way; + this.image = image; + this.description = description; + this.status = status; + this.createTime = createTime; + this.stopReason = stopReason; + this.price = price; + this.publishTime = publishTime; + } + public LotteryAPPVO(String id, String code, String title, Integer type, Integer num, Integer participant, Integer point, String regionCode, String regionName, LocalDateTime applyStartTime, LocalDateTime applyEndTime, LocalDateTime drawTime, Integer way, String image, String description, Integer status, LocalDateTime createTime, String stopReason, Integer isParticipate) { this.id = id; this.code = code; diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryDetailAPPVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryDetailAPPVO.java index 19fe9f5..3cb4f15 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryDetailAPPVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryDetailAPPVO.java @@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.Transient; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -79,6 +80,12 @@ public class LotteryDetailAPPVO implements Serializable { @ApiModelProperty(value = "停止原因") private String stopReason; + @ApiModelProperty(value = "抽奖物品价格") + private BigDecimal price; + + @ApiModelProperty(value = "发布时间") + private LocalDateTime publishTime; + @ApiModelProperty(value = "抽奖区域列表") List lotteryRegionList; @@ -111,4 +118,25 @@ public class LotteryDetailAPPVO implements Serializable { this.createTime = createTime; this.stopReason = stopReason; } + + public LotteryDetailAPPVO(String id, String code, String title, Integer type, Integer num, Integer participant, Integer point, LocalDateTime applyStartTime, LocalDateTime applyEndTime, LocalDateTime drawTime, Integer way, String image, String description, Integer status, LocalDateTime createTime, String stopReason, BigDecimal price, LocalDateTime publishTime) { + this.id = id; + this.code = code; + this.title = title; + this.type = type; + this.num = num; + this.participant = participant; + this.point = point; + this.applyStartTime = applyStartTime; + this.applyEndTime = applyEndTime; + this.drawTime = drawTime; + this.way = way; + this.image = image; + this.description = description; + this.status = status; + this.createTime = createTime; + this.stopReason = stopReason; + this.price = price; + this.publishTime = publishTime; + } } diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryDetailPCVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryDetailPCVO.java index 022116e..b09e3d7 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryDetailPCVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryDetailPCVO.java @@ -5,6 +5,7 @@ import com.luoo.user.pojo.LotteryRegion; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -80,6 +81,12 @@ public class LotteryDetailPCVO implements Serializable { @ApiModelProperty(value = "停止原因") private String stopReason; + @ApiModelProperty(value = "抽奖物品价格") + private BigDecimal price; + + @ApiModelProperty(value = "发布时间") + private LocalDateTime publishTime; + @ApiModelProperty(value = "抽奖区域列表") List lotteryRegionList; @@ -104,4 +111,25 @@ public class LotteryDetailPCVO implements Serializable { this.createTime = createTime; this.stopReason = stopReason; } + + public LotteryDetailPCVO(String id, String code, String title, Integer type, Integer num, Integer participant, Integer point, LocalDateTime applyStartTime, LocalDateTime applyEndTime, LocalDateTime drawTime, Integer way, String image, String description, Integer status, LocalDateTime createTime, String stopReason, BigDecimal price, LocalDateTime publishTime) { + this.id = id; + this.code = code; + this.title = title; + this.type = type; + this.num = num; + this.participant = participant; + this.point = point; + this.applyStartTime = applyStartTime; + this.applyEndTime = applyEndTime; + this.drawTime = drawTime; + this.way = way; + this.image = image; + this.description = description; + this.status = status; + this.createTime = createTime; + this.stopReason = stopReason; + this.price = price; + this.publishTime = publishTime; + } } diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryPCVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryPCVO.java index 9685fd0..ac859e0 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryPCVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryPCVO.java @@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.Transient; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; /** @@ -87,6 +88,12 @@ public class LotteryPCVO implements Serializable { @ApiModelProperty(value = "停止原因") private String stopReason; + @ApiModelProperty(value = "抽奖物品价格") + private BigDecimal price; + + @ApiModelProperty(value = "发布时间") + private LocalDateTime publishTime; + @Transient @ApiModelProperty(value = "参与人数") private Long participateNum; @@ -118,4 +125,29 @@ public class LotteryPCVO implements Serializable { this.createUserName = createUserName; this.stopReason = stopReason; } + + public LotteryPCVO(String id, String code, String title, Integer type, Integer num, Integer participant, Integer point, String regionCode, String regionName, LocalDateTime applyStartTime, LocalDateTime applyEndTime, LocalDateTime drawTime, Integer way, String image, String description, Integer status, LocalDateTime createTime, String createUser, String createUserName, String stopReason, BigDecimal price, LocalDateTime publishTime) { + this.id = id; + this.code = code; + this.title = title; + this.type = type; + this.num = num; + this.participant = participant; + this.point = point; + this.regionCode = regionCode; + this.regionName = regionName; + this.applyStartTime = applyStartTime; + this.applyEndTime = applyEndTime; + this.drawTime = drawTime; + this.way = way; + this.image = image; + this.description = description; + this.status = status; + this.createTime = createTime; + this.createUser = createUser; + this.createUserName = createUserName; + this.stopReason = stopReason; + this.price = price; + this.publishTime = publishTime; + } } \ No newline at end of file diff --git a/luoo_user/src/main/resources/sql/20240904.sql b/luoo_user/src/main/resources/sql/20240904.sql index 1e40810..956fb84 100644 --- a/luoo_user/src/main/resources/sql/20240904.sql +++ b/luoo_user/src/main/resources/sql/20240904.sql @@ -18,4 +18,10 @@ create index tb_lottery_user_user_id_index alter table tb_lottery_user add constraint tb_lottery_user_pk - unique (lottery_id, user_id); \ No newline at end of file + unique (lottery_id, user_id); + +alter table tb_lottery + add publish_time datetime null comment '发布时间'; + +alter table tb_lottery + add price decimal null comment '抽奖物品价格'; \ No newline at end of file