派生自 projectDept/qhighschool

Administrator
2022-12-12 888af852af74ecd24f4f4370b61427771e60d314
华为云obs上传访问
11个文件已修改
1个文件已添加
1424 ■■■■■ 已修改文件
src/main/java/com/qxueyou/scc/admin/classes/service/IClassLectureService.java 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/admin/classes/service/impl/ClassLectureService.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/admin/progress/service/impl/item/LectureProgressService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/admin/progress/service/impl/lecture/LectureCommonProgressService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/controller/CoursewareController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/controller/HweiYunOBSController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/stucontroller/StuSubjectController.java 182 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/teach/subject/model/view/MyOpenLectureV.java 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/teach/subject/service/ILectureService.java 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/teach/subject/service/ISubjectService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectLectureService.java 731 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/admin/classes/service/IClassLectureService.java
@@ -8,13 +8,14 @@
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 {
    /**
     * 新增章节文件夹
     *
     *
     * @param parentChapterId
     *            父级章节文件夹id
     * @param name
@@ -25,7 +26,7 @@
    /**
     * 返回下级章节文件夹列表,如果
     *
     *
     * @param classId
     *            班级id
     * @param parentChapterId
@@ -36,7 +37,7 @@
    /**
     * 课件列表搜索
     *
     *
     * @param chapterId
     *            章节id
     * @param keyword
@@ -54,7 +55,7 @@
    /**
     * 修改章节文件夹
     *
     *
     * @param chapterId
     *            文件夹id
     * @param name
@@ -65,7 +66,7 @@
    /**
     * 删除章节文件夹
     *
     *
     * @param chapterIds
     *            章节文件夹id数组
     * @return 上传结果:{"success":true,msg:"success",attrs:{}}
@@ -74,7 +75,7 @@
    /**
     * 新增课件
     *
     *
     * @param chapterId
     *            章节id
     * @param resId
@@ -85,7 +86,7 @@
    /**
     * 修改课件
     *
     *
     * @param lectureId
     *            课件id
     * @param resId
@@ -96,7 +97,7 @@
    /**
     * 删除课件
     *
     *
     * @param lectureIds
     *            课件id数组
     * @return 上传结果:{"success":true,msg:"success",attrs:{}}
@@ -105,7 +106,7 @@
    /**
     * 课件学习进度提交
     *
     *
     * @param clsLectureId
     * @param from
     * @param to
@@ -115,7 +116,7 @@
    /**
     * 复制课件
     *
     *
     * @param lectureId
     *            课件id
     * @param destChapterId
@@ -128,7 +129,7 @@
    /**
     * 移动课件
     *
     *
     * @param lectureId
     *            课件id
     * @param destChapterId
@@ -141,7 +142,7 @@
    /**
     * 课件列表搜索
     *
     *
     * @param chapterId
     *            章节id
     * @param keyword
@@ -159,7 +160,7 @@
    /**
     * 课件列表
     *
     *
     * @param classId
     *            章节id
     * @return
@@ -168,7 +169,7 @@
    /**
     * 读取课件真实文件访问路径
     *
     *
     * @param lectureId
     *            课件id数组
     * @param attribute
@@ -184,7 +185,7 @@
    /**
     * 读取课件目录
     *
     *
     * @param chapterId
     * @return
     */
@@ -192,7 +193,7 @@
    /**
     * 课件列表大小
     *
     *
     * @param chapterId
     *            章节id
     * @param keyword
@@ -205,7 +206,7 @@
    /**
     * 返回下级章节文件夹列表
     *
     *
     * @param classId
     *            班级id
     * @param classId
@@ -218,7 +219,7 @@
    /**
     * 返回下级章节文件夹列表,如果
     *
     *
     * @param classId
     *            班级id
     *  @param subjectId
@@ -231,7 +232,7 @@
    /**
     * 把课程上的课件拷贝到班级课程
     *
     *
     * @param subjectId
     *            课程id
     * @param classId
@@ -239,8 +240,8 @@
     * @return
     */
    Result doCopyLecturesToClass(String origSubjectId, String subjectId, String classId);
    /**
     * 清理所有的班级课件
     * @param subjectId
@@ -248,72 +249,72 @@
     * @return
     */
    Result doClearLecturesToClass(String subjectId, String classId);
    /**
     * 根据课程查询课件
     *
     *
     * @param subjectId
     * @param type
     * @param classId
     * @return
     */
    List<Map<String, Object>> listLectureBySubject(String subjectId, String type, String classId);
    /**
     * 查询班级内的课件和课程
     *
     *
     * @param classId
     * @return
     */
    Result listSubjectLecture(String classId, String sort, Pager pager);
    /**
     * 获取课程下的课件
     *
     *
     * @param subjectId
     * @param type
     * @return
     */
    public Map<String,Object> listLectureBySubjectOrderCreateTime(String subjectId, String classId, String sort, Pager pager);
    /**
     * 学员端获取课程下课件
     *
     *
     * @param subjectId
     * @param type
     * @return
     */
    public List<Map<String, Object>> listStuLectureBySubject(String subjectId, String classId);
    /**
     * 学员端获取课程下课件数量
     *
     *
     * @param subjectId
     * @param type
     * @return
     */
    public long stuLectureCountBySubject(String subjectId, String classId);
    /**
     * 获取章节下的课件
     *
     *
     * @param chapterLst
     * @param lectures
     * @return
     */
    public List<ClsSubjectChapter> getChapterLectures(List<ClsSubjectChapter> chapterLst, List<Map<String, Object>> lectures);
    /**
     * 获取文档页码
     *
     *
     * @param resItemId
     * @return
     */
    public int readDocPageCount(String resItemId);
    /**
     * 公开课课件
     *
     *
     * @param subjectId
     * @param classId
     * @param sort
@@ -321,14 +322,17 @@
     * @return
     */
    public Map<String,Object> listOpenLectureBySubjectOrderCreateTime(String subjectId, String sort, Pager pager);
    /**
     * 课件按目录分类
     *
     *
     * @param classId
     * @param subjectId
     * @param type
     * @return
     */
    public Result coursewareChapterList(String classId,String subjectId, String type);
    List<Map<String, Object>> listStuLectureByOpenSubject(String subjectId);
}
src/main/java/com/qxueyou/scc/admin/classes/service/impl/ClassLectureService.java
@@ -273,13 +273,20 @@
    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);
        TraceUtils.setUpdateTrace(lecture);
        lecture.setUpdateTime(new Date());
        lecture.setUpdator(ClientUtils.getUserId());
        save(lecture);
            lecture.setUpdateTime(new Date());
            lecture.setUpdator(ClientUtils.getUserId());
            save(lecture);
        }
        return new Result(true, "success");
    }
src/main/java/com/qxueyou/scc/admin/progress/service/impl/item/LectureProgressService.java
@@ -5,6 +5,7 @@
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;
@@ -21,7 +22,10 @@
public class LectureProgressService extends CommonAppService implements IDetailProgressService {
    @Autowired
    IClassLectureService lectureService;
    IClassLectureService clsLectureService;
    @Autowired
    ILectureService lectureService;
    /**
     * 各类型课件进度服务实现
@@ -45,8 +49,7 @@
    @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();
src/main/java/com/qxueyou/scc/admin/progress/service/impl/lecture/LectureCommonProgressService.java
@@ -5,6 +5,8 @@
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;
@@ -34,6 +36,9 @@
    @Autowired
    ClassLectureService classLectureService;
    @Autowired
    SubjectLectureService subjectLectureService;
    @Override
    public Result addProgress(String targetId, String learnerId, int start, int end) {
src/main/java/com/qxueyou/scc/controller/CoursewareController.java
@@ -136,7 +136,7 @@
    public Result deleteCourseware(String id) {
        Result result = lectureService.deleteLecture(id.split(","));
        lectureService.deleteLectureLoad(id.split(","));
//        lectureService.deleteLectureLoad(id.split(","));
        return result;
    }
@@ -323,8 +323,6 @@
            result = lectureService.addLecture(sectionId, resId_);
            successCount = result.isSuccess() ? 1 : 0;
        }
        lectureService.addLectureLoad(sectionId);
        return new Result(true, null, successCount);
    }
src/main/java/com/qxueyou/scc/controller/HweiYunOBSController.java
@@ -39,17 +39,17 @@
    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)
src/main/java/com/qxueyou/scc/stucontroller/StuSubjectController.java
@@ -9,7 +9,11 @@
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;
@@ -32,9 +36,6 @@
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;
@@ -288,15 +289,23 @@
    })
    @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")));
    }
    /**
@@ -312,12 +321,22 @@
    @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")));
        }
    }
    /**
@@ -340,12 +359,46 @@
        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"))));
        }
    }
@@ -414,14 +467,13 @@
        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();
@@ -436,7 +488,7 @@
                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));
@@ -445,12 +497,47 @@
            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,
                        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));
    }
    /**
@@ -465,34 +552,63 @@
    @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.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.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));
    }
}
src/main/java/com/qxueyou/scc/teach/subject/model/view/MyOpenLectureV.java
New file
@@ -0,0 +1,154 @@
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;
    }
}
src/main/java/com/qxueyou/scc/teach/subject/service/ILectureService.java
@@ -6,22 +6,16 @@
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);
@@ -37,10 +31,8 @@
    /**
     * 修改章节文件夹
     *
     * @param chapterId
     *            文件夹id
     * @param name
     *            名称
     * @param chapterId 文件夹id
     * @param name      名称
     * @return 上传结果:{"success":true,msg:"success",attrs:{}}
     */
    Result updateChapter(String chapterId, String name);
@@ -48,8 +40,7 @@
    /**
     * 删除章节文件夹
     *
     * @param chapterIds
     *            章节文件夹id数组
     * @param chapterIds 章节文件夹id数组
     * @return 上传结果:{"success":true,msg:"success",attrs:{}}
     */
    Result deleteChapter(String[] chapterIds);
@@ -57,10 +48,8 @@
    /**
     * 返回下级章节文件夹列表,如果
     *
     * @param subjectId
     *            课程id
     * @param parentChapterId
     *            父级章节文件夹id
     * @param subjectId       课程id
     * @param parentChapterId 父级章节文件夹id
     * @return 返回章节列表
     */
    List<SubjectChapter> doGetListChapter(String subjectId, String parentChapterId);
@@ -68,10 +57,8 @@
    /**
     * 返回下级章节文件夹列表,如果
     *
     * @param subjectId
     *            课程id
     * @param parentChapterId
     *            父级章节文件夹id
     * @param subjectId       课程id
     * @param parentChapterId 父级章节文件夹id
     * @return 返回章节列表
     */
    List<SubjectProgressTreeV> getChapterTreeVList(String subjectId, String parentChapterId);
@@ -79,10 +66,8 @@
    /**
     * 返回下级章节文件夹列表
     *
     * @param subjectId
     *            课程id
     * @param parentChapterId
     *            父级章节文件夹id
     * @param subjectId       课程id
     * @param parentChapterId 父级章节文件夹id
     * @return 返回章节列表
     */
    List<SubjectChapter> getListChapter(String subjectId, String parentChapterId);
@@ -90,8 +75,7 @@
    /**
     * 返回所有章节列表,按createTime排序
     *
     * @param subjectId
     *            课程id
     * @param subjectId 课程id
     * @return 返回章节列表
     */
    List<SubjectChapter> getAllChapterBySubjectId(String subjectId);
@@ -99,24 +83,22 @@
    /**
     * 新增课件
     *
     * @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);
@@ -124,8 +106,7 @@
    /**
     * 读取视频课件
     *
     * @param lectureId
     *            课件id
     * @param lectureId 课件id
     * @return SubjectLecture
     */
    LectureVideoV readVideoLecture(String lectureId);
@@ -133,8 +114,7 @@
    /**
     * 读取音频课件
     *
     * @param lectureId
     *            课件id
     * @param lectureId 课件id
     * @return LectureAudioV
     */
    LectureAudioV readAudioLecture(String lectureId);
@@ -142,10 +122,8 @@
    /**
     * 修改课件
     *
     * @param lectureId
     *            课件id
     * @param resId
     *            资源id
     * @param lectureId 课件id
     * @param resId     资源id
     * @return 上传结果:{"success":true,msg:"success",attrs:{}}
     */
    Result updateLecture(String lectureId, String resId);
@@ -153,23 +131,19 @@
    /**
     * 删除课件
     *
     * @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);
@@ -177,12 +151,9 @@
    /**
     * 移动课件
     *
     * @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);
@@ -190,16 +161,11 @@
    /**
     * 课件列表搜索
     *
     * @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);
@@ -207,12 +173,9 @@
    /**
     * 课件列表大小
     *
     * @param chapterId
     *            章节id
     * @param keyword
     *            关键字
     * @param type
     *            类型
     * @param chapterId 章节id
     * @param keyword   关键字
     * @param type      类型
     * @return
     */
    int listLectureCount(String chapterId, String keyword, String type);
@@ -220,20 +183,15 @@
    /**
     * 课件列表搜索
     *
     * @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,
            String type);
                                  String type);
    /**
     * 课件列表搜索
@@ -245,10 +203,8 @@
    /**
     * 读取课件真实文件访问路径
     *
     * @param lectureId
     *            课件id数组
     * @param attribute
     *            课件附加属性
     * @param lectureId 课件id数组
     * @param attribute 课件附加属性
     * @return 上传结果:{"success":true,msg:"success",attrs:{"type":"",path:""}}
     */
    Result readLectureAccessPath(String lectureId, String attribute);
@@ -262,6 +218,7 @@
    /**
     * 课件详情查询
     *
     * @param learnerId
     * @param subjectId
     * @param keyword
@@ -271,5 +228,14 @@
     * @return
     */
    List<MyLectureV> listLectureVBySubjectId(String learnerId, String subjectId, String keyword, Integer pageSize,
                                                    Integer pageNum, String type);
                                             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);
}
src/main/java/com/qxueyou/scc/teach/subject/service/ISubjectService.java
@@ -8,6 +8,7 @@
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 {
@@ -126,6 +127,11 @@
    List<MySubjectV> listMySubjectV(String classId,String userId);
    /**
     * 查询公开课程
     */
    List<OpenSubjectV> listOpenSubjectV();
    /**
     * 首页查询我的课程
     */
    List<Map<String, Object>> getMySubjectList();
src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectLectureService.java
@@ -1,10 +1,14 @@
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;
@@ -26,10 +30,6 @@
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;
@@ -37,415 +37,510 @@
@Service
public class SubjectLectureService extends CommonAppService implements ILectureService {
    public static final String RES_LECTURE_CONVER_LST = "RES_LECTURE_CONVER_LST";
    public static final String RES_LECTURE_CONVER_LST = "RES_LECTURE_CONVER_LST";
    @Autowired
    ISubjectService subjectService;
    @Autowired
    ISubjectService subjectService;
    @Autowired
    IResService resService;
    @Autowired
    IResService resService;
    @Autowired
    ICacheService cacheService;
    @Autowired
    ICacheService cacheService;
    @Autowired
    IProgressService progressService;
    @Autowired
    IProgressService progressService;
    @Autowired
    IClassLectureService clsLectureService;
    @Autowired
    IClassLectureService clsLectureService;
    @Override
    public Result addChapter(String subjectId, String parentChapterId, String name) {
    @Override
    public Result addChapter(String subjectId, String parentChapterId, String name) {
        SubjectChapter chapter = new SubjectChapter();
        SubjectChapter chapter = new SubjectChapter();
        TraceUtils.setCreateTrace(chapter);
        chapter.setName(name);
        chapter.setParentChapterId(parentChapterId);
        chapter.setSubjectId(subjectId);
        TraceUtils.setCreateTrace(chapter);
        chapter.setName(name);
        chapter.setParentChapterId(parentChapterId);
        chapter.setSubjectId(subjectId);
        save(chapter);
        save(chapter);
        return new Result(true, "success", CollectionUtils.newObjectMap("id", chapter.getChapterId(), "name", name));
        return new Result(true, "success", CollectionUtils.newObjectMap("id", chapter.getChapterId(), "name", name));
    }
    }
    @Override
    public Result updateChapter(String chapterId, String name) {
    @Override
    public Result updateChapter(String chapterId, String name) {
        SubjectChapter chapter = read(SubjectChapter.class, chapterId);
        SubjectChapter chapter = read(SubjectChapter.class, chapterId);
        TraceUtils.setUpdateTrace(chapter);
        chapter.setName(name);
        TraceUtils.setUpdateTrace(chapter);
        chapter.setName(name);
        save(chapter);
        save(chapter);
        return new Result(true, "success", CollectionUtils.newObjectMap("id", chapter.getChapterId(), "name", name));
    }
        return new Result(true, "success", CollectionUtils.newObjectMap("id", chapter.getChapterId(), "name", name));
    }
    @Override
    public Result deleteChapter(String[] chapterIds) {
        for (String chapterId : chapterIds) {
            deleteChapter(chapterId);
        }
    @Override
    public Result deleteChapter(String[] chapterIds) {
        for (String chapterId : chapterIds) {
            deleteChapter(chapterId);
        }
        return new Result(true, "success");
    }
        return new Result(true, "success");
    }
    /**
     * 删除单个章节
     *
     * @param chapterId
     *            章节id
     * @return
     */
    private Result deleteChapter(String chapterId) {
    /**
     * 删除单个章节
     *
     * @param chapterId 章节id
     * @return
     */
    private Result deleteChapter(String chapterId) {
        SubjectChapter chapter = read(SubjectChapter.class, chapterId);
        SubjectChapter chapter = read(SubjectChapter.class, chapterId);
        TraceUtils.setUpdateTrace(chapter);
        chapter.setDeleteFlag(true);
        TraceUtils.setUpdateTrace(chapter);
        chapter.setDeleteFlag(true);
        save(chapter);
        Result result = this.deleteCourseware4Chapter(chapterId);
        if (!result.isSuccess()) {
            return result;
        }
        return new Result(true, "success");
    }
        save(chapter);
        Result result = this.deleteCourseware4Chapter(chapterId);
        if (!result.isSuccess()) {
            return result;
        }
        return new Result(true, "success");
    }
    private Result deleteCourseware4Chapter(String chapterId) {
    private Result deleteCourseware4Chapter(String chapterId) {
        this.bulkUpdate("update SubjectLecture set deleteFlag = true where chapterId = ?", new String[] { chapterId });
        return new Result(true);
        this.bulkUpdate("update SubjectLecture set deleteFlag = true where chapterId = ?", new String[]{chapterId});
        return new Result(true);
    }
    }
    @Override
    public List<SubjectChapter> doGetListChapter(String subjectId, String parentChapterId) {
    @Override
    public List<SubjectChapter> doGetListChapter(String subjectId, String parentChapterId) {
        List<SubjectChapter> result = getListChapter(subjectId, parentChapterId);
        List<SubjectChapter> result = getListChapter(subjectId, parentChapterId);
        if (result.isEmpty() && StringUtils.isEmpty(parentChapterId)) {
            return CollectionUtils.newList(SubjectChapter.class, initLectureChapter(subjectId));
        }
        if (result.isEmpty() && StringUtils.isEmpty(parentChapterId)) {
            return CollectionUtils.newList(SubjectChapter.class, initLectureChapter(subjectId));
        }
        return result;
    }
        return result;
    }
    @Override
    public List<SubjectProgressTreeV> getChapterTreeVList(String subjectId, String parentChapterId) {
    @Override
    public List<SubjectProgressTreeV> getChapterTreeVList(String subjectId, String parentChapterId) {
        if (parentChapterId == null) {
            return progressService.getSubjectChapterTreeVList(subjectId, ClientUtils.getUserId());
        }
        if (parentChapterId == null) {
            return progressService.getSubjectChapterTreeVList(subjectId, ClientUtils.getUserId());
        }
        return progressService.getSubjectChapterTreeVList(parentChapterId, ClientUtils.getUserId());
    }
        return progressService.getSubjectChapterTreeVList(parentChapterId, ClientUtils.getUserId());
    }
    /**
     * 初始化
     *
     * @param subjectId
     * @return
     */
    private SubjectChapter initLectureChapter(String subjectId) {
    /**
     * 初始化
     *
     * @param subjectId
     * @return
     */
    private SubjectChapter initLectureChapter(String subjectId) {
        SubjectChapter chapter = new SubjectChapter();
        SubjectChapter chapter = new SubjectChapter();
        TraceUtils.setCreateTrace(chapter);
        chapter.setName("根节点");
        chapter.setSubjectId(subjectId);
        chapter.setParentChapterId(SubjectChapter.ROOT_CHAPTER_ID);
        TraceUtils.setCreateTrace(chapter);
        chapter.setName("根节点");
        chapter.setSubjectId(subjectId);
        chapter.setParentChapterId(SubjectChapter.ROOT_CHAPTER_ID);
        save(chapter);
        save(chapter);
        return chapter;
    }
        return chapter;
    }
    @Override
    public Result addLecture(String chapterId, String resId) {
    @Override
    public Result addLecture(String chapterId, String resId) {
        SubjectChapter chapter = read(SubjectChapter.class, chapterId);
        SubjectChapter chapter = read(SubjectChapter.class, chapterId);
        Res res = resService.read(resId);
        Res res = resService.read(resId);
        SubjectLecture lecture = new SubjectLecture();
        SubjectLecture lecture = new SubjectLecture();
        TraceUtils.setCreateTrace(lecture);
        lecture.setChapterId(chapterId);
        lecture.setLectureType(res.getType());
        lecture.setName(res.getName());
        lecture.setStatus(res.getStatus());
        lecture.setRemark(res.getRemark());
        lecture.setSubjectId(chapter.getSubjectId());
        lecture.setResItemId(res.getResId());
        save(lecture);
        subjectService.addLectureCount(lecture.getSubjectId(), 1);
        return new Result(true, "success");
    }
        TraceUtils.setCreateTrace(lecture);
        lecture.setChapterId(chapterId);
        lecture.setLectureType(res.getType());
        lecture.setName(res.getName());
        lecture.setStatus(res.getStatus());
        lecture.setRemark(res.getRemark());
        lecture.setSubjectId(chapter.getSubjectId());
        lecture.setResItemId(res.getResId());
        save(lecture);
        subjectService.addLectureCount(lecture.getSubjectId(), 1);
    @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");
    }
        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 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);
        TraceUtils.setUpdateTrace(lecture);
        lecture.setLectureType(res.getType());
        lecture.setName(res.getName());
        lecture.setRemark(res.getRemark());
        lecture.setResItemId(res.getResId());
        save(lecture);
        return new Result(true, "success");
    }
    @Override
    public Result deleteLecture(String[] lectureIds) {
        for (String lectureId : lectureIds) {
            deleteLecture(lectureId);
        }
        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
     * @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");
    }
    @Override
    public Result doCopyLecture(String lectureId, String destChapterId, String name) {
        // TODO Auto-generated method stub
        return null;
    }
    @Override
    public Result doMoveLecture(String lectureId, String destChapterId, String name) {
        // TODO Auto-generated method stub
        return null;
    }
    @Override
    public Result updateLecture(String lectureId, String resId) {
    @Override
    public List<SubjectLecture> listLecture(String chapterId, String keyword, Integer pageSize, Integer pageNum,
                                            String type) {
        SubjectLecture lecture = read(SubjectLecture.class, lectureId);
        StringBuffer hql = new StringBuffer("from SubjectLecture where chapterId=? and name like ? and deleteFlag is false");
        List<Object> args = CollectionUtils.newList(chapterId, '%' + keyword.trim() + '%');
        Res res = resService.read(resId);
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
        TraceUtils.setUpdateTrace(lecture);
        lecture.setLectureType(res.getType());
        lecture.setName(res.getName());
        lecture.setRemark(res.getRemark());
        lecture.setResItemId(res.getResId());
        List<SubjectLecture> result = findList(hql.toString(), new Pager(pageSize, pageNum), args,
                SubjectLecture.class);
        save(lecture);
        return result;
    }
        return new Result(true, "success");
    }
    @Override
    public List<MyLectureV> listLectureV(String learnerId, String chapterId, String keyword, Integer pageSize,
                                         Integer pageNum, String type) {
        StringBuffer hql = new StringBuffer("from MyLectureV where chapterId=? and id.userId=?");
        List<Object> args = CollectionUtils.newList(chapterId, learnerId);
    @Override
    public Result deleteLecture(String[] lectureIds) {
        for (String lectureId : lectureIds) {
            deleteLecture(lectureId);
        }
        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");
    }
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
    /**
     *
     * @param lectureId
     *            课件id
     * @return
     */
    private Result deleteLecture(String lectureId) {
        List<MyLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyLectureV.class);
        SubjectLecture lecture = read(SubjectLecture.class, lectureId);
        return result;
    }
        TraceUtils.setUpdateTrace(lecture);
        lecture.setDeleteFlag(true);
        save(lecture);
    @Override
    public List<MyLectureV> listLectureVBySubjectId(String learnerId, String subjectId, String keyword, Integer pageSize,
                                                    Integer pageNum, String type) {
        StringBuffer hql = new StringBuffer("from MyLectureV where subjectId=? and id.userId=? order by lectureUpdateTime desc");
        List<Object> args = CollectionUtils.newList(subjectId, learnerId);
        subjectService.addLectureCount(lecture.getSubjectId(), -1);
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
        return new Result(true, "success");
    }
        List<MyLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyLectureV.class);
    @Override
    public Result doCopyLecture(String lectureId, String destChapterId, String name) {
        // TODO Auto-generated method stub
        return null;
    }
        return result;
    }
    @Override
    public Result doMoveLecture(String lectureId, String destChapterId, String name) {
        // TODO Auto-generated method stub
        return null;
    }
    @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);
    @Override
    public List<SubjectLecture> listLecture(String chapterId, String keyword, Integer pageSize, Integer pageNum,
            String type) {
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
        StringBuffer hql = new StringBuffer("from SubjectLecture where chapterId=? and name like ? and deleteFlag is false");
        List<Object> args = CollectionUtils.newList(chapterId,'%' + keyword.trim() + '%');
        List<MyOpenLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyOpenLectureV.class);
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
        return result;
    }
        List<SubjectLecture> result = findList(hql.toString(), new Pager(pageSize, pageNum), args,
                SubjectLecture.class);
    @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);
        return result;
    }
        List<SubjectLecture> result = findList(hql.toString(), new Pager(limit, pageNum), args, SubjectLecture.class);
        return result;
    }
    @Override
    public List<MyLectureV> listLectureV(String learnerId, String chapterId, String keyword, Integer pageSize,
            Integer pageNum, String type) {
        StringBuffer hql = new StringBuffer("from MyLectureV where chapterId=? and id.userId=?");
        List<Object> args = CollectionUtils.newList(chapterId, learnerId);
    @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);
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
        List<MyOpenLectureV> result = findList(hql.toString(), new Pager(limit, pageNum), args, MyOpenLectureV.class);
        return result;
    }
        List<MyLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyLectureV.class);
    @Override
    public int listLectureCount(String chapterId, String keyword, String type) {
        StringBuffer hql = new StringBuffer("from SubjectLecture where chapterId=? and name like ? and deleteFlag is false");
        return result;
    }
        List<Object> args = CollectionUtils.newList(chapterId, '%' + keyword.trim() + '%');
    @Override
    public List<MyLectureV> listLectureVBySubjectId(String learnerId, String subjectId, String keyword, Integer pageSize,
                                         Integer pageNum, String type) {
        StringBuffer hql = new StringBuffer("from MyLectureV where subjectId=? and id.userId=? order by lectureUpdateTime desc");
        List<Object> args = CollectionUtils.newList(subjectId, learnerId);
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
        return findCount(hql.toString(), args);
        List<MyLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyLectureV.class);
    }
        return result;
    }
    @Override
    public Result readLectureAccessPath(String lectureId, String attribute) {
        SubjectLecture lecture = read(SubjectLecture.class, lectureId);
        String resItemId = null;
        if (lecture == null) {
            resItemId = read(ClsSubjectLecture.class, lectureId).getResItemId();//班级课件
        } else {
            resItemId = lecture.getResItemId();
        }
        return resService.readAccessPath(resItemId, attribute);
    }
    @Override
    public int listLectureCount(String chapterId, String keyword, String type) {
        StringBuffer hql = new StringBuffer("from SubjectLecture where chapterId=? and name like ? and deleteFlag is false");
    @Override
    public SubjectLecture readLecture(String lectureId) {
        return read(SubjectLecture.class, lectureId);
    }
        List<Object> args = CollectionUtils.newList(chapterId,'%' + keyword.trim() + '%');
    @Override
    public SubjectChapter readChapter(String chapterId) {
        return read(SubjectChapter.class, chapterId);
    }
        if (StringUtils.isNotEmpty(type)) {
            hql.append(" and lectureType=?");
            args.add(type);
        }
    @Override
    public List<SubjectChapter> getListChapter(String subjectId, String parentChapterId) {
        return findCount(hql.toString(),args);
        StringBuffer hql = new StringBuffer(
                "from SubjectChapter where subjectId=? and deleteFlag is false and parentChapterId=?");
    }
        List<Object> args = CollectionUtils.newList(subjectId);
    @Override
    public Result readLectureAccessPath(String lectureId, String attribute) {
        SubjectLecture lecture = read(SubjectLecture.class, lectureId);
        String resItemId = null;
        if(lecture == null) {
            resItemId = read(ClsSubjectLecture.class, lectureId).getResItemId();//班级课件
        }else {
            resItemId = lecture.getResItemId();
        }
        return resService.readAccessPath(resItemId, attribute);
    }
        if (StringUtils.isEmpty(parentChapterId)) {
            args.add(SubjectChapter.ROOT_CHAPTER_ID);
        } else {
            args.add(parentChapterId);
        }
    @Override
    public SubjectLecture readLecture(String lectureId) {
        return read(SubjectLecture.class, lectureId);
    }
        List<SubjectChapter> result = find(hql.toString(), args, SubjectChapter.class);
    @Override
    public SubjectChapter readChapter(String chapterId) {
        return read(SubjectChapter.class, chapterId);
    }
        return result;
    }
    @Override
    public List<SubjectChapter> getListChapter(String subjectId, String parentChapterId) {
    @Override
    public List<SubjectLecture> listLectureBySubjectId(String subjectId) {
        String hql = "from SubjectLecture where subjectId=? and deleteFlag is false";
        StringBuffer hql = new StringBuffer(
                "from SubjectChapter where subjectId=? and deleteFlag is false and parentChapterId=?");
        List<SubjectLecture> result = find(hql, CollectionUtils.newList(subjectId), SubjectLecture.class);
        List<Object> args = CollectionUtils.newList(subjectId);
        return result;
    }
        if (StringUtils.isEmpty(parentChapterId)) {
            args.add(SubjectChapter.ROOT_CHAPTER_ID);
        } else {
            args.add(parentChapterId);
        }
    /**
     * 监控resId转码状态同步Lecture的状态
     */
    @Scheduled(cron = "0/2 * * * * ?") // 每2秒执行一次
    public void doTimer() {
        String resId = cacheService.lstLeftPop(RES_LECTURE_CONVER_LST);
        if (StringUtils.isBlank(resId)) {
            return;
        }
        Res res = read(Res.class, resId);
        if (res.getStatus().equals(Res.STATUS_DRAFT)) {
            String[] resIds = resId.split(",");
            bulkUpdate(
                    "update  SubjectLecture set status = 'draft' where deleteFlag is false and status = 'conver' and resItemId = ?",
                    resIds);
            bulkUpdate(
                    "update  ClsSubjectLecture set status = 'draft' where deleteFlag is false and status = 'conver' and resItemId = ?",
                    resIds);
            return;
        }
        cacheService.lstRightPush(RES_LECTURE_CONVER_LST, resId);
    }
        List<SubjectChapter> result = find(hql.toString(), args, SubjectChapter.class);
    @Override
    public Result doStudy(String lectureId, Double from, Double to) {
        String userId = null;
        return progressService.addProgress(Progress.PROGRESS_TYPE_LECTURE, lectureId, from.intValue(), to.intValue(),
                userId);
    }
        return result;
    }
    @Cacheable(value = "LectureVideoV", key = "#lectureId")
    @Override
    public LectureVideoV readVideoLecture(String lectureId) {
        return read(LectureVideoV.class, lectureId);
    }
    @Override
    public List<SubjectLecture> listLectureBySubjectId(String subjectId) {
        String hql = "from SubjectLecture where subjectId=? and deleteFlag is false";
    @Cacheable(value = "LectureAudioV", key = "#lectureId")
    @Override
    public LectureAudioV readAudioLecture(String lectureId) {
        return read(LectureAudioV.class, lectureId);
    }
        List<SubjectLecture> result = find(hql, CollectionUtils.newList(subjectId), SubjectLecture.class);
    @Override
    public List<SubjectChapter> getAllChapterBySubjectId(String subjectId) {
        return result;
    }
        String hql = "from SubjectChapter where deleteFlag is false and subjectId = ? order by createTime";
        return find(hql, CollectionUtils.newList(subjectId), SubjectChapter.class);
    /**
     * 监控resId转码状态同步Lecture的状态
     */
    @Scheduled(cron = "0/2 * * * * ?") // 每2秒执行一次
    public void doTimer() {
        String resId = cacheService.lstLeftPop(RES_LECTURE_CONVER_LST);
        if (StringUtils.isBlank(resId)) {
            return;
        }
        Res res = read(Res.class, resId);
        if (res.getStatus().equals(Res.STATUS_DRAFT)) {
            String[] resIds = resId.split(",");
            bulkUpdate(
                    "update  SubjectLecture set status = 'draft' where deleteFlag is false and status = 'conver' and resItemId = ?",
                    resIds);
            bulkUpdate(
                    "update  ClsSubjectLecture set status = 'draft' where deleteFlag is false and status = 'conver' and resItemId = ?",
                    resIds);
            return;
        }
        cacheService.lstRightPush(RES_LECTURE_CONVER_LST, resId);
    }
    }
    @Override
    public Result doStudy(String lectureId, Double from, Double to) {
        String userId = null;
        return progressService.addProgress(Progress.PROGRESS_TYPE_LECTURE, lectureId, from.intValue(), to.intValue(),
                userId);
    }
    @Override
    public LectureDocV readDocLecture(String lectureId) {
    @Cacheable(value = "LectureVideoV", key = "#lectureId")
    @Override
    public LectureVideoV readVideoLecture(String lectureId) {
        return read(LectureVideoV.class, lectureId);
    }
        return read(LectureDocV.class, lectureId);
    }
    @Cacheable(value = "LectureAudioV", key = "#lectureId")
    @Override
    public LectureAudioV readAudioLecture(String lectureId) {
        return read(LectureAudioV.class, lectureId);
    }
    public Result updateLecturetime(String targetId) {
    @Override
    public List<SubjectChapter> getAllChapterBySubjectId(String subjectId) {
        SubjectLecture lecture = read(SubjectLecture.class, targetId);
        String hql = "from SubjectChapter where deleteFlag is false and subjectId = ? order by createTime";
        return find(hql, CollectionUtils.newList(subjectId), SubjectChapter.class);
    }
        TraceUtils.setUpdateTrace(lecture);
    @Override
    public LectureDocV readDocLecture(String lectureId) {
        lecture.setUpdateTime(new Date());
        lecture.setUpdator(ClientUtils.getUserId());
        save(lecture);
        return read(LectureDocV.class, lectureId);
    }
        return new Result(true, "success");
    }
}
src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java
@@ -419,6 +419,19 @@
    }
    @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;
@@ -607,6 +620,48 @@
            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);
    }
@@ -646,6 +701,8 @@
                        .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;
@@ -665,6 +722,21 @@
                    }
                }
            }
            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;