💖💖作者:计算机毕业设计江挽 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目
目录
- 基于Springboot的在线考试系统介绍
- 基于Springboot的在线考试系统演示视频
- 基于Springboot的在线考试系统演示图片
- 基于Springboot的在线考试系统代码展示
- 基于Springboot的在线考试系统文档展示
基于Springboot的在线考试系统介绍
《在线考试系统》是一套基于B/S架构、支持Java(Spring Boot)与Python(Django)双技术栈前后端分离的综合性在线考试管理平台,系统前端采用Vue+ElementUI构建交互界面,后端以Spring Boot或Django为核心处理业务逻辑,数据库使用MySQL进行数据持久化存储。系统面向高校教学场景,围绕考试全流程管理需求,设计了系统首页展示、学生与教师信息管理、班级与课程类别管理、课程信息维护、试题内容管理、学习交流社区、在线考试管理、轮播图管理及校园公告发布等核心功能模块,覆盖了从基础数据维护到考试组织实施、再到师生互动交流的完整业务链条。其中在线考试管理模块支持试卷自动组卷、考试过程监控、客观题自动判分与成绩统计,试题内容管理模块支持多种题型(单选题、多选题、判断题、填空题、简答题)的录入与分类存储,学习交流模块则为师生提供课程相关的答疑讨论空间。系统整体设计注重易用性与可维护性,既可作为计算机专业学生毕业设计的参考项目,也可作为高校教师开展日常课程测验与期中期末考核的辅助工具,具备实际落地应用价值。
基于Springboot的在线考试系统演示视频
演示视频
基于Springboot的在线考试系统演示图片

基于Springboot的在线考试系统代码展示
SparkSession spark = SparkSession.builder().appName("ExamDataAnalysis").master("local[*]").getOrCreate();
@Autowired
private ExamRecordMapper examRecordMapper;
@Autowired
private QuestionMapper questionMapper;
@Autowired
private StudentAnswerMapper studentAnswerMapper;
public Map<String, Object> submitExam(Integer examId, Integer studentId, List<StudentAnswerDTO> answers) {
Map<String, Object> result = new HashMap<>();
List<Question> questions = questionMapper.selectByExamId(examId);
int correctCount = 0;
int totalScore = 0;
for (StudentAnswerDTO dto : answers) {
Question q = questions.stream().filter(item -> item.getId().equals(dto.getQuestionId())).findFirst().orElse(null);
if (q == null) continue;
StudentAnswer answer = new StudentAnswer();
answer.setExamId(examId);
answer.setStudentId(studentId);
answer.setQuestionId(dto.getQuestionId());
answer.setStudentAnswerText(dto.getAnswerText());
answer.setQuestionType(q.getQuestionType());
if ("单选题".equals(q.getQuestionType()) || "判断题".equals(q.getQuestionType())) {
boolean isCorrect = q.getCorrectAnswer().equals(dto.getAnswerText());
answer.setIsCorrect(isCorrect ? 1 : 0);
if (isCorrect) { correctCount++; totalScore += q.getScore(); }
answer.setScore(isCorrect ? q.getScore() : 0);
} else if ("多选题".equals(q.getQuestionType())) {
String[] correctParts = q.getCorrectAnswer().split(",");
List<String> correctList = Arrays.asList(correctParts);
String[] studentParts = dto.getAnswerText().split(",");
List<String> studentList = Arrays.asList(studentParts);
boolean isCorrect = correctList.size() == studentList.size() && correctList.containsAll(studentList);
answer.setIsCorrect(isCorrect ? 1 : 0);
if (isCorrect) { correctCount++; totalScore += q.getScore(); }
answer.setScore(isCorrect ? q.getScore() : 0);
} else if ("填空题".equals(q.getQuestionType())) {
String[] correctKeywords = q.getCorrectAnswer().split("\\\\|");
boolean isCorrect = false;
for (String kw : correctKeywords) {
if (dto.getAnswerText().trim().contains(kw.trim())) { isCorrect = true; break; }
}
answer.setIsCorrect(isCorrect ? 1 : 0);
if (isCorrect) { correctCount++; totalScore += q.getScore(); }
answer.setScore(isCorrect ? q.getScore() : 0);
} else if ("简答题".equals(q.getQuestionType())) {
answer.setIsCorrect(0);
answer.setScore(0);
}
studentAnswerMapper.insert(answer);
}
ExamRecord record = examRecordMapper.selectByExamAndStudent(examId, studentId);
if (record == null) { record = new ExamRecord(); record.setExamId(examId); record.setStudentId(studentId); }
record.setTotalScore(totalScore);
record.setCorrectCount(correctCount);
record.setSubmitTime(new Date());
record.setStatus(1);
if ("简答题".equals(questions.stream().filter(q -> "简答题".equals(q.getQuestionType())).findFirst().orElse(null) != null ? "简答题" : "")) {
record.setScoreStatus(0);
} else { record.setScoreStatus(1); }
examRecordMapper.updateById(record);
List<Dataset<Row>> scoreData = new ArrayList<>();
List<Integer> scoreList = examRecordMapper.selectAllScoresByExamId(examId);
if (scoreList != null && !scoreList.isEmpty()) {
List<Integer> finalScoreList = scoreList;
List<Row> rows = new ArrayList<>();
for (Integer sc : finalScoreList) { rows.add(RowFactory.create(sc)); }
StructType schema = DataTypes.createStructType(Arrays.asList(DataTypes.createStructField("score", DataTypes.IntegerType, false)));
Dataset<Row> scoreDataset = spark.createDataFrame(rows, schema);
scoreDataset.createOrReplaceTempView("scores");
Dataset<Row> avgResult = spark.sql("SELECT AVG(score) as avgScore, PERCENTILE_APPROX(score, 0.5) as medianScore FROM scores");
List<Row> stats = avgResult.collectAsList();
if (!stats.isEmpty()) { Row statRow = stats.get(0); Double avg = statRow.getDouble(0); Double median = statRow.getDouble(1); record.setAvgScore(avg); record.setMedianScore(median); }
Dataset<Row> passResult = spark.sql("SELECT COUNT(*) as passCount FROM scores WHERE score >= 60");
List<Row> passRows = passResult.collectAsList();
if (!passRows.isEmpty()) { long passCount = passRows.get(0).getLong(0); double passRate = (double) passCount / finalScoreList.size() * 100; record.setPassRate(passRate); }
examRecordMapper.updateById(record);
}
result.put("totalScore", totalScore);
result.put("correctCount", correctCount);
result.put("questionCount", questions.size());
result.put("status", record.getScoreStatus() == 1 ? "已自动判分" : "待教师批阅简答题");
return result;
}
public Map<String, Object> autoGeneratePaper(Integer courseId, Integer classId, Integer questionCount, Integer totalScore) {
Map<String, Object> result = new HashMap<>();
List<Question> allQuestions = questionMapper.selectByCourseId(courseId);
Map<String, List<Question>> groupedByType = new HashMap<>();
for (Question q : allQuestions) {
String type = q.getQuestionType();
if (!groupedByType.containsKey(type)) { groupedByType.put(type, new ArrayList<>()); }
groupedByType.get(type).add(q);
}
List<Question> selectedQuestions = new ArrayList<>();
int currentTotal = 0;
List<String> typeOrder = Arrays.asList("单选题", "多选题", "判断题", "填空题", "简答题");
int remainingCount = questionCount;
for (String type : typeOrder) {
List<Question> pool = groupedByType.getOrDefault(type, new ArrayList<>());
if (pool.isEmpty()) continue;
Collections.shuffle(pool);
int take = Math.min((int) Math.ceil(remainingCount * 0.3), pool.size());
if (type.equals("简答题")) take = Math.min(2, pool.size());
for (int i = 0; i < take && i < pool.size(); i++) {
selectedQuestions.add(pool.get(i));
currentTotal += pool.get(i).getScore();
remainingCount—;
}
}
if (selectedQuestions.size() < questionCount * 0.6) {
for (String type : typeOrder) {
List<Question> pool = groupedByType.getOrDefault(type, new ArrayList<>());
if (pool.isEmpty()) continue;
Collections.shuffle(pool);
for (Question q : pool) {
if (selectedQuestions.size() >= questionCount) break;
if (!selectedQuestions.contains(q)) { selectedQuestions.add(q); currentTotal += q.getScore(); }
}
if (selectedQuestions.size() >= questionCount) break;
}
}
int maxAttempts = 100;
while (currentTotal < totalScore * 0.8 && maxAttempts > 0) {
maxAttempts—;
Question extra = allQuestions.get(new Random().nextInt(allQuestions.size()));
if (!selectedQuestions.contains(extra)) { selectedQuestions.add(extra); currentTotal += extra.getScore(); }
}
ExamPaper paper = new ExamPaper();
paper.setCourseId(courseId);
paper.setClassId(classId);
paper.setTotalQuestions(selectedQuestions.size());
paper.setTotalScore(currentTotal);
paper.setCreateTime(new Date());
paper.setStatus(0);
paperMapper.insert(paper);
for (Question q : selectedQuestions) { ExamPaperQuestion pq = new ExamPaperQuestion(); pq.setPaperId(paper.getId()); pq.setQuestionId(q.getId()); pq.setQuestionOrder(selectedQuestions.indexOf(q) + 1); paperQuestionMapper.insert(pq); }
result.put("paperId", paper.getId());
result.put("questionCount", selectedQuestions.size());
result.put("totalScore", currentTotal);
result.put("questions", selectedQuestions);
return result;
}
public List<Map<String, Object>> getStudentScoreRanking(Integer examId, Integer classId) {
List<ExamRecord> records = examRecordMapper.selectByExamIdAndClassId(examId, classId);
List<Map<String, Object>> ranking = new ArrayList<>();
for (ExamRecord record : records) {
Map<String, Object> item = new HashMap<>();
Student student = studentMapper.selectById(record.getStudentId());
item.put("studentName", student.getName());
item.put("studentNo", student.getStudentNo());
item.put("totalScore", record.getTotalScore());
item.put("correctCount", record.getCorrectCount());
item.put("submitTime", record.getSubmitTime());
ranking.add(item);
}
ranking.sort((a, b) -> Integer.compare((Integer) b.get("totalScore"), (Integer) a.get("totalScore")));
for (int i = 0; i < ranking.size(); i++) { ranking.get(i).put("rank", i + 1); }
List<Integer> scoreValues = new ArrayList<>();
for (Map<String, Object> item : ranking) { scoreValues.add((Integer) item.get("totalScore")); }
if (!scoreValues.isEmpty()) {
List<Integer> finalScoreValues = scoreValues;
List<Row> rows = new ArrayList<>();
for (Integer sc : finalScoreValues) { rows.add(RowFactory.create(sc)); }
StructType schema = DataTypes.createStructType(Arrays.asList(DataTypes.createStructField("score", DataTypes.IntegerType, false)));
Dataset<Row> scoreDataset = spark.createDataFrame(rows, schema);
scoreDataset.createOrReplaceTempView("rank_scores");
Dataset<Row> result = spark.sql("SELECT AVG(score) as avgScore, MAX(score) as maxScore, MIN(score) as minScore, STDDEV(score) as stddev FROM rank_scores");
List<Row> statsRows = result.collectAsList();
if (!statsRows.isEmpty()) {
Row statRow = statsRows.get(0);
Map<String, Object> stats = new HashMap<>();
stats.put("averageScore", statRow.getDouble(0));
stats.put("maxScore", statRow.getInt(1));
stats.put("minScore", statRow.getInt(2));
stats.put("stddev", statRow.getDouble(3));
Map<String, Object> finalResult = new HashMap<>();
finalResult.put("ranking", ranking);
finalResult.put("statistics", stats);
return Arrays.asList(finalResult);
}
}
return ranking;
}
基于Springboot的在线考试系统文档展示

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


评论前必须登录!
注册