From dc05223d619532855e0221a32f8f57bae6d40b4c Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Thu, 10 Oct 2024 08:16:33 +0800 Subject: [PATCH 1/9] =?UTF-8?q?release:=20=E6=B7=BB=E5=8A=A0serialVersionU?= =?UTF-8?q?ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/luoo/user/vo/point/LotteryDetailAPPVO.java | 4 +++- .../java/com/luoo/user/vo/point/LotteryDetailPCVO.java | 4 +++- .../java/com/luoo/user/vo/point/LotteryRegionDetailVO.java | 7 ++++++- .../main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java | 2 ++ .../java/com/luoo/user/vo/point/LotteryUserDetailPCVO.java | 2 ++ .../java/com/luoo/user/vo/point/UserInvitationLogVO.java | 2 ++ .../main/java/com/luoo/user/vo/point/UserPointLogVO.java | 2 ++ 7 files changed, 20 insertions(+), 3 deletions(-) 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 c95afe9..19fe9f5 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 @@ -7,6 +7,7 @@ import org.springframework.data.annotation.CreatedDate; import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.Transient; +import java.io.Serializable; import java.time.LocalDateTime; import java.util.List; @@ -17,8 +18,9 @@ import java.util.List; * @create: 2024-08-10 10:48 **/ @Data -public class LotteryDetailAPPVO { +public class LotteryDetailAPPVO implements Serializable { + private static final long serialVersionUID = 3343138215330629195L; @ApiModelProperty(value = "主键") private String id; 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 01e533c..022116e 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 @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.luoo.user.pojo.LotteryRegion; import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; import java.time.LocalDateTime; import java.util.List; @@ -18,8 +19,9 @@ import org.springframework.format.annotation.DateTimeFormat; * @create: 2024-08-10 10:48 **/ @Data -public class LotteryDetailPCVO { +public class LotteryDetailPCVO implements Serializable { + private static final long serialVersionUID = 5759663954223098686L; @ApiModelProperty(value = "主键") private String id; diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryRegionDetailVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryRegionDetailVO.java index 401a08c..e616422 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryRegionDetailVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryRegionDetailVO.java @@ -5,6 +5,8 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import java.io.Serializable; + /** * @program: luoo_parent * @description: 抽奖区域 @@ -14,7 +16,10 @@ import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor -public class LotteryRegionDetailVO { +public class LotteryRegionDetailVO implements Serializable { + + private static final long serialVersionUID = -9065811057137976240L; + @ApiModelProperty(value = "主键") private String id; diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java index e54aa77..0fb5f3a 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java @@ -20,6 +20,8 @@ import java.time.LocalDateTime; @Data public class LotteryUserAPPVO implements Serializable { + private static final long serialVersionUID = -8573021684153967737L; + @ApiModelProperty(value = "id") private String id; diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserDetailPCVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserDetailPCVO.java index ef0d14e..fd39f4a 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserDetailPCVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserDetailPCVO.java @@ -15,6 +15,8 @@ import lombok.Data; @Data public class LotteryUserDetailPCVO implements Serializable { + private static final long serialVersionUID = 7496284381599533274L; + @ApiModelProperty(value = "抽奖id") private String lotteryId; diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/UserInvitationLogVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/UserInvitationLogVO.java index 415ec88..f9f49c2 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/UserInvitationLogVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/UserInvitationLogVO.java @@ -14,6 +14,8 @@ import java.io.Serializable; @Data public class UserInvitationLogVO implements Serializable { + private static final long serialVersionUID = -5698797470129332684L; + @ApiModelProperty(value = "邀请人数") private Integer num; diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/UserPointLogVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/UserPointLogVO.java index 73237a0..5743e34 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/UserPointLogVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/UserPointLogVO.java @@ -21,6 +21,8 @@ import java.time.LocalDateTime; @AllArgsConstructor public class UserPointLogVO implements Serializable { + private static final long serialVersionUID = 7386740510263145282L; + @ApiModelProperty(value = "主键") String id; @ApiModelProperty(value = "积分") From 46e7cf56f80eb767c59b09e9feb939759895c5ac Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Thu, 10 Oct 2024 08:23:20 +0800 Subject: [PATCH 2/9] =?UTF-8?q?release:=201.1=20=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=A0=81=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/constants/ErrorConstants.java | 1 + .../luoo/user/controller/MyController.java | 13 +++++ .../luoo/user/service/UserInfoService.java | 54 +++++++++++-------- .../user/vo/userinfo/UserInfoForInviteVO.java | 31 +++++++++++ 4 files changed, 77 insertions(+), 22 deletions(-) create mode 100644 luoo_user/src/main/java/com/luoo/user/vo/userinfo/UserInfoForInviteVO.java diff --git a/luoo_common/src/main/java/constants/ErrorConstants.java b/luoo_common/src/main/java/constants/ErrorConstants.java index 6001b96..d4bf5a6 100644 --- a/luoo_common/src/main/java/constants/ErrorConstants.java +++ b/luoo_common/src/main/java/constants/ErrorConstants.java @@ -38,6 +38,7 @@ public class ErrorConstants { public final static String USER_ALREADY_EXISTS_ARTIST = "用户已发起过音乐人审核"; public final static String USER_STATUS_ERROR = "用户状态错误"; public final static String USER_NAME_ALREADY_EXISTS = "用户名已存在"; + public final static String USER_INVITE_CODE_NOT_EXIST = "邀请码不存在"; // 会员部分 public static final String MEMBERSHIP_CODE_NOT_EXISTS = "会员码不存在"; diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java index 4493852..284d092 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java @@ -18,8 +18,10 @@ import com.luoo.user.pojo.*; import com.luoo.user.service.*; import com.luoo.user.util.EmojiConverterUtil; import com.luoo.user.util.IpUtil; +import com.luoo.user.vo.userinfo.UserInfoForInviteVO; import com.luoo.user.vo.userinfo.UserinfoShippingAddressAppVO; import constants.Constants; +import constants.ErrorConstants; import constants.TaskPointIdConstants; import controller.BaseController; import dto.UserLoginDto; @@ -132,6 +134,17 @@ public class MyController extends BaseController { return Result.success(userRespDTO); } + @ApiOperation(value = "1.1 根据邀请码获取用户部分信息", notes = "无认证") + @GetMapping("/userInfo/invite") + public Result getUserInfoForInvite(String inviteCode) { + UserInfo userInfoByInvitationCode = userInfoService.getUserInfoByInvitationCode(inviteCode); + if(userInfoByInvitationCode != null) { + return Result.success(new UserInfoForInviteVO(userInfoByInvitationCode.getNickName(), userInfoByInvitationCode.getAvatar(), inviteCode)); + } else { + return Result.failed(ErrorConstants.USER_INVITE_CODE_NOT_EXIST); + } + } + @ApiOperation(value = "2.更新个人信息", notes = "游客无法编辑个人信息") @PutMapping("/userInfo") @GlobalInterceptor(checkAppUserLogin = true) diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java index 333be9c..28d154b 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java @@ -82,10 +82,10 @@ public class UserInfoService { private final UserPointLogDao userPointLogDao; public UserInfoService(UserInfoDao userInfoDao, IdWorker idWorker, RedisTemplate redisTemplate, - RabbitTemplate rabbitTemplate, BCryptPasswordEncoder encoder, HttpServletRequest request, - JwtUtil jwtUtil, UserRealNameDao userRealNameDao, UserBankDao userBankDao, - WithdrawDao withdrawDao, UserPointLogService userPointLogService, - UserPointLogDao userPointLogDao) { + RabbitTemplate rabbitTemplate, BCryptPasswordEncoder encoder, HttpServletRequest request, + JwtUtil jwtUtil, UserRealNameDao userRealNameDao, UserBankDao userBankDao, + WithdrawDao withdrawDao, UserPointLogService userPointLogService, + UserPointLogDao userPointLogDao) { this.userInfoDao = userInfoDao; this.idWorker = idWorker; this.redisTemplate = redisTemplate; @@ -233,8 +233,8 @@ public class UserInfoService { * 注册判断是否有邀请码 * * @param loginUserInfo 登录用户 - * @param loginReq 邀请码 - * @return token + * @param loginReq 邀请码 + * @return token */ public String loginOrRegisterWithInvite(UserInfo loginUserInfo, LoginReq loginReq) { UserInfo userInfo = userInfoDao.findByMobile(loginUserInfo.getMobile()); @@ -269,7 +269,7 @@ public class UserInfoService { userInfoDao.save(userInfo); String token = Constants.TOKEN_PREFIX + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); - if(isNewUser) { + if (isNewUser) { // 只有新用户会获得积分 userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token); } @@ -279,7 +279,7 @@ public class UserInfoService { /** * 绑定邀请人 * - * @param userInfo 用户 + * @param userInfo 用户 * @param invitationCode 邀请码 */ @Transactional(rollbackFor = Exception.class) @@ -343,7 +343,7 @@ public class UserInfoService { String token = Constants.TOKEN_PREFIX + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); - if(isNewUser) { + if (isNewUser) { // 只有新用户会获得积分 userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token); } @@ -383,7 +383,7 @@ public class UserInfoService { userInfoDao.save(userInfo); String token = Constants.TOKEN_PREFIX + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); - if(isNewUser) { + if (isNewUser) { // 只有新用户会获得积分 userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token); } @@ -469,7 +469,7 @@ public class UserInfoService { userInfoDao.save(userInfo); String token = Constants.TOKEN_PREFIX + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); - if(isNewUser) { + if (isNewUser) { // 只有新用户会获得积分 userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token); } @@ -804,9 +804,9 @@ public class UserInfoService { /** * 分页查询用户的提现记录 * - * @param token 登录token - * @param page 页码 - * @param size 每页数量 + * @param token 登录token + * @param page 页码 + * @param size 每页数量 * @return 列表 */ public PageResult withdrawPageResult(String token, Integer page, Integer size) { @@ -820,7 +820,7 @@ public class UserInfoService { long totalElements = withdrawPage.getTotalElements(); List content = withdrawPage.getContent(); for (Withdraw withdraw : content) { - if(withdraw.getState() != null) { + if (withdraw.getState() != null) { withdraw.setStateStr(Objects.requireNonNull(WithdrawStateEnum.getByCode(withdraw.getState())).getDesc()); } } @@ -843,21 +843,21 @@ public class UserInfoService { /** * 确定身份以及判断是否二维码过期等 * - * @param userId 用户id - * @param token 二维码uuid - * @param type 类型,1-扫码 2-确认 - * @return token + * @param userId 用户id + * @param token 二维码uuid + * @param type 类型,1-扫码 2-确认 + * @return token */ public void scan(String userId, String token, Integer type) throws Exception { Object o = redisTemplate.opsForValue().get(token); if (o == null) { throw new BizException("二维码失效!"); } - if(!String.valueOf(o).equals("0") && !String.valueOf(o).equals("1")) { + if (!String.valueOf(o).equals("0") && !String.valueOf(o).equals("1")) { throw new BizException("登录认证已完成"); } - if(type == 1) { + if (type == 1) { // 扫码 redisTemplate.opsForValue().set(token, 1, 60, TimeUnit.SECONDS); } else { @@ -884,7 +884,7 @@ public class UserInfoService { public String createInvitationCode(String token) { UserLoginDto user = jwtUtil.getUserLoginDto(token); UserInfo byId = userInfoDao.getById(user.getUserId()); - if(StringUtils.isNotBlank(byId.getInvitationCode())) { + if (StringUtils.isNotBlank(byId.getInvitationCode())) { return byId.getInvitationCode(); } @@ -907,4 +907,14 @@ public class UserInfoService { public List getExpireVipList() { return userInfoDao.getExpireVipList(); } + + /** + * 根据邀请码查询用户信息 + * + * @param invitationCode 邀请码 + * @return 用户信息 + */ + public UserInfo getUserInfoByInvitationCode(String invitationCode) { + return userInfoDao.findByInvitationCode(invitationCode); + } } diff --git a/luoo_user/src/main/java/com/luoo/user/vo/userinfo/UserInfoForInviteVO.java b/luoo_user/src/main/java/com/luoo/user/vo/userinfo/UserInfoForInviteVO.java new file mode 100644 index 0000000..be902cc --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/vo/userinfo/UserInfoForInviteVO.java @@ -0,0 +1,31 @@ +package com.luoo.user.vo.userinfo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @program: luoo_parent + * @description: 邀请h5展示的对象信息 + * @author: yawei.huang + * @create: 2024-10-10 08:14 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class UserInfoForInviteVO implements Serializable { + + private static final long serialVersionUID = -3383281434773850094L; + + @ApiModelProperty(value = "用户昵称") + private String nickName; + + @ApiModelProperty(value = "用户头像") + private String avatar; + + @ApiModelProperty(value = "邀请码") + private String inviteCode; +} 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 3/9] =?UTF-8?q?release:=20lottery=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=97=A8=E7=A5=A8=E4=BB=B7=E6=A0=BC=E5=AD=97=E6=AE=B5=E5=92=8C?= =?UTF-8?q?=E5=8F=91=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 From deef419f4061edc5d1b7d2bc4e47a4a23b75b8d0 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Thu, 10 Oct 2024 09:09:50 +0800 Subject: [PATCH 4/9] =?UTF-8?q?release:=20lottery=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/luoo/user/service/LotteryService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9ffc0da..180bd5d 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 @@ -494,7 +494,7 @@ public class LotteryService { qLottery.publishTime )).from(qLottery) .where(booleanBuilder) - .orderBy(qLottery.createTime.desc()) + .orderBy(qLottery.publishTime.desc()) .offset(pageable.getOffset()) .limit(pageable.getPageSize()) .fetch(); From 268bc9ad606519e587def8fc9fa54143e838822e Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Thu, 10 Oct 2024 09:23:07 +0800 Subject: [PATCH 5/9] =?UTF-8?q?release:=20=E5=85=88=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E5=BC=80=E5=A5=96=E7=8A=B6=E6=80=81=EF=BC=8C=E5=86=8D=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E5=8F=91=E5=B8=83=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/luoo/user/service/LotteryService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 180bd5d..dbe2f65 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 @@ -355,7 +355,7 @@ public class LotteryService { // 已参与抽奖,不能再次参与 LotteryUser byLotteryIdAndUserId = lotteryUserDao.findByLotteryIdAndUserId(id, userLoginDto.getUserId()); - if(byLotteryIdAndUserId != null) { + if (byLotteryIdAndUserId != null) { throw new BizException(ErrorConstants.ALREADY_PARTICIPATED); } @@ -469,6 +469,7 @@ public class LotteryService { BooleanBuilder booleanBuilder = new BooleanBuilder(); QLottery qLottery = QLottery.lottery; checkCondition(booleanBuilder, qLottery, lotterySearchDto); + booleanBuilder.and(qLottery.status.in(new Integer[]{PointEnums.LOTTERY_STATUS_LOTTERY.getCode(), PointEnums.LOTTERY_STATUS_SIGN.getCode()})); // 创建分页对象 Pageable pageable = PageRequest.of(page - 1, size); List list = jpaQueryFactory.select(Projections.constructor(LotteryAPPVO.class, @@ -494,7 +495,7 @@ public class LotteryService { qLottery.publishTime )).from(qLottery) .where(booleanBuilder) - .orderBy(qLottery.publishTime.desc()) + .orderBy(qLottery.status.asc(), qLottery.publishTime.desc()) .offset(pageable.getOffset()) .limit(pageable.getPageSize()) .fetch(); From 72c714b3c7a0dc121b1fb7913dffb92c7b394d62 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Thu, 10 Oct 2024 09:30:31 +0800 Subject: [PATCH 6/9] =?UTF-8?q?release:=20avatar=E6=8B=BC=E6=8E=A5url?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/luoo/user/controller/MyController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java index 284d092..29d578b 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java @@ -139,7 +139,7 @@ public class MyController extends BaseController { public Result getUserInfoForInvite(String inviteCode) { UserInfo userInfoByInvitationCode = userInfoService.getUserInfoByInvitationCode(inviteCode); if(userInfoByInvitationCode != null) { - return Result.success(new UserInfoForInviteVO(userInfoByInvitationCode.getNickName(), userInfoByInvitationCode.getAvatar(), inviteCode)); + return Result.success(new UserInfoForInviteVO(userInfoByInvitationCode.getNickName(), Constants.RESOURCE_PREFIX + userInfoByInvitationCode.getAvatar(), inviteCode)); } else { return Result.failed(ErrorConstants.USER_INVITE_CODE_NOT_EXIST); } From 99e85800402b83b2519c1deffe7d394c8425a75c Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Fri, 11 Oct 2024 09:34:44 +0800 Subject: [PATCH 7/9] =?UTF-8?q?release:=20=E8=AE=B0=E5=BD=95=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=B7=B2=E5=BC=B9=E5=87=BA=E6=8A=BD=E5=A5=96=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/enums/PointEnums.java | 3 ++ .../luoo/user/controller/PointController.java | 11 +++- .../java/com/luoo/user/pojo/LotteryUser.java | 4 ++ .../com/luoo/user/service/LotteryService.java | 54 +++++++++++++++---- .../user/service/UserPointLogService.java | 1 + .../luoo/user/vo/point/LotteryUserAPPVO.java | 26 +++++++++ luoo_user/src/main/resources/sql/20240904.sql | 5 +- 7 files changed, 91 insertions(+), 13 deletions(-) diff --git a/luoo_common/src/main/java/enums/PointEnums.java b/luoo_common/src/main/java/enums/PointEnums.java index a7841f9..8a93d05 100644 --- a/luoo_common/src/main/java/enums/PointEnums.java +++ b/luoo_common/src/main/java/enums/PointEnums.java @@ -41,6 +41,9 @@ public enum PointEnums { PARTICIPATED(1, "已参加"), NOT_PARTICIPATED(2, "未参加"), + ALREADY_POPUP(1, "已弹出"), + NOT_POPUP(0, "未弹出"), + ; private final Integer code; private final String description; diff --git a/luoo_user/src/main/java/com/luoo/user/controller/PointController.java b/luoo_user/src/main/java/com/luoo/user/controller/PointController.java index 6e7e3b7..a3a8140 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/PointController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/PointController.java @@ -385,7 +385,7 @@ public class PointController { @ApiOperation(value = "3.11.抽奖结果(APP)", notes = "APP") @GetMapping("/lottery/result/{id}") @GlobalInterceptor(checkAppUserLogin = true) - public Result findLotteryResult( + public Result findLotteryResult( @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "抽奖id", required = true) @PathVariable String id) { return Result.success(lotteryService.getLotteryUserResult(id, token)); @@ -426,6 +426,15 @@ public class PointController { return Result.success(lotteryService.getLotteryDetailAPPVO(id)); } + @ApiOperation(value = "3.15. 记录用户中奖信息已弹出", notes = "APP") + @PostMapping("/app/popup") + @GlobalInterceptor(checkAppUserLogin = true) + public Result popup( + @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "lotteryUser表(抽奖用户绑定)id", required = true) @PathVariable String id) { + lotteryService.popup(id); + return Result.success(); + } } diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/LotteryUser.java b/luoo_user/src/main/java/com/luoo/user/pojo/LotteryUser.java index 8111931..a6e14c9 100644 --- a/luoo_user/src/main/java/com/luoo/user/pojo/LotteryUser.java +++ b/luoo_user/src/main/java/com/luoo/user/pojo/LotteryUser.java @@ -85,4 +85,8 @@ public class LotteryUser implements Serializable { @ApiModelProperty(value = "更新人") private String updateUser; + @Column(name = "popup") + @ApiModelProperty(value = "是否已弹出弹框 0-默认状态,未弹出 1-已弹出") + private Integer popup; + } \ No newline at end of file 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 dbe2f65..911f774 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 @@ -580,14 +580,6 @@ public class LotteryService { } public PageResult findPageByLotteryId(Integer page, Integer size, String lotteryId) { -// Sort sort = new Sort(Direction.DESC, "createTime"); -// PageRequest pageRequest = PageRequest.of(page - 1, size, sort); -// -// Specification specification = getLotteryUserSpecification(lotteryId); -// Page lotteryUserPage = lotteryUserDao.findAll(specification, pageRequest); -// -// long totalElements = lotteryUserPage.getTotalElements(); -// return new PageResult<>(totalElements, lotteryUserPage.getContent()); QLotteryUser qLotteryUser = QLotteryUser.lotteryUser; QUserInfo qUserInfo = QUserInfo.userInfo; @@ -644,11 +636,44 @@ public class LotteryService { }; } - public Integer getLotteryUserResult(String lotteryId, String token) { + public LotteryUserAPPVO getLotteryUserResult(String lotteryId, String token) { + QLotteryUser qLotteryUser = QLotteryUser.lotteryUser; + QUserInfo qUserInfo = QUserInfo.userInfo; + QRegion qRegion = QRegion.region; + UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token); - LotteryUser lotteryUser = lotteryUserDao.findByLotteryIdAndUserId(lotteryId, userLoginDto.getUserId()); - return lotteryUser.getResult(); + BooleanBuilder booleanBuilder = new BooleanBuilder(); + booleanBuilder.and(qLotteryUser.lotteryId.eq(lotteryId)); + booleanBuilder.and(qLotteryUser.userId.eq(userLoginDto.getUserId())); + + // 头像字段拼接字符串 + StringExpression avatarWithPrefix = Expressions.stringTemplate("{0} || {1}", Constants.RESOURCE_PREFIX, qUserInfo.avatar); + + return jpaQueryFactory + .select(Projections.bean(LotteryUserAPPVO.class, + qLotteryUser.id.as("id"), + qLotteryUser.lotteryId.as("lotteryId"), + qLotteryUser.userId.as("userId"), + qLotteryUser.regionId.as("regionId"), + qLotteryUser.result.as("result"), + qLotteryUser.createTime.as("createTime"), + qLotteryUser.updateTime.as("updateTime"), + qLotteryUser.createUser.as("createUser"), + qLotteryUser.updateUser.as("updateUser"), + qUserInfo.nickName.as("nickName"), + avatarWithPrefix.as("avatar"), + qLotteryUser.popup.as("popup"), + qRegion.name.as("regionName"), + qRegion.code.as("regionCode") + )) + .from(qLotteryUser) + .leftJoin(qUserInfo) + .on(qLotteryUser.userId.eq(qUserInfo.id)) + .leftJoin(qRegion) + .on(qLotteryUser.regionId.eq(qRegion.id)) + .where(booleanBuilder) + .fetchOne(); } /** @@ -782,6 +807,13 @@ public class LotteryService { } + @Transactional(rollbackFor = Exception.class) + public void popup(String lotteryUserId) { + LotteryUser one = lotteryUserDao.getOne(lotteryUserId); + one.setPopup(PointEnums.ALREADY_POPUP.getCode()); + lotteryUserDao.save(one); + } + private void checkLotteryUserCondition(BooleanBuilder booleanBuilder, QLotteryUser qLotteryUser, String lotteryId, Integer userType) { booleanBuilder.and(qLotteryUser.lotteryId.eq(lotteryId)); if (Objects.nonNull(userType)) { diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java b/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java index c977537..0a7a8ee 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java @@ -253,6 +253,7 @@ public class UserPointLogService { .userId(drawDTO.getUserId()) .createUser(drawDTO.getUserId()) .updateUser(drawDTO.getUserId()) + .popup(PointEnums.NOT_POPUP.getCode()) .build(); lotteryUserDao.save(lotteryUser); diff --git a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java index 0fb5f3a..6d9cb4e 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/point/LotteryUserAPPVO.java @@ -61,6 +61,15 @@ public class LotteryUserAPPVO implements Serializable { @ApiModelProperty(value = "抽奖人头像") private String avatar; + @ApiModelProperty(value = "是否已弹出弹框 0-默认状态,未弹出 1-已弹出") + private Integer popup; + + @ApiModelProperty(value = "区域名称") + private String regionName; + + @ApiModelProperty(value = "区域编码") + private String regionCode; + public LotteryUserAPPVO() { } @@ -77,4 +86,21 @@ public class LotteryUserAPPVO implements Serializable { this.nickName = nickName; this.avatar = avatar; } + + public LotteryUserAPPVO(String id, String lotteryId, String userId, Integer regionId, Integer result, LocalDateTime createTime, LocalDateTime updateTime, String createUser, String updateUser, String nickName, String avatar, Integer popup, String regionName, String regionCode) { + this.id = id; + this.lotteryId = lotteryId; + this.userId = userId; + this.regionId = regionId; + this.result = result; + this.createTime = createTime; + this.updateTime = updateTime; + this.createUser = createUser; + this.updateUser = updateUser; + this.nickName = nickName; + this.avatar = avatar; + this.popup = popup; + this.regionName = regionName; + this.regionCode = regionCode; + } } diff --git a/luoo_user/src/main/resources/sql/20240904.sql b/luoo_user/src/main/resources/sql/20240904.sql index 956fb84..89bc3be 100644 --- a/luoo_user/src/main/resources/sql/20240904.sql +++ b/luoo_user/src/main/resources/sql/20240904.sql @@ -24,4 +24,7 @@ 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 + add price decimal null comment '抽奖物品价格'; + +alter table tb_lottery_user + add popup tinyint null comment '是否已弹出弹框 0-默认状态,未弹出 1-已弹出'; From 18e5efed1614b0d90338d7fe7cfa77781eb98a9a Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Sat, 12 Oct 2024 09:50:07 +0800 Subject: [PATCH 8/9] =?UTF-8?q?release:=20=E8=B5=8B=E4=BA=88=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E6=8A=BD=E5=A5=96=20=E9=BB=98=E8=AE=A4task=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/constants/TaskPointIdConstants.java | 6 ++++++ .../src/main/java/com/luoo/user/listener/drawListener.java | 6 +++++- .../src/main/java/com/luoo/user/service/LotteryService.java | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/luoo_common/src/main/java/constants/TaskPointIdConstants.java b/luoo_common/src/main/java/constants/TaskPointIdConstants.java index 2252c51..bf2aa3e 100644 --- a/luoo_common/src/main/java/constants/TaskPointIdConstants.java +++ b/luoo_common/src/main/java/constants/TaskPointIdConstants.java @@ -48,4 +48,10 @@ public class TaskPointIdConstants { public static final String INVITE_USER_20 = "22"; + // 积分抽奖 + public static final String LOTTERY = "1000"; + + // 积分抽奖返还 + public static final String LOTTERY_RETURNS = "1001"; + } diff --git a/luoo_user/src/main/java/com/luoo/user/listener/drawListener.java b/luoo_user/src/main/java/com/luoo/user/listener/drawListener.java index fe02473..c50cdc2 100644 --- a/luoo_user/src/main/java/com/luoo/user/listener/drawListener.java +++ b/luoo_user/src/main/java/com/luoo/user/listener/drawListener.java @@ -26,7 +26,11 @@ public class drawListener { @RabbitHandler public void executeDraw(DrawDTO drawDTO) { log.info("drawDTO:{}", drawDTO); - userPointLogService.executeDraw(drawDTO); + try { + userPointLogService.executeDraw(drawDTO); + } catch (Exception e) { + e.printStackTrace(); + } } } 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 911f774..0710a50 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 @@ -19,6 +19,7 @@ import com.querydsl.core.types.dsl.StringExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import constants.Constants; import constants.ErrorConstants; +import constants.TaskPointIdConstants; import dto.UserLoginDto; import enums.PointEnums; import enums.UserTypeEnum; @@ -309,7 +310,7 @@ public class LotteryService { .id(String.valueOf(idWorker.nextId())) .type(PointEnums.TASK_POINT_TYPE_ADD.getCode()) .createUser(lotteryUser.getUserId()) - .taskPointId(null) + .taskPointId(TaskPointIdConstants.LOTTERY_RETURNS) .description(POINTS_WILL_BE_RETURNED) .userId(lotteryUser.getUserId()) .score(lottery.getPoint()) @@ -402,6 +403,7 @@ public class LotteryService { .score(point) .type(PointEnums.TASK_POINT_TYPE_REDUCE.getCode()) .userId(userLoginDto.getUserId()) + .taskPointId(TaskPointIdConstants.LOTTERY) .build(); rabbitTemplate.convertAndSend("draw", drawDTO); From 572c38d7877f8a16f9cad95896eaacf08e1d01e9 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Sat, 12 Oct 2024 11:20:33 +0800 Subject: [PATCH 9/9] =?UTF-8?q?release:=20=E8=B5=8B=E4=BA=88=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E6=8A=BD=E5=A5=96=20=E9=BB=98=E8=AE=A4task=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/luoo/user/service/UserPointLogService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java b/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java index 0a7a8ee..8327a18 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java @@ -241,6 +241,7 @@ public class UserPointLogService { .description(LOTTERY_POINTS_TYPE) .userId(drawDTO.getUserId()) .score(drawDTO.getScore()) + .taskPointId(drawDTO.getTaskPointId()) .build(); userPointLogDao.save(userPointLog);