| | |
| | | // walletService.update(wallet.getUserId().toString(), |
| | | // Arith.add(withdraw.getAmount(), withdraw.getAmountFee())); |
| | | |
| | | CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class) |
| | | .eq(CapitaltWallet::getUserId, wallet.getUserId().toString()).last(" limit 1 ")); |
| | | // CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class) |
| | | // .eq(CapitaltWallet::getUserId, wallet.getUserId().toString()).last(" limit 1 ")); |
| | | Wallet capitaltWallet = walletService.getOne(new LambdaQueryWrapper<>(Wallet.class) |
| | | .eq(Wallet::getUserId, wallet.getUserId().toString()).last(" limit 1 ")); |
| | | if(ObjectUtil.isEmpty(capitaltWallet)){ |
| | | throw new YamiShopBindException("用户资金账户不存在!"); |
| | | } |
| | | capitaltWalletService.update(new LambdaUpdateWrapper<CapitaltWallet>() |
| | | .set(CapitaltWallet::getMoney,new BigDecimal(Arith.add(capitaltWallet.getMoney(), withdraw.getVolume()))) |
| | | .eq(CapitaltWallet::getUserId,wallet.getUserId())); |
| | | walletService.update(new LambdaUpdateWrapper<Wallet>() |
| | | .set(Wallet::getMoney,new BigDecimal(Arith.add(capitaltWallet.getMoney(), withdraw.getVolume()))) |
| | | .eq(Wallet::getUserId,wallet.getUserId())); |
| | | |
| | | |
| | | /* |
| | |
| | | throw new YamiShopBindException("Your account has been frozen"); |
| | | } |
| | | |
| | | // Wallet wallet = walletService.saveWalletByPartyId(withdraw.getUserId()); |
| | | |
| | | CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class) |
| | | .eq(CapitaltWallet::getUserId, withdraw.getUserId()).last(" limit 1 ")); |
| | | Wallet capitaltWallet = walletService.saveWalletByPartyId(withdraw.getUserId()); |
| | | // |
| | | // CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class) |
| | | // .eq(CapitaltWallet::getUserId, withdraw.getUserId()).last(" limit 1 ")); |
| | | if (capitaltWallet.getMoney().doubleValue() < withdraw.getVolume().doubleValue()) { |
| | | throw new YamiShopBindException("not sufficient funds"); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | //固定手续费10u |
| | | fee = 10; |
| | | withdraw.setAmountFee(new BigDecimal(fee)); |
| | | withdraw.setAmount(new BigDecimal(Arith.sub(withdraw.getVolume().doubleValue(), fee))); |
| | | if (channel.indexOf("USDT") != -1) { |
| | |
| | | if(ObjectUtil.isEmpty(capitaltWallet)){ |
| | | throw new YamiShopBindException("The user's funds account does not exist!"); |
| | | } |
| | | capitaltWalletService.update(capitaltWallet,-withdraw.getVolume().doubleValue()); |
| | | // walletService.update(capitaltWallet,-withdraw.getVolume().doubleValue()); |
| | | walletService.update(capitaltWallet.getUserId(),-withdraw.getVolume().doubleValue()); |
| | | |
| | | |
| | | save(withdraw); |
| | | |