diff --git a/framework/sdk-parent/frontend/src/i18n/lang/track/en-US.js b/framework/sdk-parent/frontend/src/i18n/lang/track/en-US.js index 54f7224981..2f6bf7783d 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/track/en-US.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/track/en-US.js @@ -250,11 +250,13 @@ export default { xmind_export_tip: "Switch to Case List and export!", export_field_select_tips: "please select export fields", export_to_excel: "Export excel", - export_to_excel_tips: "support xls", + export_to_excel_tips: "support xlsx", export_to_excel_tips1: "support xls/xlsx", export_to_xmind: "Export xmind", export_to_xmind_tips: "support xmind", export_format: "Export Format", + export_to_zip: "Export zip", + export_to_zip_tips: "support zip", }, case_desc: "Case Desc", passing_rate: "Case Pass Rate", diff --git a/framework/sdk-parent/frontend/src/i18n/lang/track/zh-CN.js b/framework/sdk-parent/frontend/src/i18n/lang/track/zh-CN.js index 290ee7d32f..f816ebeb4a 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/track/zh-CN.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/track/zh-CN.js @@ -222,10 +222,12 @@ export default { xmind_export_tip: "请切换成用例列表导出!", export_field_select_tips: "选择导出范围", export_to_excel: "导出Excel表格", - export_to_excel_tips: "支持xls文件", + export_to_excel_tips: "支持xlsx文件", export_to_excel_tips1: "支持xls/xlsx文件", export_to_xmind: "导出思维导图", export_to_xmind_tips: "支持xmind文件", + export_to_zip: "导出压缩包", + export_to_zip_tips: "支持zip文件", }, case_desc: "用例描述", passing_rate: "用例通过率", diff --git a/framework/sdk-parent/frontend/src/i18n/lang/track/zh-TW.js b/framework/sdk-parent/frontend/src/i18n/lang/track/zh-TW.js index 149e01b914..a5ef73c4c2 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/track/zh-TW.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/track/zh-TW.js @@ -221,10 +221,12 @@ export default { xmind_export_tip: "請切換成用例列錶導出!", export_field_select_tips: "選擇導出範圍", export_to_excel: "導出Excel表格", - export_to_excel_tips: "支持xls文件", + export_to_excel_tips: "支持xlsx文件", export_to_excel_tips1: "支持xls/xlsx文件", export_to_xmind: "導出思維導圖", export_to_xmind_tips: "支持xmind文件", + export_to_zip: "導出壓縮包", + export_to_zip_tips: "支持zip文件", }, case_desc: "用例描述", passing_rate: "用例通過率", diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/CompressUtils.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/CompressUtils.java index e94bd91b64..ce766ed14d 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/CompressUtils.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/CompressUtils.java @@ -128,6 +128,33 @@ public class CompressUtils { return zipFile; } + /** + * 将多个文件压缩至指定路径 + * + * @param fileList 待压缩的文件列表 + * @param zipFilePath 压缩文件路径 + * @return 返回压缩好的文件 + * @throws IOException + */ + public static File zipFilesToPath(String zipFilePath, List fileList) throws IOException { + File zipFile = new File(zipFilePath); + // 文件输出流 + FileOutputStream outputStream = getFileStream(zipFile); + // 压缩流 + ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream); + + int size = fileList.size(); + // 压缩列表中的文件 + for (int i = 0; i < size; i++) { + File file = fileList.get(i); + zipFile(file, zipOutputStream); + } + // 关闭压缩流、文件流 + zipOutputStream.close(); + outputStream.close(); + return zipFile; + } + public static void deleteFile(String delPath) { try { File file = new File(delPath); diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 432c6450c2..046c91d729 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -375,8 +375,7 @@