From 389dff8fbecfe927740b9b2273d24d320ecdf197 Mon Sep 17 00:00:00 2001 From: lu Date: Fri, 2 Aug 2024 13:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=AF=BC=E5=87=BA=E5=88=A4?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xboe/module/course/api/CoursePortalApi.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 74737544..eb72f82b 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 @@ -20,6 +20,7 @@ import com.xboe.module.course.entity.*; import com.xboe.module.course.vo.TeacherVo; import com.xboe.school.study.dao.StudyCourseDao; import com.xboe.school.study.dao.StudySignupDao; +import com.xboe.school.study.entity.StudyHomeWork; import com.xboe.school.study.entity.StudySignup; import com.xboe.school.study.service.IStudyHomeWorkService; import com.xboe.school.study.service.IStudyService; @@ -368,13 +369,17 @@ public class CoursePortalApi extends ApiBaseController{ return error("查询不到用户"); } Listuser=studyService.getUserNo(userIds); - try { + try {//筛选出的人员 List list = studyService.getList(courseId, contentId, name, status); if(list.isEmpty()){ return success("暂无数据"); } - list.stream().filter(Objects::nonNull).forEach(s->{ - shomeworkService.getByStudyIdAndContentId(s.getStudyId(),contentId).stream().filter(e-> !Objects.equals(e.getFilePath(), "")).filter(e->e.getFilePath()!=null).forEach(e->{ + for (StudyCourseItem s : list) { + List studyHomeWorks = shomeworkService.getByStudyIdAndContentId(s.getStudyId(), contentId).stream().filter(e-> !Objects.equals(e.getFilePath(), "")).filter(e->e.getFilePath()!=null).collect(Collectors.toList()); + if(studyHomeWorks.isEmpty()){ + return success("暂无数据"); + } + studyHomeWorks.forEach(e->{ user.forEach(u->{ if(u.getId().equals(s.getAid())){ //取后缀 @@ -384,8 +389,7 @@ public class CoursePortalApi extends ApiBaseController{ } }); }); - }); - + } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("导出异常"+e.getMessage()); @@ -410,7 +414,7 @@ public class CoursePortalApi extends ApiBaseController{ // 检查加上当前文件大小后,是否会超过2GB long fileSizeInBytes = fileToZip.length(); if (totalCompressedSize + fileSizeInBytes > 2L * 1024 * 1024 * 1024) { - return success("您要下载的作业过大,请分批下载或联系管理员!"); + return success("您要下载的作业过大,联系管理员!"); } // 添加 ZIP 条目 ZipEntry entry = new ZipEntry(e.getKey());