refactor(项目设置): 优化系统自带环境带脚本时的通知

This commit is contained in:
wxg0103 2023-05-26 11:23:22 +08:00 committed by fit2-zhao
parent f33f28ae44
commit d5e9d3da54
1 changed files with 27 additions and 14 deletions

View File

@ -171,9 +171,21 @@ public class ApiTestEnvironmentService {
apiTestEnvironmentMapper.updateByPrimaryKeyWithBLOBs(apiTestEnvironment); apiTestEnvironmentMapper.updateByPrimaryKeyWithBLOBs(apiTestEnvironment);
if (StringUtils.isBlank(apiTestEnvironment.getCreateUser())){ if (StringUtils.isBlank(apiTestEnvironment.getCreateUser())){
UserGroupExample userGroupExample = new UserGroupExample(); ProjectApplication reviewer = projectApplicationService
userGroupExample.createCriteria().andSourceIdEqualTo(apiTestEnvironment.getProjectId()).andGroupIdEqualTo("project_admin"); .getProjectApplication(apiTestEnvironment.getProjectId(), ProjectApplicationType.API_SCRIPT_REVIEWER.name());
List<UserGroup> userGroups = userGroupMapper.selectByExample(userGroupExample); if (StringUtils.isNotBlank(reviewer.getTypeValue())) {
checkAndSendReviewMessage(apiTestEnvironment.getId(),
apiTestEnvironment.getName(),
apiTestEnvironment.getProjectId(),
NoticeConstants.TaskType.ENV_TASK,
envOrg.getConfig(),
apiTestEnvironment.getConfig(),
reviewer.getTypeValue()
);
} else {
UserGroupExample example = new UserGroupExample();
example.createCriteria().andSourceIdEqualTo(apiTestEnvironment.getProjectId()).andGroupIdEqualTo("project_admin");
List<UserGroup> userGroups = userGroupMapper.selectByExample(example);
if ( CollectionUtils.isNotEmpty(userGroups)) { if ( CollectionUtils.isNotEmpty(userGroups)) {
userGroups.forEach(userGroup -> { userGroups.forEach(userGroup -> {
checkAndSendReviewMessage(apiTestEnvironment.getId(), checkAndSendReviewMessage(apiTestEnvironment.getId(),
@ -186,6 +198,7 @@ public class ApiTestEnvironmentService {
); );
}); });
} }
}
} else { } else {
checkAndSendReviewMessage(apiTestEnvironment.getId(), checkAndSendReviewMessage(apiTestEnvironment.getId(),
apiTestEnvironment.getName(), apiTestEnvironment.getName(),