mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix(接口自动化): 接口自动化通知支持显示环境
--bug=1007801 --user=刘瑞斌 【接口测试】接口自动化定时任务通知模版增加“测试环境”变量 https://www.tapd.cn/55049933/s/1073013
This commit is contained in:
parent
71c8f2e34f
commit
630f1d5ed3
@ -638,16 +638,26 @@ public class ApiScenarioReportService {
|
||||
String environmentJson = scenario.getEnvironmentJson();
|
||||
JSONObject jsonObject = JSON.parseObject(environmentJson);
|
||||
ApiTestEnvironmentExample example = new ApiTestEnvironmentExample();
|
||||
example.createCriteria().andIdIn(jsonObject.values().stream().map(Object::toString).collect(Collectors.toList()));
|
||||
List<String> collect = jsonObject.values().stream().map(Object::toString).collect(Collectors.toList());
|
||||
collect.add("-1");// 防止没有配置环境导致不能发送的问题
|
||||
example.createCriteria().andIdIn(collect);
|
||||
List<ApiTestEnvironment> envs = apiTestEnvironmentMapper.selectByExample(example);
|
||||
String env = envs.stream().map(ApiTestEnvironment::getName).collect(Collectors.joining(","));
|
||||
paramMap.put("environment", env);
|
||||
if (StringUtils.isNotBlank(env)) {
|
||||
paramMap.put("environment", env);
|
||||
} else {
|
||||
paramMap.put("environment", "未配置");
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.equals(environmentType, EnvironmentType.GROUP.name())) {
|
||||
String environmentGroupId = scenario.getEnvironmentGroupId();
|
||||
EnvironmentGroup environmentGroup = environmentGroupMapper.selectByPrimaryKey(environmentGroupId);
|
||||
paramMap.put("environment", environmentGroup.getName());
|
||||
if (environmentGroup != null) {
|
||||
paramMap.put("environment", environmentGroup.getName());
|
||||
} else {
|
||||
paramMap.put("environment", "未配置");
|
||||
}
|
||||
}
|
||||
|
||||
String context = "${operator}执行接口自动化" + status + ": ${name}";
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 2afb06dda6388121cf7791ace177202286815061
|
||||
Subproject commit 22b92e86e3426ddc38b5295b3e42239694ed66c3
|
Loading…
Reference in New Issue
Block a user