| | |
| | | if (count > 0) { |
| | | throw new ServiceException("添加失败,当前商品在该时间段内有其他团购活动"); |
| | | } |
| | | this.save(goodsGroupPurchase); |
| | | GoodsSku goodsSku = goodsSkuService.getById(dto.getGoodsSkuId()); |
| | | if (StringUtils.isNull(goodsSku)) { |
| | | throw new ServiceException("商品不存在"); |
| | |
| | | throw new ServiceException(String.format("团购商品【%s】剩余库存不足,请修改团购库存", |
| | | goodsSku.getSkuName())); |
| | | } |
| | | this.save(goodsGroupPurchase); |
| | | } else { |
| | | GoodsGroupPurchase groupPurchase = this.getById(dto.getId()); |
| | | if (StringUtils.isNull(groupPurchase)) { |
| | |
| | | return true; |
| | | } |
| | | List<GoodsGroupPurchaseInfo> notGroupedList = groupPurchaseInfoList.stream() |
| | | .filter(g -> !g.getCurrentNumber() |
| | | .equals(g.getGroupSize())).peek(p -> { |
| | | .filter(g -> g.getCurrentNumber() < g.getGroupSize()).peek(p -> { |
| | | p.setGroupStatus(GroupStatusEnum.GROUP_FAILURE.getCode()); |
| | | }).collect( |
| | | Collectors.toList()); |