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());