From 8cc6fe38e3e415b42c31b37e18575d35f725eb97 Mon Sep 17 00:00:00 2001 From: whb <17803890193@163.com> Date: Thu, 19 Dec 2024 16:53:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=94=A8=E6=88=B7=E5=AD=A6?= =?UTF-8?q?=E4=B9=A0=E8=AE=B0=E5=BD=95=E7=AD=BE=E5=88=B0=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E5=92=8C=E7=BC=BA=E5=8B=A4=E6=AC=A1=E6=95=B0=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/tch/TchSignInfoController.java | 3 +- .../TeacherOpenCourseStudentSigninLog.java | 30 ++- ...TeacherOpenCourseStudentSigninSetting.java | 28 +-- .../trade/mapper/StuLearningRecordMapper.java | 2 + ...rOpenCourseStudentSigninSettingMapper.java | 2 - .../service/impl/StuSignInfoServiceImpl.java | 34 +++ ...herOpenCourseStudentSigninServiceImpl.java | 208 ++++++++++++++---- .../mappers/StuLearningRecordMapper.xml | 11 +- ...erOpenCourseStudentSigninSettingMapper.xml | 1 - 9 files changed, 235 insertions(+), 84 deletions(-) diff --git a/src/main/java/com/sztzjy/trade/controller/tch/TchSignInfoController.java b/src/main/java/com/sztzjy/trade/controller/tch/TchSignInfoController.java index 7d2cceb..6b94ab9 100644 --- a/src/main/java/com/sztzjy/trade/controller/tch/TchSignInfoController.java +++ b/src/main/java/com/sztzjy/trade/controller/tch/TchSignInfoController.java @@ -69,7 +69,7 @@ public class TchSignInfoController { public ResultEntity endSign(@RequestBody TchEndSignDTO tchEndSignDTO) { - + //结束签到要把未签到用户统计 return teacherOpenCourseStudentSigninService.endSign(tchEndSignDTO); } @@ -88,7 +88,6 @@ public class TchSignInfoController { @PostMapping("/manualSignSure") @ApiOperation("手动签到确认按钮") @AnonymousAccess - @Transactional public ResultEntity manualSignSure(@RequestBody @Valid TchManualSignDTO tchManualSignDTO) { diff --git a/src/main/java/com/sztzjy/trade/entity/TeacherOpenCourseStudentSigninLog.java b/src/main/java/com/sztzjy/trade/entity/TeacherOpenCourseStudentSigninLog.java index 0f2b89f..b96499e 100644 --- a/src/main/java/com/sztzjy/trade/entity/TeacherOpenCourseStudentSigninLog.java +++ b/src/main/java/com/sztzjy/trade/entity/TeacherOpenCourseStudentSigninLog.java @@ -4,8 +4,6 @@ import java.util.Date; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; /** * 教师-我的课程-开课-学生签到记录 @@ -13,47 +11,45 @@ import lombok.NoArgsConstructor; * @author whb * teacher_open_course_student_signin_log */ - -@Data @Builder public class TeacherOpenCourseStudentSigninLog { - @ApiModelProperty("ID") + @ApiModelProperty(notes = "ID") private Long teacherOpenCourseStudentSigninLogId; - @ApiModelProperty("签到配置ID") + @ApiModelProperty(notes = "签到配置ID") private Long teacherOpenCourseStudentSigninSettingId; - @ApiModelProperty("场次时间") + @ApiModelProperty(notes = "场次时间") private Date teacherOpenCourseStudentSigninSettingSessionTime; - @ApiModelProperty("学生ID") + @ApiModelProperty(notes = "学生ID") private String studentId; - @ApiModelProperty("开课ID") + @ApiModelProperty(notes = "开课ID") private Long teacherOpenCourseId; - @ApiModelProperty("班级ID") + @ApiModelProperty(notes = "班级ID") private Long schoolClassId; - @ApiModelProperty("签到日期") + @ApiModelProperty(notes = "签到日期") private Date teacherOpenCourseStudentSigninLogAddTime; - @ApiModelProperty("签到方式 (数据字典 student_signin_type)") + @ApiModelProperty(notes = "签到方式 (数据字典 student_signin_type)") private String teacherOpenCourseStudentSigninLogType; - @ApiModelProperty("备注(缺勤理由)") + @ApiModelProperty(notes = "备注(缺勤理由)") private String teacherOpenCourseStudentSigninLogRemark; - @ApiModelProperty("签到的IP") + @ApiModelProperty(notes = "签到的IP") private String teacherOpenCourseStudentSigninLogIp; - @ApiModelProperty("标记 10签到 20缺勤") + @ApiModelProperty(notes = "标记 10签到 20缺勤") private Integer teacherOpenCourseStudentSigninLogTag; - @ApiModelProperty("组织ID") + @ApiModelProperty(notes = "组织ID") private Long orgId; - @ApiModelProperty("用户ID") + @ApiModelProperty(notes = "用户ID") private Long userId; public Long getTeacherOpenCourseStudentSigninLogId() { diff --git a/src/main/java/com/sztzjy/trade/entity/TeacherOpenCourseStudentSigninSetting.java b/src/main/java/com/sztzjy/trade/entity/TeacherOpenCourseStudentSigninSetting.java index 119976d..711f8e6 100644 --- a/src/main/java/com/sztzjy/trade/entity/TeacherOpenCourseStudentSigninSetting.java +++ b/src/main/java/com/sztzjy/trade/entity/TeacherOpenCourseStudentSigninSetting.java @@ -10,46 +10,46 @@ import io.swagger.annotations.ApiModelProperty; * teacher_open_course_student_signin_setting */ public class TeacherOpenCourseStudentSigninSetting { - @ApiModelProperty("ID") + @ApiModelProperty(notes = "ID") private Long teacherOpenCourseStudentSigninSettingId; - @ApiModelProperty("场次时间") + @ApiModelProperty(notes = "场次时间") private Date teacherOpenCourseStudentSigninSettingSessionTime; - @ApiModelProperty("开课ID") + @ApiModelProperty(notes = "开课ID") private Long teacherOpenCourseId; - @ApiModelProperty("班级ID集合") + @ApiModelProperty(notes = "班级ID集合") private String schoolClassIds; - @ApiModelProperty("签到方式 (数据字典 student_signin_type)") + @ApiModelProperty(notes = "签到方式 (数据字典 student_signin_type)") 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; - @ApiModelProperty("创建时间") + @ApiModelProperty(notes = "创建时间") private Date teacherOpenCourseStudentSigninSettingAddTime; - @ApiModelProperty("状态 1正常 2删除") + @ApiModelProperty(notes = "状态 1正常 2删除") private Integer teacherOpenCourseStudentSigninSettingStatus; - @ApiModelProperty("开启状态 (枚举 StartStatusEnum)") + @ApiModelProperty(notes = "开启状态 (枚举 StartStatusEnum)") private String teacherOpenCourseStudentSigninSettingStartStatus; - @ApiModelProperty("开始时间") + @ApiModelProperty(notes = "开始时间") private Date teacherOpenCourseStudentSigninSettingStartTime; - @ApiModelProperty("结束时间") + @ApiModelProperty(notes = "结束时间") private Date teacherOpenCourseStudentSigninSettingEndTime; - @ApiModelProperty("组织ID") + @ApiModelProperty(notes = "组织ID") private Long orgId; - @ApiModelProperty("用户ID") + @ApiModelProperty(notes = "用户ID") private Long userId; - @ApiModelProperty("学生签到时间") + @ApiModelProperty(notes = "学生签到时间") private Date teacherOpenCourseStudentSigninSettingSigninTime; public Long getTeacherOpenCourseStudentSigninSettingId() { diff --git a/src/main/java/com/sztzjy/trade/mapper/StuLearningRecordMapper.java b/src/main/java/com/sztzjy/trade/mapper/StuLearningRecordMapper.java index 4a7e791..fa49df0 100644 --- a/src/main/java/com/sztzjy/trade/mapper/StuLearningRecordMapper.java +++ b/src/main/java/com/sztzjy/trade/mapper/StuLearningRecordMapper.java @@ -29,4 +29,6 @@ public interface StuLearningRecordMapper { int updateByPrimaryKeySelective(StuLearningRecord record); int updateByPrimaryKey(StuLearningRecord record); + + StuLearningRecord selectByUserId(String userId); } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/trade/mapper/TeacherOpenCourseStudentSigninSettingMapper.java b/src/main/java/com/sztzjy/trade/mapper/TeacherOpenCourseStudentSigninSettingMapper.java index 02865bd..5440355 100644 --- a/src/main/java/com/sztzjy/trade/mapper/TeacherOpenCourseStudentSigninSettingMapper.java +++ b/src/main/java/com/sztzjy/trade/mapper/TeacherOpenCourseStudentSigninSettingMapper.java @@ -18,7 +18,6 @@ public interface TeacherOpenCourseStudentSigninSettingMapper { int insertSelective(TeacherOpenCourseStudentSigninSetting record); - List selectByExample(TeacherOpenCourseStudentSigninSettingExample example); TeacherOpenCourseStudentSigninSetting selectByPrimaryKey(Long teacherOpenCourseStudentSigninSettingId); @@ -30,5 +29,4 @@ public interface TeacherOpenCourseStudentSigninSettingMapper { int updateByPrimaryKeySelective(TeacherOpenCourseStudentSigninSetting record); int updateByPrimaryKey(TeacherOpenCourseStudentSigninSetting record); - } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/trade/service/impl/StuSignInfoServiceImpl.java b/src/main/java/com/sztzjy/trade/service/impl/StuSignInfoServiceImpl.java index 3d5ff37..65e6c7e 100644 --- a/src/main/java/com/sztzjy/trade/service/impl/StuSignInfoServiceImpl.java +++ b/src/main/java/com/sztzjy/trade/service/impl/StuSignInfoServiceImpl.java @@ -6,12 +6,15 @@ package com.sztzjy.trade.service.impl;/** import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateUtil; 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.sztzjy.trade.config.Constant; import com.sztzjy.trade.entity.*; import com.sztzjy.trade.entity.dto.StuSignDTO; import com.sztzjy.trade.entity.dto.StudentSigninSettingDTO; import com.sztzjy.trade.entity.dto.TeacherOpenCourseStudentSigninSettingDTO; +import com.sztzjy.trade.mapper.StuLearningRecordMapper; import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninLogMapper; import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninSettingMapper; import com.sztzjy.trade.service.StuSignInfoService; @@ -42,6 +45,9 @@ public class StuSignInfoServiceImpl implements StuSignInfoService { @Autowired private TeacherOpenCourseStudentSigninLogMapper teacherOpenCourseStudentSigninLogMapper; + @Autowired + private StuLearningRecordMapper stuLearningRecordMapper; + /** * 课程内查询用户所有签到信息 * @@ -221,6 +227,34 @@ public class StuSignInfoServiceImpl implements StuSignInfoService { teacherOpenCourseStudentSigninLogMapper.insertSelective(studentSigninLog); + + + + //签到记录 + StuLearningRecordExample stuLearningRecordExample = new StuLearningRecordExample(); + stuLearningRecordExample.createCriteria().andUserIdEqualTo(stuSignDTO.getUserId()); + List 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)); + + + } diff --git a/src/main/java/com/sztzjy/trade/service/impl/TeacherOpenCourseStudentSigninServiceImpl.java b/src/main/java/com/sztzjy/trade/service/impl/TeacherOpenCourseStudentSigninServiceImpl.java index 400aa0e..50eaf5a 100644 --- a/src/main/java/com/sztzjy/trade/service/impl/TeacherOpenCourseStudentSigninServiceImpl.java +++ b/src/main/java/com/sztzjy/trade/service/impl/TeacherOpenCourseStudentSigninServiceImpl.java @@ -15,6 +15,7 @@ import com.sztzjy.trade.config.Constant; import com.sztzjy.trade.entity.*; import com.sztzjy.trade.entity.dto.*; import com.sztzjy.trade.enums.StartStatusEnum; +import com.sztzjy.trade.mapper.StuLearningRecordMapper; import com.sztzjy.trade.mapper.StuUserMapper; import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninLogMapper; 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.http.HttpStatus; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -46,6 +48,9 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou @Autowired private TeacherOpenCourseStudentSigninLogMapper teacherOpenCourseStudentSigninLogMapper; + @Autowired + private StuLearningRecordMapper stuLearningRecordMapper; + @Override public ResultEntity addDo(TeacherOpenCourseStudentSigninSettingDTO teacherOpenCourseStudentSigninSettingDTO) { @@ -191,6 +196,10 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou //查询是否为多次插入 TeacherOpenCourseStudentSigninSetting teacherOpenCourseStudentSigninSetting = teacherOpenCourseStudentSigninSettingMapper.selectByPrimaryKey(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingId()); + //已签到数据 + List list = new ArrayList<>(); + + List notSignList = new ArrayList<>(); if (teacherOpenCourseStudentSigninSetting != null) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请勿重复操作!"); @@ -228,15 +237,120 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou .teacherOpenCourseStudentSigninLogType(Constant.MANUAL) .teacherOpenCourseStudentSigninLogRemark(item.getTeacherOpenCourseStudentSigninLogRemark()) .userId(item.getUserId()).build(); + list.add(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 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); + }); + + } + + 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); } - return new ResultEntity<>(HttpStatus.OK, "操作成功!"); + 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, Integer size, Date signTime, Integer signInfo, - String missInfo, Long signId, String classIds - ) { + String missInfo, Long signId, String classIds) { //开启分页 PageHelper.startPage(page, size); //开始时间,结束时间,签到情况,缺勤理由 {班级ID,签到ID(默认查询)} 根据签到方式展示老师手动签到学生信息,其他学生默认全部签到 TeacherOpenCourseStudentSigninLogExample openCourseStudentSigninLogExample = new TeacherOpenCourseStudentSigninLogExample(); + openCourseStudentSigninLogExample.setOrderByClause("school_class_id desc"); TeacherOpenCourseStudentSigninLogExample.Criteria criteria = openCourseStudentSigninLogExample.createCriteria(); if (StringUtils.hasText(classIds)) { String[] split = classIds.split(","); @@ -458,7 +572,7 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou .map(Long::valueOf) // 将每个字符串转换为 Long .collect(Collectors.toList()); criteria.andSchoolClassIdIn(collect); - System.out.println(collect); + //System.out.println(collect); } if (StringUtils.hasText(studentId)) { @@ -493,56 +607,57 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou return new ResultEntity<>(HttpStatus.OK); } - //查询班级所有用户 - String[] split = classIds.split(","); - - - StuUserExample userExample = new StuUserExample(); - userExample.createCriteria().andClassIdIn(Arrays.stream(split).collect(Collectors.toList())); - List stuUserList = stuUserMapper.selectByExample(userExample); - if (stuUserList.isEmpty()) { - return new ResultEntity<>(HttpStatus.OK); - } else { +// //查询班级所有用户 +// String[] split = classIds.split(","); +// +// +// StuUserExample userExample = new StuUserExample(); +// userExample.createCriteria().andClassIdIn(Arrays.stream(split).collect(Collectors.toList())); +// //查询多个班级所有学生 +// List stuUserList = stuUserMapper.selectByExample(userExample); +// if (stuUserList.isEmpty()) { +// 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) { +// boolean found = false; // 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); +// 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); +// } // } - 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 courseStudentSigninLogPageInfo = new PageInfo<>(teacherOpenCourseStudentSigninLogList); return new ResultEntity<>(HttpStatus.OK, courseStudentSigninLogPageInfo); - } + // } } @@ -698,8 +813,7 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou StuImportExcelDTO stuImportExcelDTO = new StuImportExcelDTO(); for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) { - if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) - { + if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) { stuImportExcelDTO.setStudentId(stuUser.getStudentId()); stuImportExcelDTO.setName(stuUser.getName()); stuImportExcelDTO.setClassName(stuUser.getClassName()); diff --git a/src/main/resources/mappers/StuLearningRecordMapper.xml b/src/main/resources/mappers/StuLearningRecordMapper.xml index d15504d..ecb67ee 100644 --- a/src/main/resources/mappers/StuLearningRecordMapper.xml +++ b/src/main/resources/mappers/StuLearningRecordMapper.xml @@ -172,7 +172,8 @@ - + + update stu_learning_record @@ -256,4 +257,12 @@ user_id = #{userId,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} + + + \ No newline at end of file diff --git a/src/main/resources/mappers/TeacherOpenCourseStudentSigninSettingMapper.xml b/src/main/resources/mappers/TeacherOpenCourseStudentSigninSettingMapper.xml index 67e1753..e2fe182 100644 --- a/src/main/resources/mappers/TeacherOpenCourseStudentSigninSettingMapper.xml +++ b/src/main/resources/mappers/TeacherOpenCourseStudentSigninSettingMapper.xml @@ -144,7 +144,6 @@ school_class_ids, - teacher_open_course_student_signin_setting_type,