|
|
@ -8,15 +8,18 @@ import com.blockchain.common.base.dto.WalletChangeDTO; |
|
|
|
import com.blockchain.common.base.dto.WalletOrderDTO; |
|
|
|
import com.blockchain.common.base.dto.WalletOrderDTO; |
|
|
|
import com.blockchain.common.base.exception.RPCException; |
|
|
|
import com.blockchain.common.base.exception.RPCException; |
|
|
|
import com.blockchain.server.btc.common.constants.BtcTransferConstans; |
|
|
|
import com.blockchain.server.btc.common.constants.BtcTransferConstans; |
|
|
|
|
|
|
|
import com.blockchain.server.btc.common.constants.UsdtConstans; |
|
|
|
import com.blockchain.server.btc.common.enums.BtcEnums; |
|
|
|
import com.blockchain.server.btc.common.enums.BtcEnums; |
|
|
|
import com.blockchain.server.btc.common.exception.BtcException; |
|
|
|
import com.blockchain.server.btc.common.exception.BtcException; |
|
|
|
import com.blockchain.server.btc.common.util.CheckEthFeginResult; |
|
|
|
import com.blockchain.server.btc.common.util.CheckEthFeginResult; |
|
|
|
import com.blockchain.server.btc.dto.BtcWalletDTO; |
|
|
|
import com.blockchain.server.btc.dto.BtcWalletDTO; |
|
|
|
import com.blockchain.server.btc.dto.BtcWalletTransferDTO; |
|
|
|
import com.blockchain.server.btc.dto.BtcWalletTransferDTO; |
|
|
|
import com.blockchain.server.btc.entity.BtcWalletTransfer; |
|
|
|
import com.blockchain.server.btc.entity.BtcWalletTransfer; |
|
|
|
|
|
|
|
import com.blockchain.server.btc.entity.WalletInitConfig; |
|
|
|
import com.blockchain.server.btc.feign.EthServerFegin; |
|
|
|
import com.blockchain.server.btc.feign.EthServerFegin; |
|
|
|
import com.blockchain.server.btc.feign.UserServerFegin; |
|
|
|
import com.blockchain.server.btc.feign.UserServerFegin; |
|
|
|
import com.blockchain.server.btc.mapper.BtcWalletTransferMapper; |
|
|
|
import com.blockchain.server.btc.mapper.BtcWalletTransferMapper; |
|
|
|
|
|
|
|
import com.blockchain.server.btc.mapper.WalletInitConfigMapper; |
|
|
|
import com.blockchain.server.btc.rpc.BtcUtils; |
|
|
|
import com.blockchain.server.btc.rpc.BtcUtils; |
|
|
|
import com.blockchain.server.btc.service.*; |
|
|
|
import com.blockchain.server.btc.service.*; |
|
|
|
import com.codingapi.tx.annotation.ITxTransaction; |
|
|
|
import com.codingapi.tx.annotation.ITxTransaction; |
|
|
@ -57,7 +60,11 @@ public class BtcWalletTransferServiceImpl implements BtcWalletTransferService, I |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private UserServerFegin userServerFegin; |
|
|
|
private UserServerFegin userServerFegin; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private WalletInitConfigMapper walletInitConfigMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private BtcWalletTransferService btcWalletTransferService; |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Integer insertTransfer(BtcWalletTransfer btcWalletTransfer) { |
|
|
|
public Integer insertTransfer(BtcWalletTransfer btcWalletTransfer) { |
|
|
|
return btcWalletTransferMapper.insertSelective(btcWalletTransfer); |
|
|
|
return btcWalletTransferMapper.insertSelective(btcWalletTransfer); |
|
|
@ -332,4 +339,33 @@ public class BtcWalletTransferServiceImpl implements BtcWalletTransferService, I |
|
|
|
throw new BtcException(BtcEnums.SERVER_IS_TOO_BUSY); |
|
|
|
throw new BtcException(BtcEnums.SERVER_IS_TOO_BUSY); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public BtcWalletDTO resetWallet(String userOpenId, String addr, Integer tokenId, String walletType) { |
|
|
|
|
|
|
|
//校验钱包类型
|
|
|
|
|
|
|
|
btcApplicationService.checkWalletType(walletType); |
|
|
|
|
|
|
|
//校验币种id
|
|
|
|
|
|
|
|
String tokenSymbol = btcTokenService.getAndVerifyTokenNameById(tokenId); |
|
|
|
|
|
|
|
WalletInitConfig walletInitConfig = new WalletInitConfig(); |
|
|
|
|
|
|
|
walletInitConfig.setCoin(tokenSymbol); |
|
|
|
|
|
|
|
walletInitConfig.setWalletType(walletType); |
|
|
|
|
|
|
|
WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig); |
|
|
|
|
|
|
|
//修改该钱包余额,并插入一条充值记录
|
|
|
|
|
|
|
|
BtcWalletTransfer btcWalletTransfer = new BtcWalletTransfer(); |
|
|
|
|
|
|
|
btcWalletTransfer.setId(UUID.randomUUID().toString()); |
|
|
|
|
|
|
|
btcWalletTransfer.setHash("zhixinlianResetWallet"); |
|
|
|
|
|
|
|
btcWalletTransfer.setFromAddr("zhixinlianResetWallet"); |
|
|
|
|
|
|
|
btcWalletTransfer.setToAddr(addr); |
|
|
|
|
|
|
|
btcWalletTransfer.setAmount(config.getBalance().doubleValue()); |
|
|
|
|
|
|
|
btcWalletTransfer.setGasPrice(0d); |
|
|
|
|
|
|
|
btcWalletTransfer.setTokenId(tokenId); |
|
|
|
|
|
|
|
btcWalletTransfer.setTokenSymbol(tokenSymbol); |
|
|
|
|
|
|
|
btcWalletTransfer.setTransferType(BtcTransferConstans.TYPE_IN); |
|
|
|
|
|
|
|
btcWalletTransfer.setStatus(BtcTransferConstans.STATUS_SUCCESS); |
|
|
|
|
|
|
|
btcWalletTransfer.setCreateTime(new Date()); |
|
|
|
|
|
|
|
btcWalletTransfer.setUpdateTime(btcWalletTransfer.getCreateTime()); |
|
|
|
|
|
|
|
btcWalletTransferService.handleBlockRecharge(btcWalletTransfer); |
|
|
|
|
|
|
|
//返回加减余额后的数据
|
|
|
|
|
|
|
|
return btcWalletService.selectByAddr(addr, tokenId, walletType); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|