| | |
| | | dappFundFlow.setFromHash(hash); |
| | | dappFundFlowDao.updateById(dappFundFlow); |
| | | |
| | | BigDecimal divide = amount.multiply(new BigDecimal(100)).multiply(new BigDecimal(0.9)).setScale(4,BigDecimal.ROUND_DOWN); |
| | | ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(AppContants.ADDRESS_PEOJECT, divide); |
| | | |
| | | |
| | | // String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(address, amount); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void bnbTransferTest(Long id) { |
| | | DappFundFlowEntity dappFundFlow = dappFundFlowDao.selectById(id); |
| | | if(ObjectUtil.isEmpty(dappFundFlow)){ |
| | | log.info("{}",id); |
| | | //获取对应的流水记录 |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectInfoById(id); |
| | | if(ObjectUtil.isEmpty(dappFundFlowEntity)){ |
| | | return; |
| | | } |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_ING != dappFundFlow.getIsReturn()){ |
| | | return; |
| | | } |
| | | /** |
| | | * 用户是否已经生成节点购买记录 |
| | | */ |
| | | DappMemberNodeEntity dappMemberNodeEntity = dappMemberNodeMapper.selectById(dappFundFlow.getSystemProfitId() == null ? 0L : dappFundFlow.getSystemProfitId()); |
| | | if(ObjectUtil.isEmpty(dappMemberNodeEntity)){ |
| | | return; |
| | | } |
| | | //金额 |
| | | BigDecimal amount = dappFundFlow.getAmount(); |
| | | //目标地址 |
| | | Long memberId = dappFundFlow.getMemberId(); |
| | | Long memberId = dappFundFlowEntity.getMemberId(); |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | if(ObjectUtil.isEmpty(dappMemberEntity)){ |
| | | return; |
| | | } |
| | | String address = dappMemberEntity.getAddress(); |
| | | log.info("{}",address); |
| | | // BigInteger bigInteger = new BigInteger(Convert.toWei("0.000001", Convert.Unit.ETHER).setScale(0).toString()); |
| | | BigInteger bigInteger = new BigInteger(Convert.toWei(amount.toString(), Convert.Unit.ETHER).setScale(0).toString()); |
| | | log.info("{}",bigInteger); |
| | | String hash = contractMain.trans(bigInteger,address); |
| | | if(StrUtil.isEmpty(hash)){ |
| | | return; |
| | | } |
| | | Integer count = dappFundFlowDao.updateStatusById(DappFundFlowEntity.WITHDRAW_STATUS_AGREE,dappFundFlowEntity.getId()); |
| | | if(count > 0){ |
| | | DappFundFlowEntity dappFundFlow = dappFundFlowDao.selectById(id); |
| | | //金额 |
| | | BigDecimal amount = dappFundFlow.getAmount(); |
| | | //目标地址 |
| | | String address = dappMemberEntity.getAddress(); |
| | | /** |
| | | * 发起USDT转账 |
| | | */ |
| | | String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(address, amount); |
| | | if(StrUtil.isEmpty(hash)){ |
| | | return; |
| | | } |
| | | log.info("{},{}",id,hash); |
| | | dappFundFlow.setFromHash(hash); |
| | | dappFundFlowDao.updateById(dappFundFlow); |
| | | |
| | | dappFundFlow.setFromHash(hash); |
| | | dappFundFlowDao.updateById(dappFundFlow); |
| | | } |
| | | } |
| | | |
| | | // public static void main(String[] args) { |