|
@@ -518,6 +518,33 @@ public class UserTicketOrderServiceImpl extends
|
|
|
.eq(UserTicketOrder::getStatus, UserTicketOrderStatusEnum.NOT_PAY));
|
|
|
Assert.isTrue(updateRst, "支付回调用户购票订单处理,更新订单状态失败,orderId:" + ticketOrder.getOrderId());
|
|
|
|
|
|
+
|
|
|
+ // 先更新订单状态再发放关联商品
|
|
|
+ List<UserTicketOrderItem> userTicketOrderItemList = userTicketOrderItemService.list(
|
|
|
+ new LambdaQueryWrapper<UserTicketOrderItem>().eq(UserTicketOrderItem::getOrderId, ticketOrder.getOrderId()));
|
|
|
+ for (UserTicketOrderItem orderItem : userTicketOrderItemList) {
|
|
|
+ Ticket ticket = ticketService.getById(orderItem.getTicketId());
|
|
|
+ // TODO: 线上和线下票如果有关联商品,都要发送关联商品到用户的仓库中
|
|
|
+ List<TicketBoxGoods> ticketBoxGoodsList = ticketBoxGoodsService.list(new LambdaQueryWrapper<TicketBoxGoods>()
|
|
|
+ .eq(TicketBoxGoods::getBoxId, ticketOrder.getBoxId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(ticketBoxGoodsList)) {
|
|
|
+ // 发送关联商品
|
|
|
+ for (TicketBoxGoods ticketBoxGoods : ticketBoxGoodsList) {
|
|
|
+ if (TicketBoxGoodsTypeEnum.GOODS.equals(ticketBoxGoods.getType())) {
|
|
|
+ Goods goods = goodsService.getById(Long.valueOf(ticketBoxGoods.getRefId()));
|
|
|
+ userPrizeStorageService.takeInStorage(orderItem.getUserId(),goods.getTitle(),goods.getPicUrl(),
|
|
|
+ ticketBoxGoods.getRefId(),PrizeStorageInTypeEnum.TICKET_GOODS,orderItem.getItemId());
|
|
|
+ } else if (TicketBoxGoodsTypeEnum.COUPON.equals(ticketBoxGoods.getType())) {
|
|
|
+ couponService.distribute(ticket, orderItem.getUserId(), ticketBoxGoods.getRefId());
|
|
|
+ } else if (TicketBoxGoodsTypeEnum.COUPON_PKG.equals(ticketBoxGoods.getType())) {
|
|
|
+ couponPkgService.distribute(ticket, orderItem.getUserId(), ticketBoxGoods.getRefId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|