/** * 得到用户输入的密码,允许不输入 * 提示信息为默认 * * @return */ public static String getPwdOptional() { return getPwdOptional(null); }
@Override public CommandResult execute(String[] args) { String prikey = args[1]; String password = CommandHelper.getPwdOptional(); if(StringUtils.isNotBlank(password)){ CommandHelper.confirmPwd(password); } Map<String, Object> parameters = new HashMap<>(); parameters.put("priKey", prikey); parameters.put("password", password); parameters.put("overwrite", true); RpcClientResult result = restFul.post("/account/import/pri", parameters); if (result.isFailed()) { return CommandResult.getFailed(result); } return CommandResult.getResult(CommandResult.dataTransformValue(result)); }
@Override public CommandResult execute(String[] args) { String prikey = args[1]; String password = CommandHelper.getPwdOptional(); if(StringUtils.isNotBlank(password)){ CommandHelper.confirmPwd(password); } Map<String, Object> parameters = new HashMap<>(); parameters.put("priKey", prikey); parameters.put("password", password); parameters.put("overwrite", false); RpcClientResult result = restFul.post("/account/import/pri", parameters); if (result.isFailed()) { return CommandResult.getFailed(result); } return CommandResult.getResult(CommandResult.dataTransformValue(result)); } }
@Override public CommandResult execute(String[] args) { String password = CommandHelper.getPwdOptional(); if(StringUtils.isNotBlank(password)){ CommandHelper.confirmPwd(password); } int count = 1; if(args.length == 2){ count = Integer.parseInt(args[1]); } Map<String, Object> parameters = new HashMap<>(); parameters.put("password", password); parameters.put("count", count); RpcClientResult result = restFul.post("/account", parameters); if(result.isFailed()){ return CommandResult.getFailed(result); } return CommandResult.getResult(CommandResult.dataTransformList(result)); } }
@Override public CommandResult execute(String[] args) { String path = args[1]; String password = CommandHelper.getPwdOptional(); Result rs = getAccountKeystoreDto(path); if(rs.isFailed()){ return CommandResult.getFailed(rs.getMsg()); } AccountKeyStoreDto accountKeyStoreDto = (AccountKeyStoreDto)rs.getData(); Map<String, Object> parameters = new HashMap<>(); parameters.put("accountKeyStoreDto", accountKeyStoreDto); parameters.put("password", password); parameters.put("overwrite", false); RpcClientResult result = restFul.post("/account/import", parameters); if(result.isFailed()){ return CommandResult.getFailed(result); } return CommandResult.getResult(CommandResult.dataTransformValue(result)); }