fix (接口自动化): 修复单条调试问题

--bug=1007252 --user=赵勇 调试场景中复制的其他项目单接口用例时,环境匹配错误 https://www.tapd.cn/55049933/s/1057008
This commit is contained in:
fit2-zhao 2021-10-20 18:07:15 +08:00 committed by fit2-zhao
parent 8bec32198a
commit 1ee9b1169e
1 changed files with 8 additions and 6 deletions

View File

@ -789,13 +789,15 @@ public class ApiDefinitionService {
Map<String, EnvironmentConfig> envConfig = new HashMap<>();
Map<String, String> map = request.getEnvironmentMap();
if (map != null && map.size() > 0) {
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(request.getProjectId()));
if (environment != null) {
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
env.setApiEnvironmentid(environment.getId());
envConfig.put(request.getProjectId(), env);
config.setConfig(envConfig);
for (String key : map.keySet()) {
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(key));
if (environment != null) {
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
env.setApiEnvironmentid(environment.getId());
envConfig.put(key, env);
}
}
config.setConfig(envConfig);
}
if (CollectionUtils.isNotEmpty(bodyFiles)) {