💖💖作者:计算机毕业设计江挽 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目
设计自主学习系统介绍
设计自主学习系统是一个基于Spring Boot后端框架和Vue前端技术构建的综合性在线学习平台,采用B/S架构模式,使用MySQL数据库进行数据存储和管理。该系统主要面向教育机构的师生群体,通过整合多种学习功能模块,为用户提供完整的在线学习解决方案。系统核心功能涵盖用户管理、学习资料管理、在线考试管理、学习论坛交流等多个方面,学生可以通过系统浏览和下载各类学习资料,参与在线考试测评,在论坛中进行学术讨论和经验分享,教师则可以发布学习内容,管理试题库,组织在线考试,并通过系统跟踪学生的学习进度和考试成绩。系统采用ElementUI组件库构建用户界面,确保良好的用户体验和操作便捷性,同时利用Spring Boot的微服务特性和MyBatis的数据持久化能力,保证系统的稳定性和扩展性,为现代化教育信息化建设提供了实用的技术支撑。
设计自主学习系统演示视频
设计自主学习系统演示图片
设计自主学习系统代码展示
import org.apache.spark.sql.SparkSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@Service
public class OnlineExamService {
@Autowired
private ExamMapper examMapper;
private SparkSession spark = SparkSession.builder().appName("ExamAnalysis").master("local[*]").getOrCreate();
public Map<String, Object> startExam(Long examId, Long studentId) {
Map<String, Object> result = new HashMap<>();
Exam exam = examMapper.getExamById(examId);
if (exam == null || exam.getStatus() != 1) {
result.put("success", false);
result.put("message", "考试不存在或未开放");
return result;
}
Date currentTime = new Date();
if (currentTime.before(exam.getStartTime()) || currentTime.after(exam.getEndTime())) {
result.put("success", false);
result.put("message", "不在考试时间范围内");
return result;
}
StudentExam studentExam = examMapper.getStudentExam(examId, studentId);
if (studentExam != null && studentExam.getSubmitTime() != null) {
result.put("success", false);
result.put("message", "已提交考试,不能重复参加");
return result;
}
List<Question> questions = examMapper.getExamQuestions(examId);
Collections.shuffle(questions);
if (studentExam == null) {
studentExam = new StudentExam();
studentExam.setExamId(examId);
studentExam.setStudentId(studentId);
studentExam.setStartTime(currentTime);
studentExam.setStatus(0);
examMapper.insertStudentExam(studentExam);
}
result.put("success", true);
result.put("questions", questions);
result.put("remainTime", exam.getDuration() * 60);
result.put("studentExamId", studentExam.getId());
return result;
}
public Map<String, Object> submitExam(Long studentExamId, List<Answer> answers) {
Map<String, Object> result = new HashMap<>();
StudentExam studentExam = examMapper.getStudentExamById(studentExamId);
if (studentExam == null || studentExam.getSubmitTime() != null) {
result.put("success", false);
result.put("message", "考试记录不存在或已提交");
return result;
}
Date submitTime = new Date();
long usedTime = (submitTime.getTime() - studentExam.getStartTime().getTime()) / 1000;
int totalScore = 0;
int correctCount = 0;
for (Answer answer : answers) {
Question question = examMapper.getQuestionById(answer.getQuestionId());
if (question != null && question.getCorrectAnswer().equals(answer.getSelectedAnswer())) {
totalScore += question.getScore();
correctCount++;
}
answer.setStudentExamId(studentExamId);
examMapper.insertAnswer(answer);
}
studentExam.setSubmitTime(submitTime);
studentExam.setScore(totalScore);
studentExam.setUsedTime((int) usedTime);
studentExam.setStatus(1);
examMapper.updateStudentExam(studentExam);
result.put("success", true);
result.put("score", totalScore);
result.put("correctCount", correctCount);
result.put("totalCount", answers.size());
result.put("usedTime", usedTime);
return result;
}
}
@Service
public class LearningResourceService {
@Autowired
private ResourceMapper resourceMapper;
private SparkSession spark = SparkSession.builder().appName("ResourceAnalysis").master("local[*]").getOrCreate();
public Map<String, Object> uploadResource(LearningResource resource, Long teacherId) {
Map<String, Object> result = new HashMap<>();
if (resource.getTitle() == null || resource.getTitle().trim().isEmpty()) {
result.put("success", false);
result.put("message", "资源标题不能为空");
return result;
}
if (resource.getFilePath() == null || resource.getFilePath().trim().isEmpty()) {
result.put("success", false);
result.put("message", "文件路径不能为空");
return result;
}
ResourceType resourceType = resourceMapper.getResourceTypeById(resource.getTypeId());
if (resourceType == null || resourceType.getStatus() != 1) {
result.put("success", false);
result.put("message", "资源类型不存在或未启用");
return result;
}
resource.setUploadTime(new Date());
resource.setUploaderId(teacherId);
resource.setDownloadCount(0);
resource.setStatus(1);
resource.setFileSize(calculateFileSize(resource.getFilePath()));
resourceMapper.insertResource(resource);
updateResourceStatistics(resource.getTypeId());
result.put("success", true);
result.put("message", "资源上传成功");
result.put("resourceId", resource.getId());
return result;
}
public Map<String, Object> downloadResource(Long resourceId, Long studentId) {
Map<String, Object> result = new HashMap<>();
LearningResource resource = resourceMapper.getResourceById(resourceId);
if (resource == null || resource.getStatus() != 1) {
result.put("success", false);
result.put("message", "资源不存在或已下架");
return result;
}
DownloadRecord record = new DownloadRecord();
record.setResourceId(resourceId);
record.setStudentId(studentId);
record.setDownloadTime(new Date());
record.setIpAddress(getCurrentIpAddress());
resourceMapper.insertDownloadRecord(record);
resource.setDownloadCount(resource.getDownloadCount() + 1);
resourceMapper.updateResource(resource);
result.put("success", true);
result.put("filePath", resource.getFilePath());
result.put("fileName", resource.getFileName());
result.put("fileSize", resource.getFileSize());
return result;
}
public List<LearningResource> getResourcesByType(Long typeId, int page, int pageSize) {
int offset = (page - 1) * pageSize;
Map<String, Object> params = new HashMap<>();
params.put("typeId", typeId);
params.put("offset", offset);
params.put("pageSize", pageSize);
params.put("status", 1);
return resourceMapper.getResourcesByType(params);
}
private void updateResourceStatistics(Long typeId) {
int count = resourceMapper.getResourceCountByType(typeId);
ResourceType resourceType = resourceMapper.getResourceTypeById(typeId);
resourceType.setResourceCount(count);
resourceMapper.updateResourceType(resourceType);
}
private long calculateFileSize(String filePath) {
return 1024000;
}
private String getCurrentIpAddress() {
return "127.0.0.1";
}
}
@Service
public class ForumService {
@Autowired
private ForumMapper forumMapper;
private SparkSession spark = SparkSession.builder().appName("ForumAnalysis").master("local[*]").getOrCreate();
public Map<String, Object> publishPost(ForumPost post, Long userId) {
Map<String, Object> result = new HashMap<>();
if (post.getTitle() == null || post.getTitle().trim().isEmpty()) {
result.put("success", false);
result.put("message", "帖子标题不能为空");
return result;
}
if (post.getContent() == null || post.getContent().trim().length() < 10) {
result.put("success", false);
result.put("message", "帖子内容不能少于10个字符");
return result;
}
if (containsSensitiveWords(post.getContent())) {
result.put("success", false);
result.put("message", "内容包含敏感词汇,请修改后重新发布");
return result;
}
post.setAuthorId(userId);
post.setPublishTime(new Date());
post.setReplyCount(0);
post.setViewCount(0);
post.setStatus(1);
post.setIsTop(false);
forumMapper.insertPost(post);
updateUserPostCount(userId);
result.put("success", true);
result.put("message", "帖子发布成功");
result.put("postId", post.getId());
return result;
}
public Map<String, Object> replyPost(ForumReply reply, Long userId) {
Map<String, Object> result = new HashMap<>();
ForumPost post = forumMapper.getPostById(reply.getPostId());
if (post == null || post.getStatus() != 1) {
result.put("success", false);
result.put("message", "帖子不存在或已被删除");
return result;
}
if (reply.getContent() == null || reply.getContent().trim().length() < 5) {
result.put("success", false);
result.put("message", "回复内容不能少于5个字符");
return result;
}
if (containsSensitiveWords(reply.getContent())) {
result.put("success", false);
result.put("message", "回复内容包含敏感词汇");
return result;
}
reply.setUserId(userId);
reply.setReplyTime(new Date());
reply.setStatus(1);
forumMapper.insertReply(reply);
post.setReplyCount(post.getReplyCount() + 1);
post.setLastReplyTime(new Date());
forumMapper.updatePost(post);
result.put("success", true);
result.put("message", "回复成功");
result.put("replyId", reply.getId());
return result;
}
public List<ForumPost> getHotPosts(int limit) {
Map<String, Object> params = new HashMap<>();
params.put("status", 1);
params.put("limit", limit);
return forumMapper.getHotPosts(params);
}
public Map<String, Object> viewPost(Long postId, Long userId) {
ForumPost post = forumMapper.getPostById(postId);
if (post == null || post.getStatus() != 1) {
Map<String, Object> result = new HashMap<>();
result.put("success", false);
result.put("message", "帖子不存在");
return result;
}
post.setViewCount(post.getViewCount() + 1);
forumMapper.updatePost(post);
List<ForumReply> replies = forumMapper.getRepliesByPostId(postId);
Map<String, Object> result = new HashMap<>();
result.put("success", true);
result.put("post", post);
result.put("replies", replies);
return result;
}
private boolean containsSensitiveWords(String content) {
String[] sensitiveWords = {"垃圾", "骗子", "作弊"};
for (String word : sensitiveWords) {
if (content.contains(word)) {
return true;
}
}
return false;
}
private void updateUserPostCount(Long userId) {
int count = forumMapper.getUserPostCount(userId);
forumMapper.updateUserPostCount(userId, count);
}
}
设计自主学习系统文档展示
💖💖作者:计算机毕业设计江挽 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目