Browse Source

修改获取数据集,模型用户不存在提示

dev-complex-computation
chenzhihang 1 year ago
parent
commit
ce55cade57
2 changed files with 4 additions and 5 deletions
  1. +3
    -4
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/GitServiceImpl.java
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java

+ 3
- 4
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/GitServiceImpl.java View File

@@ -50,7 +50,7 @@ public class GitServiceImpl implements GitService {
String req = httpUtils.sendPost(gitendpoint + "/oauth/token", null, JsonUtils.mapToJson(params)); String req = httpUtils.sendPost(gitendpoint + "/oauth/token", null, JsonUtils.mapToJson(params));
// 解析响应JSON // 解析响应JSON
if (StringUtils.isEmpty(req)) { if (StringUtils.isEmpty(req)) {
throw new RuntimeException("终止响应内容为空。");
throw new RuntimeException("gitlink用户信息出错");
} }
// 将响应的JSON字符串转换为Map对象 // 将响应的JSON字符串转换为Map对象
Map<String, Object> runResMap = JsonUtils.jsonToMap(req); Map<String, Object> runResMap = JsonUtils.jsonToMap(req);
@@ -61,7 +61,7 @@ public class GitServiceImpl implements GitService {
//通过access_token获取用户信息 //通过access_token获取用户信息
String userReq = httpUtils.sendGetWithToken(gitendpoint + "/api/users/get_user_info.json", null, accessToken); String userReq = httpUtils.sendGetWithToken(gitendpoint + "/api/users/get_user_info.json", null, accessToken);
if (StringUtils.isEmpty(userReq)) { if (StringUtils.isEmpty(userReq)) {
throw new RuntimeException("终止响应内容为空。");
throw new RuntimeException("gitlink用户信息出错");
} }
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
String ci4sUsername = loginUser.getUsername(); String ci4sUsername = loginUser.getUsername();
@@ -71,8 +71,7 @@ public class GitServiceImpl implements GitService {
jedis.set(ci4sUsername + "_gitUserInfo", userReq); jedis.set(ci4sUsername + "_gitUserInfo", userReq);
return accessToken; return accessToken;
} catch (Exception e) { } catch (Exception e) {
log.error("登录GitLink失败。", e);
return null;
throw new RuntimeException("gitlink用户信息出错");
} }
} }




+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java View File

@@ -1274,7 +1274,7 @@ public class ModelsServiceImpl implements ModelsService {
modelDependency1TreeVo.setChildModelList(childModelList); modelDependency1TreeVo.setChildModelList(childModelList);
} }


Map<String, Object> getUserInfo(String ci4sUsername, String gitLinkUsername, String gitLinkPassword) throws IOException {
Map<String, Object> getUserInfo(String ci4sUsername, String gitLinkUsername, String gitLinkPassword) throws Exception {
Jedis jedis = new Jedis(redisHost, redisPort); Jedis jedis = new Jedis(redisHost, redisPort);
String userReq = jedis.get(ci4sUsername + "_gitUserInfo"); String userReq = jedis.get(ci4sUsername + "_gitUserInfo");
if (userReq == null) { if (userReq == null) {


Loading…
Cancel
Save