he2802 1 anno fa
parent
commit
93f24924ae

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

@@ -378,14 +378,16 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         //判断录播拍照是否达标
         if(courseSectionVo.getSectionType()==1&&Validator.isNotEmpty(bo.getStatus())&&bo.getStatus()==1){
             if(Validator.isNotEmpty(goodsVo)){
-                ClassGrade grade = iClassGradeService.getOne(new LambdaQueryWrapper<ClassGrade>()
-                        .eq(ClassGrade::getGradeId, bo.getGradeId()));
-                if(Validator.isNotEmpty(grade)){
-                    if(Validator.isNotEmpty(grade.getClassEndTime())&&DateUtils.getNowTime()>grade.getClassEndTime()){
-                        throw new CustomException("班级已过期",601);
-                    }
-                    if(Validator.isNotEmpty(grade.getClassStartTime())&&DateUtils.getNowTime()<grade.getClassStartTime()){
-                        throw new CustomException("班级未开始",601);
+                if(Validator.isNotEmpty(bo.getGradeId())){
+                    ClassGrade grade = iClassGradeService.getOne(new LambdaQueryWrapper<ClassGrade>()
+                            .eq(ClassGrade::getGradeId, bo.getGradeId()));
+                    if(Validator.isNotEmpty(grade)){
+                        if(Validator.isNotEmpty(grade.getClassEndTime())&&DateUtils.getNowTime()>grade.getClassEndTime()){
+                            throw new CustomException("班级已过期",601);
+                        }
+                        if(Validator.isNotEmpty(grade.getClassStartTime())&&DateUtils.getNowTime()<grade.getClassStartTime()){
+                            throw new CustomException("班级未开始",601);
+                        }
                     }
                 }
                 if(Validator.isNotEmpty(fullName)){
@@ -1677,6 +1679,18 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         redisCache.setCacheObject(key, 100L,2, TimeUnit.SECONDS);
 
         if ( baseMapper.selectStudyRecord(bakStudyRecord) < 1) {
+            if(Validator.isNotEmpty(bo.getGradeId())){
+                ClassGrade grade = iClassGradeService.getOne(new LambdaQueryWrapper<ClassGrade>()
+                        .eq(ClassGrade::getGradeId, bo.getGradeId()));
+                if(Validator.isNotEmpty(grade)){
+                    if(Validator.isNotEmpty(grade.getClassEndTime())&&DateUtils.getNowTime()>grade.getClassEndTime()){
+                        throw new CustomException("班级已过期",601);
+                    }
+                    if(Validator.isNotEmpty(grade.getClassStartTime())&&DateUtils.getNowTime()<grade.getClassStartTime()){
+                        throw new CustomException("班级未开始",601);
+                    }
+                }
+            }
             UserPeriod userPeriod = new UserPeriod();
             userPeriod.setUserId(entity.getUserId());
             userPeriod.setCourseId(entity.getCourseId());