fix: 修复删除计划时重新查询model的问题

--bug=1009008 --user=刘瑞斌 【消息中心】删除测试计划提示信息参数无值 https://www.tapd.cn/55049933/s/1085153
This commit is contained in:
CaptainB 2021-12-22 16:00:02 +08:00 committed by 刘瑞斌
parent 6c38dc571c
commit bae4c71167
3 changed files with 9 additions and 3 deletions

View File

@ -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<String, Object> memberValues = (Map<String, Object>) 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<String, Object> memberValues = (Map<String, Object>) value.get(invocationHandler);
memberValues.put("source", JSON.toJSONString(v));
memberValues.put("source", JSON.toJSONString(v, WriteMapNullValue));
}
}

View File

@ -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);

View File

@ -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<String> principals = request.getPrincipals();
if (!CollectionUtils.isEmpty(principals)) {