修复1、测试用例导出时表格章节号不对问题;2、部分章节测试用例没有导出的问题

This commit is contained in:
zwz 2025-06-02 22:39:02 +08:00
parent b079d42fcd
commit 77381ea173
2 changed files with 12 additions and 5 deletions

View File

@ -37,4 +37,5 @@ public class PmsProjectTestcaseVo {
private String identifier; private String identifier;
private String testTracking; private String testTracking;
} }

View File

@ -564,7 +564,9 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
List<PmsProjectTestcaseVo> testcases = getTestcase(item); List<PmsProjectTestcaseVo> testcases = getTestcase(item);
for (PmsProjectTestcaseVo testcase : testcases) { for (PmsProjectTestcaseVo testcase : testcases) {
if (testcase.getPmsModuleId() == moduleId) { Long pmsModuleId = testcase.getPmsModuleId();
boolean isEqual = Objects.equals(pmsModuleId, moduleId);
if (isEqual) {
List<PmsProjectTestcaseStepVo> steps = getTestcaseStep(testcase.getId()); List<PmsProjectTestcaseStepVo> steps = getTestcaseStep(testcase.getId());
PendingOutputDataVo pendingOutputData = new PendingOutputDataVo(); PendingOutputDataVo pendingOutputData = new PendingOutputDataVo();
pendingOutputData.setId(testcase.getId()); pendingOutputData.setId(testcase.getId());
@ -1110,25 +1112,29 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
} }
} }
int chapter = 1; int chapter = 0;
while (!stack.isEmpty()) { while (!stack.isEmpty()) {
TreeSelect current = stack.pop(); TreeSelect current = stack.pop();
// 处理当前节点这里简单打印节点信息你可以根据需求修改 // 处理当前节点这里简单打印节点信息你可以根据需求修改
//System.out.println("ID: " + current.getId() + ", 名称: " + current.getLabel() + ", 层级:" + current.getLevel() + ", 父ID: " + current.getParentId() + ", 是否叶子节点: " + current.getIsLeaf() ); // System.out.println("ID: " + current.getId() + ", 名称: " + current.getLabel() + ", 层级:" + current.getLevel() + ", 父ID: " + current.getParentId() + ", 是否叶子节点: " + current.getIsLeaf() );
if (current.getIsLeaf()) { if (current.getIsLeaf()) {
if (current.getLevel() == 1){
chapter = chapter + 1;
}
if(current.getId() > 0){ if(current.getId() > 0){
addNumberedHeading(document, current.getLabel(), current.getLevel()); addNumberedHeading(document, current.getLabel(), current.getLevel());
List<PendingOutputDataVo> pendingOutputDatas = GetPendingOutputData(projectId, current.getId()); List<PendingOutputDataVo> pendingOutputDatas = GetPendingOutputData(projectId, current.getId());
insertTable(document, pendingOutputDatas, chapter); insertTable(document, pendingOutputDatas, chapter);
chapter = chapter + 1;
} else { } else {
addNumberedHeading(document, current.getLabel(), current.getLevel()); addNumberedHeading(document, current.getLabel(), current.getLevel());
List<PendingOutputDataVo> pendingOutputDatas = GetPendingOutputData(projectId, null); List<PendingOutputDataVo> pendingOutputDatas = GetPendingOutputData(projectId, null);
insertTable(document, pendingOutputDatas, chapter); insertTable(document, pendingOutputDatas, chapter);
chapter = chapter + 1;
} }
} else{ } else{
if (current.getLevel() == 1){
chapter = chapter + 1;
}
if(current.getId() > 0){ if(current.getId() > 0){
addNumberedHeading(document, current.getLabel(), current.getLevel()); addNumberedHeading(document, current.getLabel(), current.getLevel());
} }