基于java+springboot+vue的在线远程考试系统

项目介绍

信息数据从传统到当代,是一直在变革当中,突如其来的互联网让传统的信息管理看到了革命性的曙光,因为传统信息管理从时效性,还是安全性,还是可操作性等各个方面来讲,遇到了互联网时代才发现能补上自古以来的短板,有效的提升管理的效率和业务水平。传统的管理模式,时间越久管理的内容越多,也需要更多的人来对数据进行整理,并且数据的汇总查询方面效率也是极其的低下,并且数据安全方面永远不会保证安全性能。结合数据内容管理的种种缺点,在互联网时代都可以得到有效的补充。结合先进的互联网技术,开发符合需求的软件,让数据内容管理不管是从录入的及时性,查看的及时性还是汇总分析的及时性,都能让正确率达到最高,管理更加的科学和便捷。本次开发的在线远程考试系统实现了字典管理、试卷表管理、试题表管理、考试记录表管理、答题详情表管理、错题表管理、公告管理、用户管理、老师管理、管理员管理等功能。系统用到了关系型数据库中王者MySql作为系统的数据库,有效的对数据进行安全的存储,有效的备份,对数据可靠性方面得到了保证。并且程序也具备程序需求的所有功能,使得操作性还是安全性都大大提高,让在线远程考试系统更能从理念走到现实,确确实实的让人们提升信息处理效率。

在这里插入图片描述

开发环境

编程语言:Java
数据库 :Mysql
系统架构:B/S
后端框架:SpringBoot
编译工具:idea或者eclipse,jdk1.8,maven
支持定做:java/php/python/android/小程序vue/爬虫/c#/asp.net

系统实现

5.1管理员功能实现
5.1.1 试卷管理
此页面让管理员管理试卷的数据,试卷管理页面见下图。此页面主要实现试卷的增加、修改、删除、查看的功能。
在这里插入图片描述

图5-1 试卷管理页面

5.1.2 公告信息管理
公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。下图就是公告信息管理页面。
在这里插入图片描述

图5.3 公告信息管理页面

5.1.3公告类型管理
公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。下图就是公告类型管理页面。
在这里插入图片描述

图5.4 公告类型列表页面
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

核心代码

package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 考试记录表
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/examrecord")
public class ExamrecordController {
    private static final Logger logger = LoggerFactory.getLogger(ExamrecordController.class);

    @Autowired
    private ExamrecordService examrecordService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service
    @Autowired
    private ExampaperService exampaperService;
    @Autowired
    private YonghuService yonghuService;

    @Autowired
    private LaoshiService laoshiService;


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        else if("老师".equals(role))
            params.put("laoshiId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = examrecordService.queryPage(params);

        //字典表数据转换
        List<ExamrecordView> list =(List<ExamrecordView>)page.getList();
        for(ExamrecordView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ExamrecordEntity examrecord = examrecordService.selectById(id);
        if(examrecord !=null){
            //entity转view
            ExamrecordView view = new ExamrecordView();
            BeanUtils.copyProperties( examrecord , view );//把实体数据重构到view中

                //级联表
                ExampaperEntity exampaper = exampaperService.selectById(examrecord.getExampaperId());
                if(exampaper != null){
                    BeanUtils.copyProperties( exampaper , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setExampaperId(exampaper.getId());
                }
                //级联表
                YonghuEntity yonghu = yonghuService.selectById(examrecord.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody ExamrecordEntity examrecord, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,examrecord:{}",this.getClass().getName(),examrecord.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("用户".equals(role))
            examrecord.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        Wrapper<ExamrecordEntity> queryWrapper = new EntityWrapper<ExamrecordEntity>()
            .eq("examrecord_uuid_number", examrecord.getExamrecordUuidNumber())
            .eq("yonghu_id", examrecord.getYonghuId())
            .eq("exampaper_id", examrecord.getExampaperId())
            .eq("total_score", examrecord.getTotalScore())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ExamrecordEntity examrecordEntity = examrecordService.selectOne(queryWrapper);
        if(examrecordEntity==null){
            examrecord.setInsertTime(new Date());
            examrecord.setCreateTime(new Date());
            examrecordService.insert(examrecord);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody ExamrecordEntity examrecord, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,examrecord:{}",this.getClass().getName(),examrecord.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            examrecord.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<ExamrecordEntity> queryWrapper = new EntityWrapper<ExamrecordEntity>()
            .notIn("id",examrecord.getId())
            .andNew()
            .eq("examrecord_uuid_number", examrecord.getExamrecordUuidNumber())
            .eq("yonghu_id", examrecord.getYonghuId())
            .eq("exampaper_id", examrecord.getExampaperId())
            .eq("total_score", examrecord.getTotalScore())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ExamrecordEntity examrecordEntity = examrecordService.selectOne(queryWrapper);
        if(examrecordEntity==null){
            examrecordService.updateById(examrecord);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }



    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        examrecordService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            List<ExamrecordEntity> examrecordList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            ExamrecordEntity examrecordEntity = new ExamrecordEntity();
//                            examrecordEntity.setExamrecordUuidNumber(data.get(0));                    //考试编号 要改的
//                            examrecordEntity.setYonghuId(Integer.valueOf(data.get(0)));   //考试用户 要改的
//                            examrecordEntity.setExampaperId(Integer.valueOf(data.get(0)));   //所属试卷id(外键) 要改的
//                            examrecordEntity.setTotalScore(Integer.valueOf(data.get(0)));   //所得总分 要改的
//                            examrecordEntity.setInsertTime(date);//时间
//                            examrecordEntity.setCreateTime(date);//时间
                            examrecordList.add(examrecordEntity);


                            //把要查询是否重复的字段放入map中
                                //考试编号
                                if(seachFields.containsKey("examrecordUuidNumber")){
                                    List<String> examrecordUuidNumber = seachFields.get("examrecordUuidNumber");
                                    examrecordUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> examrecordUuidNumber = new ArrayList<>();
                                    examrecordUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("examrecordUuidNumber",examrecordUuidNumber);
                                }
                        }

                        //查询是否重复
                         //考试编号
                        List<ExamrecordEntity> examrecordEntities_examrecordUuidNumber = examrecordService.selectList(new EntityWrapper<ExamrecordEntity>().in("examrecord_uuid_number", seachFields.get("examrecordUuidNumber")));
                        if(examrecordEntities_examrecordUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(ExamrecordEntity s:examrecordEntities_examrecordUuidNumber){
                                repeatFields.add(s.getExamrecordUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [考试编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        examrecordService.insertBatch(examrecordList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }





    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = examrecordService.queryPage(params);

        //字典表数据转换
        List<ExamrecordView> list =(List<ExamrecordView>)page.getList();
        for(ExamrecordView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ExamrecordEntity examrecord = examrecordService.selectById(id);
            if(examrecord !=null){


                //entity转view
                ExamrecordView view = new ExamrecordView();
                BeanUtils.copyProperties( examrecord , view );//把实体数据重构到view中

                //级联表
                    ExampaperEntity exampaper = exampaperService.selectById(examrecord.getExampaperId());
                if(exampaper != null){
                    BeanUtils.copyProperties( exampaper , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setExampaperId(exampaper.getId());
                }
                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(examrecord.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody ExamrecordEntity examrecord, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,examrecord:{}",this.getClass().getName(),examrecord.toString());
        Wrapper<ExamrecordEntity> queryWrapper = new EntityWrapper<ExamrecordEntity>()
            .eq("examrecord_uuid_number", examrecord.getExamrecordUuidNumber())
            .eq("yonghu_id", examrecord.getYonghuId())
            .eq("exampaper_id", examrecord.getExampaperId())
            .eq("total_score", examrecord.getTotalScore())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ExamrecordEntity examrecordEntity = examrecordService.selectOne(queryWrapper);
        if(examrecordEntity==null){
            examrecord.setInsertTime(new Date());
            examrecord.setCreateTime(new Date());
        examrecordService.insert(examrecord);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }



    @Autowired
    private ExamredetailsService examredetailsService;
    /**
    * 后端保存
    */
    @RequestMapping("/saveExamrecord")
    public R saveExamrecord(Integer exampaperId, HttpServletRequest request){
        ExamrecordEntity examrecord = new ExamrecordEntity();
        String uuid = String.valueOf(new Date().getTime());
        examrecord.setExamrecordUuidNumber(uuid);
        examrecord.setExampaperId(exampaperId);
        examrecord.setTotalScore(0);
        examrecord.setYonghuId((Integer) request.getSession().getAttribute("userId"));
        examrecord.setInsertTime(new Date());
        examrecord.setCreateTime(new Date());
        boolean insert = examrecordService.insert(examrecord);
        if(!insert){
            return R.error();
        }
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("uuid",uuid);
        map.put("id",examrecord.getId());
        return R.ok(map);
    }

    /**
     * 删除
     */
    @RequestMapping("/deleteExamrecord")
    public R deleteExamrecord(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<ExamrecordEntity> examrecordE = examrecordService.selectBatchIds(Arrays.asList(ids));//考试记录表
        List<String> joinIds = new ArrayList<>();
        for (ExamrecordEntity examrecord:examrecordE) {
            joinIds.add(examrecord.getExamrecordUuidNumber());
        }
        boolean examredetails_uuid_number = examredetailsService.delete(new EntityWrapper<ExamredetailsEntity>().in("examredetails_uuid_number", joinIds));
        if(!examredetails_uuid_number){
            return R.error();
        }
        boolean b = examrecordService.deleteBatchIds(Arrays.asList(ids));//删除当前表
        if(!b){
            return R.error();
        }
        return R.ok();
    }
}

论文参考

在这里插入图片描述

目 录
摘 要 I
目 录 III
第1章 绪论 1
1.1 研究背景 1
1.2目的和意义 1
1.3 论文研究内容 1
第2章 程序开发技术 3
2.1 Mysql数据库 3
2.2 Java语言 4
第3章 系统分析 5
3.1可行性分析 5
3.1.1技术可行性分析 5
3.1.2经济可行性分析 5
3.1.3操作可行性分析 6
3.2系统运行环境 6
3.3系统流程分析 6
第4章 系统设计 10
4.1 系统设计的原则 10
4.2 系统结构设计 10
4.3功能结构设计 11
4.4数据库设计 12
4.4.1 数据库E-R图 15
4.4.2 数据库表结构 16
第5章 系统实现 19
5.1管理员功能实现 19
5.1.1 试卷管理 19
5.1.2 公告信息管理 19
5.1.3公告类型管理 20
第6章 系统测试 21
6.1系统测试方法 21
6.2 系统功能测试 22
6.2.1 用户登录测试 22
6.2.2 添加账户功能测试 22
6.3 系统测试分析 22
结 论 23
致 谢 25
参考文献 26

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Vue.js是一款流行的JavaScript框架,用于构建现代化的用户界面。它提供了响应式数据绑定和组件化的开发模式,使开发者可以更轻松地构建交互丰富的应用程序。 而xterm.js是一个基于Web的终端模拟器,它可以在浏览器中模拟一个命令行界面,支持输入和输出文本,以及一些常见的终端命令。Vue.js和xterm.js可以很好地结合在一起,以实现在浏览器中模拟终端的功能。 Spring Boot是一个用于快速构建Java应用程序的框架,它提供了自动化配置和约定优于配置的原则,使开发者可以更快地搭建Java Web应用。Spring Boot支持各种后端技术,包括Spring MVC、Spring Data、Spring Security等。 结合Vue.js、xterm.js和Spring Boot,我们可以实现一个完整的Web应用程序,具备交互式终端的功能。用户可以在浏览器中输入命令,并由xterm.js模拟终端效果,然后通过Vue.js将输入的命令发送到后端的Spring Boot应用处理。后端应用可以执行相应的逻辑,并将结果返回给前端显示。 这样的应用程序可以用于各种场景,比如远程服务器管理、日志查看、文件操作等。使用Vue.js和xterm.js可以使用户体验更加友好和直观,而Spring Boot则提供了强大的后端支持,使开发过程更加高效。 总之,将Vue.js、xterm.js和Spring Boot结合起来,可以构建出一个功能强大且用户友好的Web应用程序,实现在浏览器中模拟终端的功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_3306428634

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值