mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-30 11:08:38 +08:00
refactor(接口测试): 环境组选项查询时过滤掉不存在的项目
--bug=1011599 --user=李玉号 【接口测试】场景批量执行,带自定义请求的场景,选择环境组,提示缺少项目环境 https://www.tapd.cn/55049933/s/1124186
This commit is contained in:
parent
7ce28d2589
commit
274fe5c7c0
@ -287,12 +287,18 @@ public class EnvironmentGroupService {
|
||||
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId());
|
||||
List<EnvironmentGroupDTO> result = new ArrayList<>();
|
||||
List<EnvironmentGroup> groups = environmentGroupMapper.selectByExample(example);
|
||||
List<String> ids = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(projectIds)) {
|
||||
List<Project> projects = projectMapper.selectByExample(new ProjectExample());
|
||||
List<String> allProjectIds = projects.stream().map(Project::getId).collect(Collectors.toList());
|
||||
ids = projectIds.stream().filter(allProjectIds::contains).collect(Collectors.toList());
|
||||
}
|
||||
for (EnvironmentGroup group : groups) {
|
||||
Map<String, String> envMap = environmentGroupProjectService.getEnvMap(group.getId());
|
||||
EnvironmentGroupDTO dto = new EnvironmentGroupDTO();
|
||||
BeanUtils.copyProperties(group, dto);
|
||||
if (CollectionUtils.isNotEmpty(projectIds)) {
|
||||
boolean b = envMap.keySet().containsAll(projectIds);
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
boolean b = envMap.keySet().containsAll(ids);
|
||||
if (BooleanUtils.isFalse(b)) {
|
||||
dto.setDisabled(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user