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,20 +171,33 @@ 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())) {
if (CollectionUtils.isNotEmpty(userGroups)){ checkAndSendReviewMessage(apiTestEnvironment.getId(),
userGroups.forEach(userGroup -> { apiTestEnvironment.getName(),
checkAndSendReviewMessage(apiTestEnvironment.getId(), apiTestEnvironment.getProjectId(),
apiTestEnvironment.getName(), NoticeConstants.TaskType.ENV_TASK,
apiTestEnvironment.getProjectId(), envOrg.getConfig(),
NoticeConstants.TaskType.ENV_TASK, apiTestEnvironment.getConfig(),
envOrg.getConfig(), reviewer.getTypeValue()
apiTestEnvironment.getConfig(), );
userGroup.getUserId() } else {
); UserGroupExample example = new UserGroupExample();
}); example.createCriteria().andSourceIdEqualTo(apiTestEnvironment.getProjectId()).andGroupIdEqualTo("project_admin");
List<UserGroup> userGroups = userGroupMapper.selectByExample(example);
if ( CollectionUtils.isNotEmpty(userGroups)) {
userGroups.forEach(userGroup -> {
checkAndSendReviewMessage(apiTestEnvironment.getId(),
apiTestEnvironment.getName(),
apiTestEnvironment.getProjectId(),
NoticeConstants.TaskType.ENV_TASK,
envOrg.getConfig(),
apiTestEnvironment.getConfig(),
userGroup.getUserId()
);
});
}
} }
} else { } else {
checkAndSendReviewMessage(apiTestEnvironment.getId(), checkAndSendReviewMessage(apiTestEnvironment.getId(),