From bae4c71167bd7265edce171a7e51a124b081d8aa Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 22 Dec 2021 16:00:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=97=B6=E9=87=8D=E6=96=B0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?model=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009008 --user=刘瑞斌 【消息中心】删除测试计划提示信息参数无值 https://www.tapd.cn/55049933/s/1085153 --- .../java/io/metersphere/notice/sender/SendNoticeAspect.java | 6 ++++-- .../io/metersphere/track/controller/TestPlanController.java | 2 +- .../java/io/metersphere/track/service/TestPlanService.java | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/notice/sender/SendNoticeAspect.java b/backend/src/main/java/io/metersphere/notice/sender/SendNoticeAspect.java index dd62d85463..d69a4ce34a 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/SendNoticeAspect.java +++ b/backend/src/main/java/io/metersphere/notice/sender/SendNoticeAspect.java @@ -35,6 +35,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static com.alibaba.fastjson.serializer.SerializerFeature.WriteMapNullValue; + @Aspect @Component public class SendNoticeAspect { @@ -81,7 +83,7 @@ public class SendNoticeAspect { Expression titleExp = parser.parseExpression(target); Object v = titleExp.getValue(context, Object.class); Map memberValues = (Map) value.get(invocationHandler); - memberValues.put("source", JSON.toJSONString(v)); + memberValues.put("source", JSON.toJSONString(v, WriteMapNullValue)); } } catch (Exception e) { LogUtil.error(e.getMessage(), e); @@ -119,7 +121,7 @@ public class SendNoticeAspect { Object v = titleExp.getValue(context, Object.class); if (v != null) { Map memberValues = (Map) value.get(invocationHandler); - memberValues.put("source", JSON.toJSONString(v)); + memberValues.put("source", JSON.toJSONString(v, WriteMapNullValue)); } } diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java index d650310393..a6b0db84de 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java @@ -133,7 +133,7 @@ public class TestPlanController { @PostMapping("/delete/{testPlanId}") @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_DELETE) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testPlanId)", msClass = TestPlanService.class) - @SendNotice(taskType = NoticeConstants.TaskType.TEST_PLAN_TASK, target = "#targetClass.getTestPlan(#testPlanId)", targetClass = TestPlanService.class, + @SendNotice(taskType = NoticeConstants.TaskType.TEST_PLAN_TASK, target = "#targetClass.get(#testPlanId)", targetClass = TestPlanService.class, event = NoticeConstants.Event.DELETE, mailTemplate = "track/TestPlanDelete", subject = "测试计划通知") public int deleteTestPlan(@PathVariable String testPlanId) { checkPermissionService.checkTestPlanOwner(testPlanId); diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 01c62a9203..4ff72b95ec 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -243,6 +243,10 @@ public class TestPlanService { return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlanWithBLOBs()); } + public TestPlanWithBLOBs get(String testPlanId) { + return testPlanMapper.selectByPrimaryKey(testPlanId); + } + public TestPlan editTestPlanWithRequest(AddTestPlanRequest request) { List principals = request.getPrincipals(); if (!CollectionUtils.isEmpty(principals)) {