Selaa lähdekoodia

3.4.6 20250613 测试下载文件名乱码

xiaofei 3 viikkoa sitten
vanhempi
commit
6764a6987d

+ 7 - 2
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -1539,8 +1539,13 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             writer.writeDataArrays("成绩单", null, columnNames, columnValues.listIterator());
 //            FileOutputStream fileOut = new FileOutputStream(downloadFilePath + File.separator + basicCourse.getName() + "-成绩单" + SystemConstant.EXCEL_PREFIX);
 //            Path filePath = Paths.get(downloadFilePath, "111" + SystemConstant.EXCEL_PREFIX);
-            Path basePath = Paths.get(downloadFilePath);  // 纯ASCII路径
-            Path filePath = basePath.resolve(basicCourse.getName() + "-成绩单" + SystemConstant.EXCEL_PREFIX);  // 添加中文部分
+//            Path basePath = Paths.get(downloadFilePath);  // 纯ASCII路径
+//            Path filePath = basePath.resolve(basicCourse.getName() + "-成绩单" + SystemConstant.EXCEL_PREFIX);  // 添加中文部分
+
+            Path filePath = Paths.get(
+                    downloadFilePath,
+                    new String((basicCourse.getName() + "-成绩单" + SystemConstant.EXCEL_PREFIX).getBytes("UTF-8"), StandardCharsets.UTF_8)
+            );
             OutputStream outputStream = Files.newOutputStream(filePath, StandardOpenOption.CREATE, StandardOpenOption.WRITE);
             writer.output(outputStream);
             outputStream.flush();