| | |
| | | package com.qxueyou.scc.stucontroller; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | 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.SubjectUtils; |
| | | import com.qxueyou.scc.user.model.User; |
| | | import org.hibernate.Session; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.orm.hibernate4.HibernateTemplate; |
| | | import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import com.alibaba.druid.util.StringUtils; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | * 学习端 课程前端控制器 |
| | | * |
| | | * @author chenjunliang |
| | | * |
| | | */ |
| | | @Api(tags= "课程管理-学员端") |
| | | @RestController |
| | |
| | | IEvaluateService evaluateService; |
| | | |
| | | //--------------------------------------------------------------app端接口--------------------------------------------------------------------------------------------------- |
| | | |
| | | /** |
| | | * 学习端获取 所有课件 |
| | | * |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 学习端获取课程列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "学习端获取课程学年列表") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 学习端获取课程列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "我的课程按学期分类") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 学习端获取课程列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "我的课程按时间排序") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 学习端获取课程列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "我的班级信息") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 学习端获取课程列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "学习端获取课程列表") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 学习端获取课程列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "学习端获取课程下课件,按创建时间排序") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 学习端获取其他课件统计 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "学习端获取其他课件统计") |
| | | @GetMapping(value = "/app/otherLectureCount") |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 学习端获取课程列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "学习端获取课程下课件,按目录分类", notes = "") |
| | | @ApiImplicitParams({ |
| | |
| | | |
| | | /** |
| | | * 我的公开课列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "我的公开课列表", notes = "") |
| | | @GetMapping(value = "/app/myOpenSubjectList") |
| | |
| | | |
| | | /** |
| | | * 公开课列表 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "公开课列表", notes = "") |
| | | @GetMapping(value = "/app/openSubjectList") |
| | |
| | | |
| | | /** |
| | | * 公开课详情 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "公开课详情", notes = "") |
| | | @GetMapping(value = "/app/openSubjectInfo") |
| | |
| | | /** |
| | | * 获取课件列表 |
| | | * |
| | | * @param chapterId |
| | | * 章节id |
| | | * @param type |
| | | * 课件类型 |
| | | * @param keyword |
| | | * 搜索关键字 |
| | | * @param limit |
| | | * 每页显示几条 |
| | | * @param pageNum |
| | | * 页码 |
| | | * @param chapterId 章节id |
| | | * @param type 课件类型 |
| | | * @param keyword 搜索关键字 |
| | | * @param limit 每页显示几条 |
| | | * @param pageNum 页码 |
| | | * @return 状态说明(0,视频。1,音频。2,文档。3,练习。) |
| | | */ |
| | | @ApiOperation(value = "根据章节获取课件列表", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)") |
| | |
| | | /** |
| | | * 课件学习进度提交 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 = "提交学习进度") |
| | | @ApiImplicitParams({ |
| | |
| | | /** |
| | | * 音频时长提交 stu/subject/submitAudioDuration |
| | | * |
| | | * @param lectureId |
| | | * 课件id |
| | | * @param seconds |
| | | * 时长 |
| | | * @param lectureId 课件id |
| | | * @param seconds 时长 |
| | | */ |
| | | @ApiOperation(value = "音频时长提交") |
| | | @ApiImplicitParams({ |
| | |
| | | /** |
| | | * 课程列表 |
| | | * |
| | | * @param clssId |
| | | * 班级id |
| | | * @param startTime |
| | | * 开班时间 |
| | | * @param clssId 班级id |
| | | * @param startTime 开班时间 |
| | | */ |
| | | @ApiOperation(value = "课程列表") |
| | | @ApiImplicitParams({ |
| | |
| | | @GetMapping(value = "getSubjectLst") |
| | | public Result getList(String userId,String classId, String startTime, Integer limit, @RequestParam(defaultValue="1")Integer pageNum, HttpServletRequest request) { |
| | | userId = StringUtils.isEmpty(userId)?ClientUtils.getUserId():userId; |
| | | if(userId == null || userId == ""){ |
| | | userId = ClientUtils.getUserId(); |
| | | } |
| | | classId = StringUtils.isEmpty(classId)?ClientUtils.getClassId():classId; |
| | | List<MySubjectV> result = subjectService.listMySubjectV(classId,userId); |
| | | List<MySubjectV> resultMs = subjectService.listMySubjectV(classId, userId); |
| | | List<MySubjectV> result = new ArrayList<>(); |
| | | List<Object> lecurelist = new ArrayList<>(); |
| | | int i = 0; |
| | | 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()) { |
| | | for (MyLectureV myLectureV : myLectureVList) { |
| | | if (myLectureV.getPercent() != null && myLectureV.getProgressValue() != null) { |
| | | percent += myLectureV.getPercent(); |
| | | progressValue += myLectureV.getProgressValue().intValue(); |
| | | } |
| | | } |
| | | percentAvg = percent / myLectureVList.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(ms.getId().getSubjectId()); |
| | | subjectUtils.setPercent(new BigDecimal(percentAvg)); |
| | | subjectUtils.setStudyTime(new BigDecimal(progressValue)); |
| | | } |
| | | result.add(ms); |
| | | lecurelist.add(subjectUtils); |
| | | } |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("subjectList", |
| | | QBeanUtils.listBean2ListMap(result, |
| | | CollectionUtils.newStringMap("id.subjectId", "subjectId", "id.classId", "classId", |
| | | "subjectName", "subjectName,coursewareName", "percent", "percent", "progressValue", |
| | | "studyTime", "coverPageUrl", "coverPageUrl"))); |
| | | "subjectName", "subjectName", "percent", "percent", "progressValue", |
| | | "studyTime", "coverPageUrl", "coverPageUrl")),"lecurelist",lecurelist)); |
| | | } |
| | | |
| | | /** |
| | | * 进入课程 |
| | | * |
| | | * @param subjectId |
| | | * 课程id |
| | | * @param subjectId 课程id |
| | | */ |
| | | @ApiOperation(value = "课程详情") |
| | | @ApiImplicitParams({ |
| | |
| | | MySubjectV subject = subjectService.getMy1stSubjectVById(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) { |
| | | 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.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 { |
| | | |
| | | } |
| | | 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)); |
| | | "chapterLst", progressLst,"coursewareName",coursewareName)); |
| | | } |
| | | |
| | | } |