From 956cd90c3e6fe6389f0d06fa0cc0d49d4c67c734 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 3 Nov 2022 15:26:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E8=87=AA=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1017289 --user=陈建星 【测试跟踪】github]#17894,测试计划勾选“自动更新状态”后,执行接口用例/场景报错 https://www.tapd.cn/55049933/s/1287519 --- .../io/metersphere/track/service/TestCaseCommentService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseCommentService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseCommentService.java index 1c88c77595..4bb331927d 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseCommentService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseCommentService.java @@ -7,6 +7,7 @@ import io.metersphere.base.mapper.TestCaseMapper; import io.metersphere.base.mapper.UserMapper; import io.metersphere.base.mapper.ext.ExtTestCaseCommentMapper; import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.i18n.Translator; import io.metersphere.log.utils.ReflexObjectUtil; @@ -39,7 +40,8 @@ public class TestCaseCommentService { public TestCaseComment saveComment(SaveCommentRequest request) { TestCaseComment testCaseComment = new TestCaseComment(); testCaseComment.setId(request.getId()); - testCaseComment.setAuthor(SessionUtils.getUser().getId()); + SessionUser user = SessionUtils.getUser(); + testCaseComment.setAuthor(user == null ? "System" : user.getId()); testCaseComment.setCaseId(request.getCaseId()); testCaseComment.setCreateTime(System.currentTimeMillis()); testCaseComment.setUpdateTime(System.currentTimeMillis());