|
|
@@ -60,12 +60,13 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
for (GoodsDonSku sku : skuIds) {
|
|
|
Long skuId = sku.getId();
|
|
|
Long goodsId = sku.getGoodsId();
|
|
|
- List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
|
|
|
- .field(GroupsRelationView::getGoodsId, goodsId)
|
|
|
- .field(GroupsRelationView::getSkuId, skuId)
|
|
|
- .field(GroupsRelationView::getUserId, userId)
|
|
|
- .field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
|
|
|
- .build());
|
|
|
+ sku = goodsDonSkuMapper.selectById(skuId);
|
|
|
+// List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
|
|
|
+// .field(GroupsRelationView::getGoodsId, goodsId)
|
|
|
+// .field(GroupsRelationView::getUserId, userId)
|
|
|
+// .field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
|
|
|
+// .build());
|
|
|
+ List<GroupsRelationView> relationViewList = groupsRelationMapper.selectRelationByGoodsId(goodsId, userId);
|
|
|
//是否有该规格车票,若无直接发放车票
|
|
|
if (CollUtil.isEmpty(relationViewList)) {
|
|
|
//领取权益时,没有车票的用户自动上车,获得对应车票
|
|
|
@@ -129,6 +130,9 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
if (availableBenefits == null) {
|
|
|
throw BusinessRuntimeException.getInstance("可获取的权益不存在");
|
|
|
}
|
|
|
+ if (availableBenefits.getStatusCode() == 1) {
|
|
|
+ throw BusinessRuntimeException.getInstance("已领取该权益");
|
|
|
+ }
|
|
|
if (!availableBenefits.getDeleted()) {
|
|
|
throw BusinessRuntimeException.getInstance("购买的实物设备已退款,无法领取该权益");
|
|
|
}
|
|
|
@@ -152,6 +156,7 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
}
|
|
|
//删除可领取的权益
|
|
|
int update = availableBenefitsMapper.update(null, Wrappers.lambdaUpdate(UserPayEquipmentAvailableBenefits.class)
|
|
|
+ .set(UserPayEquipmentAvailableBenefits::getStatusCode, 1)
|
|
|
.set(UserPayEquipmentAvailableBenefits::getDeleted, false)
|
|
|
.eq(UserPayEquipmentAvailableBenefits::getDeleted, true)
|
|
|
.eq(UserPayEquipmentAvailableBenefits::getId, benefitsId));
|
|
|
@@ -174,13 +179,16 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<UserAvailableGoodsTicketView> getAvailableBenefitsTickets(Long userId) {
|
|
|
- List<UserAvailableGoodsTicketView> ticketViews = beanSearcher.searchAll(UserAvailableGoodsTicketView.class, MapUtils.builder().field(UserAvailableGoodsTicketView::getUserId, userId)
|
|
|
- .field(UserAvailableGoodsTicketView::getDeleted, true).build());
|
|
|
+ public List<UserAvailableGoodsTicketView> getAvailableBenefitsTickets(Long userId, Long orderId) {
|
|
|
+ List<UserAvailableGoodsTicketView> ticketViews = beanSearcher.searchAll(UserAvailableGoodsTicketView.class, MapUtils.builder()
|
|
|
+ .field(UserAvailableGoodsTicketView::getUserId, userId)
|
|
|
+ .field(UserAvailableGoodsTicketView::getDeleted, true)
|
|
|
+ .field(UserAvailableGoodsTicketView::getRealOrderId, orderId)
|
|
|
+ .build());
|
|
|
ticketViews.forEach(ticket -> {
|
|
|
List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
|
|
|
- .field(GroupsRelationView::getSkuId, ticket.getSkuId())
|
|
|
.field(GroupsRelationView::getUserId, userId)
|
|
|
+ .field(GroupsRelationView::getGoodsId, ticket.getGoodsId())
|
|
|
.field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
|
|
|
.field(GroupsRelationView::getExpiryTime).op(Operator.NotNull)
|
|
|
.build());
|