fuliqi
2024-07-04 f5379a7100a20f538092eb839b2f4c9f6d3a1b45
src/main/java/com/ycl/jxkg/service/impl/MeetServiceImpl.java
@@ -1,6 +1,7 @@
package com.ycl.jxkg.service.impl;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -170,15 +171,26 @@
        Meet vo = baseMapper.getById(id);
        Assert.notNull(vo, "记录不存在");
        if(vo.getStatus().equals(MeetStatusEnum.Starting.getCode())){
            //增加学生上课记录
            Integer userId = webContext.getCurrentUser().getId();
            //验证有没有重复进入(重复进入会导致上课次数增多)
            QueryWrapper<MeetStudent> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("meet_id",id);
            queryWrapper.eq("student_id",userId);
            queryWrapper.eq("version",vo.getUpdateVersion());
            MeetStudent one = meetStudentMapper.selectOne(queryWrapper);
            if(one != null){
                return Result.ok();
            }
            //增加学生上课记录
            MeetStudent meetStudent = new MeetStudent();
            meetStudent.setMeetId(id);
            meetStudent.setStudentId(userId);
            meetStudent.setCreateTime(new Date());
            meetStudent.setStartTime(vo.getStartTime());
            meetStudent.setVersion(vo.getUpdateVersion());
            meetStudent.setMeetName(vo.getMeetName());
            //TODO:暂时处理,后期考虑jitsiApi
            meetStudent.setDuringTime((vo.getEndTime().getTime()-new Date().getTime())/1000);
            meetStudent.setDuringTime(0L);
            meetStudentMapper.insert(meetStudent);
            //学生学习档案更新
            StudyRecord studyRecord = studyRecordMapper.getByStudentId(userId);