完成用户学习记录签到次数和缺勤次数汇总功能

main
whb 3 months ago
parent 20913b3955
commit 8cc6fe38e3

@ -69,7 +69,7 @@ public class TchSignInfoController {
public ResultEntity endSign(@RequestBody public ResultEntity endSign(@RequestBody
TchEndSignDTO tchEndSignDTO) { TchEndSignDTO tchEndSignDTO) {
//结束签到要把未签到用户统计
return teacherOpenCourseStudentSigninService.endSign(tchEndSignDTO); return teacherOpenCourseStudentSigninService.endSign(tchEndSignDTO);
} }
@ -88,7 +88,6 @@ public class TchSignInfoController {
@PostMapping("/manualSignSure") @PostMapping("/manualSignSure")
@ApiOperation("手动签到确认按钮") @ApiOperation("手动签到确认按钮")
@AnonymousAccess @AnonymousAccess
@Transactional
public ResultEntity manualSignSure(@RequestBody @Valid public ResultEntity manualSignSure(@RequestBody @Valid
TchManualSignDTO tchManualSignDTO) { TchManualSignDTO tchManualSignDTO) {

@ -4,8 +4,6 @@ import java.util.Date;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Builder; import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/** /**
* --- * ---
@ -13,47 +11,45 @@ import lombok.NoArgsConstructor;
* @author whb * @author whb
* teacher_open_course_student_signin_log * teacher_open_course_student_signin_log
*/ */
@Data
@Builder @Builder
public class TeacherOpenCourseStudentSigninLog { public class TeacherOpenCourseStudentSigninLog {
@ApiModelProperty("ID") @ApiModelProperty(notes = "ID")
private Long teacherOpenCourseStudentSigninLogId; private Long teacherOpenCourseStudentSigninLogId;
@ApiModelProperty("签到配置ID") @ApiModelProperty(notes = "签到配置ID")
private Long teacherOpenCourseStudentSigninSettingId; private Long teacherOpenCourseStudentSigninSettingId;
@ApiModelProperty("场次时间") @ApiModelProperty(notes = "场次时间")
private Date teacherOpenCourseStudentSigninSettingSessionTime; private Date teacherOpenCourseStudentSigninSettingSessionTime;
@ApiModelProperty("学生ID") @ApiModelProperty(notes = "学生ID")
private String studentId; private String studentId;
@ApiModelProperty("开课ID") @ApiModelProperty(notes = "开课ID")
private Long teacherOpenCourseId; private Long teacherOpenCourseId;
@ApiModelProperty("班级ID") @ApiModelProperty(notes = "班级ID")
private Long schoolClassId; private Long schoolClassId;
@ApiModelProperty("签到日期") @ApiModelProperty(notes = "签到日期")
private Date teacherOpenCourseStudentSigninLogAddTime; private Date teacherOpenCourseStudentSigninLogAddTime;
@ApiModelProperty("签到方式 (数据字典 student_signin_type)") @ApiModelProperty(notes = "签到方式 (数据字典 student_signin_type)")
private String teacherOpenCourseStudentSigninLogType; private String teacherOpenCourseStudentSigninLogType;
@ApiModelProperty("备注(缺勤理由)") @ApiModelProperty(notes = "备注(缺勤理由)")
private String teacherOpenCourseStudentSigninLogRemark; private String teacherOpenCourseStudentSigninLogRemark;
@ApiModelProperty("签到的IP") @ApiModelProperty(notes = "签到的IP")
private String teacherOpenCourseStudentSigninLogIp; private String teacherOpenCourseStudentSigninLogIp;
@ApiModelProperty("标记 10签到 20缺勤") @ApiModelProperty(notes = "标记 10签到 20缺勤")
private Integer teacherOpenCourseStudentSigninLogTag; private Integer teacherOpenCourseStudentSigninLogTag;
@ApiModelProperty("组织ID") @ApiModelProperty(notes = "组织ID")
private Long orgId; private Long orgId;
@ApiModelProperty("用户ID") @ApiModelProperty(notes = "用户ID")
private Long userId; private Long userId;
public Long getTeacherOpenCourseStudentSigninLogId() { public Long getTeacherOpenCourseStudentSigninLogId() {

@ -10,46 +10,46 @@ import io.swagger.annotations.ApiModelProperty;
* teacher_open_course_student_signin_setting * teacher_open_course_student_signin_setting
*/ */
public class TeacherOpenCourseStudentSigninSetting { public class TeacherOpenCourseStudentSigninSetting {
@ApiModelProperty("ID") @ApiModelProperty(notes = "ID")
private Long teacherOpenCourseStudentSigninSettingId; private Long teacherOpenCourseStudentSigninSettingId;
@ApiModelProperty("场次时间") @ApiModelProperty(notes = "场次时间")
private Date teacherOpenCourseStudentSigninSettingSessionTime; private Date teacherOpenCourseStudentSigninSettingSessionTime;
@ApiModelProperty("开课ID") @ApiModelProperty(notes = "开课ID")
private Long teacherOpenCourseId; private Long teacherOpenCourseId;
@ApiModelProperty("班级ID集合") @ApiModelProperty(notes = "班级ID集合")
private String schoolClassIds; private String schoolClassIds;
@ApiModelProperty("签到方式 (数据字典 student_signin_type)") @ApiModelProperty(notes = "签到方式 (数据字典 student_signin_type)")
private String teacherOpenCourseStudentSigninSettingType; private String teacherOpenCourseStudentSigninSettingType;
@ApiModelProperty("设置的值数据例子IP: x.x.x.x-x.x.x.x验证码xxxx手动签到无需设置") @ApiModelProperty(notes = "设置的值数据例子IP: x.x.x.x-x.x.x.x验证码xxxx手动签到无需设置")
private String teacherOpenCourseStudentSigninSettingValue; private String teacherOpenCourseStudentSigninSettingValue;
@ApiModelProperty("创建时间") @ApiModelProperty(notes = "创建时间")
private Date teacherOpenCourseStudentSigninSettingAddTime; private Date teacherOpenCourseStudentSigninSettingAddTime;
@ApiModelProperty("状态 1正常 2删除") @ApiModelProperty(notes = "状态 1正常 2删除")
private Integer teacherOpenCourseStudentSigninSettingStatus; private Integer teacherOpenCourseStudentSigninSettingStatus;
@ApiModelProperty("开启状态 (枚举 StartStatusEnum") @ApiModelProperty(notes = "开启状态 (枚举 StartStatusEnum")
private String teacherOpenCourseStudentSigninSettingStartStatus; private String teacherOpenCourseStudentSigninSettingStartStatus;
@ApiModelProperty("开始时间") @ApiModelProperty(notes = "开始时间")
private Date teacherOpenCourseStudentSigninSettingStartTime; private Date teacherOpenCourseStudentSigninSettingStartTime;
@ApiModelProperty("结束时间") @ApiModelProperty(notes = "结束时间")
private Date teacherOpenCourseStudentSigninSettingEndTime; private Date teacherOpenCourseStudentSigninSettingEndTime;
@ApiModelProperty("组织ID") @ApiModelProperty(notes = "组织ID")
private Long orgId; private Long orgId;
@ApiModelProperty("用户ID") @ApiModelProperty(notes = "用户ID")
private Long userId; private Long userId;
@ApiModelProperty("学生签到时间") @ApiModelProperty(notes = "学生签到时间")
private Date teacherOpenCourseStudentSigninSettingSigninTime; private Date teacherOpenCourseStudentSigninSettingSigninTime;
public Long getTeacherOpenCourseStudentSigninSettingId() { public Long getTeacherOpenCourseStudentSigninSettingId() {

@ -29,4 +29,6 @@ public interface StuLearningRecordMapper {
int updateByPrimaryKeySelective(StuLearningRecord record); int updateByPrimaryKeySelective(StuLearningRecord record);
int updateByPrimaryKey(StuLearningRecord record); int updateByPrimaryKey(StuLearningRecord record);
StuLearningRecord selectByUserId(String userId);
} }

@ -18,7 +18,6 @@ public interface TeacherOpenCourseStudentSigninSettingMapper {
int insertSelective(TeacherOpenCourseStudentSigninSetting record); int insertSelective(TeacherOpenCourseStudentSigninSetting record);
List<TeacherOpenCourseStudentSigninSetting> selectByExample(TeacherOpenCourseStudentSigninSettingExample example); List<TeacherOpenCourseStudentSigninSetting> selectByExample(TeacherOpenCourseStudentSigninSettingExample example);
TeacherOpenCourseStudentSigninSetting selectByPrimaryKey(Long teacherOpenCourseStudentSigninSettingId); TeacherOpenCourseStudentSigninSetting selectByPrimaryKey(Long teacherOpenCourseStudentSigninSettingId);
@ -30,5 +29,4 @@ public interface TeacherOpenCourseStudentSigninSettingMapper {
int updateByPrimaryKeySelective(TeacherOpenCourseStudentSigninSetting record); int updateByPrimaryKeySelective(TeacherOpenCourseStudentSigninSetting record);
int updateByPrimaryKey(TeacherOpenCourseStudentSigninSetting record); int updateByPrimaryKey(TeacherOpenCourseStudentSigninSetting record);
} }

@ -6,12 +6,15 @@ package com.sztzjy.trade.service.impl;/**
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.sztzjy.trade.config.Constant; import com.sztzjy.trade.config.Constant;
import com.sztzjy.trade.entity.*; import com.sztzjy.trade.entity.*;
import com.sztzjy.trade.entity.dto.StuSignDTO; import com.sztzjy.trade.entity.dto.StuSignDTO;
import com.sztzjy.trade.entity.dto.StudentSigninSettingDTO; import com.sztzjy.trade.entity.dto.StudentSigninSettingDTO;
import com.sztzjy.trade.entity.dto.TeacherOpenCourseStudentSigninSettingDTO; import com.sztzjy.trade.entity.dto.TeacherOpenCourseStudentSigninSettingDTO;
import com.sztzjy.trade.mapper.StuLearningRecordMapper;
import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninLogMapper; import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninLogMapper;
import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninSettingMapper; import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninSettingMapper;
import com.sztzjy.trade.service.StuSignInfoService; import com.sztzjy.trade.service.StuSignInfoService;
@ -42,6 +45,9 @@ public class StuSignInfoServiceImpl implements StuSignInfoService {
@Autowired @Autowired
private TeacherOpenCourseStudentSigninLogMapper teacherOpenCourseStudentSigninLogMapper; private TeacherOpenCourseStudentSigninLogMapper teacherOpenCourseStudentSigninLogMapper;
@Autowired
private StuLearningRecordMapper stuLearningRecordMapper;
/** /**
* *
* *
@ -221,6 +227,34 @@ public class StuSignInfoServiceImpl implements StuSignInfoService {
teacherOpenCourseStudentSigninLogMapper.insertSelective(studentSigninLog); teacherOpenCourseStudentSigninLogMapper.insertSelective(studentSigninLog);
//签到记录
StuLearningRecordExample stuLearningRecordExample = new StuLearningRecordExample();
stuLearningRecordExample.createCriteria().andUserIdEqualTo(stuSignDTO.getUserId());
List<StuLearningRecord> stuLearningRecordList = stuLearningRecordMapper.selectByExample(stuLearningRecordExample);
if (stuLearningRecordList.isEmpty()) {
//默认赋值
StuLearningRecord stuLearningRecord=new StuLearningRecord(stuSignDTO.getUserId());
int i = UUID.randomUUID().hashCode();
if (i<0)
{
i = -i;
}
stuLearningRecord.setId(i);
stuLearningRecordMapper.insertSelective(stuLearningRecord);
stuLearningRecordList.add(stuLearningRecord);
}
stuLearningRecordList.get(0).setCheckInFrequency(stuLearningRecordList.get(0).getCheckInFrequency() + 1);
stuLearningRecordMapper.updateByPrimaryKeySelective(stuLearningRecordList.get(0));
} }

@ -15,6 +15,7 @@ import com.sztzjy.trade.config.Constant;
import com.sztzjy.trade.entity.*; import com.sztzjy.trade.entity.*;
import com.sztzjy.trade.entity.dto.*; import com.sztzjy.trade.entity.dto.*;
import com.sztzjy.trade.enums.StartStatusEnum; import com.sztzjy.trade.enums.StartStatusEnum;
import com.sztzjy.trade.mapper.StuLearningRecordMapper;
import com.sztzjy.trade.mapper.StuUserMapper; import com.sztzjy.trade.mapper.StuUserMapper;
import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninLogMapper; import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninLogMapper;
import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninSettingMapper; import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninSettingMapper;
@ -26,6 +27,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -46,6 +48,9 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
@Autowired @Autowired
private TeacherOpenCourseStudentSigninLogMapper teacherOpenCourseStudentSigninLogMapper; private TeacherOpenCourseStudentSigninLogMapper teacherOpenCourseStudentSigninLogMapper;
@Autowired
private StuLearningRecordMapper stuLearningRecordMapper;
@Override @Override
public ResultEntity addDo(TeacherOpenCourseStudentSigninSettingDTO teacherOpenCourseStudentSigninSettingDTO) { public ResultEntity addDo(TeacherOpenCourseStudentSigninSettingDTO teacherOpenCourseStudentSigninSettingDTO) {
@ -191,6 +196,10 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
//查询是否为多次插入 //查询是否为多次插入
TeacherOpenCourseStudentSigninSetting teacherOpenCourseStudentSigninSetting = TeacherOpenCourseStudentSigninSetting teacherOpenCourseStudentSigninSetting =
teacherOpenCourseStudentSigninSettingMapper.selectByPrimaryKey(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingId()); teacherOpenCourseStudentSigninSettingMapper.selectByPrimaryKey(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingId());
//已签到数据
List<TeacherOpenCourseStudentSigninLog> list = new ArrayList<>();
List<TeacherOpenCourseStudentSigninLog> notSignList = new ArrayList<>();
if (teacherOpenCourseStudentSigninSetting != null) { if (teacherOpenCourseStudentSigninSetting != null) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请勿重复操作!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请勿重复操作!");
@ -228,8 +237,58 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
.teacherOpenCourseStudentSigninLogType(Constant.MANUAL) .teacherOpenCourseStudentSigninLogType(Constant.MANUAL)
.teacherOpenCourseStudentSigninLogRemark(item.getTeacherOpenCourseStudentSigninLogRemark()) .teacherOpenCourseStudentSigninLogRemark(item.getTeacherOpenCourseStudentSigninLogRemark())
.userId(item.getUserId()).build(); .userId(item.getUserId()).build();
list.add(studentSigninLog);
teacherOpenCourseStudentSigninLogMapper.insertSelective(studentSigninLog); teacherOpenCourseStudentSigninLogMapper.insertSelective(studentSigninLog);
//写入学习记录中
updateLearningRecord(studentSigninLog);
});
//TODO 未被抽中用户数据 进行全部签到操作
//查询班级所有用户
String[] split = tchManualSignDTO.getClassIds().split(",");
StuUserExample userExample = new StuUserExample();
userExample.createCriteria().andClassIdIn(Arrays.stream(split).collect(Collectors.toList()));
//查询多个班级所有学生
List<StuUser> stuUserList = stuUserMapper.selectByExample(userExample);
if (stuUserList.isEmpty()) {
return new ResultEntity<>(HttpStatus.OK);
} else {
for (StuUser stuUser : stuUserList) {
boolean found = false;
for (TeacherOpenCourseStudentSigninLog studentSigninLog : list) {
if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) {
found = true;
break; // 找到匹配项,跳出内层循环
}
}
if (!found) {
// 如果没有找到匹配项,加入新数据到 teacherOpenCourseStudentSigninLogList
TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = TeacherOpenCourseStudentSigninLog.builder()
.studentId(stuUser.getStudentId())
.teacherOpenCourseStudentSigninLogAddTime(list.get(0).getTeacherOpenCourseStudentSigninLogAddTime())
.teacherOpenCourseStudentSigninLogTag(10)
.userId(Convert.toLong(stuUser.getUserId()))
.teacherOpenCourseStudentSigninSettingId(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingId())
.teacherOpenCourseStudentSigninSettingSessionTime(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingSessionTime())
.teacherOpenCourseId(tchManualSignDTO.getTeacherOpenCourseId())
.schoolClassId(Long.parseLong(stuUser.getClassId())).build();
notSignList.add(teacherOpenCourseStudentSigninLog);
}
}
//遍历数据写入数据库
notSignList.forEach(item -> {
//写入学习记录中
updateLearningRecord(item);
//写入签到记录中
insertSignLog(item);
}); });
@ -238,6 +297,61 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
return new ResultEntity<>(HttpStatus.OK, "操作成功!"); return new ResultEntity<>(HttpStatus.OK, "操作成功!");
} }
}
//学习记录
public void updateLearningRecord(TeacherOpenCourseStudentSigninLog item) {
StuLearningRecord stuLearningRecord = stuLearningRecordMapper.selectByUserId(item.getUserId().toString());
if (stuLearningRecord == null) {
StuLearningRecord record = new StuLearningRecord(item.getUserId().toString());
int i = UUID.randomUUID().hashCode();
if (i <0)
{
i = -i;
}
record.setId(i);
record.setUserId(item.getUserId().toString());
record.setNumberOfAbsences(0);
record.setLearningDuration(0);
record.setCheckInFrequency(0);
record.setTrainingProgress(0.0);
record.setNumberOfInteractions(0);
stuLearningRecordMapper.insertSelective(record);
stuLearningRecord = record;
}
//随机抽取的用户数据同时记录签到和缺勤次数
if (item.getTeacherOpenCourseStudentSigninLogTag() == 10) {
//写入的是已签到和未签到抽取的用户
stuLearningRecord.setCheckInFrequency(stuLearningRecord.getCheckInFrequency() + 1);
} else if (item.getTeacherOpenCourseStudentSigninLogTag() == 20) {
stuLearningRecord.setNumberOfAbsences(stuLearningRecord.getNumberOfAbsences() + 1);
}
stuLearningRecordMapper.updateByPrimaryKeySelective(stuLearningRecord);
}
public void insertSignLog(TeacherOpenCourseStudentSigninLog item){
//判断是否缺勤或者签到
TeacherOpenCourseStudentSigninLog studentSigninLog = TeacherOpenCourseStudentSigninLog.builder()
.teacherOpenCourseStudentSigninSettingId(item.getTeacherOpenCourseStudentSigninSettingId())
.teacherOpenCourseStudentSigninSettingSessionTime(item.getTeacherOpenCourseStudentSigninSettingSessionTime())
.studentId(item.getStudentId())
.teacherOpenCourseStudentSigninLogTag(item.getTeacherOpenCourseStudentSigninLogTag())
.teacherOpenCourseId(item.getTeacherOpenCourseId())
.schoolClassId(item.getSchoolClassId())
.teacherOpenCourseStudentSigninLogAddTime(item.getTeacherOpenCourseStudentSigninLogAddTime())
.teacherOpenCourseStudentSigninLogType(Constant.MANUAL)
.teacherOpenCourseStudentSigninLogRemark(item.getTeacherOpenCourseStudentSigninLogRemark())
.userId(item.getUserId()).build();
teacherOpenCourseStudentSigninLogMapper.insertSelective(studentSigninLog);
}
// 课程内查询签到信息 // 课程内查询签到信息
@ -442,14 +556,14 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
String classId, Integer page, String classId, Integer page,
Integer size, Date signTime, Integer size, Date signTime,
Integer signInfo, Integer signInfo,
String missInfo, Long signId, String classIds String missInfo, Long signId, String classIds) {
) {
//开启分页 //开启分页
PageHelper.startPage(page, size); PageHelper.startPage(page, size);
//开始时间,结束时间,签到情况,缺勤理由 {班级ID签到ID默认查询} 根据签到方式展示老师手动签到学生信息,其他学生默认全部签到 //开始时间,结束时间,签到情况,缺勤理由 {班级ID签到ID默认查询} 根据签到方式展示老师手动签到学生信息,其他学生默认全部签到
TeacherOpenCourseStudentSigninLogExample openCourseStudentSigninLogExample = new TeacherOpenCourseStudentSigninLogExample(); TeacherOpenCourseStudentSigninLogExample openCourseStudentSigninLogExample = new TeacherOpenCourseStudentSigninLogExample();
openCourseStudentSigninLogExample.setOrderByClause("school_class_id desc");
TeacherOpenCourseStudentSigninLogExample.Criteria criteria = openCourseStudentSigninLogExample.createCriteria(); TeacherOpenCourseStudentSigninLogExample.Criteria criteria = openCourseStudentSigninLogExample.createCriteria();
if (StringUtils.hasText(classIds)) { if (StringUtils.hasText(classIds)) {
String[] split = classIds.split(","); String[] split = classIds.split(",");
@ -458,7 +572,7 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
.map(Long::valueOf) // 将每个字符串转换为 Long .map(Long::valueOf) // 将每个字符串转换为 Long
.collect(Collectors.toList()); .collect(Collectors.toList());
criteria.andSchoolClassIdIn(collect); criteria.andSchoolClassIdIn(collect);
System.out.println(collect); //System.out.println(collect);
} }
if (StringUtils.hasText(studentId)) { if (StringUtils.hasText(studentId)) {
@ -493,22 +607,45 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
return new ResultEntity<>(HttpStatus.OK); return new ResultEntity<>(HttpStatus.OK);
} }
//查询班级所有用户 // //查询班级所有用户
String[] split = classIds.split(","); // String[] split = classIds.split(",");
//
//
StuUserExample userExample = new StuUserExample(); // StuUserExample userExample = new StuUserExample();
userExample.createCriteria().andClassIdIn(Arrays.stream(split).collect(Collectors.toList())); // userExample.createCriteria().andClassIdIn(Arrays.stream(split).collect(Collectors.toList()));
List<StuUser> stuUserList = stuUserMapper.selectByExample(userExample); // //查询多个班级所有学生
if (stuUserList.isEmpty()) { // List<StuUser> stuUserList = stuUserMapper.selectByExample(userExample);
return new ResultEntity<>(HttpStatus.OK); // if (stuUserList.isEmpty()) {
} else { // return new ResultEntity<>(HttpStatus.OK);
// } else {
//// for (StuUser stuUser : stuUserList) {
//// for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) {
//// if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) {
//// continue;
//// } else {
//// //加入往里面加数据teacherOpenCourseStudentSigninLogList
//// TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = TeacherOpenCourseStudentSigninLog.builder()
//// .studentId(stuUser.getStudentId())
//// .teacherOpenCourseStudentSigninLogAddTime(teacherOpenCourseStudentSigninLogList.get(0).getTeacherOpenCourseStudentSigninLogAddTime())
//// .teacherOpenCourseStudentSigninLogTag(10)
//// .schoolClassId(Long.parseLong(stuUser.getClassId())).build();
//// teacherOpenCourseStudentSigninLogList.add(teacherOpenCourseStudentSigninLog);
//// }
////
//// }
////
////
//// }
// for (StuUser stuUser : stuUserList) { // for (StuUser stuUser : stuUserList) {
// boolean found = false;
// for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) { // for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) {
// if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) { // if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) {
// continue; // found = true;
// } else { // break; // 找到匹配项,跳出内层循环
// //加入往里面加数据teacherOpenCourseStudentSigninLogList // }
// }
// if (!found) {
// // 如果没有找到匹配项,加入新数据到 teacherOpenCourseStudentSigninLogList
// TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = TeacherOpenCourseStudentSigninLog.builder() // TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = TeacherOpenCourseStudentSigninLog.builder()
// .studentId(stuUser.getStudentId()) // .studentId(stuUser.getStudentId())
// .teacherOpenCourseStudentSigninLogAddTime(teacherOpenCourseStudentSigninLogList.get(0).getTeacherOpenCourseStudentSigninLogAddTime()) // .teacherOpenCourseStudentSigninLogAddTime(teacherOpenCourseStudentSigninLogList.get(0).getTeacherOpenCourseStudentSigninLogAddTime())
@ -516,33 +653,11 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
// .schoolClassId(Long.parseLong(stuUser.getClassId())).build(); // .schoolClassId(Long.parseLong(stuUser.getClassId())).build();
// teacherOpenCourseStudentSigninLogList.add(teacherOpenCourseStudentSigninLog); // teacherOpenCourseStudentSigninLogList.add(teacherOpenCourseStudentSigninLog);
// } // }
//
// }
//
//
// } // }
for (StuUser stuUser : stuUserList) {
boolean found = false;
for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) {
if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) {
found = true;
break; // 找到匹配项,跳出内层循环
}
}
if (!found) {
// 如果没有找到匹配项,加入新数据到 teacherOpenCourseStudentSigninLogList
TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = TeacherOpenCourseStudentSigninLog.builder()
.studentId(stuUser.getStudentId())
.teacherOpenCourseStudentSigninLogAddTime(teacherOpenCourseStudentSigninLogList.get(0).getTeacherOpenCourseStudentSigninLogAddTime())
.teacherOpenCourseStudentSigninLogTag(10)
.schoolClassId(Long.parseLong(stuUser.getClassId())).build();
teacherOpenCourseStudentSigninLogList.add(teacherOpenCourseStudentSigninLog);
}
}
PageInfo<TeacherOpenCourseStudentSigninLog> courseStudentSigninLogPageInfo = new PageInfo<>(teacherOpenCourseStudentSigninLogList); PageInfo<TeacherOpenCourseStudentSigninLog> courseStudentSigninLogPageInfo = new PageInfo<>(teacherOpenCourseStudentSigninLogList);
return new ResultEntity<>(HttpStatus.OK, courseStudentSigninLogPageInfo); return new ResultEntity<>(HttpStatus.OK, courseStudentSigninLogPageInfo);
} // }
} }
@ -698,8 +813,7 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
StuImportExcelDTO stuImportExcelDTO = new StuImportExcelDTO(); StuImportExcelDTO stuImportExcelDTO = new StuImportExcelDTO();
for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) { for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) {
if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) {
{
stuImportExcelDTO.setStudentId(stuUser.getStudentId()); stuImportExcelDTO.setStudentId(stuUser.getStudentId());
stuImportExcelDTO.setName(stuUser.getName()); stuImportExcelDTO.setName(stuUser.getName());
stuImportExcelDTO.setClassName(stuUser.getClassName()); stuImportExcelDTO.setClassName(stuUser.getClassName());

@ -172,6 +172,7 @@
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update stu_learning_record update stu_learning_record
<set> <set>
@ -256,4 +257,12 @@
user_id = #{userId,jdbcType=VARCHAR} user_id = #{userId,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectByUserId" resultMap="BaseResultMap">
select id, training_score_rank, training_progress, learning_duration, check_in_frequency,
number_of_absences, number_of_interactions, user_id from stu_learning_record
where user_id = #{userId,jdbcType=VARCHAR}
</select>
</mapper> </mapper>

@ -144,7 +144,6 @@
<if test="schoolClassIds != null"> <if test="schoolClassIds != null">
school_class_ids, school_class_ids,
</if> </if>
<if test="teacherOpenCourseStudentSigninSettingType != null"> <if test="teacherOpenCourseStudentSigninSettingType != null">
teacher_open_course_student_signin_setting_type, teacher_open_course_student_signin_setting_type,
</if> </if>

Loading…
Cancel
Save