Ver código fonte

Merge remote-tracking branch 'origin/dev' into dev

yangdamao 1 ano atrás
pai
commit
432cc89c2f

+ 25 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserBankRecordServiceImpl.java

@@ -21,6 +21,7 @@ import com.zhongzheng.modules.exam.service.IExamPaperService;
 import com.zhongzheng.modules.goods.domain.GoodsAttached;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
+import com.zhongzheng.modules.grade.domain.ClassGrade;
 import com.zhongzheng.modules.grade.domain.UserPeriod;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
@@ -172,6 +173,18 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
         if(Validator.isEmpty(bo.getGradeId())||Validator.isEmpty(bo.getOrderGoodsId())){
             throw new CustomException("OrderGoodsId参数缺失");
         }
+        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);
+                }
+            }
+        }
         UserBankRecord add = BeanUtil.toBean(bo, UserBankRecord.class);
         validEntityBeforeSave(add);
         add.setStatus(1);
@@ -209,6 +222,18 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
         if(Validator.isEmpty(bo.getOrderGoodsId())){
             throw new CustomException("OrderGoodsId缺失");
         }
+        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);
+                }
+            }
+        }
         UserBankRecord update = BeanUtil.toBean(bo, UserBankRecord.class);
         validEntityBeforeSave(update);
         update.setStatus(1);

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

@@ -16,6 +16,7 @@ import com.zhongzheng.modules.collect.service.ICollectBankService;
 import com.zhongzheng.modules.collect.service.ICollectQuestionService;
 import com.zhongzheng.modules.exam.domain.ExamPaper;
 import com.zhongzheng.modules.exam.service.IExamPaperService;
+import com.zhongzheng.modules.grade.service.IClassGradeService;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.user.bo.CheckUserExamRecordBo;
@@ -68,6 +69,9 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
     @Autowired
     private IExamPaperService iExamPaperService;
 
+    @Autowired
+    private IClassGradeService iClassGradeService;
+
     @Override
     public UserExamRecordVo queryById(Long recordId){
         UserExamRecord db = this.baseMapper.selectById(recordId);

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

@@ -36,10 +36,12 @@ import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.bo.UserPeriodEditBo;
 import com.zhongzheng.modules.grade.bo.UserPeriodQueryBo;
+import com.zhongzheng.modules.grade.domain.ClassGrade;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.domain.UserPeriod;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper;
+import com.zhongzheng.modules.grade.service.IClassGradeService;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
@@ -130,6 +132,9 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     @Autowired
     private IPolyvLiveService iPolyvLiveService;
 
+    @Autowired
+    private IClassGradeService iClassGradeService;
+
     @Autowired
     private IInformUserService iInformUserService;
 
@@ -373,6 +378,18 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         //判断录播拍照是否达标
         if(courseSectionVo.getSectionType()==1&&Validator.isNotEmpty(bo.getStatus())&&bo.getStatus()==1){
             if(Validator.isNotEmpty(goodsVo)){
+                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)){
                     if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")||fullName.equals("考前培训七大员施工现场专业人员")||(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员"))){
                         if(Validator.isNotEmpty(courseSectionVo.getDurationTime())||Validator.isNotEmpty(bo.getVideoCurrentTime())){
@@ -1662,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());