瀏覽代碼

fix 试听

he2802 3 年之前
父節點
當前提交
ca0f0e2aac

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserVo.java

@@ -258,4 +258,7 @@ public class GoodsUserVo {
 
 	@ApiModelProperty("前培名字")
 	private String beforeName;
+
+	@ApiModelProperty("课程数量")
+	private Long courseNum;
 }

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

@@ -1,6 +1,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.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.bo.UserStudyRecordAddBo;
@@ -38,4 +39,8 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
     List<String> examTypes(Long id);
 
     Long selectStudyRecord(UserStudyRecord bo);
+
+    Long selectPeriod(UserStudyRecord entity);
+
+    UserPeriodStatus selectPeriodCount(UserStudyRecord entity);
 }

+ 8 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -164,9 +164,16 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
             iUserPeriodStatusService.save(userPeriodStatusAddBo);
         }
         //待审有结束时间跳过下面两步
+        if (baseMapper.selectPeriod(entity) < 1){
         //有学习记录时审核记录或0作弊或3待重修更改为待审核,完整播放也添加结束时间
-        //有学习记录完整播放且为待审添加结束时间
+            UserPeriodStatus userPeriodStatus = baseMapper.selectPeriodCount(entity);
+            if (userPeriodStatus.getStatus() == 0){
+
+            }else {
 
+            }
+        //有学习记录完整播放且为待审添加结束时间
+        }
         //记录照片
         UserStudyRecordPhotoAddBo userStudyRecordPhotoAddBo = new UserStudyRecordPhotoAddBo();
         userStudyRecordPhotoAddBo.setPhoto(bo.getPhoto());

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -160,6 +160,7 @@
         <result property="beforeStatus" column="before_status"/>
         <result property="applyName" column="apply_name"/>
         <result property="beforeName" column="before_name"/>
+        <result property="courseNum" column="course_num"/>
     </resultMap>
 
 
@@ -386,6 +387,7 @@
             g.*,
             cgu.grade_id,
                cgu.user_id,
+        (SELECT COUNT(1) FROM goods_course gc where gc.goods_id = g.goods_id) as course_num,
         (case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) >0 then 1 ELSE 0 end) as apply_status,
         (case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status,
         (SELECT ea.apply_name FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) as apply_name,

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

@@ -92,6 +92,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="recordNum" column="record_num"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.user.domain.UserPeriodStatus" id="UserPeriodStatusResult">
+        <result property="status" column="status"/>
+        <result property="recordStartTime" column="record_start_time"/>
+        <result property="recordEndTime" column="record_end_time"/>
+        <result property="id" column="id"/>
+        <result property="periodId" column="period_id"/>
+        <result property="periodStatus" column="period_status"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
     <select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo"  resultMap="UserStudyRecordResult">
         SELECT DISTINCT
         temp.course_id,
@@ -491,4 +502,126 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </choose>
           AND usr.user_id = #{userId}
     </select>
+
+    <select id="selectPeriod" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultType="Long">
+    SELECT
+    COUNT( 1 )
+    FROM
+    user_period up
+    LEFT JOIN user_period_status ups on up.id = ups.period_id
+    WHERE
+    1 =1
+    <choose>
+        <when test="chapterId != null and chapterId !=''">
+            AND usr.chapter_id = #{chapterId}
+        </when>
+        <otherwise>
+            AND usr.chapter_id = 0
+        </otherwise>
+    </choose>
+    <choose>
+        <when test="sectionId != null and sectionId !=''">
+            AND usr.section_id = #{sectionId}
+        </when>
+        <otherwise>
+            AND usr.section_id = 0
+        </otherwise>
+    </choose>
+    <choose>
+        <when test="moduleId != null and moduleId !=''">
+            AND usr.module_id = #{moduleId}
+        </when>
+        <otherwise>
+            AND usr.module_id = 0
+        </otherwise>
+    </choose>
+    <choose>
+        <when test="courseId != null and courseId !=''">
+            AND usr.course_id = #{courseId}
+        </when>
+        <otherwise>
+            AND usr.course_id = 0
+        </otherwise>
+    </choose>
+    <choose>
+        <when test="gradeId != null and gradeId !=''">
+            AND usr.grade_id = #{gradeId}
+        </when>
+        <otherwise>
+            AND usr.grade_id = 0
+        </otherwise>
+    </choose>
+    <choose>
+        <when test="goodsId != null and goodsId !=''">
+            AND usr.goods_id = #{gradeId}
+        </when>
+        <otherwise>
+            AND usr.goods_id = 0
+        </otherwise>
+    </choose>
+    AND usr.user_id = #{userId}
+    AND ups.period_status = 1
+    AND ups.`status` =2
+    AND ups.record_end_time is NOT NULL
+    </select>
+
+    <select id="selectPeriodCount" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultMap="">
+        SELECT
+        ups.*
+        FROM
+        user_period up
+        LEFT JOIN user_period_status ups on up.id = ups.period_id
+        WHERE
+        1 =1
+        <choose>
+            <when test="chapterId != null and chapterId !=''">
+                AND usr.chapter_id = #{chapterId}
+            </when>
+            <otherwise>
+                AND usr.chapter_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="sectionId != null and sectionId !=''">
+                AND usr.section_id = #{sectionId}
+            </when>
+            <otherwise>
+                AND usr.section_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="moduleId != null and moduleId !=''">
+                AND usr.module_id = #{moduleId}
+            </when>
+            <otherwise>
+                AND usr.module_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="courseId != null and courseId !=''">
+                AND usr.course_id = #{courseId}
+            </when>
+            <otherwise>
+                AND usr.course_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="gradeId != null and gradeId !=''">
+                AND usr.grade_id = #{gradeId}
+            </when>
+            <otherwise>
+                AND usr.grade_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="goodsId != null and goodsId !=''">
+                AND usr.goods_id = #{gradeId}
+            </when>
+            <otherwise>
+                AND usr.goods_id = 0
+            </otherwise>
+        </choose>
+        AND usr.user_id = #{userId}
+        AND ups.period_status = 1
+    </select>
 </mapper>