高校班务管理系统设计与实现:基于Java+uni-app的毕业设计指导

35 阅读7分钟

💖💖作者:计算机编程小咖 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目

@TOC

基于微信小程序的高校班务管理系统介绍

基于微信小程序的高校班务管理系统是一套专门为高校班级日常管理工作设计开发的综合性管理平台,采用当前主流的前后端分离架构,后端基于SpringBoot框架构建,整合Spring、SpringMVC和MyBatis组件形成完整的Java企业级开发解决方案,前端采用uni-app跨平台开发框架结合微信小程序原生开发工具,实现了小程序端和安卓端的双端覆盖,数据存储采用MySQL关系型数据库确保数据的稳定性和一致性。系统功能涵盖班级管理的各个环节,包括教师和学生的基础信息管理、专业年级班级的层级化组织架构、课程信息的统一维护、考勤签到的数字化管理、作业布置提交及成绩评定的全流程跟踪、考试成绩的录入查询、课表时间的智能排布、学生请假申请的在线审批、班务通知的即时推送以及公告信息的分类发布等核心功能模块。系统采用C/S和B/S混合架构模式,既保证了数据处理的高效性,又提供了便捷的Web端管理界面,教师可以通过系统高效完成班级各项管理工作,学生能够便捷地进行考勤打卡、作业提交、成绩查询等操作,真正实现了高校班务管理的数字化转型,提高了管理效率,优化了师生体验。

基于微信小程序的高校班务管理系统演示视频

演示视频

基于微信小程序的高校班务管理系统演示图片

班级信息管理.png

发起考勤.png

教师信息.png

考勤签到.png

考试成绩.png

课程信息.png

年级信息管理.png

提交作业.png

学生管理.png

专业信息管理.png

作业成绩.png

作业信息.png

基于微信小程序的高校班务管理系统代码展示

from datetime import datetime, date
import json
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from django.views import View
from .models import Student, Teacher, Attendance, Assignment, Notice, Class
spark = SparkSession.builder.appName("ClassManagementSystem").config("spark.sql.adaptive.enabled", "true").getOrCreate()
@method_decorator(csrf_exempt, name='dispatch')
class AttendanceSignInView(View):
    def post(self, request):
        data = json.loads(request.body)
        student_id = data.get('student_id')
        class_id = data.get('class_id')
        latitude = data.get('latitude')
        longitude = data.get('longitude')
        sign_time = datetime.now()
        try:
            student = Student.objects.get(id=student_id)
            class_info = Class.objects.get(id=class_id)
            if not student.classes.filter(id=class_id).exists():
                return JsonResponse({'code': 400, 'message': '学生不属于该班级'})
            existing_attendance = Attendance.objects.filter(student=student, class_info=class_info, date=sign_time.date()).first()
            if existing_attendance:
                return JsonResponse({'code': 400, 'message': '今日已签到,请勿重复签到'})
            distance = self.calculate_distance(latitude, longitude, class_info.classroom_lat, class_info.classroom_lng)
            if distance > 100:
                status = 'late'
                return JsonResponse({'code': 400, 'message': '签到位置超出范围,请确认您在教室内'})
            current_time = sign_time.time()
            class_start_time = class_info.start_time
            if current_time <= class_start_time:
                status = 'present'
            elif current_time <= class_start_time.replace(minute=class_start_time.minute + 10):
                status = 'late'
            else:
                status = 'absent'
            attendance = Attendance.objects.create(student=student, class_info=class_info, date=sign_time.date(), time=current_time, status=status, latitude=latitude, longitude=longitude)
            attendance_data = spark.createDataFrame([(student_id, class_id, str(sign_time.date()), str(current_time), status, latitude, longitude)], ["student_id", "class_id", "date", "time", "status", "latitude", "longitude"])
            attendance_data.write.mode("append").option("driver", "com.mysql.cj.jdbc.Driver").option("url", "jdbc:mysql://localhost:3306/class_management").option("dbtable", "attendance_records").option("user", "root").option("password", "password").save()
            class_attendance_stats = Attendance.objects.filter(class_info=class_info, date=sign_time.date())
            total_students = student.classes.filter(id=class_id).count()
            present_count = class_attendance_stats.filter(status='present').count()
            late_count = class_attendance_stats.filter(status='late').count()
            absent_count = total_students - present_count - late_count
            attendance_rate = round((present_count + late_count) / total_students * 100, 2) if total_students > 0 else 0
            return JsonResponse({'code': 200, 'message': '签到成功', 'data': {'status': status, 'sign_time': sign_time.strftime('%Y-%m-%d %H:%M:%S'), 'attendance_rate': attendance_rate, 'present_count': present_count, 'late_count': late_count, 'absent_count': absent_count}})
        except Exception as e:
            return JsonResponse({'code': 500, 'message': f'签到失败:{str(e)}'})
    def calculate_distance(self, lat1, lng1, lat2, lng2):
        import math
        lat1_rad = math.radians(lat1)
        lng1_rad = math.radians(lng1)
        lat2_rad = math.radians(lat2)
        lng2_rad = math.radians(lng2)
        dlat = lat2_rad - lat1_rad
        dlng = lng2_rad - lng1_rad
        a = math.sin(dlat/2)**2 + math.cos(lat1_rad) * math.cos(lat2_rad) * math.sin(dlng/2)**2
        c = 2 * math.asin(math.sqrt(a))
        distance = 6371000 * c
        return distance
@method_decorator(csrf_exempt, name='dispatch')
class AssignmentGradeView(View):
    def post(self, request):
        data = json.loads(request.body)
        assignment_id = data.get('assignment_id')
        student_grades = data.get('student_grades')
        teacher_id = data.get('teacher_id')
        grade_time = datetime.now()
        try:
            teacher = Teacher.objects.get(id=teacher_id)
            assignment = Assignment.objects.get(id=assignment_id)
            if assignment.teacher != teacher:
                return JsonResponse({'code': 403, 'message': '无权限批改此作业'})
            graded_count = 0
            total_score = 0
            grade_distribution = {'excellent': 0, 'good': 0, 'medium': 0, 'poor': 0}
            grade_records = []
            for grade_info in student_grades:
                student_id = grade_info.get('student_id')
                score = grade_info.get('score')
                comment = grade_info.get('comment', '')
                student = Student.objects.get(id=student_id)
                submission = assignment.submissions.filter(student=student).first()
                if not submission:
                    continue
                submission.score = score
                submission.comment = comment
                submission.grade_time = grade_time
                submission.is_graded = True
                submission.save()
                total_score += score
                graded_count += 1
                if score >= 90:
                    grade_distribution['excellent'] += 1
                elif score >= 80:
                    grade_distribution['good'] += 1
                elif score >= 70:
                    grade_distribution['medium'] += 1
                else:
                    grade_distribution['poor'] += 1
                grade_records.append((assignment_id, student_id, score, comment, str(grade_time), teacher_id))
            if graded_count > 0:
                average_score = round(total_score / graded_count, 2)
                grade_df = spark.createDataFrame(grade_records, ["assignment_id", "student_id", "score", "comment", "grade_time", "teacher_id"])
                grade_df.write.mode("append").option("driver", "com.mysql.cj.jdbc.Driver").option("url", "jdbc:mysql://localhost:3306/class_management").option("dbtable", "assignment_grades").option("user", "root").option("password", "password").save()
                assignment.average_score = average_score
                assignment.graded_count = graded_count
                assignment.save()
                high_score_students = [record for record in grade_records if record[2] >= 90]
                low_score_students = [record for record in grade_records if record[2] < 60]
                return JsonResponse({'code': 200, 'message': '批改完成', 'data': {'graded_count': graded_count, 'average_score': average_score, 'grade_distribution': grade_distribution, 'high_score_count': len(high_score_students), 'low_score_count': len(low_score_students)}})
            else:
                return JsonResponse({'code': 400, 'message': '没有找到需要批改的作业'})
        except Exception as e:
            return JsonResponse({'code': 500, 'message': f'批改失败:{str(e)}'})
@method_decorator(csrf_exempt, name='dispatch')
class NoticePublishView(View):
    def post(self, request):
        data = json.loads(request.body)
        title = data.get('title')
        content = data.get('content')
        class_ids = data.get('class_ids')
        teacher_id = data.get('teacher_id')
        notice_type = data.get('notice_type', 'general')
        is_urgent = data.get('is_urgent', False)
        publish_time = datetime.now()
        try:
            teacher = Teacher.objects.get(id=teacher_id)
            if not title or not content or not class_ids:
                return JsonResponse({'code': 400, 'message': '标题、内容和目标班级不能为空'})
            if len(title) > 100:
                return JsonResponse({'code': 400, 'message': '标题长度不能超过100字符'})
            if len(content) > 2000:
                return JsonResponse({'code': 400, 'message': '内容长度不能超过2000字符'})
            notice = Notice.objects.create(title=title, content=content, teacher=teacher, notice_type=notice_type, is_urgent=is_urgent, publish_time=publish_time, status='published')
            target_students = []
            total_classes = 0
            for class_id in class_ids:
                try:
                    class_info = Class.objects.get(id=class_id)
                    notice.target_classes.add(class_info)
                    class_students = Student.objects.filter(classes=class_info)
                    target_students.extend(class_students)
                    total_classes += 1
                except Class.DoesNotExist:
                    continue
            unique_students = list(set(target_students))
            notice_data = []
            read_records = []
            for student in unique_students:
                notice_data.append((notice.id, student.id, str(publish_time), notice_type, is_urgent, 'unread'))
                read_records.append({'student_id': student.id, 'notice_id': notice.id, 'is_read': False, 'read_time': None})
            if notice_data:
                notice_df = spark.createDataFrame(notice_data, ["notice_id", "student_id", "publish_time", "notice_type", "is_urgent", "status"])
                notice_df.write.mode("append").option("driver", "com.mysql.cj.jdbc.Driver").option("url", "jdbc:mysql://localhost:3306/class_management").option("dbtable", "notice_records").option("user", "root").option("password", "password").save()
            priority_level = 'high' if is_urgent else 'normal'
            push_success_count = 0
            for student in unique_students:
                try:
                    push_result = self.send_wechat_notification(student.openid, title, content[:50] + '...', notice.id, priority_level)
                    if push_result:
                        push_success_count += 1
                except:
                    continue
            notice.target_student_count = len(unique_students)
            notice.push_success_count = push_success_count
            notice.save()
            return JsonResponse({'code': 200, 'message': '通知发布成功', 'data': {'notice_id': notice.id, 'target_classes': total_classes, 'target_students': len(unique_students), 'push_success_count': push_success_count, 'publish_time': publish_time.strftime('%Y-%m-%d %H:%M:%S')}})
        except Exception as e:
            return JsonResponse({'code': 500, 'message': f'发布失败:{str(e)}'})
    def send_wechat_notification(self, openid, title, content, notice_id, priority):
        try:
            import requests
            access_token = self.get_wechat_access_token()
            url = f"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={access_token}"
            template_data = {"touser": openid, "template_id": "your_template_id", "data": {"title": {"value": title}, "content": {"value": content}, "time": {"value": datetime.now().strftime('%Y-%m-%d %H:%M:%S')}}}
            response = requests.post(url, json=template_data)
            result = response.json()
            return result.get('errcode') == 0
        except:
            return False
    def get_wechat_access_token(self):
        return "mock_access_token_for_demo"

基于微信小程序的高校班务管理系统文档展示

文档.png

💖💖作者:计算机编程小咖 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目