fix(测试用例): 拆分单元格&合并单元格&自定义字段解析格式处理

--bug=1045153 --user=王旭 【测试用例】ms系统语言为中文-用例导出为excel-默认格式/单元格拆分格式-导出数据模块、用例等级、步骤描述和预期结果为空 https://www.tapd.cn/55049933/s/1563756
This commit is contained in:
WangXu10 2024-08-15 19:59:17 +08:00 committed by 刘瑞斌
parent 9bdf6b013d
commit 2ac649b06f
2 changed files with 19 additions and 4 deletions

View File

@ -57,8 +57,7 @@ public class CustomFieldMultipleTextValidator extends AbstractCustomFieldValidat
if (StringUtils.isBlank(keyOrValuesStr) || StringUtils.equals(keyOrValuesStr, "[]")) { if (StringUtils.isBlank(keyOrValuesStr) || StringUtils.equals(keyOrValuesStr, "[]")) {
return JSON.toJSONString(new ArrayList<>()); return JSON.toJSONString(new ArrayList<>());
} }
List<String> keyOrValues = parse2Array(keyOrValuesStr); String keyOrValues = String.join(",", JSON.parseArray(keyOrValuesStr));
return keyOrValues;
return JSON.toJSONString(keyOrValues);
} }
} }

View File

@ -606,10 +606,12 @@ public class FunctionalCaseFileService {
//构建其他字段 //构建其他字段
buildExportOtherField(functionalCase, data, caseCommentMap, executeCommentMap, reviewCommentMap, request); buildExportOtherField(functionalCase, data, caseCommentMap, executeCommentMap, reviewCommentMap, request);
validateExportTextField(data); validateExportTextField(data);
if (CollectionUtils.isNotEmpty(textDescriptionList) && !request.getIsMerge()) { if (CollectionUtils.isNotEmpty(textDescriptionList) && request.getIsMerge()) {
// 如果有多条步骤则添加多条数据之后合并单元格 // 如果有多条步骤则添加多条数据之后合并单元格
buildExportMergeData(rowMergeInfo, list, textDescriptionList, expectedResultList, data); buildExportMergeData(rowMergeInfo, list, textDescriptionList, expectedResultList, data);
} else { } else {
data.setTextDescription(parseData(textDescriptionList));
data.setExpectedResult(parseData(expectedResultList));
list.add(data); list.add(data);
} }
}); });
@ -617,6 +619,20 @@ public class FunctionalCaseFileService {
return list; return list;
} }
/**
* 处理单行格式
*
* @param list
* @return
*/
private String parseData(List<String> list) {
String result = "";
for (int i = 0; i < list.size(); i++) {
result += "[" + (i + 1) + "]" + list.get(i) + "\n";
}
return result;
}
/** /**
* 构建基本参数 * 构建基本参数
* *