|
|
|
@ -11,9 +11,9 @@ import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeCourseInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.CourseInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.FileEntity;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeCourseInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.web.query.ResourcesInfoQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.ResourcesQuestionQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeCourseInfoQuery;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
@ -34,6 +34,7 @@ import java.io.*;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
|
|
|
|
|
import static java.util.stream.Collectors.joining;
|
|
|
|
|
import static java.util.stream.Collectors.toSet;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -56,6 +57,12 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
|
|
|
|
|
private ResourcesApplicationCourseService resourcesApplicationCourseService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherService teacherService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseMergeResourcesInfoService teacherOpenCourseMergeResourcesInfoService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResourcesInfoService resourcesInfoService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResourcesQuestionService resourcesQuestionService;
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseMergeCourseInfo>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseMergeCourseInfoDao.queryByCondition(query);
|
|
|
|
@ -431,11 +438,31 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
|
|
|
|
|
courseInfoIds.stream().parallel().forEach(courseInfoId -> {
|
|
|
|
|
// 获取这个课程章节下的所有的子章节信息
|
|
|
|
|
List<CourseInfo> chapterList = courseInfoService.getChapterList(Long.valueOf(courseInfoId));
|
|
|
|
|
|
|
|
|
|
// 如果课程章节没查到记录,则下面的资源也没必要执行,资源依赖课程章节
|
|
|
|
|
if (ObjectUtil.isEmpty(chapterList)) { return; }
|
|
|
|
|
|
|
|
|
|
// 取出来所有的课程章节ID
|
|
|
|
|
Set<Long> cids = chapterList.stream().map(CourseInfo::getCourseInfoId).collect(toSet());
|
|
|
|
|
// 拷贝所有的题目关联到指定的开课下
|
|
|
|
|
teacherOpenCourseMergeResourcesQuestionService.copyFromQuestion(cids, teacherOpenCourseId);
|
|
|
|
|
String allCourseInfoIdsJoin = chapterList.stream().map(item -> item.getCourseInfoId().toString()).collect(joining(","));
|
|
|
|
|
|
|
|
|
|
ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery();
|
|
|
|
|
resourcesQuestionQuery.setCourseInfoIds(allCourseInfoIdsJoin);
|
|
|
|
|
resourcesQuestionQuery.setQuestionStatus(1);
|
|
|
|
|
List<ResourcesQuestion> resourcesQuestionList = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery);
|
|
|
|
|
|
|
|
|
|
// 系统题目库ID集合
|
|
|
|
|
Set<Long> resourcesQuestionIds = resourcesQuestionList.stream().map(ResourcesQuestion::getResourcesQuestionId).collect(toSet());
|
|
|
|
|
// 拷贝系统题目库到教师开课
|
|
|
|
|
teacherOpenCourseMergeResourcesQuestionService.copyFromQuestion(resourcesQuestionIds, teacherOpenCourseId);
|
|
|
|
|
|
|
|
|
|
ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery();
|
|
|
|
|
resourcesInfoQuery.setCourseInfoIds(allCourseInfoIdsJoin);
|
|
|
|
|
List<ResourcesInfo> resourcesInfoList = resourcesInfoService.getValuesByQuery(resourcesInfoQuery);
|
|
|
|
|
|
|
|
|
|
// 系统资源库ID集合
|
|
|
|
|
Set<Long> resourcesInfoIds = resourcesInfoList.stream().map(ResourcesInfo::getResourcesInfoId).collect(toSet());
|
|
|
|
|
// 拷贝系统资源库到教师开课
|
|
|
|
|
teacherOpenCourseMergeResourcesInfoService.copyFromResourcesInfo(resourcesInfoIds, teacherOpenCourseId);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|