xiaoyong931011
2022-09-23 8d1be6f3ab9489cc5cca15b01a0d8e47b1cce862
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -100,6 +100,9 @@
        //订单范围内才允许下单
        MallAddressInfo address = mallAddressInfoMapper.selectAddressInfoByMemberIdAndId(member.getId(), addOrderDto.getAddressId());
        if(ObjectUtil.isEmpty(address)){
            throw new FebsException("请重新选择提货人信息");
        }
//        MallElectronicFence mallElectronicFence = mallElectronicFenceMapper.selectByTeamLeaderCode(mallTeamLeader.getUniqueCode());
//        if(ObjectUtil.isNotEmpty(mallElectronicFence)){
//            String inStr = iMallElectronicFenceService.fenceToLocation(mallElectronicFence.getGKey(),
@@ -261,6 +264,8 @@
        orderInfo.setCancelType(MallOrderInfo.CANCEL_BY_SELF);
        this.baseMapper.updateById(orderInfo);
        List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfo.getId());
        if(CollUtil.isNotEmpty(mallOrderItemList)){
            for(MallOrderItem mallOrderItem : mallOrderItemList){
@@ -274,12 +279,12 @@
                }
                MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId());
                Integer goodsResult = mallGoodsMapper.upDateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt());
                Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt());
                if(1 != goodsResult){
                    throw new FebsException(mallGoods.getGoodsName() + "库存不足");
                }
                Integer skuResult = mallGoodsSkuMapper.upDateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt());
                Integer skuResult = mallGoodsSkuMapper.updateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt());
                if(1 != skuResult){
                    throw new FebsException(sku.getSkuName() + "库存不足");
                }
@@ -492,7 +497,8 @@
        IPage<MallOrderInfo> page = new Page<>(orderListDto.getPageNum(), orderListDto.getPageSize());
        orderListDto.setMemberId(member.getId());
        IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectApiOrderListInPage(page, orderListDto);
//        IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectApiOrderListInPage(page, orderListDto);
        IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectNewApiOrderListInPage(page, orderListDto);
        if (CollUtil.isNotEmpty(mallOrderInfos.getRecords())) {
            mallOrderInfos.getRecords().forEach(item -> {
                item.setItems(mallOrderItemMapper.selectListByOrderId(item.getId()));
@@ -706,17 +712,17 @@
                        throw new FebsException("购买商品或sku不存在");
                    }
                    if (sku.getStock() < mallOrderItem.getCnt()) {
                        throw new FebsException(sku.getSkuName() + "库存不足");
                    }
//                    if (sku.getStock() < mallOrderItem.getCnt()) {
//                        throw new FebsException(sku.getSkuName() + "库存不足");
//                    }
                    MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId());
                    Integer goodsResult = mallGoodsMapper.upDateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt());
                    Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt());
                    if(1 != goodsResult){
                        throw new FebsException(mallGoods.getGoodsName() + "库存不足");
                    }
                    Integer skuResult = mallGoodsSkuMapper.upDateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt());
                    Integer skuResult = mallGoodsSkuMapper.updateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt());
                    if(1 != skuResult){
                        throw new FebsException(sku.getSkuName() + "库存不足");
                    }