| | |
| | | return httpTokenDao.selectOne(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateToken(String clientId) { |
| | | Map<String, String> params = new HashMap<>(1); |
| | | params.put("timeout", "30000"); |
| | | HttpTokenEntity entity = httpTokenDao.selectOne(new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)); |
| | | Map<String, String> dataJson = new HashMap<>(2); |
| | | String url = entity.getLoginUrl(); |
| | | String userName = entity.getUsername(); |
| | | String password = entity.getPassword(); |
| | | String prvsetName = entity.getPrvsetName(); |
| | | String projectName = entity.getProjectName(); |
| | | String platform = entity.getPlatform(); |
| | | dataJson.put("username", userName); |
| | | dataJson.put("password", password); |
| | | dataJson.put("prvset_name", prvsetName); |
| | | dataJson.put("project_name", projectName); |
| | | dataJson.put("platform", platform); |
| | | //查询token的请求 |
| | | String responseStr = httpsRequest.doPostToken(url, params, JSONObject.toJSONString(dataJson), "utf-8"); |
| | | //插入token和更新时间 |
| | | entity.setToken(responseStr); |
| | | entity.setUpdateTime(new Date()); |
| | | httpTokenDao.update(entity, new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)); |
| | | } |
| | | |
| | | @Override |
| | | public String queryToken(String clientId) { |
| | | return httpTokenDao.selectOne(new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)).getToken(); |