前言
💖💖作者:计算机程序员小杨 💙💙个人简介:我是一名计算机相关专业的从业者,擅长Java、微信小程序、Python、Golang、安卓Android等多个IT方向。会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。热爱技术,喜欢钻研新工具和框架,也乐于通过代码解决实际问题,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💕💕文末获取源码联系 计算机程序员小杨 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目 计算机毕业设计选题 💜💜
一.开发工具简介
后端开发语言:Java 后端框架:Spring Boot(Spring+SpringMVC+Mybatis) 前端:微信小程序 数据库:MySQL 系统架构:C/S 开发工具:微信小程序开发工具
二.系统内容简介
课堂考勤签到小程序是一款基于微信小程序平台开发的教育管理系统,采用Java作为后端开发语言,结合Spring Boot框架构建了完整的后端服务体系。系统通过Spring+SpringMVC+MyBatis的技术架构,实现了前后端分离的C/S架构模式,后端数据存储采用MySQL数据库,确保了数据的稳定性和可靠性。该系统主要面向高等院校的日常教学管理需求,为教师和学生提供便捷的考勤管理服务。系统具备完整的用户权限管理体系,包含教师管理和学生管理两个核心用户模块,支持课程信息的全生命周期管理,能够处理学生的请假申请流程,实时记录和统计学生的考勤情况。同时系统还集成了成绩信息管理功能,可以将考勤数据与学习成绩相结合,为教师提供个性化的学习建议管理工具,帮助教师更好地了解学生的学习状态。整个系统设计简洁实用,操作便捷,能够有效提升教学管理的效率和准确性。
三.系统功能演示
四.系统界面展示
五.系统源码展示
import org.apache.spark.sql.SparkSession;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class AttendanceService {
@Autowired
private AttendanceMapper attendanceMapper;
private SparkSession spark = SparkSession.builder().appName("AttendanceAnalysis").master("local[*]").getOrCreate();
public Map<String, Object> processAttendanceRecord(AttendanceRecord record) {
Map<String, Object> result = new HashMap<>();
try {
String currentTime = DateUtil.getCurrentDateTime();
record.setSignTime(currentTime);
record.setSignStatus("已签到");
Location signLocation = LocationUtil.getCurrentLocation(record.getLongitude(), record.getLatitude());
double distance = LocationUtil.calculateDistance(signLocation, record.getCourse().getClassroomLocation());
if (distance > 500) {
record.setSignStatus("异地签到");
result.put("warning", "签到位置距离教室较远,请确认位置是否正确");
}
Dataset<Row> attendanceData = spark.read().jdbc("jdbc:mysql://localhost:3306/attendance", "attendance_records", getConnectionProperties());
Dataset<Row> studentHistory = attendanceData.filter(attendanceData.col("student_id").equalTo(record.getStudentId()));
long totalClasses = studentHistory.count();
long attendedClasses = studentHistory.filter(studentHistory.col("sign_status").equalTo("已签到")).count();
double attendanceRate = totalClasses > 0 ? (double) attendedClasses / totalClasses * 100 : 0;
record.setAttendanceRate(attendanceRate);
if (attendanceRate < 70) {
record.setSignStatus("出勤率不足");
result.put("alert", "出勤率低于70%,建议改善出勤情况");
}
attendanceMapper.insertAttendanceRecord(record);
NotificationUtil.sendNotificationToTeacher(record.getCourse().getTeacherId(), "学生" + record.getStudentName() + "已完成签到");
result.put("success", true);
result.put("attendanceRate", attendanceRate);
result.put("signTime", currentTime);
return result;
} catch (Exception e) {
result.put("success", false);
result.put("error", "签到处理失败:" + e.getMessage());
return result;
}
}
}
@Service
public class StudentService {
@Autowired
private StudentMapper studentMapper;
private SparkSession spark = SparkSession.builder().appName("StudentManagement").master("local[*]").getOrCreate();
public Map<String, Object> processStudentRegistration(Student student) {
Map<String, Object> result = new HashMap<>();
try {
if (ValidationUtil.isValidStudentId(student.getStudentId())) {
Student existingStudent = studentMapper.findByStudentId(student.getStudentId());
if (existingStudent != null) {
result.put("success", false);
result.put("message", "学号已存在,请检查后重新输入");
return result;
}
} else {
result.put("success", false);
result.put("message", "学号格式不正确,请按照规定格式输入");
return result;
}
String encryptedPassword = PasswordUtil.encryptPassword(student.getPassword());
student.setPassword(encryptedPassword);
student.setRegistrationTime(DateUtil.getCurrentDateTime());
student.setStatus("正常");
studentMapper.insertStudent(student);
Dataset<Row> studentData = spark.read().jdbc("jdbc:mysql://localhost:3306/attendance", "students", getConnectionProperties());
Dataset<Row> sameGradeStudents = studentData.filter(studentData.col("grade").equalTo(student.getGrade()));
long gradeCount = sameGradeStudents.count();
Dataset<Row> sameMajorStudents = studentData.filter(studentData.col("major").equalTo(student.getMajor()));
long majorCount = sameMajorStudents.count();
UserProfile profile = new UserProfile();
profile.setStudentId(student.getStudentId());
profile.setGradeRanking((int) gradeCount + 1);
profile.setMajorRanking((int) majorCount + 1);
profile.setCreateTime(DateUtil.getCurrentDateTime());
studentMapper.insertUserProfile(profile);
NotificationUtil.sendWelcomeMessage(student.getPhone(), student.getName());
result.put("success", true);
result.put("message", "学生注册成功");
result.put("studentId", student.getStudentId());
return result;
} catch (Exception e) {
result.put("success", false);
result.put("message", "注册失败:" + e.getMessage());
return result;
}
}
}
@Service
public class CourseService {
@Autowired
private CourseMapper courseMapper;
private SparkSession spark = SparkSession.builder().appName("CourseManagement").master("local[*]").getOrCreate();
public Map<String, Object> processCourseScheduling(Course course) {
Map<String, Object> result = new HashMap<>();
try {
List<Course> conflictCourses = courseMapper.findConflictCourses(course.getTeacherId(), course.getStartTime(), course.getEndTime(), course.getClassroom());
if (!conflictCourses.isEmpty()) {
result.put("success", false);
result.put("message", "存在时间冲突或教室冲突的课程");
result.put("conflictCourses", conflictCourses);
return result;
}
int maxCapacity = ClassroomUtil.getClassroomCapacity(course.getClassroom());
if (course.getEnrolledCount() > maxCapacity) {
result.put("success", false);
result.put("message", "选课人数超过教室容量限制");
return result;
}
course.setCourseCode(CourseUtil.generateCourseCode(course.getCourseName(), course.getSemester()));
course.setCreateTime(DateUtil.getCurrentDateTime());
course.setStatus("正常开课");
courseMapper.insertCourse(course);
Dataset<Row> courseData = spark.read().jdbc("jdbc:mysql://localhost:3306/attendance", "courses", getConnectionProperties());
Dataset<Row> teacherCourses = courseData.filter(courseData.col("teacher_id").equalTo(course.getTeacherId()));
long teacherCourseCount = teacherCourses.count();
Dataset<Row> semesterCourses = courseData.filter(courseData.col("semester").equalTo(course.getSemester()));
long semesterCourseCount = semesterCourses.count();
if (teacherCourseCount > 8) {
result.put("warning", "该教师本学期课程数量较多,建议合理安排教学任务");
}
CourseStatistics statistics = new CourseStatistics();
statistics.setCourseId(course.getCourseId());
statistics.setTotalSessions(course.getTotalSessions());
statistics.setCompletedSessions(0);
statistics.setAverageAttendanceRate(0.0);
courseMapper.insertCourseStatistics(statistics);
List<Student> enrolledStudents = studentMapper.findStudentsByCourseId(course.getCourseId());
for (Student student : enrolledStudents) {
NotificationUtil.sendCourseNotification(student.getPhone(), course.getCourseName(), course.getStartTime());
}
result.put("success", true);
result.put("message", "课程安排成功");
result.put("courseCode", course.getCourseCode());
return result;
} catch (Exception e) {
result.put("success", false);
result.put("message", "课程安排失败:" + e.getMessage());
return result;
}
}
}
六.系统文档展示
结束
💕💕文末获取源码联系 计算机程序员小杨