| | |
| | | } |
| | | |
| | | @Override |
| | | public List<OpenSubjectV> listOpenSubjectV() { |
| | | StringBuffer hql = new StringBuffer("from OpenSubjectV p where 1 = ?"); |
| | | int param = 1; |
| | | List<Object> args = CollectionUtils.newList(param); |
| | | |
| | | |
| | | List<OpenSubjectV> result = find(hql.toString(), args, OpenSubjectV.class); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> listChapterStudyProgress(String subjectId) { |
| | | |
| | | QSubjectProgressTreeV qSubjectProgressTreeV = QSubjectProgressTreeV.subjectProgressTreeV; |
| | |
| | | subject.put("toBeCommitExamCount", examService.getToBeCommitExamCount(classId, userId)); |
| | | |
| | | } |
| | | List<OpenSubjectV> subjects = listOpenSubjectV(); |
| | | for(OpenSubjectV subject : subjects){ |
| | | Map<String, Object> subjectMap = new HashMap<>(); |
| | | String classId = ClientUtils.getClassId(); |
| | | String subjectId = subject.getSubjectId(); |
| | | Map<String, Object> map = progressDao.getStudyById(userId, subjectId, null); |
| | | List<MyOpenLectureV> myLectureVList = lectureService.listOpenLectureVBySubjectId(userId, subjectId, "", 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 / myLectureVList.size(); |
| | | if (percentAvg.isNaN()) { |
| | | percentAvg = 0.0; |
| | | } |
| | | } |
| | | String className = "公开课"; |
| | | subjectMap.put("subjectName",subject.getSubjectName()); |
| | | subjectMap.put("subjectId",subject.getSubjectId()); |
| | | |
| | | subjectMap.put("percent", new BigDecimal(percentAvg)); |
| | | subjectMap.put("progressValue", new BigDecimal(progressValue)); |
| | | subjectMap.put("className",className); |
| | | subjectMap.put("lectureParentId", map.get("lectureParentId")); |
| | | subjectMap.put("lectureId", map.get("lectureId")); |
| | | subjectMap.put("unCommitExerciseCount", exerciseInfoService.getUnCommitExerciseCount(classId, userId)); |
| | | subjectMap.put("toBeCommitExerciseCount", exerciseInfoService.getToBeCommitExerciseCount(classId, userId)); |
| | | subjectMap.put("CommitExerciseCount", exerciseInfoService.getCommitExerciseCount(classId, userId)); |
| | | subjectMap.put("exerciseCount", exerciseInfoService.getExerciseCount(classId, userId)); |
| | | subjectMap.put("examCount", examService.getExamCount(classId, userId)); |
| | | subjectMap.put("unCommitExamCount", examService.getUnCommitExamCount(classId, userId)); |
| | | subjectMap.put("commitExamCount", examService.getCommitExamCount(classId, userId)); |
| | | subjectMap.put("toBeCommitExamCount", examService.getToBeCommitExamCount(classId, userId)); |
| | | |
| | | subjectLstMap.add(subjectMap); |
| | | } |
| | | return new Result(true, "success", subjectLstMap); |
| | | } |
| | | |
| | |
| | | .and(qSubjectProgressTreeV.id.nodeId.eq(nodeId))).orderBy(order).fetch().stream().map(tuple -> { |
| | | |
| | | List<ClsClassReSubject> clsClassReSubjects = find("from ClsClassReSubject where classId = ?",CollectionUtils.newList(nodeId),ClsClassReSubject.class); |
| | | int type = 3; |
| | | List<Subject> subjects = find("from Subject where type = ?",CollectionUtils.newList(type),Subject.class); |
| | | Double percent = 0.0; |
| | | Double progressValue = 0.0; |
| | | Double percentAvg = 0.0; |
| | |
| | | } |
| | | } |
| | | } |
| | | for(Subject subject : subjects){ |
| | | List<MyOpenLectureV> myOpenLectureVList = lectureService.listOpenLectureVBySubjectId(tuple.get(qUser.userId), subject.getSubjectId(), "", 1000, 1, null); |
| | | if(!myOpenLectureVList.isEmpty()){ |
| | | for(MyOpenLectureV myOpenLecture : myOpenLectureVList){ |
| | | if (myOpenLecture.getPercent() != null && myOpenLecture.getProgressValue() != null) { |
| | | percent += myOpenLecture.getPercent(); |
| | | progressValue += myOpenLecture.getProgressValue().intValue(); |
| | | } |
| | | } |
| | | size += myOpenLectureVList.size(); |
| | | if (percentAvg.isNaN()) { |
| | | percentAvg += 0.0; |
| | | } |
| | | } |
| | | } |
| | | percentAvg += percent / size; |
| | | if(percentAvg.isNaN()){ |
| | | percentAvg = 0.0; |