mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
作业导出,删除注释代码
This commit is contained in:
@@ -396,49 +396,6 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
String zipFilePath = "/home/www/elearning/upload/saveZip/" + courseName+"【作业】" + ".zip";
|
||||
createZipFile(map, zipFilePath);
|
||||
return success(zipFilePath);
|
||||
// 创建一个临时文件用于存储ZIP文件
|
||||
// File tempZipFile = new File("/home/www/elearning/upload/temp.zip");
|
||||
//
|
||||
// try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(tempZipFile))) {
|
||||
// for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
// File fileToZip = new File(e.getValue());
|
||||
// // 添加 ZIP 条目
|
||||
// ZipEntry entry = new ZipEntry(e.getKey());
|
||||
// entry.setSize(fileToZip.length());
|
||||
//
|
||||
// zos.putNextEntry(entry);
|
||||
//
|
||||
// try (FileInputStream fis = new FileInputStream(fileToZip)) {
|
||||
// byte[] buffer = new byte[4096];
|
||||
// int len;
|
||||
// while ((len = fis.read(buffer)) > 0) {
|
||||
// zos.write(buffer, 0, len);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// zos.closeEntry();
|
||||
// }
|
||||
// }
|
||||
// // 将临时文件移动到指定位置
|
||||
// Path source = tempZipFile.toPath();
|
||||
// //生成uuid
|
||||
//// String uuid = UUID.randomUUID().toString();
|
||||
// Path destination = Paths.get("/home/www/elearning/upload/saveZip/" + courseName+"【作业】" + ".zip");
|
||||
//
|
||||
// // 确保目标目录存在
|
||||
// Files.createDirectories(destination.getParent());
|
||||
//
|
||||
// // 删除目标文件如果已存在
|
||||
// if (Files.exists(destination)) {
|
||||
// Files.delete(destination);
|
||||
// }
|
||||
//
|
||||
// // 移动文件
|
||||
// Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
|
||||
//
|
||||
// // 返回文件路径给前端
|
||||
// String filePath = destination.toAbsolutePath().toString();
|
||||
// return success(filePath);
|
||||
}
|
||||
private static void createZipFile(Map<String, String> map, String zipFilePath) throws IOException {
|
||||
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFilePath))) {
|
||||
|
||||
Reference in New Issue
Block a user