fix(测试跟踪): 修复缺陷列表用例为0,场景导入创建接口响应体默认值问题

修复缺陷列表展示用例为0的情况,修复场景导入响应体数据的默认值不全导致接口编辑页面响应体展示不显示输入框以及运行404的问题
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001011982
--user=郭雨琦
This commit is contained in:
guoyuqi 2022-04-07 14:46:08 +08:00 committed by xiaomeinvG
parent cad9110d4a
commit 883b9cbef6
2 changed files with 14 additions and 4 deletions

View File

@ -7,6 +7,8 @@ import io.metersphere.api.dto.automation.ApiScenarioModuleDTO;
import io.metersphere.api.dto.definition.ApiDefinitionResult;
import io.metersphere.api.dto.definition.parse.ms.NodeTree;
import io.metersphere.api.dto.definition.response.HttpResponse;
import io.metersphere.api.dto.scenario.Body;
import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.api.parse.ApiImportAbstractParser;
import io.metersphere.api.service.ApiDefinitionService;
import io.metersphere.api.service.ApiScenarioModuleService;
@ -20,6 +22,7 @@ import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.service.CheckPermissionService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -209,7 +212,14 @@ public class ApiScenarioImportUtil {
objectNew.remove("refType");
objectNew.remove("referenced");
test.setRequest(objectNew.toJSONString());
test.setResponse(JSON.toJSONString(new HttpResponse()));
HttpResponse httpResponse = new HttpResponse();
KeyValue keyValue = new KeyValue();
List<KeyValue> list = new ArrayList<>();
list.add(keyValue);
httpResponse.setHeaders(list);
httpResponse.setStatusCode(list);
httpResponse.setBody(new Body());
test.setResponse(JSON.toJSONString(httpResponse));
test.setUserId(SessionUtils.getUserId());
test.setLatest(true);
test.setOrder(apiDefinitionService.getImportNextOrder(projectId));

View File

@ -406,10 +406,10 @@ public class IssuesService {
} else {
caseIdSet.add(i.getResourceId());
}
if(map.get(i.getId())!=null){
map.get(i.getId()).addAll(caseIdSet);
if(map.get(i.getIssuesId())!=null){
map.get(i.getIssuesId()).addAll(caseIdSet);
}else{
map.put(i.getId(),caseIdSet);
map.put(i.getIssuesId(),caseIdSet);
}
});
return map;