| | |
| | | Long aimMemberId = selectByMap.get(0).getMemberId(); |
| | | MemberWalletCoinEntity aimWalletCoin = memberWalletCoinMapper.findWalletCoinByMemberIdAndWalletCode(aimMemberId, symbol); |
| | | |
| | | BigDecimal addTotal = aimWalletCoin.getTotalBalance().add(selectById.getAmount()); |
| | | BigDecimal addAvailable = aimWalletCoin.getAvailableBalance().add(selectById.getAmount()); |
| | | BigDecimal addTotal = aimWalletCoin.getTotalBalance().add(amount.subtract(selectById.getFeeAmount())); |
| | | BigDecimal addAvailable = aimWalletCoin.getAvailableBalance().add(amount.subtract(selectById.getFeeAmount())); |
| | | aimWalletCoin.setTotalBalance(addTotal); |
| | | aimWalletCoin.setAvailableBalance(addAvailable); |
| | | |
| | |
| | | MemberAccountMoneyChangeEntity memberAccountMoneyChangeEntity = new MemberAccountMoneyChangeEntity(); |
| | | memberAccountMoneyChangeEntity.setContent("收款"); |
| | | memberAccountMoneyChangeEntity.setMemberId(aimMemberId); |
| | | memberAccountMoneyChangeEntity.setAmount(selectById.getAmount()); |
| | | memberAccountMoneyChangeEntity.setAmount(amount.subtract(selectById.getFeeAmount())); |
| | | memberAccountMoneyChangeEntity.setStatus(MemberAccountMoneyChangeEntity.STATUS_SUCCESS_INTEGER); |
| | | memberAccountMoneyChangeEntity.setSymbol(selectById.getSymbol()); |
| | | memberAccountMoneyChangeEntity.setType(MemberAccountMoneyChangeEntity.TYPE_WALLET_COIN); |
| | |
| | | } |
| | | // 转币 需要扣除手续费 |
| | | amount = amount.subtract(selectById.getFeeAmount()); |
| | | if("ROC".equals(symbol)){ |
| | | if("ROC".equals(symbol) && !"Y".equals(selectById.getIsInside())){ |
| | | // 如果是ROC 则自动转 |
| | | String transfer = RocService.transfer(amount, address, "ROC"); |
| | | }else if("USDT".equals(symbol) && !"Y".equals(selectById.getIsInside())){ |
| | | EthService ethService = new EthService(); |
| | | // 查询余额是否足够 |
| | | BigDecimal bigDecimal = ethService.tokenGetBalance(EthService.TOTAL_ADDRESS); |
| | | if(bigDecimal==null ||bigDecimal.compareTo(amount)<0 ){ |
| | | FebsResponse fail = new FebsResponse().fail(); |
| | | fail.message("总钱包余额不足"); |
| | | return fail; |
| | | } |
| | | amount = amount.multiply(new BigDecimal("1000000")); |
| | | String usdtStr = amount.toPlainString(); |
| | | if (usdtStr.contains(".")) { |
| | | usdtStr = usdtStr.substring(0, usdtStr.lastIndexOf(".")); |
| | | } |
| | | String s = ethService.tokenSend(address, usdtStr, null); |
| | | // EthService ethService = new EthService(); |
| | | // // 查询余额是否足够 |
| | | // BigDecimal bigDecimal = ethService.tokenGetBalance(EthService.TOTAL_ADDRESS); |
| | | // if(bigDecimal==null ||bigDecimal.compareTo(amount)<0 ){ |
| | | // FebsResponse fail = new FebsResponse().fail(); |
| | | // fail.message("总钱包余额不足"); |
| | | // return fail; |
| | | // } |
| | | // amount = amount.multiply(new BigDecimal("1000000")); |
| | | // String usdtStr = amount.toPlainString(); |
| | | // if (usdtStr.contains(".")) { |
| | | // usdtStr = usdtStr.substring(0, usdtStr.lastIndexOf(".")); |
| | | // } |
| | | // String s = ethService.tokenSend(address, usdtStr, null); |
| | | } |
| | | |
| | | /** |