fuliqi
2024-07-04 f5379a7100a20f538092eb839b2f4c9f6d3a1b45
上课记录Bug修复
2个文件已修改
32 ■■■■■ 已修改文件
src/main/java/com/ycl/jxkg/domain/entity/MeetStudent.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/MeetServiceImpl.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/domain/entity/MeetStudent.java
@@ -1,16 +1,30 @@
package com.ycl.jxkg.domain.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName("t_meet_student")
public class MeetStudent {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @TableField("meet_id")
    private Integer meetId;
    @TableField("meet_name")
    private String meetName;
    @TableField("student_id")
    private Integer studentId;
    @TableField("start_time")
    private Date startTime;
    @TableField("create_time")
    private Date createTime;
    @TableField("during_time")
    private Long duringTime;
    @TableField
    private Integer version;
}
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);