作业导出判空

This commit is contained in:
lu
2024-07-31 16:55:01 +08:00
parent 860fb3f27c
commit b9c4503aaa

View File

@@ -369,7 +369,11 @@ public class CoursePortalApi extends ApiBaseController{
public void export(String courseName,String courseId,String contentId,String name,Integer status,HttpServletResponse response) throws IOException {
Map<String, String>map=new HashMap<>();
try {
studyService.getList(courseId, contentId, name, status).stream().filter(Objects::nonNull).forEach(s->{
List<StudyCourseItem> list = studyService.getList(courseId, contentId, name, status);
if(list.isEmpty()){
throw new RuntimeException("暂无数据");
}
list.stream().filter(Objects::nonNull).forEach(s->{
shomeworkService.getByStudyIdAndContentId(s.getStudyId(),contentId).stream().filter(Objects::nonNull).filter(e->e.getFilePath()!=null).forEach(e->{
//取作业后缀名
int dotIndex = e.getFilePath().lastIndexOf('/'); // 查找最后一个'.'的位置