Merge branch 'zcwy-0724' into dev0525

This commit is contained in:
nisen
2024-08-02 13:50:57 +08:00

View File

@@ -20,6 +20,7 @@ import com.xboe.module.course.entity.*;
import com.xboe.module.course.vo.TeacherVo; import com.xboe.module.course.vo.TeacherVo;
import com.xboe.school.study.dao.StudyCourseDao; import com.xboe.school.study.dao.StudyCourseDao;
import com.xboe.school.study.dao.StudySignupDao; 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.entity.StudySignup;
import com.xboe.school.study.service.IStudyHomeWorkService; import com.xboe.school.study.service.IStudyHomeWorkService;
import com.xboe.school.study.service.IStudyService; import com.xboe.school.study.service.IStudyService;
@@ -368,13 +369,17 @@ public class CoursePortalApi extends ApiBaseController{
return error("查询不到用户"); return error("查询不到用户");
} }
List<User>user=studyService.getUserNo(userIds); List<User>user=studyService.getUserNo(userIds);
try { try {//筛选出的人员
List<StudyCourseItem> list = studyService.getList(courseId, contentId, name, status); List<StudyCourseItem> list = studyService.getList(courseId, contentId, name, status);
if(list.isEmpty()){ if(list.isEmpty()){
return success("暂无数据"); return success("暂无数据");
} }
list.stream().filter(Objects::nonNull).forEach(s->{ for (StudyCourseItem s : list) {
shomeworkService.getByStudyIdAndContentId(s.getStudyId(),contentId).stream().filter(e-> !Objects.equals(e.getFilePath(), "")).filter(e->e.getFilePath()!=null).forEach(e->{ List<StudyHomeWork> 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->{ user.forEach(u->{
if(u.getId().equals(s.getAid())){ if(u.getId().equals(s.getAid())){
//取后缀 //取后缀
@@ -384,8 +389,7 @@ public class CoursePortalApi extends ApiBaseController{
} }
}); });
}); });
}); }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("导出异常"+e.getMessage()); throw new RuntimeException("导出异常"+e.getMessage());
@@ -410,7 +414,7 @@ public class CoursePortalApi extends ApiBaseController{
// 检查加上当前文件大小后是否会超过2GB // 检查加上当前文件大小后是否会超过2GB
long fileSizeInBytes = fileToZip.length(); long fileSizeInBytes = fileToZip.length();
if (totalCompressedSize + fileSizeInBytes > 2L * 1024 * 1024 * 1024) { if (totalCompressedSize + fileSizeInBytes > 2L * 1024 * 1024 * 1024) {
return success("您要下载的作业过大,请分批下载或联系管理员!"); return success("您要下载的作业过大,联系管理员!");
} }
// 添加 ZIP 条目 // 添加 ZIP 条目
ZipEntry entry = new ZipEntry(e.getKey()); ZipEntry entry = new ZipEntry(e.getKey());