| | |
| | | return R.fail("该商品库存不足,无法下单"); |
| | | } |
| | | //查询用户信息 |
| | | SysUser user = userMapper.selectById(orderDto.getUserId()); |
| | | SysUser user = userMapper.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getUserId,orderDto.getUserId())); |
| | | if(user == null){ |
| | | return R.fail("未查询到用户信息"); |
| | | } |
| | |
| | | ComBatteryCommodityOrder commodityOrder = getCreateOrder(commodity,userAddress,user,commoditySpecs,orderDto,nowDate,commodityActivity); |
| | | Map<String,Object> resultMap = new HashMap<>(2); |
| | | if(commodityOrderMapper.insert(commodityOrder) > 0){ |
| | | //更新活动商品库存 |
| | | commodityActivity.setCommoditySaleNum(commodityActivity.getCommoditySaleNum() + orderDto.getCount()); |
| | | commodityActivityMapper.updateById(commodityActivity); |
| | | //更新商品库存 |
| | | commoditySpecs.setStock(commoditySpecs.getStock() - orderDto.getCount()); |
| | | commoditySpecsMapper.updateById(commoditySpecs); |