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)) {