| | |
| | | import com.xcong.excoin.modules.member.mapper.MemberMapper; |
| | | import com.xcong.excoin.modules.member.mapper.MemberQuickBuySaleMapper; |
| | | import com.xcong.excoin.modules.member.mapper.MemberWalletCoinMapper; |
| | | import com.xcong.excoin.modules.member.service.EthService; |
| | | import com.xcong.excoin.modules.member.service.IMemberService; |
| | | import com.xcong.excoin.modules.member.service.RocService; |
| | | import com.xcong.excoin.modules.member.vo.MemberAuthenticationVo; |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.ExecutionException; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public FebsResponse memberWithdrawCoinConfirm(@NotNull(message = "{required}") Long id) { |
| | | public FebsResponse memberWithdrawCoinConfirm(@NotNull(message = "{required}") Long id) throws ExecutionException, InterruptedException { |
| | | |
| | | MemberCoinWithdrawEntity selectById = memberCoinWithdrawMapper.selectById(id); |
| | | Long memberId = selectById.getMemberId(); |
| | |
| | | BigDecimal frozen = walletCoin.getFrozenBalance().subtract(selectById.getAmount()); |
| | | walletCoin.setFrozenBalance(frozen); |
| | | |
| | | //memberWalletCoinMapper.updateById(walletCoin); |
| | | memberWalletCoinMapper.updateById(walletCoin); |
| | | |
| | | if ("Y".equals(selectById.getIsInside())) { |
| | | Map<String, Object> columnMap = new HashMap<>(); |
| | |
| | | if("ROC".equals(symbol)){ |
| | | // 如果是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); |
| | | } |
| | | |
| | | /** |