mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 09:26:48 +08:00
作业导出判空
This commit is contained in:
@@ -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("查询不到用户");
|
||||
}
|
||||
List<User>user=studyService.getUserNo(userIds);
|
||||
try {
|
||||
try {//筛选出的人员
|
||||
List<StudyCourseItem> 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<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->{
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user