| | |
| | | package com.qxueyou.scc.admin.classes.service.impl; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | 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 org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | |
| | | @Autowired |
| | | ITeacherService teacherService; |
| | | |
| | | @Autowired |
| | | ILectureService lectureService; |
| | | |
| | | /** |
| | | * 添加班级 |
| | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getSubjectLstByClsId(String classId) { |
| | | String hql = "from MySubjectV where classId = ?"; |
| | | List<MySubjectV> mySubjectVList = find(hql,CollectionUtils.newList(classId),MySubjectV.class); |
| | | List<Map<String,Object>> maps = new ArrayList<>(); |
| | | for(MySubjectV mySubjectV : mySubjectVList){ |
| | | List<MyLectureV> myLectureVList = lectureService.listLectureVBySubjectId(mySubjectV.getId().getUserId(),mySubjectV.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; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |