diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/course/api/CoursePortalApi.java b/servers/boe-server-all/src/main/java/com/xboe/module/course/api/CoursePortalApi.java index c06882f5..bcfc7094 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/module/course/api/CoursePortalApi.java +++ b/servers/boe-server-all/src/main/java/com/xboe/module/course/api/CoursePortalApi.java @@ -366,15 +366,15 @@ public class CoursePortalApi extends ApiBaseController{ } //作业导出 @GetMapping("/export") - public void export(String courseName,String courseId,String contentId,String name,Integer status,HttpServletResponse response) throws IOException { + public JsonResponse export(String courseName,String courseId,String contentId,String name,Integer status,HttpServletResponse response) throws IOException { Mapmap=new HashMap<>(); try { List list = studyService.getList(courseId, contentId, name, status); if(list.isEmpty()){ - throw new RuntimeException("暂无数据"); + return success("暂无数据"); } list.stream().filter(Objects::nonNull).forEach(s->{ - shomeworkService.getByStudyIdAndContentId(s.getStudyId(),contentId).stream().filter(Objects::nonNull).filter(e->e.getFilePath()!=null).forEach(e->{ + shomeworkService.getByStudyIdAndContentId(s.getStudyId(),contentId).stream().filter(e-> !Objects.equals(e.getFilePath(), "")).filter(e->e.getFilePath()!=null).forEach(e->{ //取作业后缀名 int dotIndex = e.getFilePath().lastIndexOf('/'); // 查找最后一个'.'的位置 String extension = e.getFilePath().substring(dotIndex+1); @@ -406,7 +406,7 @@ public class CoursePortalApi extends ApiBaseController{ // 检查加上当前文件大小后,是否会超过2GB long fileSizeInBytes = fileToZip.length(); if (totalCompressedSize + fileSizeInBytes > 2L * 1024 * 1024 * 1024) { - throw new RuntimeException("您要下载的作业过大,请分批下载或联系管理员!"); + return success("您要下载的作业过大,请分批下载或联系管理员!"); } // 添加 ZIP 条目 ZipEntry entry = new ZipEntry(e.getKey()); @@ -426,6 +426,7 @@ public class CoursePortalApi extends ApiBaseController{ zos.closeEntry(); } } + return success("导出成功"); } @GetMapping("/detail-study") public JsonResponse> detailStudy(String courseId, String aid){