From 0aca48dad3f6f1897641abc7c0c54eb0ed48e4c9 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Fri, 25 Nov 2022 15:02:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=AD=A6=E7=94=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...erOpenCourseStudentSigninLogSigninDTO.java | 6 ---- ...cherOpenCourseStudentSigninLogService.java | 34 +++++++++---------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseStudentSigninLogSigninDTO.java b/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseStudentSigninLogSigninDTO.java index 2296d380..8cb1ba5a 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseStudentSigninLogSigninDTO.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseStudentSigninLogSigninDTO.java @@ -4,7 +4,6 @@ import lombok.Data; import lombok.Getter; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; /** @@ -23,11 +22,6 @@ public class TeacherOpenCourseStudentSigninLogSigninDTO { // 签到配置ID private Long teacherOpenCourseStudentSigninSettingId; - @NotEmpty(message = "学生ID不能为空") - // 学生ID,参数传递,支持老师的身份代替签到 - - private Long studentId; - @NotNull(message = "签到类型不能为空") // 签到类型 private TeacherOpenCourseStudentSigninLogTypeEnum teacherOpenCourseStudentSigninLogType; diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java index 74a071fd..2618941f 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java @@ -52,6 +52,7 @@ import java.io.*; import java.util.*; import java.util.stream.Collectors; +import static cn.jlw.util.CacheUserUtil.getStudent; import static cn.jlw.util.IpUtils.getIpAddr; import static cn.jlw.util.IpUtils.isRangeInner; import static cn.jlw.util.ValidatorUtil.getFirstErrorMessage; @@ -208,6 +209,9 @@ public class TeacherOpenCourseStudentSigninLogService extends CoreBaseService signinSettingList = teacherOpenCourseStudentSigninSettingDao.getByIds(signinDTO.getTeacherOpenCourseStudentSigninSettingId() + ""); @@ -218,13 +222,10 @@ public class TeacherOpenCourseStudentSigninLogService extends CoreBaseService studentList = studentDao.getByIds(signinDTO.getStudentId() + ""); - Assert.notEmpty(studentList, "学生ID未查询到学生信息!"); - Student student = studentList.get(0); + Student student = getStudent(); + Assert.notNull(student, "IP签到方式,只允许学生进行操作!"); + // 获取学生信息 Assert.isTrue(schoolClassIdJudgment(student.getClassId(), signinSetting), "该学生所在的班级不符合签到要求!"); // 构建实体 @@ -338,7 +337,7 @@ public class TeacherOpenCourseStudentSigninLogService extends CoreBaseService