fix(接口测试): 更改接口测试审核人的通知方式,如果不指定人则默认发送给创建人或责任人

This commit is contained in:
wxg0103 2023-05-22 15:50:35 +08:00 committed by fit2-zhao
parent 77490c32a1
commit cacd315da8
5 changed files with 34 additions and 21 deletions

View File

@ -437,7 +437,8 @@ public class ApiTestCaseService {
"接口用例通知",
NoticeConstants.TaskType.API_DEFINITION_TASK,
requestOrg,
test.getRequest()
test.getRequest(),
test.getCreateUserId()
);
}
// 存储附件关系
@ -511,7 +512,8 @@ public class ApiTestCaseService {
"接口用例通知",
NoticeConstants.TaskType.API_DEFINITION_TASK,
null,
test.getRequest()
test.getRequest(),
test.getCreateUserId()
);
// 存储附件关系
extFileAssociationService.saveApi(test.getId(), request.getRequest(), FileAssociationTypeEnums.CASE.name());
@ -1343,21 +1345,23 @@ public class ApiTestCaseService {
String title,
String resourceType,
String requestOrg,
String requestTarget) {
String requestTarget,
String sendUser) {
ProjectApplication scriptEnable = baseProjectApplicationService
.getProjectApplication(projectId, ProjectApplicationType.API_REVIEW_TEST_SCRIPT.name());
if (BooleanUtils.toBoolean(scriptEnable.getTypeValue())) {
ProjectApplication reviewer = baseProjectApplicationService
.getProjectApplication(projectId, ProjectApplicationType.API_SCRIPT_REVIEWER.name());
if (StringUtils.isNotEmpty(reviewer.getTypeValue()) &&
baseProjectService.isProjectMember(projectId, reviewer.getTypeValue())) {
List<String> org = ElementUtil.scriptList(requestOrg);
List<String> target = ElementUtil.scriptList(requestTarget);
boolean isSend = ElementUtil.isSend(org, target);
if (isSend) {
ProjectApplication reviewer = baseProjectApplicationService
.getProjectApplication(projectId, ProjectApplicationType.API_SCRIPT_REVIEWER.name());
if (StringUtils.isNotEmpty(reviewer.getTypeValue())) {
sendUser = reviewer.getTypeValue();
}
if (baseProjectService.isProjectMember(projectId, sendUser)) {
Notification notification = new Notification();
notification.setTitle(title);
notification.setOperator(reviewer.getTypeValue());
@ -1368,7 +1372,7 @@ public class ApiTestCaseService {
notification.setType(NotificationConstants.Type.SYSTEM_NOTICE.name());
notification.setStatus(NotificationConstants.Status.UNREAD.name());
notification.setCreateTime(System.currentTimeMillis());
notification.setReceiver(reviewer.getTypeValue());
notification.setReceiver(sendUser);
notificationService.sendAnnouncement(notification);
}
}

View File

@ -304,7 +304,8 @@ public class ApiScenarioService {
"场景用例通知",
NoticeConstants.TaskType.API_AUTOMATION_TASK,
null,
scenario.getScenarioDefinition()
scenario.getScenarioDefinition(),
scenario.getPrincipal()
);
uploadFiles(request, bodyFiles, scenarioFiles);
@ -418,7 +419,8 @@ public class ApiScenarioService {
"场景用例通知",
NoticeConstants.TaskType.API_AUTOMATION_TASK,
beforeScenario.getScenarioDefinition(),
scenario.getScenarioDefinition()
scenario.getScenarioDefinition(),
scenario.getPrincipal()
);
String defaultVersion = baseProjectVersionMapper.getDefaultVersion(request.getProjectId());

View File

@ -420,7 +420,8 @@ public class BaseEnvironmentService extends NodeTreeService<ApiModuleDTO> {
request.getProjectId(),
NoticeConstants.TaskType.ENV_TASK,
null,
request.getConfig()
request.getConfig(),
request.getCreateUser()
);
return request.getId();
}
@ -509,7 +510,8 @@ public class BaseEnvironmentService extends NodeTreeService<ApiModuleDTO> {
apiTestEnvironment.getProjectId(),
NoticeConstants.TaskType.ENV_TASK,
envOrg.getConfig(),
apiTestEnvironment.getConfig()
apiTestEnvironment.getConfig(),
apiTestEnvironment.getCreateUser()
);
}
@ -1015,20 +1017,24 @@ public class BaseEnvironmentService extends NodeTreeService<ApiModuleDTO> {
String projectId,
String resourceType,
String requestOrg,
String requestTarget) {
String requestTarget,
String sendUser) {
ProjectApplication scriptEnable = baseProjectApplicationService
.getProjectApplication(projectId, ProjectApplicationType.API_REVIEW_TEST_SCRIPT.name());
if (BooleanUtils.toBoolean(scriptEnable.getTypeValue())) {
ProjectApplication reviewer = baseProjectApplicationService
.getProjectApplication(projectId, ProjectApplicationType.API_SCRIPT_REVIEWER.name());
if (StringUtils.isNotEmpty(reviewer.getTypeValue()) &&
baseProjectService.isProjectMember(projectId, reviewer.getTypeValue())) {
List<String> org = scriptList(requestOrg);
List<String> target = scriptList(requestTarget);
boolean isSend = isSend(org, target);
if (isSend) {
ProjectApplication reviewer = baseProjectApplicationService
.getProjectApplication(projectId, ProjectApplicationType.API_SCRIPT_REVIEWER.name());
if (StringUtils.isNotBlank(reviewer.getTypeValue())) {
sendUser = reviewer.getTypeValue();
}
if (baseProjectService.isProjectMember(projectId, sendUser)) {
Notification notification = new Notification();
notification.setTitle("环境设置");
notification.setOperator(reviewer.getTypeValue());
@ -1039,7 +1045,7 @@ public class BaseEnvironmentService extends NodeTreeService<ApiModuleDTO> {
notification.setType(NotificationConstants.Type.SYSTEM_NOTICE.name());
notification.setStatus(NotificationConstants.Status.UNREAD.name());
notification.setCreateTime(System.currentTimeMillis());
notification.setReceiver(reviewer.getTypeValue());
notification.setReceiver(sendUser);
notificationService.sendAnnouncement(notification);
}
}

View File

@ -1022,7 +1022,7 @@ public class PerformanceTestService {
if (StringUtils.isNotEmpty(loadTestScriptReviewerConfig.getTypeValue())) {
sendUser = loadTestScriptReviewerConfig.getTypeValue();
}
if (baseProjectService.isProjectMember(projectId, loadTestScriptReviewerConfig.getTypeValue())) {
if (baseProjectService.isProjectMember(projectId, sendUser)) {
Notification notification = new Notification();
notification.setTitle("性能测试通知");
notification.setOperator(SessionUtils.getUserId());

View File

@ -258,7 +258,8 @@ public class ProjectApplicationService {
String type = conf.getType();
String value = conf.getTypeValue();
//性能测试审核人允许value值为空
if (!StringUtils.equals(type, ProjectApplicationType.PERFORMANCE_SCRIPT_REVIEWER.name())
if ( !StringUtils.equals(type, ProjectApplicationType.API_SCRIPT_REVIEWER.name())
&& !StringUtils.equals(type, ProjectApplicationType.PERFORMANCE_SCRIPT_REVIEWER.name())
&& (StringUtils.isBlank(projectId) || StringUtils.isBlank(type) || StringUtils.isEmpty(value))) {
LogUtil.error("create or update project config error. project id or conf type or value is blank.");
return;