release: 会员抽奖修改

release-2024-04-25
huangyw 3 months ago
parent f851ec4f22
commit b396f8a1a4

@ -338,7 +338,7 @@ public class LotteryService {
Integer participant = lottery.getParticipant(); Integer participant = lottery.getParticipant();
if (Objects.equals(participant, PointEnums.LOTTERY_ALL_MEMBER.getCode())) { if (Objects.equals(participant, PointEnums.LOTTERY_ALL_MEMBER.getCode())) {
// 会员可参与 // 会员可参与
if (!Objects.equals(userInfo.getVipStatus(), UserVipStatusEnum.INITIAL.getCode()) && if (!Objects.equals(userInfo.getVipStatus(), UserVipStatusEnum.ACTIVE.getCode()) &&
!Objects.equals(userInfo.getVipStatus(), UserVipStatusEnum.LIFE.getCode())) { !Objects.equals(userInfo.getVipStatus(), UserVipStatusEnum.LIFE.getCode())) {
throw new BizException(ErrorConstants.NOT_MEMBER); throw new BizException(ErrorConstants.NOT_MEMBER);
} }

@ -204,30 +204,22 @@ public class UserPointLogService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void executeDraw(DrawDTO drawDTO) { public void executeDraw(DrawDTO drawDTO) {
String taskPointId = drawDTO.getTaskPointId();
if (taskPointId != null) {
TaskPoint taskPoint = taskPointService.getTaskPoint(taskPointId);
if(taskPoint == null) {
return ;
}
// 调整用户积分 // 调整用户积分
UserInfo userInfo = userInfoDao.findById(drawDTO.getUserId()).get(); UserInfo userInfo = userInfoDao.findById(drawDTO.getUserId()).get();
int point = userInfo.getPoint() == null ? 0 : userInfo.getPoint(); int point = userInfo.getPoint() == null ? 0 : userInfo.getPoint();
if(point < taskPoint.getScore()) { if(point < drawDTO.getScore()) {
throw new BizException(ErrorConstants.POINT_NOT_ENOUGH); throw new BizException(ErrorConstants.POINT_NOT_ENOUGH);
} }
userInfo.setPoint(point - taskPoint.getScore()); userInfo.setPoint(point - drawDTO.getScore());
userInfoDao.save(userInfo); userInfoDao.save(userInfo);
UserPointLog userPointLog = UserPointLog.builder() UserPointLog userPointLog = UserPointLog.builder()
.id(String.valueOf(idWorker.nextId())) .id(String.valueOf(idWorker.nextId()))
.type(PointEnums.TASK_POINT_TYPE_REDUCE.getCode()) .type(PointEnums.TASK_POINT_TYPE_REDUCE.getCode())
.createUser(drawDTO.getUserId()) .createUser(drawDTO.getUserId())
.taskPointId(null)
.description(LOTTERY_POINTS_TYPE) .description(LOTTERY_POINTS_TYPE)
.userId(drawDTO.getUserId()) .userId(drawDTO.getUserId())
.score(point) .score(drawDTO.getScore())
.build(); .build();
userPointLogDao.save(userPointLog); userPointLogDao.save(userPointLog);
@ -244,7 +236,6 @@ public class UserPointLogService {
lotteryUserDao.save(lotteryUser); lotteryUserDao.save(lotteryUser);
} }
}
/** /**
* *

@ -1,3 +1,5 @@
alter table tb_task_point alter table tb_task_point
add action varchar(50) null comment 'APP动作'; add action varchar(50) null comment 'APP动作';
alter table tb_task_point
add task_point_id varchar(20) null comment 'tb_task_point表id';
Loading…
Cancel
Save