fix(测试跟踪): 用例导入最后一条数据是合并单元格并且最后一行是空内容,该用例导入失败

--bug=1022350 --user=陈建星 【测试跟踪】功能用例导入-当只有一个步骤时-第二个步骤为空不填写-导入失败 https://www.tapd.cn/55049933/s/1351497
This commit is contained in:
chenjianxing 2023-03-16 15:35:12 +08:00 committed by jianxing
parent 752ddb3ab8
commit 99f4622cc9
1 changed files with 14 additions and 5 deletions

View File

@ -182,6 +182,16 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
testCaseExcelData = this.parseDataToModel(data);
}
buildUpdateOrErrorList(rowIndex, testCaseExcelData);
if (list.size() > BATCH_COUNT || updateList.size() > BATCH_COUNT) {
saveData();
list.clear();
updateList.clear();
}
}
private void buildUpdateOrErrorList(Integer rowIndex, TestCaseExcelData testCaseExcelData) {
StringBuilder errMsg;
try {
//根据excel数据实体中的javax.validation + 正则表达式来校验excel数据
@ -214,11 +224,6 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
list.add(testCaseExcelData);
}
}
if (list.size() > BATCH_COUNT || updateList.size() > BATCH_COUNT) {
saveData();
list.clear();
updateList.clear();
}
}
/**
@ -856,6 +861,10 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
// 如果文件最后一行是没有内容的步骤这里处理最后一条合并单元格的数据
if (this.currentMergeData != null) {
buildUpdateOrErrorList(firstMergeRowIndex, currentMergeData);
}
saveData();
list.clear();
customFieldsMap.clear();