Skip to content

Commit

Permalink
refactor(项目设置): 优化系统自带环境带脚本时的通知
Browse files Browse the repository at this point in the history
  • Loading branch information
wxg0103 authored and fit2-zhao committed May 29, 2023
1 parent f33f28a commit d5e9d3d
Showing 1 changed file with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,33 @@ public void update(ApiTestEnvironmentDTO apiTestEnvironment, List<MultipartFile>
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(),
Expand Down

0 comments on commit d5e9d3d

Please sign in to comment.