初始化充值增加初始化額度判斷

pull/1/head
liushaodong 5 years ago
parent 326f076d91
commit 4440d0cc15
  1. 1
      blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/common/enums/BtcEnums.java
  2. 3
      blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java
  3. 1
      blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java
  4. 4
      blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java
  5. 1
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java
  6. 3
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java

@ -3,6 +3,7 @@ package com.blockchain.server.btc.common.enums;
public enum BtcEnums { public enum BtcEnums {
ADDRESS_ERROR(7000, "请输入有效的地址", "Please enter a valid address.", "請輸入有效的地址"), ADDRESS_ERROR(7000, "请输入有效的地址", "Please enter a valid address.", "請輸入有效的地址"),
AMOUNT_NULL(7001, "请输入数量", "Please input quantity.", "請輸入數量"), AMOUNT_NULL(7001, "请输入数量", "Please input quantity.", "請輸入數量"),
RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"),
SENDTOADDRESS_ERROR(7002, "交易失败", "Transaction failure.", "交易失敗"), SENDTOADDRESS_ERROR(7002, "交易失败", "Transaction failure.", "交易失敗"),
GET_NEW_ADDRESS_ERROR(7003, "生成地址失败", "Request success", "生成地址失敗"), GET_NEW_ADDRESS_ERROR(7003, "生成地址失败", "Request success", "生成地址失敗"),
LIST_UNSPENT_ERROR(7004, "获取UTXO失败", "Failed to get UTXO", "獲取UTXO失敗"), LIST_UNSPENT_ERROR(7004, "获取UTXO失败", "Failed to get UTXO", "獲取UTXO失敗"),

@ -205,6 +205,9 @@ public class BtcWalletServiceImpl<psvm> implements BtcWalletService {
walletInitConfig.setCoin(tokenId); walletInitConfig.setCoin(tokenId);
walletInitConfig.setWalletType(walletType); walletInitConfig.setWalletType(walletType);
WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig); WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig);
if(config==null || config.getBalance()==null){
throw new BtcException(BtcEnums.RESET_ERROR);
}
btcWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); btcWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date());
return 1; return 1;

@ -2,6 +2,7 @@ package com.blockchain.server.eos.common.enums;
public enum EosWalletEnums { public enum EosWalletEnums {
SESSION_ERROR(201, "操作失败,用户未登录!", "The operation failed and the user is not logged in!", "操作失敗,用戶未登錄!"), SESSION_ERROR(201, "操作失败,用户未登录!", "The operation failed and the user is not logged in!", "操作失敗,用戶未登錄!"),
RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"),
EOSWALLET_GETWALLET_ERROR(202, "该钱包不存在!", "The wallet does not exist!", "該錢包不存在!"), EOSWALLET_GETWALLET_ERROR(202, "该钱包不存在!", "The wallet does not exist!", "該錢包不存在!"),
ERROR(203, "操作失败!", "operation failure!", "操作失敗!"), ERROR(203, "操作失败!", "operation failure!", "操作失敗!"),
BALANCE_AMOUNT_ERROR(204, "操作失败,余额不足!", "The operation failed and the balance is insufficient!", "操作失敗,餘額不足!"), BALANCE_AMOUNT_ERROR(204, "操作失败,余额不足!", "The operation failed and the balance is insufficient!", "操作失敗,餘額不足!"),

@ -437,6 +437,10 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction {
walletInitConfig.setCoin(tokenId); walletInitConfig.setCoin(tokenId);
walletInitConfig.setWalletType(walletType); walletInitConfig.setWalletType(walletType);
WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig); WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig);
if(config==null || config.getBalance()==null){
throw new EosWalletException(EosWalletEnums.RESET_ERROR);
}
// 修改钱包插入充值记录 // 修改钱包插入充值记录
walletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); walletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date());
} }

@ -2,6 +2,7 @@ package com.blockchain.server.eth.common.enums;
public enum EthWalletEnums { public enum EthWalletEnums {
SUCCESS(200, "请求成功", "Request success", ""), SUCCESS(200, "请求成功", "Request success", ""),
RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"),
NO_LOGIN(201, "未登录", "No login", ""), NO_LOGIN(201, "未登录", "No login", ""),
NOT_PERFECT(500, "接口未完善", "Not perfect", ""), NOT_PERFECT(500, "接口未完善", "Not perfect", ""),
NOT_WALLETPASSWORD(800, "你还没有设置资金密码", "You have not set the fund password", "妳還沒有設置資金密碼"), NOT_WALLETPASSWORD(800, "你还没有设置资金密码", "You have not set the fund password", "妳還沒有設置資金密碼"),

@ -424,6 +424,9 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction {
WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig); WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig);
ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date());
if(config==null || config.getBalance()==null){
throw new EthWalletException(EthWalletEnums.RESET_ERROR);
}
EthWalletDTO walletDTO = selectByAddrAndTokenAddrAndWalletType(addr, addr, walletType); EthWalletDTO walletDTO = selectByAddrAndTokenAddrAndWalletType(addr, addr, walletType);
return walletDTO; return walletDTO;

Loading…
Cancel
Save