From 4a18fee70675257f89301eb9e2d1958b6b65a394 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 27 Oct 2021 22:48:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=8F=82=E6=95=B0):=20#1007539=20=E8=A7=A3=E5=86=B3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=B3=BB=E7=BB=9F=E5=8F=82=E6=95=B0=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F=E5=8F=82=E6=95=B0=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiTestEnvironmentService.java | 5 ++--- .../java/io/metersphere/service/ProjectService.java | 12 +++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestEnvironmentService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestEnvironmentService.java index 7e50ea9dbd..622e0b94b1 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestEnvironmentService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestEnvironmentService.java @@ -382,9 +382,8 @@ public class ApiTestEnvironmentService { private String getSystemIdByProjectId(String projectId){ ProjectService projectService = CommonBeanFactory.getBean(ProjectService.class); - - if(projectService != null){ - Project project = projectService.getProjectById(projectId); + Project project = projectService.getProjectById(projectId); + if(project != null){ project = projectService.checkSystemId(project); return projectService.getSystemIdByProjectId(projectId); }else { diff --git a/backend/src/main/java/io/metersphere/service/ProjectService.java b/backend/src/main/java/io/metersphere/service/ProjectService.java index 0833fa6896..f7a42b8468 100644 --- a/backend/src/main/java/io/metersphere/service/ProjectService.java +++ b/backend/src/main/java/io/metersphere/service/ProjectService.java @@ -412,11 +412,13 @@ public class ProjectService { public Project getProjectById(String id) { Project project = projectMapper.selectByPrimaryKey(id); - String createUser = project.getCreateUser(); - if (StringUtils.isNotBlank(createUser)) { - User user = userMapper.selectByPrimaryKey(createUser); - if (user != null) { - project.setCreateUser(user.getName()); + if(project != null){ + String createUser = project.getCreateUser(); + if (StringUtils.isNotBlank(createUser)) { + User user = userMapper.selectByPrimaryKey(createUser); + if (user != null) { + project.setCreateUser(user.getName()); + } } } return project;