Quellcode durchsuchen

课程节目录

he2802 vor 3 Jahren
Ursprung
Commit
47204e595a

+ 2 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/course/CourseController.java

@@ -124,4 +124,6 @@ public class CourseController extends BaseController {
         List<CourseUserChapterSectionVo> list = iCourseChapterSectionService.sectionList(bo);
         return AjaxResult.success(list);
     }
+
+
 }

+ 10 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserStudyRecordController.java

@@ -5,6 +5,8 @@ import java.util.Arrays;
 
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.framework.web.service.WxTokenService;
+import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
+import com.zhongzheng.modules.course.vo.CourseUserMenuVo;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.user.bo.UserStudyRecordAddBo;
 import com.zhongzheng.modules.user.bo.UserStudyRecordEditBo;
@@ -110,5 +112,13 @@ public class UserStudyRecordController extends BaseController {
         return AjaxResult.success(iUserStudyRecordService.checkStudyOrder1(bo) ? 1 : 0);
     }
 
+    /**
+     * 查询课程目录结构列表
+     */
+    @ApiOperation("查询课程所有子目录结构列表")
+    @GetMapping("/menuAllList")
+    public AjaxResult<Integer> menuAllList(UserStudyRecordQueryBo bo) {
+        return AjaxResult.success(iUserStudyRecordService.menuAllList(bo) ? 1 : 0);
+    }
 
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java

@@ -7,6 +7,7 @@ import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.vo.*;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo;
 import com.zhongzheng.modules.user.domain.User;
 
 import java.util.Collection;
@@ -99,4 +100,5 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 	Long selectOfficialInfoCount(ClassGradeUserQueryBo bo);
 
 	Long selectOfficialPeriodCount(ClassGradeUserQueryBo bo);
+
 }

+ 4 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -1189,6 +1189,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return classPeriodUserVos;
     }
 
+
+
     @Override
     public List<ClassPeriodVo> listPeriodAudit(ClassGradeUserQueryBo bo) {
         //查找最外层课程目录 模块 章 节
@@ -1468,7 +1470,6 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
 
     @Override
     public Long selectList(User bo) {
-
         return baseMapper.selectUserCount(bo);
     }
 
@@ -1487,6 +1488,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return baseMapper.selectOfficialPeriodCount(bo);
     }
 
+
+
     /**
      * 实体类转化成视图对象
      *

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodVo.java

@@ -35,6 +35,10 @@ public class ClassPeriodVo implements Comparable<ClassPeriodVo> {
 	@ApiModelProperty("id")
 	private Long id;
 
+	/** 节ID */
+	@ApiModelProperty("节ID")
+	private Long sectionId;
+
 	/** 章ID */
 	@ApiModelProperty("章ID")
 	private Long chapterId;

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordMapper.java

@@ -2,6 +2,7 @@ package com.zhongzheng.modules.user.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.vo.ClassPeriodVo;
 import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
@@ -69,4 +70,10 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
     SectionStudyRecordVo listExamRecord(SubjectStudyRecordQueryBo bo);
 
     Long selectChapterSectionRecord(UserStudyRecordQueryBo bo);
+
+    List<ClassPeriodVo> listMenu(UserStudyRecordQueryBo bo);
+
+    List<ClassPeriodVo> listChapterSection(UserStudyRecordQueryBo bo);
+
+    List<ClassPeriodVo> listModuleChapter(UserStudyRecordQueryBo bo);
 }

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyRecordService.java

@@ -1,7 +1,9 @@
 package com.zhongzheng.modules.user.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.vo.ClassPeriodVo;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.UserStudyRecord;
 import com.zhongzheng.modules.user.vo.*;
@@ -80,5 +82,5 @@ public interface IUserStudyRecordService extends IService<UserStudyRecord> {
 
 	boolean checkStudyOrder1(UserStudyRecordQueryBo entity);
 
-	boolean checkStudyOrder2(UserStudyRecordQueryBo entity);
+	boolean menuAllList(UserStudyRecordQueryBo bo);
 }

+ 103 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -22,6 +22,7 @@ import com.zhongzheng.modules.face.service.IFaceService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsUserVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
+import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.bo.UserPeriodAddBo;
 import com.zhongzheng.modules.grade.bo.UserPeriodStatusAddBo;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
@@ -30,6 +31,9 @@ import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
+import com.zhongzheng.modules.grade.vo.ClassPeriodChapterVo;
+import com.zhongzheng.modules.grade.vo.ClassPeriodSectionVo;
+import com.zhongzheng.modules.grade.vo.ClassPeriodVo;
 import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
 import com.zhongzheng.modules.inform.bo.InformRemindQueryBo;
 import com.zhongzheng.modules.inform.bo.InformUserAddBo;
@@ -404,12 +408,109 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         return false;
     }
 
+    /**
+     * 获取课程目录
+     * @param bo
+     * @return
+     */
     @Override
-    public boolean checkStudyOrder2(UserStudyRecordQueryBo entity) {
-        
+    public boolean menuAllList(UserStudyRecordQueryBo bo) {
+        //存储整个目录节列表
+        List<ClassPeriodVo> sectionList = new ArrayList<>();
+        //获取课程目录
+        List<ClassPeriodVo> list = baseMapper.listMenu(bo);
+        //排序目录
+        Collections.sort(list);
+        for (ClassPeriodVo classPeriodVo : list) {
+            //为模块搜索下面的章 和节
+            if (classPeriodVo.getType() == 1){
+                UserStudyRecordQueryBo moduleQueryBo = new UserStudyRecordQueryBo();
+                moduleQueryBo.setModuleId(classPeriodVo.getId());
+                List<ClassPeriodVo> classPeriodChapterVos = baseMapper.listModuleChapter(moduleQueryBo);
+                //排序章目录
+                Collections.sort(classPeriodChapterVos);
+                for (ClassPeriodVo classChapterVo : classPeriodChapterVos) {
+                    UserStudyRecordQueryBo chapterQueryBo = new UserStudyRecordQueryBo();
+                    chapterQueryBo.setChapterId(classChapterVo.getId());
+                    List<ClassPeriodVo> classPeriodSectionVos = baseMapper.listChapterSection(chapterQueryBo);
+                    //排序节目录
+                    Collections.sort(classPeriodSectionVos);
+                    for (ClassPeriodVo classSectionVo : classPeriodSectionVos) {
+                        classSectionVo.setModuleId(classPeriodVo.getId());
+                        classSectionVo.setChapterId(classChapterVo.getId());
+                        classSectionVo.setSectionId(classSectionVo.getId());
+                        sectionList.add(classSectionVo);
+                    }
+                }
+
+            }
+            //为章搜索节记录
+            if (classPeriodVo.getType() == 2){
+                UserStudyRecordQueryBo chapterQueryBo = new UserStudyRecordQueryBo();
+                chapterQueryBo.setChapterId(classPeriodVo.getId());
+                List<ClassPeriodVo> classPeriodSectionVos = baseMapper.listChapterSection(chapterQueryBo);
+                //排序节目录
+                Collections.sort(classPeriodSectionVos);
+                for (ClassPeriodVo classSectionVo : classPeriodSectionVos) {
+                    classSectionVo.setModuleId(0L);
+                    classSectionVo.setChapterId(classPeriodVo.getId());
+                    classSectionVo.setSectionId(classSectionVo.getId());
+                    sectionList.add(classSectionVo);
+                }
+
+            }
+            //为节搜索学时记录
+            if (classPeriodVo.getType() == 3){
+                classPeriodVo.setModuleId(0L);
+                classPeriodVo.setChapterId(0L);
+                classPeriodVo.setSectionId(classPeriodVo.getId());
+                sectionList.add(classPeriodVo);
+
+            }
+        }
+        System.out.println("事件"+sectionList.size());
+        System.out.println(sectionList);
+
+        return false;
+    }
+
+
+    //判断当前未看完的节是否是点击播放的节
+    private boolean compareSection(UserStudyRecordVo recordVo,UserStudyRecordQueryBo entity){
+        if(recordVo.getModuleId().equals(entity.getModuleId())){
+            if(recordVo.getChapterId().equals(entity.getChapterId())){
+                if(recordVo.getSectionId().equals(entity.getSectionId())){
+                    return true;
+                }
+            }
+        }
         return false;
     }
 
+
+
+
+    /**
+     * 获取最后一次看完的节
+     * @param bo
+     * @return
+     */
+    private UserStudyRecordVo queryLastOver(UserStudyRecordQueryBo bo) {
+        LambdaQueryWrapper<UserStudyRecord> lqw = Wrappers.lambdaQuery();
+        lqw.eq(UserStudyRecord::getUserId, bo.getUserId());
+        lqw.eq( UserStudyRecord::getCourseId, bo.getCourseId());
+        lqw.eq(UserStudyRecord::getSectionId, bo.getSectionId());
+        lqw.eq(UserStudyRecord::getGradeId, bo.getGradeId());
+        lqw.eq(UserStudyRecord::getGoodsId, bo.getGoodsId());
+        lqw.eq(UserStudyRecord::getModuleId, bo.getModuleId());
+        lqw.eq(UserStudyRecord::getChapterId, bo.getChapterId());
+        lqw.eq( UserStudyRecord::getCurrentStatus, 1);
+        lqw.eq( UserStudyRecord::getStatus, 1);
+        lqw.orderByDesc(UserStudyRecord::getRecordId);
+        UserStudyRecord last = this.getOne(lqw.last("limit 1"));
+        return BeanUtil.toBean(last, UserStudyRecordVo.class);
+    }
+
     @Override
     public Boolean updateByEditBo(UserStudyRecordEditBo bo) {
         UserStudyRecord update = BeanUtil.toBean(bo, UserStudyRecord.class);

+ 86 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -100,6 +100,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="recordNum" column="record_num"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
+        <result property="userId" column="user_id"/>
+        <result property="id" column="id"/>
+        <result property="typeName" column="type_name"/>
+        <result property="realName" column="realname"/>
+        <result property="classHours" column="class_hours"/>
+        <result property="studyStartTime" column="study_start_time"/>
+        <result property="status" column="status"/>
+        <result property="auditTime" column="audit_time"/>
+        <result property="type" column="type"/>
+        <result property="sort" column="sort"/>
+        <result property="courseId" column="course_id"/>
+        <result property="studyEndTime" column="study_end_time"/>
+        <result property="durationTime" column="duration_time"/>
+        <result property="courseSort" column="course_sort"/>
+    </resultMap>
+
 
 
     <select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo"  resultMap="UserStudyRecordResult">
@@ -1041,4 +1058,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND current_status = 1
     </select>
 
+
+    <select id="listMenu" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo"
+            resultMap="ClassPeriodVo">
+        SELECT
+        cm.sort,
+        cm.menu_id as id,
+        cm.course_id,
+        1 as type
+        FROM
+        course_menu cm
+        where 1=1
+        <if test="courseId != null and courseId !='' ">
+            and cm.course_id=#{courseId}
+        </if>
+        AND cm.type=1
+        UNION
+        SELECT
+        cm.sort,
+        cm.menu_id as id,
+        cm.course_id,
+        2 as type
+        FROM
+        course_menu cm
+        LEFT JOIN goods_course gc on gc.course_id = cm.course_id
+        where 1=1   <if test="courseId != null and courseId !='' ">
+        and cm.course_id=#{courseId}
+    </if>  AND cm.type=2
+        UNION
+        SELECT
+        cm.sort,
+        cm.menu_id as id,
+        cm.course_id,
+        3 as type
+        FROM
+        course_menu cm
+        where 1=1
+        <if test="courseId != null and courseId !='' ">
+            and cm.course_id=#{courseId}
+        </if>
+        AND cm.type=3
+    </select>
+
+    <select id="listChapterSection" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo" resultMap="ClassPeriodVo">
+        SELECT
+        ccs.sort,
+        ccs.section_id AS id,
+        3 AS type
+        FROM
+        course_chapter_section ccs
+        WHERE
+        1 = 1
+        <if test="chapterId != null and chapterId !='' ">
+            AND ccs.chapter_id = #{chapterId}
+        </if>
+    </select>
+
+    <select id="listModuleChapter" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo" resultMap="ClassPeriodVo">
+        SELECT
+        cmc.sort,
+        cc.chapter_id as id,
+        2 AS type
+        FROM
+         course_module_chapter cmc
+        WHERE
+        1 = 1
+        <if test="moduleId != null and moduleId !='' ">
+            AND cmc.module_id=#{moduleId}
+        </if>
+    </select>
 </mapper>