|
@@ -292,6 +292,13 @@ public class UserTicketController extends BaseApiController {
|
|
return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1018);
|
|
return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1018);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 线上盲票不支持查看兑奖奖品
|
|
|
|
+ TicketBox ticketBox = ticketBoxService.getById(ticket.getBoxId());
|
|
|
|
+ if (TicketTypeEnum.ONLINE.equals(ticketBox.getType())) {
|
|
|
|
+ LogUtil.error(logger, "线上盲票不支持查看兑奖奖品。ticketId:{0}", ticket.getTicketId());
|
|
|
|
+ return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1000);
|
|
|
|
+ }
|
|
|
|
+
|
|
List<TicketAwardsPrize> ticketAwardsPrizes = userHitPrizeService.listPrize(ticket, userId);
|
|
List<TicketAwardsPrize> ticketAwardsPrizes = userHitPrizeService.listPrize(ticket, userId);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("prizeList", ticketAwardsPrizes);
|
|
jsonObject.put("prizeList", ticketAwardsPrizes);
|
|
@@ -304,6 +311,19 @@ public class UserTicketController extends BaseApiController {
|
|
@ApiOperation("自动开奖")
|
|
@ApiOperation("自动开奖")
|
|
public AjaxResult autoCashPrize(@Validated @RequestBody TicketAutoCashPrizeParam param) {
|
|
public AjaxResult autoCashPrize(@Validated @RequestBody TicketAutoCashPrizeParam param) {
|
|
Long userId = SecurityUtils.getLoginUser().getUserId();
|
|
Long userId = SecurityUtils.getLoginUser().getUserId();
|
|
|
|
+ if (Objects.nonNull(param.getTicketId())) {
|
|
|
|
+ Ticket ticket = ticketService.getById(param.getTicketId());
|
|
|
|
+ UserTicketOrderItem userTicketOrderItem = userTicketOrderItemService.getOne(new LambdaQueryWrapper<UserTicketOrderItem>()
|
|
|
|
+ .eq(UserTicketOrderItem::getTicketId, param.getTicketId())
|
|
|
|
+ .eq(UserTicketOrderItem::getUserId, userId));
|
|
|
|
+ if (Objects.isNull(ticket) || Objects.isNull(userTicketOrderItem)) {
|
|
|
|
+ return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1018);
|
|
|
|
+ }
|
|
|
|
+ param.setBoxId(ticket.getBoxId());
|
|
|
|
+ param.setOrderId(userTicketOrderItem.getOrderId());
|
|
|
|
+ param.setIsTry(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
return AjaxResult.success(userHitPrizeService.autoCashPrize(userId, param));
|
|
return AjaxResult.success(userHitPrizeService.autoCashPrize(userId, param));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -330,6 +350,13 @@ public class UserTicketController extends BaseApiController {
|
|
return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1019);
|
|
return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1019);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 线上盲票不支持手动兑奖
|
|
|
|
+ TicketBox ticketBox = ticketBoxService.getById(ticket.getBoxId());
|
|
|
|
+ if (TicketTypeEnum.ONLINE.equals(ticketBox.getType())) {
|
|
|
|
+ LogUtil.error(logger, "线上盲票不支持手动兑奖。ticketId:{0}", ticket.getTicketId());
|
|
|
|
+ return AjaxResult.error(ErrorCodeEnum.ERROR_CODE_1000);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 兑奖
|
|
// 兑奖
|
|
String lockKey = RedisLockKey.build(RedisLockKey.USER_TICKET_CASH_LOCK, param.getPrizeId());
|
|
String lockKey = RedisLockKey.build(RedisLockKey.USER_TICKET_CASH_LOCK, param.getPrizeId());
|
|
if (!distributedLocker.tryLock(lockKey)) {
|
|
if (!distributedLocker.tryLock(lockKey)) {
|