| | |
| | | import com.querydsl.jpa.hibernate.HibernateQueryFactory; |
| | | import com.qxueyou.scc.base.dao.BaseDAO; |
| | | import com.qxueyou.scc.base.model.UserInfoWrapper; |
| | | import com.qxueyou.scc.teach.subject.model.Subject; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectChapter; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectLecture; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectUtils; |
| | | import com.qxueyou.scc.teach.subject.model.view.*; |
| | | import com.qxueyou.scc.user.model.User; |
| | | import org.hibernate.Session; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import com.qxueyou.scc.evaluate.service.IEvaluateService; |
| | | import com.qxueyou.scc.operation.topic.service.ITopicService; |
| | | import com.qxueyou.scc.teach.res.service.IResAudioService; |
| | | import com.qxueyou.scc.teach.subject.model.view.LectureAudioV; |
| | | import com.qxueyou.scc.teach.subject.model.view.MyLectureV; |
| | | import com.qxueyou.scc.teach.subject.model.view.MySubjectV; |
| | | import com.qxueyou.scc.teach.subject.service.ILectureService; |
| | | import com.qxueyou.scc.teach.subject.service.ISubjectService; |
| | | |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * 学习端 课程前端控制器 |
| | | * 学习端 课程前端控制器 |
| | | * |
| | | * @author chenjunliang |
| | | */ |
| | | @Api(tags = "课程管理-学员端") |
| | | @Api(tags = "课程管理-学员端") |
| | | @RestController |
| | | @CrossOrigin(origins = "*", maxAge = 3600) |
| | | @RequestMapping(value = "stu/subject") |
| | |
| | | @Autowired |
| | | IEvaluateService evaluateService; |
| | | |
| | | //--------------------------------------------------------------app端接口--------------------------------------------------------------------------------------------------- |
| | | //--------------------------------------------------------------app端接口--------------------------------------------------------------------------------------------------- |
| | | |
| | | /** |
| | | * 学习端获取 所有课件 |
| | | * 学习端获取 所有课件 |
| | | * |
| | | * @param classId |
| | | * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。) |
| | | * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。) |
| | | */ |
| | | @ApiOperation(value = "获取班级所有课件-学习端", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)") |
| | | @ApiOperation(value = "获取班级所有课件-学习端", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "sort", value = "排序方式(desc从大到小,asc从小到大)", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "sort", value = "排序方式(desc从大到小,asc从小到大)", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "/app/getCoursewareLstByClassId") |
| | | public Result appCoursewareLst(String classId, @RequestParam(defaultValue = "desc") String sort, Pager pager) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取课程列表 |
| | | * 学习端获取课程列表 |
| | | */ |
| | | @ApiOperation(value = "学习端获取课程学年列表") |
| | | @ApiOperation(value = "学习端获取课程学年列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "/app/termList") |
| | | public Result termList(String classId) { |
| | | classId = CommonUtils.getClassId(classId); |
| | | if (StringUtils.isEmpty(classId)) { |
| | | return new Result(false, "班级id不能为空"); |
| | | return new Result(false, "班级id不能为空"); |
| | | } |
| | | //课程 |
| | | //课程 |
| | | List<Map<String, Object>> lstSubject = subjectService.clsSubjectlist(classId, null, null); |
| | | //组装的学期和课程 |
| | | //组装的学期和课程 |
| | | List<Map<String, Object>> lstTerm = subjectService.termSubjectList(classId, lstSubject); |
| | | |
| | | return new Result(true, "success", CollectionUtils.newObjectMap("termList", lstTerm, "allSubject", lstSubject)); |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取课程列表 |
| | | * 学习端获取课程列表 |
| | | */ |
| | | @ApiOperation(value = "我的课程按学期分类") |
| | | @ApiOperation(value = "我的课程按学期分类") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "/app/myTermSubjectList") |
| | | public Result myTermSubjectList(String classId) { |
| | | classId = CommonUtils.getClassId(classId); |
| | | System.out.println("vvvvvvvvv" + classId); |
| | | if (StringUtils.isEmpty(classId)) { |
| | | return new Result(false, "班级id不能为空"); |
| | | return new Result(false, "班级id不能为空"); |
| | | } |
| | | return new Result(true, "success", subjectService.myTermSubjectList(classId)); |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取课程列表 |
| | | * 学习端获取课程列表 |
| | | */ |
| | | @ApiOperation(value = "我的课程按时间排序") |
| | | @ApiOperation(value = "我的课程按时间排序") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "/app/mySubjectList") |
| | | public Result mySubjectList(String classId, Pager pager) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 我的课程详情 |
| | | * 我的课程详情 |
| | | * |
| | | * @param subjectId |
| | | * @param classId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "我的课程详情") |
| | | @ApiOperation(value = "我的课程详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "/app/mySubjectInfo") |
| | | public Result mySubjectInfo(String subjectId, String classId) { |
| | | classId = CommonUtils.getClassId(classId); |
| | | if (StringUtils.isEmpty(classId)) { |
| | | return new Result(false, "班级id不能为空"); |
| | | return new Result(false, "班级id不能为空"); |
| | | } |
| | | if (StringUtils.isEmpty(subjectId)) { |
| | | return new Result(false, "课程id不能为空"); |
| | | return new Result(false, "课程id不能为空"); |
| | | } |
| | | return new Result(true, "success", subjectService.mySubjectInfo(subjectId, classId)); |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取课程列表 |
| | | * 学习端获取课程列表 |
| | | */ |
| | | @ApiOperation(value = "我的班级信息") |
| | | @ApiOperation(value = "我的班级信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "/app/myClassInfo") |
| | | public Result myClassInfo(String classId) { |
| | | classId = ClientUtils.getClassId(); |
| | | if (StringUtils.isEmpty(classId)) { |
| | | return new Result(false, "班级id不能为空"); |
| | | return new Result(false, "班级id不能为空"); |
| | | } |
| | | return new Result(true, "success", subjectService.myClassInfo(classId)); |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取课程列表 |
| | | * 学习端获取课程列表 |
| | | */ |
| | | @ApiOperation(value = "学习端获取课程列表") |
| | | @ApiOperation(value = "学习端获取课程列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "schoolYear", value = "学年", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "term", value = "学期", required = true, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "schoolYear", value = "学年", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "term", value = "学期", required = true, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "/app/subjectList") |
| | | public Result subjectList(String classId, Integer schoolYear, Integer term) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取课程列表 |
| | | * 学习端获取课程列表 |
| | | */ |
| | | @ApiOperation(value = "学习端获取课程下课件,按创建时间排序") |
| | | @ApiOperation(value = "学习端获取课程下课件,按创建时间排序") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "sort", value = "排序方式(desc从大到小,asc从小到大)", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "sort", value = "排序方式(desc从大到小,asc从小到大)", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "/app/listLectureBySubject") |
| | | public Result listLectureBySubject(String subjectId, String classId, @RequestParam(defaultValue = "desc") String sort, Pager pager) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取其他课件统计 |
| | | * 学习端获取其他课件统计 |
| | | */ |
| | | @ApiOperation(value = "学习端获取其他课件统计") |
| | | @ApiOperation(value = "学习端获取其他课件统计") |
| | | @GetMapping(value = "/app/otherLectureCount") |
| | | public Result otherLectureCount() { |
| | | return new Result(true, "success", CollectionUtils.newObjectMap("topicCount", |
| | |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取课程列表 |
| | | * 学习端获取课程列表 |
| | | */ |
| | | @ApiOperation(value = "学习端获取课程下课件,按目录分类", notes = "") |
| | | @ApiOperation(value = "学习端获取课程下课件,按目录分类", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "/app/coursewareList") |
| | | public Result coursewareList(String classId, String subjectId, String type) { |
| | | classId = CommonUtils.getClassId(classId); |
| | | |
| | | if (StringUtils.isEmpty(subjectId)) { |
| | | return new Result(false, "课程id不能为空"); |
| | | return new Result(false, "课程id不能为空"); |
| | | } |
| | | |
| | | return this.clsLectureService.coursewareChapterList(classId, subjectId, type); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 我的公开课列表 |
| | | * 我的公开课列表 |
| | | */ |
| | | @ApiOperation(value = "我的公开课列表", notes = "") |
| | | @ApiOperation(value = "我的公开课列表", notes = "") |
| | | @GetMapping(value = "/app/myOpenSubjectList") |
| | | public Result myOpenSubjectList(Pager pager, @RequestParam(defaultValue = "") String keyword) { |
| | | return new Result(true, "success", this.subjectService.myOpenSubjectList(pager.getOffset(), pager.getPageSize(), keyword)); |
| | | } |
| | | |
| | | /** |
| | | * 公开课列表 |
| | | * 公开课列表 |
| | | */ |
| | | @ApiOperation(value = "公开课列表", notes = "") |
| | | @ApiOperation(value = "公开课列表", notes = "") |
| | | @GetMapping(value = "/app/openSubjectList") |
| | | public Result openSubjectList(Pager pager, @RequestParam(defaultValue = "") String keyword) { |
| | | return new Result(true, "success", this.subjectService.openSubjectList(pager.getOffset(), pager.getPageSize(), keyword)); |
| | | } |
| | | |
| | | /** |
| | | * 公开课详情 |
| | | * 公开课详情 |
| | | */ |
| | | @ApiOperation(value = "公开课详情", notes = "") |
| | | @ApiOperation(value = "公开课详情", notes = "") |
| | | @GetMapping(value = "/app/openSubjectInfo") |
| | | public Result openSubjectInfo(@RequestParam(defaultValue = "") String subjectId) { |
| | | return new Result(true, "success", this.subjectService.openSubjectInfo(subjectId)); |
| | | } |
| | | |
| | | //--------------------------------------------------------后台端接口--------------------------------------------------------------------------------------------------- |
| | | //--------------------------------------------------------后台端接口--------------------------------------------------------------------------------------------------- |
| | | |
| | | /** |
| | | * 加载课件tree |
| | | * 加载课件tree |
| | | */ |
| | | @ApiOperation(value = "加载课件tree", notes = "") |
| | | @ApiOperation(value = "加载课件tree", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "subjectId", value = "班级id", required = false, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "subjectId", value = "班级id", required = false, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "categoryTree") |
| | | public Result categoryTree(String subjectId, String parentId) { |
| | | // classId = StringUtils.isEmpty(classId)?ClientUtils.getClassId():classId; |
| | | List<SubjectProgressTreeV> chapterLst = clsLectureService.getChapterTreeVList(subjectId, parentId); |
| | | Subject subject = subjectService.read(subjectId); |
| | | if (subject.getType() == 3) { |
| | | List<SubjectChapter> openChapterLst = lectureService.getListChapter(subjectId, parentId); |
| | | return new Result(true, "success", QBeanUtils.listBean2ListMap(openChapterLst, CollectionUtils |
| | | .newStringMap("name", "name", "chapterId", "id", "parentChapterId", "parentId"))); |
| | | |
| | | for (SubjectProgressTreeV v : chapterLst) { |
| | | v.setNodeName(v.getNodeName() + "(" + String.format("%.2f", v.getPercent() * 100) + "%)"); //保留两位小数 |
| | | } else { |
| | | // classId = StringUtils.isEmpty(classId)?ClientUtils.getClassId():classId; |
| | | List<SubjectProgressTreeV> chapterLst = clsLectureService.getChapterTreeVList(subjectId, parentId); |
| | | |
| | | for (SubjectProgressTreeV v : chapterLst) { |
| | | v.setNodeName(v.getNodeName() + "(" + String.format("%.2f", v.getPercent() * 100) + "%)"); //保留两位小数 |
| | | } |
| | | return new Result(true, "success", QBeanUtils.listBean2ListMap(chapterLst, CollectionUtils |
| | | .newStringMap("nodeName", "name", "id.nodeId", "id", "parentId", "parentId", "percent", "percent"))); |
| | | |
| | | } |
| | | |
| | | return new Result(true, "success", QBeanUtils.listBean2ListMap(chapterLst, CollectionUtils |
| | | .newStringMap("nodeName", "name", "id.nodeId", "id", "parentId", "parentId", "percent", "percent"))); |
| | | } |
| | | |
| | | /** |
| | | * 学习端获取 所有课件 |
| | | * 学习端获取 所有课件 |
| | | * |
| | | * @param classId |
| | | * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。) |
| | | * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。) |
| | | */ |
| | | @ApiOperation(value = "学习端获取 所有课件", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)") |
| | | @ApiOperation(value = "学习端获取 所有课件", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "subjectId", value = "班级id", required = false, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "subjectId", value = "班级id", required = false, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "getCoursewareLstByClassId") |
| | | public Result getCoursewareLst(String subjectId) { |
| | | List<ClsSubjectLecture> lectureLst = clsLectureService.listLecture(subjectId); |
| | | if (lectureLst.size() > 0) { |
| | | // id为小节id //返回的数据按照tree的小节排序 |
| | | return new Result(true, "success", |
| | | |
| | | // id为小节id //返回的数据按照tree的小节排序 |
| | | return new Result(true, "success", |
| | | QBeanUtils.listBean2ListMap(lectureLst, CollectionUtils.newStringMap("name", "name", "lectureId", "id", |
| | | "lectureType", "type", "chapterId", "chapterId"))); |
| | | } else { |
| | | List<SubjectLecture> lectureList = lectureService.listLectureBySubjectId(subjectId); |
| | | // id为小节id //返回的数据按照tree的小节排序 |
| | | return new Result(true, "success", |
| | | |
| | | QBeanUtils.listBean2ListMap(lectureLst, CollectionUtils.newStringMap("name", "name", "lectureId", "id", |
| | | "lectureType", "type", "chapterId", "chapterId"))); |
| | | QBeanUtils.listBean2ListMap(lectureList, CollectionUtils.newStringMap("name", "name", "lectureId", "id", |
| | | "lectureType", "type", "chapterId", "chapterId"))); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取课件列表 |
| | | * 获取课件列表 |
| | | * |
| | | * @param chapterId 章节id |
| | | * @param type 课件类型 |
| | | * @param keyword 搜索关键字 |
| | | * @param limit 每页显示几条 |
| | | * @param pageNum 页码 |
| | | * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。) |
| | | * @param chapterId 章节id |
| | | * @param type 课件类型 |
| | | * @param keyword 搜索关键字 |
| | | * @param limit 每页显示几条 |
| | | * @param pageNum 页码 |
| | | * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。) |
| | | */ |
| | | @ApiOperation(value = "根据章节获取课件列表", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)") |
| | | @ApiOperation(value = "根据章节获取课件列表", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "chapterId", value = "章节id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "chapterId", value = "章节id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "coursewareListByChapterId") |
| | | public Result coursewareList(String chapterId, String type, String keyword, Integer limit, @RequestParam(defaultValue = "1") Integer pageNum) { |
| | | |
| | | List<MyLectureV> lectures = clsLectureService.listLectureV(ClientUtils.getUserId(), chapterId, keyword, limit, |
| | | pageNum, type); |
| | | if (lectures.size() == 0) { |
| | | List<SubjectLecture> lecturesTwo = lectureService.getSubjectLectureVByChapterId(chapterId, keyword, limit, pageNum); |
| | | List<MyOpenLectureV> lecturesThree = lectureService.getMyOpenLectureVByChapterId(ClientUtils.getUserId(), chapterId, keyword, limit, pageNum); |
| | | for (SubjectLecture subjectLecture : lecturesTwo) { |
| | | boolean isNull = true; |
| | | MyLectureV myLectureV = new MyLectureV(new MyLectureVId()); |
| | | for (MyOpenLectureV myOpenLectureV : lecturesThree) { |
| | | if (subjectLecture.getLectureId().equals(myOpenLectureV.getLectureId())) { |
| | | isNull = false; |
| | | myLectureV.setLectureName(myOpenLectureV.getLectureName()); |
| | | myLectureV.getId().setLectureId(myOpenLectureV.getLectureId()); |
| | | myLectureV.setLectureType(myOpenLectureV.getLectureType()); |
| | | myLectureV.setLectureUpdateTime(myOpenLectureV.getLectureUpdateTime()); |
| | | myLectureV.setPercent(myOpenLectureV.getPercent()); |
| | | lectures.add(myLectureV); |
| | | } |
| | | } |
| | | if (isNull) { |
| | | myLectureV.setLectureName(subjectLecture.getName()); |
| | | myLectureV.getId().setLectureId(subjectLecture.getLectureId()); |
| | | myLectureV.setLectureType(subjectLecture.getLectureType()); |
| | | myLectureV.setLectureUpdateTime(subjectLecture.getUpdateTime()); |
| | | myLectureV.setPercent(0.0); |
| | | lectures.add(myLectureV); |
| | | } |
| | | } |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("coursewareLst", |
| | | QBeanUtils.listBean2ListMap(lectures, |
| | | CollectionUtils.newStringMap("lectureName", "name", "id.lectureId", "id", "lectureType", |
| | | "type", "lectureUpdateTime", "endUpdateTime", "percent", "percent")))); |
| | | |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("coursewareLst", |
| | | QBeanUtils.listBean2ListMap(lectures, |
| | | CollectionUtils.newStringMap("lectureName", "name", "id.lectureId", "id", "lectureType", |
| | | "type", "lectureUpdateTime", "endUpdateTime", "percent", "percent")))); |
| | | } else { |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("coursewareLst", |
| | | QBeanUtils.listBean2ListMap(lectures, |
| | | CollectionUtils.newStringMap("lectureName", "name", "id.lectureId", "id", "lectureType", |
| | | "type", "lectureUpdateTime", "endUpdateTime", "percent", "percent")))); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 课件学习进度提交 stu/subject/study |
| | | * 课件学习进度提交 stu/subject/study |
| | | * |
| | | * @param lectureId 课件id |
| | | * @param from 开始学习位置 ,如视频,则为时分秒(00:10:12),如文档,则无需提交该参数 |
| | | * @param to 结束学习位置,同to |
| | | * @param lectureId 课件id |
| | | * @param from 开始学习位置 ,如视频,则为时分秒(00:10:12),如文档,则无需提交该参数 |
| | | * @param to 结束学习位置,同to |
| | | */ |
| | | @ApiOperation(value = "提交学习进度") |
| | | @ApiOperation(value = "提交学习进度") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "lectureId", value = "课件id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "from", value = "开始学习位置 ,如视频,则为时分秒(00:10:12),如文档,则无需提交该参数", required = true, paramType = "query", dataType = "Double"), |
| | | @ApiImplicitParam(name = "to", value = "结束学习位置,同to", required = true, paramType = "query", dataType = "Double"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "lectureParentId", value = "父课件id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "lectureId", value = "课件id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "from", value = "开始学习位置 ,如视频,则为时分秒(00:10:12),如文档,则无需提交该参数", required = true, paramType = "query", dataType = "Double"), |
| | | @ApiImplicitParam(name = "to", value = "结束学习位置,同to", required = true, paramType = "query", dataType = "Double"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "lectureParentId", value = "父课件id", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "study") |
| | | public Result study(String lectureId, @RequestParam(defaultValue = "1") Double from, |
| | | @RequestParam(defaultValue = "0") Double to, String subjectId, String classId, String lectureParentId) { |
| | | String userId = ClientUtils.getUserId(); |
| | | classId = CommonUtils.getClassId(classId); |
| | | progressDao.putStudyById(userId, subjectId, lectureId, lectureParentId, classId);// 记录学员每个课程的学习位置; |
| | | progressDao.putStudyByUserId(userId, subjectId, lectureId, lectureParentId, classId);// 记录学员上次学习的位置; |
| | | progressDao.putStudyById(userId, subjectId, lectureId, lectureParentId, classId);// 记录学员每个课程的学习位置; |
| | | progressDao.putStudyByUserId(userId, subjectId, lectureId, lectureParentId, classId);// 记录学员上次学习的位置; |
| | | return clsLectureService.doStudy(lectureId, from, to); |
| | | } |
| | | |
| | | /** |
| | | * 音频时长提交 stu/subject/submitAudioDuration |
| | | * 音频时长提交 stu/subject/submitAudioDuration |
| | | * |
| | | * @param lectureId 课件id |
| | | * @param seconds 时长 |
| | | * @param lectureId 课件id |
| | | * @param seconds 时长 |
| | | */ |
| | | @ApiOperation(value = "音频时长提交") |
| | | @ApiOperation(value = "音频时长提交") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "lectureId", value = "课件id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "seconds", value = "时长", required = true, paramType = "query", dataType = "Double") |
| | | @ApiImplicitParam(name = "lectureId", value = "课件id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "seconds", value = "时长", required = true, paramType = "query", dataType = "Double") |
| | | }) |
| | | @CacheEvict(value = "LectureAudioV", key = "#lectureId") |
| | | @GetMapping(value = "submitAudioDuration") |
| | |
| | | } |
| | | |
| | | /** |
| | | * 课程列表 |
| | | * 课程列表 |
| | | * |
| | | * @param clssId 班级id |
| | | * @param startTime 开班时间 |
| | | * @param clssId 班级id |
| | | * @param startTime 开班时间 |
| | | */ |
| | | @ApiOperation(value = "课程列表") |
| | | @ApiOperation(value = "课程列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "startTime", value = "开班时间", required = false, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "startTime", value = "开班时间", required = false, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "getSubjectLst") |
| | | public Result getList(String userId, String classId, String startTime, Integer limit, @RequestParam(defaultValue = "1") Integer pageNum, HttpServletRequest request) { |
| | |
| | | List<MySubjectV> resultMs = subjectService.listMySubjectV(classId, userId); |
| | | List<MySubjectV> result = new ArrayList<>(); |
| | | List<Object> lecurelist = new ArrayList<>(); |
| | | int i = 0; |
| | | for(MySubjectV ms : resultMs){ |
| | | for (MySubjectV ms : resultMs) { |
| | | SubjectUtils subjectUtils = new SubjectUtils(); |
| | | List<MyLectureV> myLectureVList = lectureService.listLectureVBySubjectId(userId, ms.getId().getSubjectId(), "", 1000, 1, null); |
| | | Double percent = 0.0; |
| | | Double progressValue = 0.0; |
| | | Double percentAvg = 0.0; |
| | | if(!myLectureVList.isEmpty()) { |
| | | if (!myLectureVList.isEmpty()) { |
| | | for (MyLectureV myLectureV : myLectureVList) { |
| | | if (myLectureV.getPercent() != null && myLectureV.getProgressValue() != null) { |
| | | percent += myLectureV.getPercent(); |
| | |
| | | subjectUtils.setSubjectId(myLectureVList.get(0).getSubjectId()); |
| | | subjectUtils.setPercent(new BigDecimal(percentAvg)); |
| | | subjectUtils.setStudyTime(new BigDecimal(progressValue)); |
| | | }else { |
| | | } else { |
| | | subjectUtils.setCoursewareName(null); |
| | | subjectUtils.setSubjectId(ms.getId().getSubjectId()); |
| | | subjectUtils.setPercent(new BigDecimal(percentAvg)); |
| | |
| | | result.add(ms); |
| | | lecurelist.add(subjectUtils); |
| | | } |
| | | List<OpenSubjectV> openSubjects = subjectService.listOpenSubjectV(); |
| | | for (OpenSubjectV openSubjectV : openSubjects) { |
| | | MySubjectV mySubjectV = new MySubjectV(new MySubjectVId()); |
| | | SubjectUtils subjectUtils = new SubjectUtils(); |
| | | List<SubjectLecture> subjectLectureList = lectureService.listLectureBySubjectId(openSubjectV.getSubjectId()); |
| | | List<MyOpenLectureV> myLectureVList = lectureService.listOpenLectureVBySubjectId(userId, openSubjectV.getSubjectId(), "", 1000, 1, null); |
| | | Double percent = 0.0; |
| | | Double progressValue = 0.0; |
| | | Double percentAvg = 0.0; |
| | | if (!myLectureVList.isEmpty()) { |
| | | for (MyOpenLectureV myOpenLectureV : myLectureVList) { |
| | | if (myOpenLectureV.getPercent() != null && myOpenLectureV.getProgressValue() != null) { |
| | | percent += myOpenLectureV.getPercent(); |
| | | progressValue += myOpenLectureV.getProgressValue().intValue(); |
| | | } |
| | | } |
| | | percentAvg = percent / subjectLectureList.size(); |
| | | if (percentAvg.isNaN()) { |
| | | percentAvg = 0.0; |
| | | } |
| | | subjectUtils.setCoursewareName(myLectureVList.get(0).getLectureName()); |
| | | subjectUtils.setSubjectId(myLectureVList.get(0).getSubjectId()); |
| | | subjectUtils.setPercent(new BigDecimal(percentAvg)); |
| | | subjectUtils.setStudyTime(new BigDecimal(progressValue)); |
| | | } else { |
| | | subjectUtils.setCoursewareName(null); |
| | | subjectUtils.setSubjectId(openSubjectV.getSubjectId()); |
| | | subjectUtils.setPercent(new BigDecimal(percentAvg)); |
| | | subjectUtils.setStudyTime(new BigDecimal(progressValue)); |
| | | } |
| | | mySubjectV.setSubjectName(openSubjectV.getSubjectName()); |
| | | mySubjectV.setCoverPageUrl(openSubjectV.getCoverPageUrl()); |
| | | mySubjectV.getId().setSubjectId(openSubjectV.getSubjectId()); |
| | | result.add(mySubjectV); |
| | | lecurelist.add(subjectUtils); |
| | | } |
| | | for (MySubjectV mySubjectV: |
| | | result) { |
| | | System.out.println(mySubjectV); |
| | | } |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("subjectList", |
| | | QBeanUtils.listBean2ListMap(result, |
| | | CollectionUtils.newStringMap("id.subjectId", "subjectId", "id.classId", "classId", |
| | | "subjectName", "subjectName", "percent", "percent", "progressValue", |
| | | "studyTime", "coverPageUrl", "coverPageUrl")),"lecurelist",lecurelist)); |
| | | QBeanUtils.listBean2ListMap(result, |
| | | CollectionUtils.newStringMap("id.subjectId", "subjectId", "id.classId", "classId", |
| | | "subjectName", "subjectName", "percent", "percent", "progressValue", |
| | | "studyTime", "coverPageUrl", "coverPageUrl")), "lecurelist", lecurelist)); |
| | | } |
| | | |
| | | /** |
| | | * 进入课程 |
| | | * 进入课程 |
| | | * |
| | | * @param subjectId 课程id |
| | | * @param subjectId 课程id |
| | | */ |
| | | @ApiOperation(value = "课程详情") |
| | | @ApiOperation(value = "课程详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = false, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = false, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "getSubjectDetail") |
| | | public Result getSubjectDetail(String subjectId) { |
| | | MySubjectV subject = subjectService.getMy1stSubjectVById(subjectId); |
| | | |
| | | Subject subject1 = subjectService.read(subjectId); |
| | | List<Map<String, Object>> progressLst = subjectService.listChapterStudyProgress(subjectId); |
| | | List<MyLectureV> myLectureVList = lectureService.listLectureVBySubjectId(ClientUtils.getUserId(), subjectId, "", 1000, 1, null); |
| | | Double percent = 0.0; |
| | | Double progressValue = 0.0; |
| | | String coursewareName = null; |
| | | if(!myLectureVList.isEmpty()) { |
| | | for (MyLectureV myLectureV : myLectureVList) { |
| | | List<MyOpenLectureV> myOpenLectureVList = lectureService.listOpenLectureVBySubjectId(ClientUtils.getUserId(), subjectId, "", 100, 1, null); |
| | | List<SubjectLecture> subjectLectureList = lectureService.listLectureBySubjectId(subjectId); |
| | | if (myLectureVList.size() > 0) { |
| | | for (MyLectureV myLectureV : myLectureVList) { |
| | | if (myLectureV.getPercent() != null && myLectureV.getProgressValue() != null) { |
| | | percent += myLectureV.getPercent(); |
| | | progressValue += myLectureV.getProgressValue().intValue(); |
| | | } |
| | | } |
| | | } |
| | | Double percentAvg = percent / myLectureVList.size(); |
| | | if (percentAvg.isNaN()) { |
| | | percentAvg = 0.0; |
| | | } |
| | | } |
| | | subject.setCoverPageUrl(subject1.getCoverPageUrl()); |
| | | subject.setPercent(percentAvg); |
| | | subject.setProgressValue(new BigDecimal(progressValue)); |
| | | progressLst.get(0).put("percent", subject.getPercent()); |
| | | progressLst.get(0).put("studyTime", subject.getProgressValue()); |
| | | coursewareName = myLectureVList.get(0).getLectureName(); |
| | | } else if (subjectLectureList.size() > 0) { |
| | | if (myOpenLectureVList.size() > 0) { |
| | | for (MyOpenLectureV myLectureV : myOpenLectureVList) { |
| | | if (myLectureV.getPercent() != null && myLectureV.getProgressValue() != null) { |
| | | percent += myLectureV.getPercent(); |
| | | progressValue += myLectureV.getProgressValue().intValue(); |
| | | } |
| | | } |
| | | coursewareName = myOpenLectureVList.get(0).getLectureName(); |
| | | } |
| | | if (subject == null) { |
| | | subject = new MySubjectV(new MySubjectVId()); |
| | | } |
| | | Double percentAvg = percent / subjectLectureList.size(); |
| | | if (percentAvg.isNaN()) { |
| | | percentAvg = 0.0; |
| | | } |
| | | subject.setCoverPageUrl(subject1.getCoverPageUrl()); |
| | | subject.setPercent(percentAvg); |
| | | subject.setProgressValue(new BigDecimal(progressValue)); |
| | | subject.setSubjectName(subject1.getName()); |
| | | subject.getId().setSubjectId(subjectLectureList.get(0).getSubjectId()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("percent", subject.getPercent()); |
| | | map.put("studyTime", subject.getProgressValue()); |
| | | map.put("chapterId", subjectLectureList.get(0).getSubjectId()); |
| | | map.put("chapterName", subject1.getName()); |
| | | progressLst.add(map); |
| | | } |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("subject", QBeanUtils.bean2Map(subject, |
| | | CollectionUtils.newStringMap("subjectName", "subjectName", "id.subjectId", "subjectId", |
| | | "progressValue", "studyTime", "percent", "percent", "coverPageUrl", "coverPageUrl")), |
| | | "chapterLst", progressLst,"coursewareName",coursewareName)); |
| | | "chapterLst", progressLst, "coursewareName", coursewareName)); |
| | | } |
| | | |
| | | } |