| | |
| | | .stream().mapToInt(Integer::intValue).sum(); |
| | | } |
| | | Integer userCount = good.getUserCount(); |
| | | if (good.getUserCount() > totalNumber) { |
| | | if (userCount > totalNumber) { |
| | | int i = userCount - totalNumber; |
| | | if (number > i) { |
| | | return R.exchangeError("兑换失败,当前兑换数量已超过最大兑换数量,剩余兑换数量为: " + |
| | | i + "!"); |
| | | } |
| | | } else { |
| | | return R.exchangeError("兑换失败,当前兑换数量已超过最大兑换数量!"); |
| | | } |
| | | } |
| | | boolean result = exchangeGood(goodExchange, recipient, number, goodId, needIntegral); |
| | |
| | | return R.exchangeError("兑换失败,当前兑换数量已超过最大兑换数量,剩余兑换数量为: " + |
| | | i + "!"); |
| | | } |
| | | } else { |
| | | return R.exchangeError("兑换失败,当前兑换数量已超过最大兑换数量!"); |
| | | } |
| | | } |
| | | boolean result = exchangeGoodParent(goodExchange, recipient, number, goodId, needIntegral); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateOne(TGoods dto) { |
| | | this.baseMapper.updateOne(dto); |
| | | } |
| | | |
| | | private TOrder orderInfo(GoodExchangeDTO goodExchange, Recipient recipient, Integer number, Integer goodId, int needIntegral) { |
| | | TOrder order = new TOrder(); |
| | | order.setOrderNumber(goodExchange.getOrderNumber()); |