| | |
| | | return AjaxResult.error("当前用户已兑换"+count+"张"); |
| | | }else { |
| | | //减少库存 |
| | | good.setInventory(good.getInventory()-exchangeDto.getNum()); |
| | | goodsService.updateById(good); |
| | | if (good.getInventory()!=-1) { |
| | | good.setInventory(good.getInventory() - exchangeDto.getNum()); |
| | | goodsService.updateById(good); |
| | | } |
| | | } |
| | | if (user.getPoints()<good.getRedeemPoints()){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); |
| | | }else { |
| | | coupon.setInventoryQuantity(coupon.getInventoryQuantity()-1); |
| | | couponService.updateById(coupon); |
| | | if (coupon.getInventoryQuantity()!=-1) { |
| | | coupon.setInventoryQuantity(coupon.getInventoryQuantity() - 1); |
| | | couponService.updateById(coupon); |
| | | } |
| | | } |
| | | |
| | | |