feat(测试计划): 测试计划通知
This commit is contained in:
parent
8eaadd7bc3
commit
0d60b03697
|
@ -460,7 +460,6 @@ message.domain.test_plan_plannedEndTime=计划结束时间
|
||||||
message.domain.test_plan_actualStartTime=实际开始时间
|
message.domain.test_plan_actualStartTime=实际开始时间
|
||||||
message.domain.test_plan_actualEndTime=实际结束时间
|
message.domain.test_plan_actualEndTime=实际结束时间
|
||||||
message.domain.test_plan_num=编号
|
message.domain.test_plan_num=编号
|
||||||
message.domain.test_plan_name=名称
|
|
||||||
message.domain.test_plan_type=类型
|
message.domain.test_plan_type=类型
|
||||||
# 用例评审
|
# 用例评审
|
||||||
message.domain.case_review_name=名称
|
message.domain.case_review_name=名称
|
||||||
|
|
|
@ -461,7 +461,6 @@ message.domain.test_plan_plannedEndTime=計劃結束時間
|
||||||
message.domain.test_plan_actualStartTime=實際開始時間
|
message.domain.test_plan_actualStartTime=實際開始時間
|
||||||
message.domain.test_plan_actualEndTime=實際結束時間
|
message.domain.test_plan_actualEndTime=實際結束時間
|
||||||
message.domain.test_plan_num=編號
|
message.domain.test_plan_num=編號
|
||||||
message.domain.test_plan_name=名稱
|
|
||||||
message.domain.test_plan_type=類型
|
message.domain.test_plan_type=類型
|
||||||
# 用例評審
|
# 用例評審
|
||||||
message.domain.case_review_name=名稱
|
message.domain.case_review_name=名稱
|
||||||
|
|
|
@ -6,14 +6,13 @@ import io.metersphere.plan.dto.request.*;
|
||||||
import io.metersphere.plan.dto.response.TestPlanDetailResponse;
|
import io.metersphere.plan.dto.response.TestPlanDetailResponse;
|
||||||
import io.metersphere.plan.dto.response.TestPlanResponse;
|
import io.metersphere.plan.dto.response.TestPlanResponse;
|
||||||
import io.metersphere.plan.dto.response.TestPlanStatisticsResponse;
|
import io.metersphere.plan.dto.response.TestPlanStatisticsResponse;
|
||||||
import io.metersphere.plan.service.TestPlanLogService;
|
import io.metersphere.plan.service.*;
|
||||||
import io.metersphere.plan.service.TestPlanManagementService;
|
|
||||||
import io.metersphere.plan.service.TestPlanService;
|
|
||||||
import io.metersphere.plan.service.TestPlanStatisticsService;
|
|
||||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.log.annotation.Log;
|
import io.metersphere.system.log.annotation.Log;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
|
import io.metersphere.system.notice.annotation.SendNotice;
|
||||||
|
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||||
import io.metersphere.system.security.CheckOwner;
|
import io.metersphere.system.security.CheckOwner;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
|
@ -74,6 +73,7 @@ public class TestPlanController {
|
||||||
@Operation(summary = "测试计划-创建测试计划")
|
@Operation(summary = "测试计划-创建测试计划")
|
||||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_ADD)
|
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_ADD)
|
||||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||||
|
@SendNotice(taskType = NoticeConstants.TaskType.TEST_PLAN_TASK, event = NoticeConstants.Event.CREATE, target = "#targetClass.sendAddNotice(#request)", targetClass = TestPlanSendNoticeService.class)
|
||||||
public String add(@Validated @RequestBody TestPlanCreateRequest request) {
|
public String add(@Validated @RequestBody TestPlanCreateRequest request) {
|
||||||
testPlanManagementService.checkModuleIsOpen(request.getProjectId(), TestPlanResourceConfig.CHECK_TYPE_PROJECT, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN));
|
testPlanManagementService.checkModuleIsOpen(request.getProjectId(), TestPlanResourceConfig.CHECK_TYPE_PROJECT, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN));
|
||||||
return testPlanService.add(request, SessionUtils.getUserId(), "/test-plan/add", HttpMethodConstants.POST.name());
|
return testPlanService.add(request, SessionUtils.getUserId(), "/test-plan/add", HttpMethodConstants.POST.name());
|
||||||
|
@ -83,6 +83,7 @@ public class TestPlanController {
|
||||||
@Operation(summary = "测试计划-更新测试计划")
|
@Operation(summary = "测试计划-更新测试计划")
|
||||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
||||||
@CheckOwner(resourceId = "#request.getId()", resourceType = "test_plan")
|
@CheckOwner(resourceId = "#request.getId()", resourceType = "test_plan")
|
||||||
|
@SendNotice(taskType = NoticeConstants.TaskType.TEST_PLAN_TASK, event = NoticeConstants.Event.CREATE, target = "#targetClass.sendUpdateNotice(#request)", targetClass = TestPlanSendNoticeService.class)
|
||||||
public String add(@Validated @RequestBody TestPlanUpdateRequest request) {
|
public String add(@Validated @RequestBody TestPlanUpdateRequest request) {
|
||||||
testPlanManagementService.checkModuleIsOpen(request.getId(), TestPlanResourceConfig.CHECK_TYPE_TEST_PLAN, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN));
|
testPlanManagementService.checkModuleIsOpen(request.getId(), TestPlanResourceConfig.CHECK_TYPE_TEST_PLAN, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN));
|
||||||
return testPlanService.update(request, SessionUtils.getUserId(), "/test-plan/update", HttpMethodConstants.POST.name());
|
return testPlanService.update(request, SessionUtils.getUserId(), "/test-plan/update", HttpMethodConstants.POST.name());
|
||||||
|
@ -93,6 +94,7 @@ public class TestPlanController {
|
||||||
@Operation(summary = "测试计划-删除测试计划")
|
@Operation(summary = "测试计划-删除测试计划")
|
||||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_DELETE)
|
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_DELETE)
|
||||||
@CheckOwner(resourceId = "#id", resourceType = "test_plan")
|
@CheckOwner(resourceId = "#id", resourceType = "test_plan")
|
||||||
|
@SendNotice(taskType = NoticeConstants.TaskType.TEST_PLAN_TASK, event = NoticeConstants.Event.CREATE, target = "#targetClass.sendDeleteNotice(#id)", targetClass = TestPlanSendNoticeService.class)
|
||||||
public void delete(@NotBlank @PathVariable String id) {
|
public void delete(@NotBlank @PathVariable String id) {
|
||||||
testPlanManagementService.checkModuleIsOpen(id, TestPlanResourceConfig.CHECK_TYPE_TEST_PLAN, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN));
|
testPlanManagementService.checkModuleIsOpen(id, TestPlanResourceConfig.CHECK_TYPE_TEST_PLAN, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN));
|
||||||
testPlanService.delete(id, SessionUtils.getUserId(), "/test-plan/delete", HttpMethodConstants.GET.name());
|
testPlanService.delete(id, SessionUtils.getUserId(), "/test-plan/delete", HttpMethodConstants.GET.name());
|
||||||
|
|
|
@ -3,9 +3,14 @@ package io.metersphere.plan.service;
|
||||||
import io.metersphere.functional.domain.FunctionalCase;
|
import io.metersphere.functional.domain.FunctionalCase;
|
||||||
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
||||||
import io.metersphere.plan.domain.TestPlan;
|
import io.metersphere.plan.domain.TestPlan;
|
||||||
|
import io.metersphere.plan.domain.TestPlanConfig;
|
||||||
import io.metersphere.plan.domain.TestPlanExample;
|
import io.metersphere.plan.domain.TestPlanExample;
|
||||||
import io.metersphere.plan.dto.TestPlanDTO;
|
import io.metersphere.plan.dto.TestPlanDTO;
|
||||||
|
import io.metersphere.plan.dto.request.TestPlanCreateRequest;
|
||||||
|
import io.metersphere.plan.dto.request.TestPlanUpdateRequest;
|
||||||
|
import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
||||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||||
|
import io.metersphere.sdk.constants.TestPlanConstants;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.domain.User;
|
import io.metersphere.system.domain.User;
|
||||||
|
@ -40,6 +45,8 @@ public class TestPlanSendNoticeService {
|
||||||
private NoticeSendService noticeSendService;
|
private NoticeSendService noticeSendService;
|
||||||
@Resource
|
@Resource
|
||||||
private CommonNoticeSendService commonNoticeSendService;
|
private CommonNoticeSendService commonNoticeSendService;
|
||||||
|
@Resource
|
||||||
|
private TestPlanConfigMapper testPlanConfigMapper;
|
||||||
|
|
||||||
public void sendNoticeCase(List<String> relatedUsers, String userId, String caseId, String task, String event, String testPlanId) {
|
public void sendNoticeCase(List<String> relatedUsers, String userId, String caseId, String task, String event, String testPlanId) {
|
||||||
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(caseId);
|
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(caseId);
|
||||||
|
@ -118,4 +125,30 @@ public class TestPlanSendNoticeService {
|
||||||
List<TestPlan> testPlans = testPlanMapper.selectByExample(example);
|
List<TestPlan> testPlans = testPlanMapper.selectByExample(example);
|
||||||
return testPlans.stream().collect(Collectors.toMap(TestPlan::getId, testPlan -> testPlan));
|
return testPlans.stream().collect(Collectors.toMap(TestPlan::getId, testPlan -> testPlan));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TestPlanDTO sendAddNotice(TestPlanCreateRequest request) {
|
||||||
|
TestPlanDTO dto = new TestPlanDTO();
|
||||||
|
BeanUtils.copyBean(dto, request);
|
||||||
|
dto.setStatus(TestPlanConstants.TEST_PLAN_STATUS_PREPARED);
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestPlanDTO sendUpdateNotice(TestPlanUpdateRequest request) {
|
||||||
|
TestPlanDTO dto = new TestPlanDTO();
|
||||||
|
BeanUtils.copyBean(dto, request);
|
||||||
|
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getId());
|
||||||
|
dto.setStatus(testPlan.getStatus());
|
||||||
|
dto.setType(testPlan.getType());
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestPlanDTO sendDeleteNotice(String id) {
|
||||||
|
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(id);
|
||||||
|
TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(id);
|
||||||
|
TestPlanDTO dto = new TestPlanDTO();
|
||||||
|
BeanUtils.copyBean(dto, testPlan);
|
||||||
|
BeanUtils.copyBean(dto, testPlanConfig);
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue