he2802 2 years ago
parent
commit
1f4c28e5d6

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

@@ -1591,6 +1591,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         for (ClassPeriodUserVo classPeriodUserVo : classPeriodUserVos) {
             Long secLong = 0L;
             Long studyLong = 0L;
+            Long finishSectionDuration = 0L;
             SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
             subjectStudyRecordQueryBo.setGoodsId(classPeriodUserVo.getGoodsId());
             subjectStudyRecordQueryBo.setUserId(bo.getUserId());
@@ -1600,7 +1601,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
                 secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
                 studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
-
+                finishSectionDuration = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordTime().toString())).longValue();
             }
             //BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
             //classGradeStudentVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
@@ -1608,6 +1609,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             classPeriodUserVo.setSecAllNum(secLong);
             //学习节数
             classPeriodUserVo.setStuAllNum(studyLong);
+            //已学习秒数
+            classPeriodUserVo.setFinishSectionDuration(finishSectionDuration);
             classPeriodUserVo.setPending(classPeriodUserVo.getSecAllNum() - classPeriodUserVo.getPass() - classPeriodUserVo.getCheat());
             classPeriodUserVo.setExamPending(classPeriodUserVo.getExamNum() - classPeriodUserVo.getExamPass() - classPeriodUserVo.getExamCheat());
             //當前班級學員審核狀態 -1不可审核 0待審  1未通过 2通过

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodUserVo.java

@@ -135,4 +135,7 @@ public class ClassPeriodUserVo {
 
 	@ApiModelProperty("订单商品ID")
 	private Long orderGoodsId;
+
+	@ApiModelProperty("已完成总视频秒数")
+	private Long finishSectionDuration;
 }

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

@@ -63,6 +63,9 @@ public class SubjectStudyRecordVo {
     @ApiModelProperty("已学节数")
     private Long recordNum;
 
+    @ApiModelProperty("已学节数秒数")
+    private Long recordTime;
+
     /** 科目節模塊學習返回 */
     @ApiModelProperty("科目節模塊學習返回")
     private List<SectionStudyRecordVo> sectionStudyRecordVo;

+ 11 - 1
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -59,6 +59,7 @@
         <result property="chapterNum" column="chapter_num"/>
         <result property="sectionNum" column="section_num"/>
         <result property="recordNum" column="record_num"/>
+        <result property="recordTime" column="record_time"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.user.vo.SectionStudyRecordVo" id="SectionStudyRecordVoResult">
@@ -285,7 +286,16 @@
         <if test="orderGoodsId != null and orderGoodsId !=''">
             and c.order_goods_id=#{orderGoodsId}
         </if>
-        and c.user_id=#{userId} and c.status = 1 and c.goods_id = #{goodsId}) as record_num
+        and c.user_id=#{userId} and c.status = 1 and c.goods_id = #{goodsId}) as record_num,
+        (SELECT IFNULL(SUM(cs.duration_time),0) from (select DISTINCT c.section_id,c.course_id FROM user_study_record c where 1=1
+        and c.current_status=1
+        <if test="gradeId != null and gradeId !=''">
+            and c.grade_id=#{gradeId}
+        </if>
+        <if test="orderGoodsId != null and orderGoodsId !=''">
+            and c.order_goods_id=#{orderGoodsId}
+        </if>
+        and c.user_id=#{userId} and c.status = 1 and c.goods_id = #{goodsId})cc LEFT JOIN  course_section cs on cc.section_id = cs.section_id WHERE  cc.course_id = r.course_id) as record_time
         FROM
         course r
         LEFT JOIN goods_course c ON c.course_id = r.course_id