| | |
| | | import com.qxueyou.scc.admin.progress.model.view.SubjectProgressTreeV; |
| | | import com.qxueyou.scc.base.model.Pager; |
| | | import com.qxueyou.scc.base.model.Result; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectLecture; |
| | | import com.qxueyou.scc.teach.subject.model.view.MyLectureV; |
| | | |
| | | public interface IClassLectureService { |
| | |
| | | * @return |
| | | */ |
| | | public Result coursewareChapterList(String classId,String subjectId, String type); |
| | | |
| | | List<Map<String, Object>> listStuLectureByOpenSubject(String subjectId); |
| | | |
| | | } |
| | |
| | | public Result updateLecturetime(String targetId) { |
| | | |
| | | ClsSubjectLecture lecture = read(ClsSubjectLecture.class, targetId); |
| | | if(lecture == null){ |
| | | SubjectLecture lecture1 = read(SubjectLecture.class,targetId); |
| | | TraceUtils.setUpdateTrace(lecture1); |
| | | |
| | | |
| | | lecture1.setUpdateTime(new Date()); |
| | | lecture1.setUpdator(ClientUtils.getUserId()); |
| | | save(lecture1); |
| | | }else { |
| | | TraceUtils.setUpdateTrace(lecture); |
| | | |
| | | lecture.setUpdateTime(new Date()); |
| | | lecture.setUpdator(ClientUtils.getUserId()); |
| | | save(lecture); |
| | | } |
| | | |
| | | return new Result(true, "success"); |
| | | } |
| | |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | |
| | | import com.qxueyou.scc.teach.subject.service.ILectureService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | public class LectureProgressService extends CommonAppService implements IDetailProgressService { |
| | | |
| | | @Autowired |
| | | IClassLectureService lectureService; |
| | | IClassLectureService clsLectureService; |
| | | |
| | | @Autowired |
| | | ILectureService lectureService; |
| | | |
| | | /** |
| | | * 各类型课件进度服务实现 |
| | |
| | | |
| | | @Override |
| | | public Result addProgress(String targetId,String learnerId, int start, int end) { |
| | | ClsSubjectLecture lecture = lectureService.readClsLecture(targetId); |
| | | |
| | | ClsSubjectLecture lecture = clsLectureService.readClsLecture(targetId); |
| | | String lectureType = null; |
| | | if(lecture == null) { |
| | | lectureType = this.read(SubjectLecture.class, targetId).getLectureType(); |
| | |
| | | |
| | | import com.qxueyou.scc.admin.classes.model.ClsSubjectLecture; |
| | | import com.qxueyou.scc.admin.classes.service.impl.ClassLectureService; |
| | | import com.qxueyou.scc.teach.subject.service.ILectureService; |
| | | import com.qxueyou.scc.teach.subject.service.impl.SubjectLectureService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Autowired |
| | | ClassLectureService classLectureService; |
| | | |
| | | @Autowired |
| | | SubjectLectureService subjectLectureService; |
| | | |
| | | @Override |
| | | public Result addProgress(String targetId, String learnerId, int start, int end) { |
| | | |
| | |
| | | public Result deleteCourseware(String id) { |
| | | |
| | | Result result = lectureService.deleteLecture(id.split(",")); |
| | | lectureService.deleteLectureLoad(id.split(",")); |
| | | // lectureService.deleteLectureLoad(id.split(",")); |
| | | return result; |
| | | |
| | | } |
| | |
| | | result = lectureService.addLecture(sectionId, resId_); |
| | | successCount = result.isSuccess() ? 1 : 0; |
| | | } |
| | | lectureService.addLectureLoad(sectionId); |
| | | |
| | | return new Result(true, null, successCount); |
| | | } |
| | | |
| | |
| | | private HweiYunOBSService hweiYunOBSService; |
| | | |
| | | @RequestMapping(value = "upload", method = RequestMethod.POST) |
| | | public Result save(@RequestParam(value = "file", required = false) MultipartFile file) { |
| | | public List<FileMeta> save(@RequestParam(value = "file", required = false) MultipartFile file) { |
| | | |
| | | if (ObjectUtils.isEmpty(file) || file.getSize() <= 0) { |
| | | return new Result(false,"文件为空"); |
| | | return null; |
| | | } |
| | | // if (FileUtil.isEmpty(file)) { |
| | | // return new Result(false,"文件为空"); |
| | | // } |
| | | final List<FileMeta> test = hweiYunOBSService.fileUpload(file, file.getOriginalFilename()); |
| | | // return ResponseVO.ok("执行成功",test); |
| | | return new Result(true,"success",test); |
| | | return test; |
| | | } |
| | | |
| | | @RequestMapping(value = "delete", method = RequestMethod.POST) |
| | |
| | | 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; |
| | | |
| | |
| | | }) |
| | | @GetMapping(value = "categoryTree") |
| | | public Result categoryTree(String subjectId, String 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"))); |
| | | |
| | | } 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"))); |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @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", |
| | | |
| | | 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(lectureList, CollectionUtils.newStringMap("name", "name", "lectureId", "id", |
| | | "lectureType", "type", "chapterId", "chapterId"))); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | 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")))); |
| | | |
| | | } 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")))); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | 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.getId().setSubjectId(openSubjectV.getSubjectId()); |
| | | result.add(mySubjectV); |
| | | lecurelist.add(subjectUtils); |
| | | } |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("subjectList", |
| | | QBeanUtils.listBean2ListMap(result, |
| | |
| | | @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()) { |
| | | 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(); |
| | |
| | | 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.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, |
New file |
| | |
| | | package com.qxueyou.scc.teach.subject.model.view; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonView; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.persistence.*; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Entity(name = "MyOpenLectureV") |
| | | @Table(name = "my_open_lecture_v") |
| | | public class MyOpenLectureV implements java.io.Serializable { |
| | | private static final long serialVersionUID = -332455459706490649L; |
| | | |
| | | private String userId; |
| | | |
| | | private String lectureId; |
| | | |
| | | private String chapterId; |
| | | private String lectureType; |
| | | private String lectureName; |
| | | private String userName; |
| | | private String subjectName; |
| | | private Date lectureUpdateTime; |
| | | private BigDecimal progressValue; |
| | | private Double percent; |
| | | private String subjectId; |
| | | private Date lectureCreateTime; |
| | | |
| | | @Id |
| | | @Column(name = "USER_ID") |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | @Id |
| | | @Column(name = "LECTURE_ID") |
| | | public String getLectureId() { |
| | | return lectureId; |
| | | } |
| | | |
| | | public void setLectureId(String lectureId) { |
| | | this.lectureId = lectureId; |
| | | } |
| | | |
| | | public MyOpenLectureV() { |
| | | } |
| | | |
| | | |
| | | @Column(name = "SUBJECT_NAME") |
| | | public String getSubjectName() { |
| | | return subjectName; |
| | | } |
| | | |
| | | public void setSubjectName(String subjectName) { |
| | | this.subjectName = subjectName; |
| | | } |
| | | |
| | | @Column(name = "PROGRESS_VALUE") |
| | | public BigDecimal getProgressValue() { |
| | | return this.progressValue; |
| | | } |
| | | |
| | | public void setProgressValue(BigDecimal progressValue) { |
| | | this.progressValue = progressValue; |
| | | } |
| | | |
| | | @Column(name = "CHAPTER_ID") |
| | | public String getChapterId() { |
| | | return chapterId; |
| | | } |
| | | |
| | | public void setChapterId(String chapterId) { |
| | | this.chapterId = chapterId; |
| | | } |
| | | |
| | | @Column(name = "LECTURE_TYPE") |
| | | public String getLectureType() { |
| | | return lectureType; |
| | | } |
| | | |
| | | public void setLectureType(String lectureType) { |
| | | this.lectureType = lectureType; |
| | | } |
| | | |
| | | @Column(name = "LECTURE_NAME") |
| | | public String getLectureName() { |
| | | return lectureName; |
| | | } |
| | | |
| | | public void setLectureName(String lectureName) { |
| | | this.lectureName = lectureName; |
| | | } |
| | | |
| | | @Column(name = "USER_NAME") |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | @Column(name = "PERCENT") |
| | | public Double getPercent() { |
| | | return percent; |
| | | } |
| | | |
| | | public void setPercent(Double percent) { |
| | | this.percent = percent; |
| | | } |
| | | |
| | | @Column(name = "LECTURE_UPDATE_TIME") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonIgnore |
| | | public Date getLectureUpdateTime() { |
| | | return lectureUpdateTime; |
| | | } |
| | | |
| | | public void setLectureUpdateTime(Date lectureUpdateTime) { |
| | | this.lectureUpdateTime = lectureUpdateTime; |
| | | } |
| | | |
| | | @Id |
| | | @Column(name = "SUBJECT_ID") |
| | | public String getSubjectId() { |
| | | return subjectId; |
| | | } |
| | | |
| | | public void setSubjectId(String subjectId) { |
| | | this.subjectId = subjectId; |
| | | } |
| | | |
| | | |
| | | @Column(name = "LECTURE_CREATE_TIME") |
| | | public Date getLectureCreateTime() { |
| | | return lectureCreateTime; |
| | | } |
| | | |
| | | public void setLectureCreateTime(Date lectureCreateTime) { |
| | | this.lectureCreateTime = lectureCreateTime; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.qxueyou.scc.base.model.Result; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectChapter; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectLecture; |
| | | import com.qxueyou.scc.teach.subject.model.view.LectureAudioV; |
| | | import com.qxueyou.scc.teach.subject.model.view.LectureDocV; |
| | | import com.qxueyou.scc.teach.subject.model.view.LectureVideoV; |
| | | import com.qxueyou.scc.teach.subject.model.view.MyLectureV; |
| | | import com.qxueyou.scc.teach.subject.model.view.*; |
| | | |
| | | public interface ILectureService { |
| | | |
| | | /** |
| | | * 新增章节文件夹 |
| | | * |
| | | * @param subjectId |
| | | * 课程id |
| | | * @param parentChapterId |
| | | * 父级章节文件夹id |
| | | * @param name |
| | | * 文件夹名称 |
| | | * @param subjectId 课程id |
| | | * @param parentChapterId 父级章节文件夹id |
| | | * @param name 文件夹名称 |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{"chapterId","90023afwe32300fee23"}},若成功,则返回ChapterId |
| | | */ |
| | | Result addChapter(String subjectId, String parentChapterId, String name); |
| | |
| | | /** |
| | | * 修改章节文件夹 |
| | | * |
| | | * @param chapterId |
| | | * 文件夹id |
| | | * @param name |
| | | * 名称 |
| | | * @param chapterId 文件夹id |
| | | * @param name 名称 |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{}} |
| | | */ |
| | | Result updateChapter(String chapterId, String name); |
| | |
| | | /** |
| | | * 删除章节文件夹 |
| | | * |
| | | * @param chapterIds |
| | | * 章节文件夹id数组 |
| | | * @param chapterIds 章节文件夹id数组 |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{}} |
| | | */ |
| | | Result deleteChapter(String[] chapterIds); |
| | |
| | | /** |
| | | * 返回下级章节文件夹列表,如果 |
| | | * |
| | | * @param subjectId |
| | | * 课程id |
| | | * @param parentChapterId |
| | | * 父级章节文件夹id |
| | | * @param subjectId 课程id |
| | | * @param parentChapterId 父级章节文件夹id |
| | | * @return 返回章节列表 |
| | | */ |
| | | List<SubjectChapter> doGetListChapter(String subjectId, String parentChapterId); |
| | |
| | | /** |
| | | * 返回下级章节文件夹列表,如果 |
| | | * |
| | | * @param subjectId |
| | | * 课程id |
| | | * @param parentChapterId |
| | | * 父级章节文件夹id |
| | | * @param subjectId 课程id |
| | | * @param parentChapterId 父级章节文件夹id |
| | | * @return 返回章节列表 |
| | | */ |
| | | List<SubjectProgressTreeV> getChapterTreeVList(String subjectId, String parentChapterId); |
| | |
| | | /** |
| | | * 返回下级章节文件夹列表 |
| | | * |
| | | * @param subjectId |
| | | * 课程id |
| | | * @param parentChapterId |
| | | * 父级章节文件夹id |
| | | * @param subjectId 课程id |
| | | * @param parentChapterId 父级章节文件夹id |
| | | * @return 返回章节列表 |
| | | */ |
| | | List<SubjectChapter> getListChapter(String subjectId, String parentChapterId); |
| | |
| | | /** |
| | | * 返回所有章节列表,按createTime排序 |
| | | * |
| | | * @param subjectId |
| | | * 课程id |
| | | * @param subjectId 课程id |
| | | * @return 返回章节列表 |
| | | */ |
| | | List<SubjectChapter> getAllChapterBySubjectId(String subjectId); |
| | |
| | | /** |
| | | * 新增课件 |
| | | * |
| | | * @param chapterId |
| | | * 章节id |
| | | * @param resId |
| | | * 资源id |
| | | * @param chapterId 章节id |
| | | * @param resId 资源id |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{"chapterId","90023afwe32300fee23"}},若成功,则返回chapterId |
| | | */ |
| | | Result addLecture(String chapterId, String resId); |
| | | |
| | | |
| | | /** |
| | | * 新增后刷新课件 |
| | | */ |
| | | Result addLectureLoad(String sectionId); |
| | | // /** |
| | | // * 新增后刷新课件 |
| | | // */ |
| | | // Result addLectureLoad(String sectionId); |
| | | |
| | | /** |
| | | * 读取课件 |
| | | * |
| | | * @param lectureId |
| | | * 课件id |
| | | * @param lectureId 课件id |
| | | * @return SubjectLecture |
| | | */ |
| | | SubjectLecture readLecture(String lectureId); |
| | |
| | | /** |
| | | * 读取视频课件 |
| | | * |
| | | * @param lectureId |
| | | * 课件id |
| | | * @param lectureId 课件id |
| | | * @return SubjectLecture |
| | | */ |
| | | LectureVideoV readVideoLecture(String lectureId); |
| | |
| | | /** |
| | | * 读取音频课件 |
| | | * |
| | | * @param lectureId |
| | | * 课件id |
| | | * @param lectureId 课件id |
| | | * @return LectureAudioV |
| | | */ |
| | | LectureAudioV readAudioLecture(String lectureId); |
| | |
| | | /** |
| | | * 修改课件 |
| | | * |
| | | * @param lectureId |
| | | * 课件id |
| | | * @param resId |
| | | * 资源id |
| | | * @param lectureId 课件id |
| | | * @param resId 资源id |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{}} |
| | | */ |
| | | Result updateLecture(String lectureId, String resId); |
| | |
| | | /** |
| | | * 删除课件 |
| | | * |
| | | * @param lectureIds |
| | | * 课件id数组 |
| | | * @param lectureIds 课件id数组 |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{}} |
| | | */ |
| | | Result deleteLecture(String[] lectureIds); |
| | | |
| | | Result deleteLectureLoad(String[] lectureIds); |
| | | // Result deleteLectureLoad(String[] lectureIds); |
| | | |
| | | /** |
| | | * 复制课件 |
| | | * |
| | | * @param lectureId |
| | | * 课件id |
| | | * @param destChapterId |
| | | * 目标章节id |
| | | * @param name |
| | | * 课件名称 |
| | | * @param lectureId 课件id |
| | | * @param destChapterId 目标章节id |
| | | * @param name 课件名称 |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{}} |
| | | */ |
| | | Result doCopyLecture(String lectureId, String destChapterId, String name); |
| | |
| | | /** |
| | | * 移动课件 |
| | | * |
| | | * @param lectureId |
| | | * 课件id |
| | | * @param destChapterId |
| | | * 目标章节id |
| | | * @param name |
| | | * 课件名称 |
| | | * @param lectureId 课件id |
| | | * @param destChapterId 目标章节id |
| | | * @param name 课件名称 |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{}} |
| | | */ |
| | | Result doMoveLecture(String lectureId, String destChapterId, String name); |
| | |
| | | /** |
| | | * 课件列表搜索 |
| | | * |
| | | * @param chapterId |
| | | * 章节id |
| | | * @param keyword |
| | | * 关键字 |
| | | * @param pageSize |
| | | * 页码 |
| | | * @param pageNum |
| | | * 每页显示数据条数 |
| | | * @param type |
| | | * 类型 |
| | | * @param chapterId 章节id |
| | | * @param keyword 关键字 |
| | | * @param pageSize 页码 |
| | | * @param pageNum 每页显示数据条数 |
| | | * @param type 类型 |
| | | * @return |
| | | */ |
| | | List<SubjectLecture> listLecture(String chapterId, String keyword, Integer pageSize, Integer pageNum, String type); |
| | |
| | | /** |
| | | * 课件列表大小 |
| | | * |
| | | * @param chapterId |
| | | * 章节id |
| | | * @param keyword |
| | | * 关键字 |
| | | * @param type |
| | | * 类型 |
| | | * @param chapterId 章节id |
| | | * @param keyword 关键字 |
| | | * @param type 类型 |
| | | * @return |
| | | */ |
| | | int listLectureCount(String chapterId, String keyword, String type); |
| | |
| | | /** |
| | | * 课件列表搜索 |
| | | * |
| | | * @param chapterId |
| | | * 章节id |
| | | * @param keyword |
| | | * 关键字 |
| | | * @param pageSize |
| | | * 页码 |
| | | * @param pageNum |
| | | * 每页显示数据条数 |
| | | * @param type |
| | | * 类型 |
| | | * @param chapterId 章节id |
| | | * @param keyword 关键字 |
| | | * @param pageSize 页码 |
| | | * @param pageNum 每页显示数据条数 |
| | | * @param type 类型 |
| | | * @return |
| | | */ |
| | | List<MyLectureV> listLectureV(String learnerId, String chapterId, String keyword, Integer pageSize, Integer pageNum, |
| | |
| | | /** |
| | | * 读取课件真实文件访问路径 |
| | | * |
| | | * @param lectureId |
| | | * 课件id数组 |
| | | * @param attribute |
| | | * 课件附加属性 |
| | | * @param lectureId 课件id数组 |
| | | * @param attribute 课件附加属性 |
| | | * @return 上传结果:{"success":true,msg:"success",attrs:{"type":"",path:""}} |
| | | */ |
| | | Result readLectureAccessPath(String lectureId, String attribute); |
| | |
| | | |
| | | /** |
| | | * 课件详情查询 |
| | | * |
| | | * @param learnerId |
| | | * @param subjectId |
| | | * @param keyword |
| | |
| | | */ |
| | | List<MyLectureV> listLectureVBySubjectId(String learnerId, String subjectId, String keyword, Integer pageSize, |
| | | Integer pageNum, String type); |
| | | |
| | | List<MyOpenLectureV> listOpenLectureVBySubjectId(String learnerId, String subjectId, String keyword, Integer pageSize, |
| | | Integer pageNum, String type); |
| | | |
| | | List<SubjectLecture> getSubjectLectureVByChapterId(String chapterId, String keyword, Integer limit, Integer pageNum); |
| | | |
| | | List<MyOpenLectureV> getMyOpenLectureVByChapterId(String userId, String chapterId, String keyword, Integer limit, Integer pageNum); |
| | | |
| | | |
| | | } |
| | |
| | | import com.qxueyou.scc.base.model.Result; |
| | | import com.qxueyou.scc.teach.subject.model.Subject; |
| | | import com.qxueyou.scc.teach.subject.model.view.MySubjectV; |
| | | import com.qxueyou.scc.teach.subject.model.view.OpenSubjectV; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | public interface ISubjectService { |
| | |
| | | List<MySubjectV> listMySubjectV(String classId,String userId); |
| | | |
| | | /** |
| | | * 查询公开课程 |
| | | */ |
| | | List<OpenSubjectV> listOpenSubjectV(); |
| | | |
| | | /** |
| | | * 首页查询我的课程 |
| | | */ |
| | | List<Map<String, Object>> getMySubjectList(); |
| | |
| | | package com.qxueyou.scc.teach.subject.service.impl; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.qxueyou.scc.admin.classes.model.ClsClassReSubject; |
| | | import com.qxueyou.scc.admin.classes.model.ClsSubjectChapter; |
| | | import com.qxueyou.scc.admin.classes.service.IClassLectureService; |
| | | import com.qxueyou.scc.teach.subject.model.Subject; |
| | | import com.qxueyou.scc.teach.subject.model.view.*; |
| | | import com.qxueyou.scc.user.model.UserTeacher; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | import com.qxueyou.scc.teach.res.service.IResService; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectChapter; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectLecture; |
| | | import com.qxueyou.scc.teach.subject.model.view.LectureAudioV; |
| | | import com.qxueyou.scc.teach.subject.model.view.LectureDocV; |
| | | import com.qxueyou.scc.teach.subject.model.view.LectureVideoV; |
| | | import com.qxueyou.scc.teach.subject.model.view.MyLectureV; |
| | | import com.qxueyou.scc.teach.subject.service.ILectureService; |
| | | import com.qxueyou.scc.teach.subject.service.ISubjectService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | /** |
| | | * 删除单个章节 |
| | | * |
| | | * @param chapterId |
| | | * 章节id |
| | | * @param chapterId 章节id |
| | | * @return |
| | | */ |
| | | private Result deleteChapter(String chapterId) { |
| | |
| | | lecture.setResItemId(res.getResId()); |
| | | save(lecture); |
| | | subjectService.addLectureCount(lecture.getSubjectId(), 1); |
| | | |
| | | String hql = "from Subject where subjectId = ? and deleteFlag is false"; |
| | | Subject subject = findUnique(hql, CollectionUtils.newList(chapter.getSubjectId()), Subject.class); |
| | | String hql1 = "from Subject where name = ? and deleteFlag is false and type = 2"; |
| | | List<Subject> subjects = find(hql1, CollectionUtils.newList(subject.getName()), Subject.class); |
| | | for (Subject subjectv : subjects) { |
| | | |
| | | String hql2 = "from ClsSubjectChapter where subjectId = ? and deleteFlag is false and Name = ? "; |
| | | ClsSubjectChapter clsSubjectChapter = findUnique(hql2, CollectionUtils.newList(subjectv.getSubjectId(), chapter.getName()), ClsSubjectChapter.class); |
| | | String hql3 = "from ClsClassReSubject where subjectId = ? and deleteFlag is false"; |
| | | List<ClsClassReSubject> reSubject = find(hql3, CollectionUtils.newList(subjectv.getSubjectId()), ClsClassReSubject.class); |
| | | |
| | | for (ClsClassReSubject classReSubject : reSubject) { |
| | | ClsSubjectLecture clsLecture = new ClsSubjectLecture(); |
| | | TraceUtils.setCreateTrace(clsLecture); |
| | | clsLecture.setChapterId(clsSubjectChapter.getChapterId()); |
| | | clsLecture.setLectureType(res.getType()); |
| | | clsLecture.setName(res.getName()); |
| | | clsLecture.setStatus(res.getStatus()); |
| | | clsLecture.setRemark(res.getRemark()); |
| | | clsLecture.setSubjectId(clsSubjectChapter.getSubjectId()); |
| | | clsLecture.setResItemId(res.getResId()); |
| | | clsLecture.setClassId(classReSubject.getClassId()); |
| | | save(clsLecture); |
| | | } |
| | | } |
| | | |
| | | |
| | | return new Result(true, "success"); |
| | | } |
| | | |
| | | @Override |
| | | public Result addLectureLoad(String sectionId){ |
| | | SubjectChapter chapter = read(SubjectChapter.class, sectionId); |
| | | String hql = "from Subject where subjectId = ? and deleteFlag is false"; |
| | | String subjectId = chapter.getSubjectId(); |
| | | Subject subjectOne = findUnique(hql,CollectionUtils.newList(subjectId),Subject.class); |
| | | String hqlOne = "from Subject where name = ? and deleteFlag is false"; |
| | | List<Subject> subjectTwo = find(hqlOne,CollectionUtils.newList(subjectOne.getName()),Subject.class); |
| | | for (Subject s : subjectTwo){ |
| | | String hqlTwo = "from ClsClassReSubject where subjectId = ? and deleteFlag is false"; |
| | | ClsClassReSubject subject = findUnique(hqlTwo,CollectionUtils.newList(s.getSubjectId()),ClsClassReSubject.class); |
| | | if(subject != null){ |
| | | subjectService.updateClsSubject(subject.getClassId(),s.getSubjectId(),s.getOrigSubjectId(),s.getTeacherId(),s.getSchoolYear(),s.getTerm()); |
| | | } |
| | | } |
| | | return new Result(true, "success"); |
| | | } |
| | | // @Override |
| | | // public Result addLectureLoad(String sectionId){ |
| | | // SubjectChapter chapter = read(SubjectChapter.class, sectionId); |
| | | // String hql = "from Subject where subjectId = ? and deleteFlag is false"; |
| | | // String subjectId = chapter.getSubjectId(); |
| | | // Subject subjectOne = findUnique(hql,CollectionUtils.newList(subjectId),Subject.class); |
| | | // String hqlOne = "from Subject where name = ? and deleteFlag is false"; |
| | | // List<Subject> subjectTwo = find(hqlOne,CollectionUtils.newList(subjectOne.getName()),Subject.class); |
| | | // for (Subject s : subjectTwo){ |
| | | // String hqlTwo = "from ClsClassReSubject where subjectId = ? and deleteFlag is false"; |
| | | // ClsClassReSubject subject2 = findUnique(hqlTwo,CollectionUtils.newList(s.getSubjectId()),ClsClassReSubject.class); |
| | | // if(subject2 != null){ |
| | | // subjectService.updateClsSubject(subject2.getClassId(),s.getSubjectId(),s.getOrigSubjectId(),s.getTeacherId(),s.getSchoolYear(),s.getTerm()); |
| | | // Subject subject = read(Subject.class,s.getSubjectId()); |
| | | // |
| | | // |
| | | // clsLectureService.doCopyLecturesToClass(s.getSubjectId(), subjectId, subject2.getClassId()); |
| | | // |
| | | // |
| | | // } |
| | | // } |
| | | // return new Result(true, "success"); |
| | | // } |
| | | |
| | | @Override |
| | | public Result updateLecture(String lectureId, String resId) { |
| | | |
| | | SubjectLecture lecture = read(SubjectLecture.class, lectureId); |
| | | |
| | | |
| | | Res res = resService.read(resId); |
| | | |
| | |
| | | } |
| | | return new Result(true, "success"); |
| | | } |
| | | @Override |
| | | public Result deleteLectureLoad(String[] lectureIds){ |
| | | SubjectLecture lecture = read(SubjectLecture.class, lectureIds[0]); |
| | | String hql = "from Subject where subjectId = ? and deleteFlag is false"; |
| | | String subjectId = lecture.getSubjectId(); |
| | | Subject subjectOne = findUnique(hql,CollectionUtils.newList(subjectId),Subject.class); |
| | | String hqlOne = "from Subject where name = ? and deleteFlag is false"; |
| | | List<Subject> subjectTwo = find(hqlOne,CollectionUtils.newList(subjectOne.getName()),Subject.class); |
| | | for (Subject s : subjectTwo){ |
| | | String hqlTwo = "from ClsClassReSubject where subjectId = ? and deleteFlag is false"; |
| | | ClsClassReSubject subject = findUnique(hqlTwo,CollectionUtils.newList(s.getSubjectId()),ClsClassReSubject.class); |
| | | if(subject != null){ |
| | | subjectService.updateClsSubject(subject.getClassId(),s.getSubjectId(),s.getOrigSubjectId(),s.getTeacherId(),s.getSchoolYear(),s.getTerm()); |
| | | } |
| | | } |
| | | return new Result(true, "success"); |
| | | } |
| | | |
| | | // @Override |
| | | // public Result deleteLectureLoad(String[] lectureIds){ |
| | | // SubjectLecture lecture = read(SubjectLecture.class, lectureIds[0]); |
| | | // String hql = "from Subject where subjectId = ? and deleteFlag is false"; |
| | | // String subjectId = lecture.getSubjectId(); |
| | | // Subject subjectOne = findUnique(hql,CollectionUtils.newList(subjectId),Subject.class); |
| | | // String hqlOne = "from Subject where name = ? and deleteFlag is false"; |
| | | // List<Subject> subjectTwo = find(hqlOne,CollectionUtils.newList(subjectOne.getName()),Subject.class); |
| | | // for (Subject s : subjectTwo){ |
| | | // String hqlTwo = "from ClsClassReSubject where subjectId = ? and deleteFlag is false"; |
| | | // ClsClassReSubject subject = findUnique(hqlTwo,CollectionUtils.newList(s.getSubjectId()),ClsClassReSubject.class); |
| | | // if(subject != null){ |
| | | // subjectService.updateClsSubject(subject.getClassId(),s.getSubjectId(),s.getOrigSubjectId(),s.getTeacherId(),s.getSchoolYear(),s.getTerm()); |
| | | // } |
| | | // } |
| | | // return new Result(true, "success"); |
| | | // } |
| | | |
| | | /** |
| | | * |
| | | * @param lectureId |
| | | * 课件id |
| | | * @param lectureId 课件id |
| | | * @return |
| | | */ |
| | | private Result deleteLecture(String lectureId) { |
| | | |
| | | SubjectLecture lecture = read(SubjectLecture.class, lectureId); |
| | | |
| | | TraceUtils.setUpdateTrace(lecture); |
| | | lecture.setDeleteFlag(true); |
| | | save(lecture); |
| | | |
| | | subjectService.addLectureCount(lecture.getSubjectId(), -1); |
| | | |
| | | String hql = "from Subject where subjectId = ? and deleteFlag is false"; |
| | | Subject subject = findUnique(hql, CollectionUtils.newList(lecture.getSubjectId()), Subject.class); |
| | | String hql1 = "from Subject where name = ? and deleteFlag is false and type = 2"; |
| | | List<Subject> subjects = find(hql1, CollectionUtils.newList(subject.getName()), Subject.class); |
| | | for (Subject subjectv : subjects) { |
| | | |
| | | String hql2 = "from ClsSubjectLecture where subjectId = ? and deleteFlag is false and Name = ? "; |
| | | ClsSubjectLecture clsSubjectLecture = findUnique(hql2, CollectionUtils.newList(subjectv.getSubjectId(), lecture.getName()), ClsSubjectLecture.class); |
| | | if(clsSubjectLecture != null){ |
| | | TraceUtils.setUpdateTrace(clsSubjectLecture); |
| | | clsSubjectLecture.setDeleteFlag(true); |
| | | save(clsSubjectLecture); |
| | | } |
| | | } |
| | | |
| | | return new Result(true, "success"); |
| | | } |
| | |
| | | |
| | | List<MyLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyLectureV.class); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<MyOpenLectureV> listOpenLectureVBySubjectId(String learnerId, String subjectId, String keyword, Integer pageSize, |
| | | Integer pageNum, String type) { |
| | | StringBuffer hql = new StringBuffer("from MyOpenLectureV where subjectId=? and userId = ? order by lectureUpdateTime desc"); |
| | | List<Object> args = CollectionUtils.newList(subjectId, learnerId); |
| | | |
| | | if (StringUtils.isNotEmpty(type)) { |
| | | hql.append(" and lectureType=?"); |
| | | args.add(type); |
| | | } |
| | | |
| | | List<MyOpenLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyOpenLectureV.class); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<SubjectLecture> getSubjectLectureVByChapterId(String chapterId, String keyword, Integer limit, Integer pageNum) { |
| | | StringBuffer hql = new StringBuffer("from SubjectLecture where chapterId=? and deleteFlag is false"); |
| | | List<Object> args = CollectionUtils.newList(chapterId); |
| | | |
| | | List<SubjectLecture> result = findList(hql.toString(), new Pager(limit, pageNum), args, SubjectLecture.class); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<MyOpenLectureV> getMyOpenLectureVByChapterId(String userId, String chapterId, String keyword, Integer limit, Integer pageNum) { |
| | | StringBuffer hql = new StringBuffer("from MyOpenLectureV where userId=? and chapterId = ?"); |
| | | List<Object> args = CollectionUtils.newList(userId, chapterId); |
| | | |
| | | List<MyOpenLectureV> result = findList(hql.toString(), new Pager(limit, pageNum), args, MyOpenLectureV.class); |
| | | return result; |
| | | } |
| | | |
| | |
| | | return read(LectureDocV.class, lectureId); |
| | | } |
| | | |
| | | public Result updateLecturetime(String targetId) { |
| | | |
| | | SubjectLecture lecture = read(SubjectLecture.class, targetId); |
| | | |
| | | |
| | | TraceUtils.setUpdateTrace(lecture); |
| | | |
| | | lecture.setUpdateTime(new Date()); |
| | | lecture.setUpdator(ClientUtils.getUserId()); |
| | | save(lecture); |
| | | |
| | | return new Result(true, "success"); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @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; |