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);
if (StringUtils.isBlank(apiTestEnvironment.getCreateUser())){
UserGroupExample userGroupExample = new UserGroupExample();
userGroupExample.createCriteria().andSourceIdEqualTo(apiTestEnvironment.getProjectId()).andGroupIdEqualTo("project_admin");
List<UserGroup> userGroups = userGroupMapper.selectByExample(userGroupExample);
if (CollectionUtils.isNotEmpty(userGroups)){
userGroups.forEach(userGroup -> {
checkAndSendReviewMessage(apiTestEnvironment.getId(),
apiTestEnvironment.getName(),
apiTestEnvironment.getProjectId(),
NoticeConstants.TaskType.ENV_TASK,
envOrg.getConfig(),
apiTestEnvironment.getConfig(),
userGroup.getUserId()
);
});
ProjectApplication reviewer = projectApplicationService
.getProjectApplication(apiTestEnvironment.getProjectId(), ProjectApplicationType.API_SCRIPT_REVIEWER.name());
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)) {
userGroups.forEach(userGroup -> {
checkAndSendReviewMessage(apiTestEnvironment.getId(),
apiTestEnvironment.getName(),
apiTestEnvironment.getProjectId(),
NoticeConstants.TaskType.ENV_TASK,
envOrg.getConfig(),
apiTestEnvironment.getConfig(),
userGroup.getUserId()
);
});
}
}
} else {
checkAndSendReviewMessage(apiTestEnvironment.getId(),