| | |
| | | |
| | | this.baseMapper.insert(orderInfo); |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | BigDecimal carriage = BigDecimal.ZERO; |
| | | for (AddOrderItemDto item : addOrderDto.getItems()) { |
| | | MallOrderItem orderItem = new MallOrderItem(); |
| | | |
| | |
| | | } |
| | | |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId()); |
| | | |
| | | // 零撸专区购买 |
| | | if (new BigDecimal(mallGoods.getPresentPrice()).compareTo(BigDecimal.ZERO) == 0) { |
| | | List<MallOrderItem> items = mallOrderItemMapper.selectItemByGoodsIdUnCancel(mallGoods.getId()); |
| | | if (CollUtil.isNotEmpty(items)) { |
| | | throw new FebsException("无法重复领取同一个商品"); |
| | | } |
| | | } |
| | | |
| | | if (MallGoods.ISSALE_STATUS_DISABLED.equals(mallGoods.getIsSale())) { |
| | | throw new FebsException(mallGoods.getGoodsName() + "已下架"); |
| | | } |
| | |
| | | orderItem.setCostPrice(sku.getCostPrice()); |
| | | |
| | | total = total.add(amount); |
| | | carriage = carriage.add(mallGoods.getCarriage()); |
| | | |
| | | sku.setStock(sku.getStock() - item.getCnt()); |
| | | sku.setSkuVolume(sku.getSkuVolume() + item.getCnt()); |
| | |
| | | } |
| | | |
| | | orderInfo.setAmount(total); |
| | | orderInfo.setCarriage(carriage); |
| | | this.baseMapper.updateById(orderInfo); |
| | | |
| | | agentProducer.sendOrderCancelDelayMsg(orderInfo.getId(), 15 * 60 * 1000L); |
| | |
| | | throw new FebsException("支付密码错误"); |
| | | } |
| | | |
| | | memberWalletService.reduce(orderInfo.getAmount(), mallMember.getId(), field); |
| | | memberWalletService.reduce(orderInfo.getAmount().add(orderInfo.getCarriage()), mallMember.getId(), field); |
| | | return orderInfo.getOrderNo(); |
| | | } |
| | | |