Bladeren bron

学员班级查询

change 3 jaren geleden
bovenliggende
commit
9a1f3e4e77

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

@@ -31,5 +31,5 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
 
     List<SectionStudyRecordVo> listSection(SubjectStudyRecordQueryBo bo);
 
-    String sectionType(Long courseId);
+    List<Long> sectionType(@Param("courseId") Long courseId,@Param("sectionType") Long sectionType);
 }

+ 20 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -3,6 +3,9 @@ package com.zhongzheng.modules.user.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.microsoft.schemas.office.visio.x2012.main.SectionType;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.UserStudyRecord;
@@ -137,18 +140,35 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         for (GoodsStudyRecordVo goodsStudyRecordVo : list) {
             Long secLong = 0L;
             Long studyLong = 0L;
+
             SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
             subjectStudyRecordQueryBo.setGoodId(goodsStudyRecordVo.getGoodsId());
             subjectStudyRecordQueryBo.setUserId(goodsStudyRecordVo.getUserId());
             List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
             for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
+                String sectionType = "";
                 secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
                 studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
+
+                if (CollectionUtils.isNotEmpty(baseMapper.sectionType(subjectStudyRecordVo.getCourseId(),1L))){
+                    sectionType = sectionType.concat("1,");
+                }
+                if (CollectionUtils.isNotEmpty(baseMapper.sectionType(subjectStudyRecordVo.getCourseId(),2L))){
+                    sectionType = sectionType.concat("2,");
+                }
+                if (CollectionUtils.isNotEmpty(baseMapper.sectionType(subjectStudyRecordVo.getCourseId(),3L))){
+                    sectionType = sectionType.concat("3,");
+                }
+                if (StringUtils.isNotBlank(sectionType)) {
+                    subjectStudyRecordVo.setSectionType(sectionType.substring(0, sectionType.length() - 1));
+                }
             }
             BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
 
             goodsStudyRecordVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
             goodsStudyRecordVo.setSubjectStudyRecordVos(subjectStudyRecordVos);
+            goodsStudyRecordVo.setSecAllNum(secLong);
+            goodsStudyRecordVo.setStuAllNum(studyLong);
         }
 
         return list;

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/GoodsStudyRecordVo.java

@@ -85,6 +85,14 @@ public class GoodsStudyRecordVo {
     @ApiModelProperty("学习进度")
     private Long studyNum;
 
+    /** 学习进度 */
+    @ApiModelProperty("总节数")
+    private Long secAllNum;
+
+    /** 学习进度 */
+    @ApiModelProperty("已学节数")
+    private Long stuAllNum;
+
 
     /** 課程科目返回 */
     @ApiModelProperty("課程科目返回")

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/SubjectStudyRecordVo.java

@@ -56,8 +56,8 @@ public class SubjectStudyRecordVo {
     private Long sectionNum;
 
     /** 节数 */
-    @ApiModelProperty("1 直播 2回放 3錄播 (1,2代表直播,回放)")
-    private Long sectionType;
+    @ApiModelProperty("1 3錄播 2直播 3回放 (1,2代表直播,回放)")
+    private String sectionType;
 
     /** 已学节数 */
     @ApiModelProperty("已学节数")

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

@@ -232,4 +232,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
 
     </select>
+
+
+    <select id="sectionType" parameterType="map"  resultType="Long">
+        SELECT
+            s.section_id
+        FROM
+            course_menu m
+                LEFT JOIN course_section s ON m.menu_id = s.section_id
+        WHERE
+            m.type =3
+          and m.course_id=#{courseId}
+          and s.section_type=#{sectionType}
+        UNION
+        SELECT
+            s.section_id
+        FROM
+            course_chapter_section c
+                LEFT JOIN course_menu m on m.menu_id = c.chapter_id
+                LEFT JOIN course_section s ON c.section_id = s.section_id
+        WHERE
+            m.type =2
+          and m.course_id=#{courseId}
+          and s.section_type=#{sectionType}
+        UNION
+        SELECT
+            s.section_id
+        FROM
+            course_chapter_section c
+                LEFT JOIN course_module_chapter e on c.chapter_id = e.chapter_id
+                LEFT JOIN course_menu m on m.menu_id = e.module_id
+                LEFT JOIN course_section s ON c.section_id = s.section_id
+        WHERE
+            m.type =1
+          and m.course_id=#{courseId}
+          and s.section_type=#{sectionType}
+    </select>
 </mapper>