| | |
| | | private final CouponGoodsMapper couponGoodsMapper; |
| | | |
| | | private final IMallVipConfigService mallVipConfigService; |
| | | private final MallActivityMapper mallActivityMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return couponAmountMap; |
| | | } |
| | | |
| | | |
| | | Long couponId = mallMemberCoupon.getCouponId();//优惠卷ID |
| | | List<Long> goodsIdsAll = couponGoodsMapper.selectByCouponId(couponId); |
| | | List<MallGoodsSku> skusAll = mallGoodsSkuMapper.selectSkuIdsByGoodsId(goodsIdsAll);//获取该优惠卷绑定的全部商品sku |
| | | Set<Long> skuIdsAll = skusAll.stream().map(MallGoodsSku::getId).collect(Collectors.toSet());//获取该优惠卷绑定的全部商品skuIDS |
| | | Set<Long> skuIds = items.stream().map(AddOrderItemDto::getSkuId).collect(Collectors.toSet());//订单中的全部skuIds |
| | | |
| | | // 获取交集 |
| | | Set<Long> intersection = skuIds.stream() |
| | | .filter(skuIdsAll::contains) |
| | | .collect(Collectors.toSet()); |
| | | Set<Long> intersection = items.stream().map(AddOrderItemDto::getSkuId).collect(Collectors.toSet());//订单中的全部skuIds |
| | | |
| | | if (intersection.isEmpty()) { |
| | | return couponAmountMap; |
| | |
| | | if (sku == null) { |
| | | return new FebsResponse().fail().message("购买商品或sku不存在"); |
| | | } |
| | | // if("样品".equals(sku.getSample())){ |
| | | // List<MallOrderItem> mallOrderItems = mallOrderItemMapper.selectItemBySkuIdUnCancel(sku.getId(), member.getId()); |
| | | // if (CollUtil.isNotEmpty(mallOrderItems)) { |
| | | // return new FebsResponse().fail().message("样品只能购买一次"); |
| | | // } |
| | | // Integer cnt = item.getCnt(); |
| | | // if(1 < cnt){ |
| | | // return new FebsResponse().fail().message("样品只能购买一件"); |
| | | // } |
| | | // }else{ |
| | | // //验证用户的等级 |
| | | // if(AgentLevelEnum.ZERO_LEVEL.name().equals(member.getLevel())){ |
| | | // return new FebsResponse().fail().message("请先申请成为合伙人"); |
| | | // } |
| | | // } |
| | | |
| | | if (sku.getStock() < item.getCnt()) { |
| | | return new FebsResponse().fail().message(sku.getSkuName() + "库存不足"); |
| | | } |
| | |
| | | if (MallGoods.ISSALE_STATUS_DISABLED.equals(mallGoods.getIsSale())) { |
| | | return new FebsResponse().fail().message(mallGoods.getGoodsName() + "已下架"); |
| | | } |
| | | if(GoodsTypeEnum.HUO_DONG.getValue() == mallGoods.getIsNormal()){ |
| | | //活动商品判断是否在活动进行中 |
| | | MallActivity mallActivity = mallActivityMapper.selectById(mallGoods.getActivityId()); |
| | | if(mallActivity == null || mallActivity.getState() != 2){ |
| | | return new FebsResponse().fail().message("活动不在进行中"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return new FebsResponse().success(); |