fix(测试用例): 导出用例子模块未导出问题

--bug=1046089 --user=王旭 【测试用例】github#32941导出excle格式的用例,导出是选择了所属模块,但是excle中所属模块内容为空 https://www.tapd.cn/55049933/s/1574745
This commit is contained in:
WangXu10 2024-09-05 11:32:41 +08:00 committed by Craftsman
parent 22c5bb9125
commit dd6a088a92
1 changed files with 13 additions and 3 deletions

View File

@ -330,7 +330,7 @@ public class FunctionalCaseFileService {
XMindCaseParser xMindParser = new XMindCaseParser(request, customFields, user, lasePos); XMindCaseParser xMindParser = new XMindCaseParser(request, customFields, user, lasePos);
errList = xMindParser.parse(multipartFile); errList = xMindParser.parse(multipartFile);
response.setErrorMessages(errList); response.setErrorMessages(errList);
response.setSuccessCount(xMindParser.getList().size() + xMindParser.getUpdateList().size()+ xMindParser.getCheckSuccessList().size()); response.setSuccessCount(xMindParser.getList().size() + xMindParser.getUpdateList().size() + xMindParser.getCheckSuccessList().size());
response.setFailCount(errList.size()); response.setFailCount(errList.size());
xMindParser.clear(); xMindParser.clear();
return response; return response;
@ -407,7 +407,7 @@ public class FunctionalCaseFileService {
} }
xmindParser.saveData(); xmindParser.saveData();
response.setErrorMessages(errList); response.setErrorMessages(errList);
response.setSuccessCount(xmindParser.getList().size() + xmindParser.getUpdateList().size()+ xmindParser.getCheckSuccessList().size()); response.setSuccessCount(xmindParser.getList().size() + xmindParser.getUpdateList().size() + xmindParser.getCheckSuccessList().size());
response.setFailCount(errList.size()); response.setFailCount(errList.size());
xmindParser.clear(); xmindParser.clear();
return response; return response;
@ -882,7 +882,17 @@ public class FunctionalCaseFileService {
*/ */
private Map<String, String> getModuleMap(String projectId) { private Map<String, String> getModuleMap(String projectId) {
List<BaseTreeNode> moduleTree = functionalCaseModuleService.getTree(projectId); List<BaseTreeNode> moduleTree = functionalCaseModuleService.getTree(projectId);
Map<String, String> moduleMap = moduleTree.stream().collect(Collectors.toMap(BaseTreeNode::getId, BaseTreeNode::getPath)); Map<String, String> moduleMap = buildModuleMap(moduleTree, new HashMap());
return moduleMap;
}
private Map<String, String> buildModuleMap(List<BaseTreeNode> moduleTree, Map<String, String> moduleMap) {
for (BaseTreeNode treeNode : moduleTree) {
moduleMap.put(treeNode.getId(), treeNode.getPath());
if (CollectionUtils.isNotEmpty(treeNode.getChildren())) {
buildModuleMap(treeNode.getChildren(), moduleMap);
}
}
return moduleMap; return moduleMap;
} }