pull/1/head
liushaodong 5 years ago
parent a6601256e2
commit 9271b536b0
  1. 3
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/controller/EthWalletController.java
  2. 2
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/IEthWalletService.java
  3. 6
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java

@ -153,7 +153,8 @@ public class EthWalletController {
@ApiParam(EthWalletApi.ResetWallet.TOKENID) @RequestParam("tokenId") String tokenId, @ApiParam(EthWalletApi.ResetWallet.TOKENID) @RequestParam("tokenId") String tokenId,
@ApiParam(EthWalletApi.ResetWallet.WALLET_TYPE) @RequestParam(value = "walletType") String walletType) { @ApiParam(EthWalletApi.ResetWallet.WALLET_TYPE) @RequestParam(value = "walletType") String walletType) {
String userOpenId = SSOHelper.getUserId(redisTemplate, request); String userOpenId = SSOHelper.getUserId(redisTemplate, request);
return ResultDTO.requstSuccess(ethWalletService.resetWallet(userOpenId, addr, tokenId, walletType)); ethWalletService.resetWallet(userOpenId, addr, tokenId, walletType);
return ResultDTO.requstSuccess();
} }
} }

@ -206,5 +206,5 @@ public interface IEthWalletService {
*/ */
EthWalletTransfer handleTransfer(String userId,String fromType, String toType, String coinName, BigDecimal amount); EthWalletTransfer handleTransfer(String userId,String fromType, String toType, String coinName, BigDecimal amount);
EthWalletDTO resetWallet(String userOpenId, String addr, String tokenId, String walletType); void resetWallet(String userOpenId, String addr, String tokenId, String walletType);
} }

@ -416,20 +416,18 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction {
} }
@Override @Override
public EthWalletDTO resetWallet(String userOpenId, String addr, String tokenId, String walletType) { public void resetWallet(String userOpenId, String addr, String tokenId, String walletType) {
WalletInitConfig walletInitConfig = new WalletInitConfig(); WalletInitConfig walletInitConfig = new WalletInitConfig();
walletInitConfig.setCoin(tokenId); walletInitConfig.setCoin(tokenId);
walletInitConfig.setWalletType(walletType); walletInitConfig.setWalletType(walletType);
WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig); WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig);
ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date());
if(config==null || config.getBalance()==null){ if(config==null || config.getBalance()==null){
throw new EthWalletException(EthWalletEnums.RESET_ERROR); throw new EthWalletException(EthWalletEnums.RESET_ERROR);
} }
ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date());
EthWalletDTO walletDTO = selectByAddrAndTokenAddrAndWalletType(addr, addr, walletType);
return walletDTO;
} }
/** /**

Loading…
Cancel
Save