Springboot+vue前后端分離考試系統(tǒng)
?作者主頁:
?簡介:Java領(lǐng)域優(yōu)質(zhì)創(chuàng)作者、CSDN博客專家? Java項目、簡歷模板、學習資料、面試題庫、技術(shù)互助
文末獲取源碼
項目編號:BS-XX-104
指南針考試系統(tǒng)是一個多角色在線培訓考試系統(tǒng),系統(tǒng)集成了用戶管理、角色管理、題庫管理、試題管理、考試管理、在線考試等功能,考試流程完善。實現(xiàn)一整套完整體系的考試系統(tǒng),方便用戶在此系統(tǒng)中進行練習并不斷提升自己,在考試中不斷進步。本系統(tǒng)采用前后端分離方式進行開發(fā)實現(xiàn),使用springboot+vue來進行開發(fā).
技術(shù)棧
SpringBoot
Mybatis-plus
MySQL 5.7
Vue全家桶
ElementUI
Redis
Swagger
阿里云OSS
Log4j
主要功能
1. 權(quán)限控制
本系統(tǒng)存在三個不同的角色,教師,管理員,學生三種用戶,此系統(tǒng)是基于vue+springboot實現(xiàn)的前后端分離,用戶權(quán)限校驗通過JWT生成token令牌發(fā)放到用戶,并根據(jù)令牌對用戶的身份合法性進行校驗。
2. 在線考試
學生用戶在注冊登錄之后,可以在本系統(tǒng)進行在線的考試,考試可由教師和管理員進行布置并設置考試權(quán)限(公開,密碼),考試題型分為 單選、多選、判斷、簡答題,并支持題目附帶配圖。考試過程中需開啟攝像頭進行考試,系統(tǒng)會自動抓拍考生實時考試狀態(tài)。
3. 成績模塊
參加考試后的學生用戶,在提交試卷后進入考試結(jié)果頁面,頁面會自動核對學生用戶的邏輯題的對錯,對于簡答題需要老師或者超級管理員進行批閱。對于學生用戶參與的考試,學生用戶可以查看到考試的詳情并可以查看到自己所錯的邏輯題。
4. 題庫模塊
學生用戶在題庫模塊中可以進行題目的功能訓練,訓練模式分為,順序練習,隨機練習,也可以根據(jù)題型練習(單選,多選,判斷)。用戶答題時會實時判斷正確與否,并有錯題解析功能。
5. 題庫管理
超級管理員和教師可以對本考試系統(tǒng)已有的題庫進行管理,實現(xiàn)對題庫信息的CRUD操作
6. 試題管理
教師和系統(tǒng)管理員用戶有權(quán)限對本系統(tǒng)的所有試題進行操作,本系統(tǒng)試題支持復雜類型的題目,考試題目支持多插圖,選項答案支持單插圖功能。
7. 考試管理
教師和系統(tǒng)管理員用戶有權(quán)限對系統(tǒng)存在的考試進行操作,本系統(tǒng)考試支持公開考試和密碼口令考試,并可以對考試進行禁用也可以在設置考試時間段,對于考試可以進行很便利的進行組卷,系統(tǒng)內(nèi)置兩種組卷模式,題庫組卷和自由選題組卷。
8. 考卷批閱
對于本系統(tǒng)中存在的復雜考試的題目,可以又對應的老師進行批閱,此系統(tǒng)的邏輯題無需老師用戶進行批閱,老師的工作僅僅是批閱簡答題這種無準確答案類型的題目,極大地減輕了老師用戶的工作量
9. 考試統(tǒng)計
本系統(tǒng)針對每一次考試進行數(shù)據(jù)統(tǒng)計和報表,讓使用本系統(tǒng)的老師用戶能夠直觀的了解到每一次考試人員的進步。
10. 用戶管理
超級管理員可以對注冊本系統(tǒng)用戶的進行授權(quán),并擁有操作一切用戶的權(quán)限。
下面展示一下系統(tǒng)的主要功能:
登陸:
后臺管理首頁

題庫管理

試題管理

考試管理

閱卷管理


考試統(tǒng)計

公告管理

用戶管理

教師登陸


學生登陸

在線考試:考試時要調(diào)出攝相頭進行監(jiān)控


查看個人成績和錯題:并為通過考試的生成證書


日常題庫訓練

部門核心代碼:
package com.wzz.controller;import com.wzz.dto.AddUserDto;import com.wzz.entity.Notice;import com.wzz.entity.UserRole;import com.wzz.service.NoticeService;import com.wzz.service.UserRoleService;import com.wzz.service.UserService;import com.wzz.vo.CommonResult;import com.wzz.vo.PageResponse;import com.wzz.vo.UserInfoVo;import io.swagger.annotations.Api;import io.swagger.annotations.ApiImplicitParam;import io.swagger.annotations.ApiImplicitParams;import io.swagger.annotations.ApiOperation;import lombok.RequiredArgsConstructor;import org.springframework.validation.annotation.Validated;import org.springframework.web.bind.annotation.*;import javax.validation.Valid;import java.util.List;/**
* @author by znz
* @implNote 2021/10/20 19:07
*/public class AdminController { ? ?private final UserService userService; ? ?private final UserRoleService userRoleService; ? ?private final NoticeService noticeService; ? ?
? ?
? ?public CommonResult<PageResponse<UserInfoVo>> getUser( { ? ? ? ? String loginName, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? String trueName,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Integer pageNo, Integer pageSize)return CommonResult.<PageResponse<UserInfoVo>>builder()
? ? ? ? ? ? ? ?.data(userService.getUser(loginName, trueName, pageNo, pageSize))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?public CommonResult<Void> handleUser( {
? ? ? ?userService.handlerUser(type, userIds); ? ? ? ? Integer type, String userIds)return CommonResult.<Void>builder().build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> addUser( {
? ? ? ?userService.addUser(userDto); ? ? ? ? AddUserDto userDto)return CommonResult.<Void>builder().build();
? ?} ? ?
? ?
? ?public CommonResult<List<UserRole>> getRole() { ? ? ? ?return CommonResult.<List<UserRole>>builder()
? ? ? ? ? ? ? ?.data(userRoleService.getUserRole())
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<PageResponse<Notice>> getAllNotice( { ? ? ? ? String content,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Integer pageNo, Integer pageSize)return CommonResult.<PageResponse<Notice>>builder()
? ? ? ? ? ? ? ?.data(noticeService.getAllNotices(content, pageNo, pageSize))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> publishNotice( {
? ? ? ?noticeService.publishNotice(notice); ? ? ? ? Notice notice)return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> deleteNotice( {
? ? ? ?noticeService.deleteNoticeByIds(noticeIds); ? ? ? ? String noticeIds)return CommonResult.<Void>builder().build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> updateNotice( {
? ? ? ?noticeService.updateNotice(notice); ? ? ? ? Notice notice)return CommonResult.<Void>builder().build();
? ?}
}
package com.wzz.controller;import com.wzz.entity.ExamQuestion;import com.wzz.entity.ExamRecord;import com.wzz.service.ExamQuestionService;import com.wzz.service.QuestionService;import com.wzz.service.impl.ExamRecordServiceImpl;import com.wzz.vo.CommonResult;import com.wzz.vo.PageResponse;import com.wzz.vo.QuestionVo;import io.swagger.annotations.Api;import io.swagger.annotations.ApiImplicitParam;import io.swagger.annotations.ApiImplicitParams;import io.swagger.annotations.ApiOperation;import lombok.RequiredArgsConstructor;import lombok.extern.slf4j.Slf4j;import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;/**
* @author by znz
* @implNote 2021/11/7 19:44
*/public class StudentController { ? ?private final ExamRecordServiceImpl examRecordService; ? ?private final QuestionService questionService; ? ?private final ExamQuestionService examQuestionService; ? ?
? ?
? ?
? ?public CommonResult<PageResponse<ExamRecord>> getMyGrade(String username, Integer pageNo, Integer pageSize, { ? ? ? ? Integer examId)return CommonResult.<PageResponse<ExamRecord>>builder().data(examRecordService.getUserGrade(username, examId, pageNo, pageSize)).build();
? ?} ? ?
? ?
? ?
? ?public void getCertificate(HttpServletResponse response, {
? ? ? ?examRecordService.createExamCertificate(response, examName, examRecordId);
? ?} ? ? String examName, Integer examRecordId)
? ?
? ?
? ?public CommonResult<Integer> addExamRecord( { ? ? ? ? ExamRecord examRecord, HttpServletRequest request)return CommonResult.<Integer>builder().data(examRecordService.addExamRecord(examRecord, request)).build();
? ?} ? ?// TODO 優(yōu)化成多id一次查詢
? ?
? ?
? ?
? ?public CommonResult<QuestionVo> getQuestionById( { ? ? ? ? Integer id)return CommonResult.<QuestionVo>builder()
? ? ? ? ? ? ? ?.data(questionService.getQuestionVoById(id))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<ExamRecord> getExamRecordById( { ? ? ? ? Integer recordId)return CommonResult.<ExamRecord>builder()
? ? ? ? ? ? ? ?.data(examRecordService.getExamRecordById(recordId))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<ExamQuestion> getExamQuestionByExamId( { ? ? ? ? Integer examId)return CommonResult.<ExamQuestion>builder()
? ? ? ? ? ? ? ?.data(examQuestionService.getExamQuestionByExamId(examId))
? ? ? ? ? ? ? ?.build();
? ?}
}
package com.wzz.controller;import com.wzz.entity.ExamRecord;import com.wzz.entity.Question;import com.wzz.entity.QuestionBank;import com.wzz.service.*;import com.wzz.utils.OSSUtil;import com.wzz.vo.*;import io.swagger.annotations.Api;import io.swagger.annotations.ApiImplicitParam;import io.swagger.annotations.ApiImplicitParams;import io.swagger.annotations.ApiOperation;import lombok.RequiredArgsConstructor;import lombok.extern.slf4j.Slf4j;import org.springframework.validation.annotation.Validated;import org.springframework.web.bind.annotation.*;import org.springframework.web.multipart.MultipartFile;import javax.validation.Valid;import java.util.List;/**
* @author wzz
* @implNote 2021/10/24 15:42
*/public class TeacherController { ? ?private final ExamService examService; ? ?private final UserService userService; ? ?private final QuestionService questionService; ? ?private final ExamRecordService examRecordService; ? ?private final QuestionBankService questionBankService; ? ?
? ?
? ?public CommonResult<List<QuestionBank>> getQuestionBank() { ? ? ? ?return CommonResult.<List<QuestionBank>>builder()
? ? ? ? ? ? ? ?.data(questionBankService.getAllQuestionBanks())
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<PageResponse<Question>> getQuestion( { ? ? ? ? String questionType, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? String questionBank, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? String questionContent,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Integer pageNo, Integer pageSize)return CommonResult.<PageResponse<Question>>builder()
? ? ? ? ? ? ? ?.data(questionService.getQuestion(questionType, questionBank, questionContent, pageNo, pageSize))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> deleteQuestion(String questionIds) {
? ? ? ?questionService.deleteQuestionByIds(questionIds); ? ? ? ?return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<String> addBankQuestion(String questionIds, String banks) {
? ? ? ?questionBankService.addQuestionToBank(questionIds, banks); ? ? ? ?return CommonResult.<String>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> removeBankQuestion(String questionIds, String banks) {
? ? ? ?questionBankService.removeBankQuestion(questionIds, banks); ? ? ? ?return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<String> uploadQuestionImage(MultipartFile file) throws Exception {
? ? ? ?log.info("開始上傳文件: {}", file.getOriginalFilename()); ? ? ? ?return CommonResult.<String>builder()
? ? ? ? ? ? ? ?.data(OSSUtil.picOSS(file))
? ? ? ? ? ? ? ?.message("上傳成功")
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> addQuestion( {
? ? ? ?questionService.addQuestion(questionVo); ? ? ? ? QuestionVo questionVo)return CommonResult.<Void>builder().build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> updateQuestion( {
? ? ? ?questionService.updateQuestion(questionVo); ? ? ? ? QuestionVo questionVo)return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> deleteQuestionBank(String ids) {
? ? ? ?questionBankService.deleteQuestionBank(ids); ? ? ? ?return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> addQuestionBank( {
? ? ? ?questionBankService.addQuestionBank(questionBank); ? ? ? ? QuestionBank questionBank)return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> operationExam( {
? ? ? ?examService.operationExam(type, ids); ? ? ? ? Integer type, String ids)return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> addExamByBank( {
? ? ? ?examService.addExamByBank(addExamByBankVo); ? ? ? ? AddExamByBankVo addExamByBankVo)return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> addExamByQuestionList( {
? ? ? ?examService.addExamByQuestionList(addExamByQuestionVo); ? ? ? ? AddExamByQuestionVo addExamByQuestionVo)return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> updateExamInfo( {
? ? ? ?examService.updateExamInfo(addExamByQuestionVo); ? ? ? ? AddExamByQuestionVo addExamByQuestionVo)return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<PageResponse<ExamRecord>> getExamRecord( { ? ? ? ? Integer examId, Integer pageNo, Integer pageSize)return CommonResult.<PageResponse<ExamRecord>>builder()
? ? ? ? ? ? ? ?.data(examRecordService.getExamRecord(examId, pageNo, pageSize))
? ? ? ? ? ? ? ?.build();
? ?} ? ?// TODO 改成ids查詢
? ?
? ?
? ?
? ?public CommonResult<UserInfoVo> getUserById( { ? ? ? ? Integer userId)return CommonResult.<UserInfoVo>builder()
? ? ? ? ? ? ? ?.data(userService.getUserInfoById(userId))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<Void> setObjectQuestionScore(Integer totalScore, Integer examRecordId) {
? ? ? ?examRecordService.setObjectQuestionScore(totalScore, examRecordId); ? ? ? ?return CommonResult.<Void>builder()
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?public CommonResult<List<String>> getExamPassRate() { ? ? ? ?return CommonResult.<List<String>>builder()
? ? ? ? ? ? ? ?.data(examService.getExamPassRateEchartData())
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?public CommonResult<List<String>> getExamNumbers() { ? ? ? ?return CommonResult.<List<String>>builder()
? ? ? ? ? ? ? ?.data(examService.getExamNumbersEchartData())
? ? ? ? ? ? ? ?.build();
? ?}
}
package com.wzz.controller;import com.wzz.entity.Exam;import com.wzz.service.ExamService;import com.wzz.service.NoticeService;import com.wzz.service.QuestionBankService;import com.wzz.vo.*;import io.swagger.annotations.Api;import io.swagger.annotations.ApiImplicitParam;import io.swagger.annotations.ApiImplicitParams;import io.swagger.annotations.ApiOperation;import lombok.RequiredArgsConstructor;import org.springframework.web.bind.annotation.*;import java.util.List;public class PublicController { ? ?private final NoticeService noticeService; ? ?private final ExamService examService; ? ?private final QuestionBankService questionBankService; ? ?
? ?
? ?
? ?public CommonResult<PageResponse<Exam>> getExamInfo( { ? ? ? ? ExamQueryVo examQueryVo)return CommonResult.<PageResponse<Exam>>builder()
? ? ? ? ? ? ? ?.data(examService.getExamPage(examQueryVo))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<AddExamByQuestionVo> getExamInfoById( { ? ? ? ? Integer examId)return CommonResult.<AddExamByQuestionVo>builder()
? ? ? ? ? ? ? ?.data(examService.getExamInfoById(examId))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?public CommonResult<List<Exam>> allExamInfo() { ? ? ? ?return CommonResult.<List<Exam>>builder()
? ? ? ? ? ? ? ?.data(examService.list(null))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<PageResponse<BankHaveQuestionSum>> getBankHaveQuestionSumByType( { ? ? ? ? String bankName,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Integer pageNo, Integer pageSize)return CommonResult.<PageResponse<BankHaveQuestionSum>>builder()
? ? ? ? ? ? ? ?.data(questionBankService.getBankHaveQuestionSumByType(bankName, pageNo, pageSize))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<List<QuestionVo>> getQuestionByBankIdAndType(Integer bankId, Integer type) { ? ? ? ?return CommonResult.<List<QuestionVo>>builder()
? ? ? ? ? ? ? ?.data(questionBankService.getQuestionByBankIdAndType(bankId, type))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?
? ?public CommonResult<List<QuestionVo>> getQuestionByBank(Integer bankId) { ? ? ? ?return CommonResult.<List<QuestionVo>>builder()
? ? ? ? ? ? ? ?.data(questionBankService.getQuestionsByBankId(bankId))
? ? ? ? ? ? ? ?.build();
? ?} ? ?
? ?
? ?public CommonResult<String> getCurrentNewNotice() { ? ? ? ?return CommonResult.<String>builder()
? ? ? ? ? ? ? ?.data(noticeService.getCurrentNotice())
? ? ? ? ? ? ? ?.build();
? ?}
}