Browse Source

学习顺序1

he2802 3 năm trước cách đây
mục cha
commit
64358c771b

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

@@ -102,6 +102,13 @@ public class UserStudyRecordController extends BaseController {
         return toAjax(iUserStudyRecordService.updateByEditBo(bo) ? 1 : 0);
     }
 
+    @ApiOperation("判断学习顺序1")
+    @GetMapping("/checkStudyOrder1")
+    public AjaxResult<Integer> checkStudyOrder1(UserStudyRecordQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return AjaxResult.success(iUserStudyRecordService.checkStudyOrder1(bo) ? 1 : 0);
+    }
 
 
 }

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CourseBusiness.java

@@ -48,6 +48,8 @@ private static final long serialVersionUID=1L;
 
     private Integer templateStatus;
 
-    /** 1限制视频商品做卷顺序 0不限制 */
+    /** 1限制章下做卷顺序 0不限制 2限制整个目录顺序 */
     private Integer goodsLearningOrder;
+
+
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseBusinessServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.course.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo;
@@ -148,6 +149,10 @@ public class CourseBusinessServiceImpl extends ServiceImpl<CourseBusinessMapper,
     @Override
     public boolean editLearningOrder(CourseBusinessEditBo bo) {
         for (Long businessId : bo.getBusinessIds()) {
+            CourseBusinessVo oldBusiness = this.queryById(businessId);
+            if(oldBusiness.getGoodsLearningOrder()!=0){
+                throw new CustomException("无法修改学习顺序");
+            }
             CourseBusiness update =new CourseBusiness();
             update.setUpdateTime(DateUtils.getNowTime());
             update.setId(businessId);

+ 3 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseBusinessVo.java

@@ -88,8 +88,8 @@ public class CourseBusinessVo {
 	@ApiModelProperty("模板选用名称")
 	private String templateName;
 
-	/** 1限制视频商品做卷顺序 0不限制 */
-	@Excel(name = "1限制视频商品做卷顺序 0不限制")
-	@ApiModelProperty("1限制视频商品做卷顺序 0不限制")
+	/** 1限制章下做卷顺序 0不限制 2限制整个目录顺序 */
+	@Excel(name = "1限制章下做卷顺序 0不限制 2限制整个目录顺序")
+	@ApiModelProperty("1限制章下做卷顺序 0不限制 2限制整个目录顺序")
 	private Integer goodsLearningOrder;
 }

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

@@ -67,4 +67,6 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
     Long selectCountPlan(Long planId);
 
     SectionStudyRecordVo listExamRecord(SubjectStudyRecordQueryBo bo);
+
+    Long selectChapterSectionRecord(UserStudyRecordQueryBo bo);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyRecordService.java

@@ -77,4 +77,8 @@ public interface IUserStudyRecordService extends IService<UserStudyRecord> {
 	SectionStudyRecordVo listExamRecord(SubjectStudyRecordQueryBo bo);
 
 	void studyFinish(UserStudyRecord bo);
+
+	boolean checkStudyOrder1(UserStudyRecordQueryBo entity);
+
+	boolean checkStudyOrder2(UserStudyRecordQueryBo entity);
 }

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

@@ -13,8 +13,10 @@ import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.bank.domain.Exam;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.domain.CoursePhotoLog;
+import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
 import com.zhongzheng.modules.course.service.ICoursePhotoLogService;
 import com.zhongzheng.modules.course.service.ICourseSectionService;
+import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import com.zhongzheng.modules.face.service.IFaceService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
@@ -91,6 +93,8 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     private IClassGradeUserService iClassGradeUserService;
     @Autowired
     private IUserSubscribeService iUserSubscribeService;
+    @Autowired
+    private ICourseChapterSectionService iCourseChapterSectionService;
 
 
     @Autowired
@@ -270,7 +274,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
             queryBo.setChapterId(bo.getChapterId());
             queryBo.setSectionId(bo.getSectionId());
             UserStudyRecordVo lastVo = queryLast(queryBo);
-            if(Validator.isEmpty(lastVo)||lastVo.getVideoCurrentTime().longValue()>add.getVideoCurrentTime().longValue()){
+            if(Validator.isEmpty(lastVo)||Validator.isEmpty(lastVo.getVideoCurrentTime())||lastVo.getVideoCurrentTime().longValue()>add.getVideoCurrentTime().longValue()){
                 //如果没有历史数据或者之前播放时长比现在晚,则新增观看记录
                 this.save(add);
             }else{
@@ -388,6 +392,24 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         }
     }
 
+    //判断学习顺序1
+    @Override
+    public boolean checkStudyOrder1(UserStudyRecordQueryBo entity) {
+        List<CourseChapterSectionVo> list = iCourseChapterSectionService.getListById(entity.getChapterId());
+        Long studyNum = baseMapper.selectChapterSectionRecord(entity);
+        int num = studyNum.intValue();
+        if(num==list.size()){
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean checkStudyOrder2(UserStudyRecordQueryBo entity) {
+        
+        return false;
+    }
+
     @Override
     public Boolean updateByEditBo(UserStudyRecordEditBo bo) {
         UserStudyRecord update = BeanUtil.toBean(bo, UserStudyRecord.class);

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

@@ -1025,4 +1025,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
 
+    <select id="selectChapterSectionRecord" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo"  resultType="Long">
+        SELECT
+            count(DISTINCT section_id)
+        FROM
+            user_study_record
+        WHERE
+            user_id = #{userId}
+          AND grade_id = #{gradeId}
+          AND course_id = #{courseId}
+          AND module_id = #{moduleId}
+          AND chapter_id = #{chapterId}
+          AND goods_id = #{goodsId}
+          AND `status` = 1
+          AND current_status = 1
+    </select>
+
 </mapper>