一、前言
随着信息时代的来临,过去的传统管理方式缺点逐渐暴露,对过去的传统管理方式的缺点进行分析,采取计算机方式构建《学生手册》线上考试系统设计与实现。本文通过课题背景、课题目的及意义相关技术,提出了一种考试试卷、考试试题、在线考试等于一体的系统构建方案。
本文通过采用B/S架构,MySQL数据库以及java语言、springboot框架,结合国内线上管理现状,开发了一个基于springboot的《学生手册》线上考试系统。系统分为多个功能模块:学生信息、辅导员信息、学生成绩、考试试卷管、考试试题、在线考试等。通过系统测试,本系统实现了系统设计目标,相对于人工管理方式,本系统有效的减少了学校的经济投入,并且大幅度提升了线上考试的效率。
随着网络的高速发展,网络技术的应用越来越广泛,信息化技术发展迅速,计算机管理系统优势逐渐体现,并且大量的计算机进入了千家万户。《学生手册》线上考试系统成为信息时代的一个重要代表,由于其涉及的数据量过大,过去的人工管理方式已经很难再维持下去,所以引用了信息化技术来进行管理[1]。计算机系统管理方式替代了人工管理方式,相对过去人工管理方式,利用计算机进行《学生手册》线上考试系统查询便利、信息准确率高、成本降低、效率提高、本次系统开发主要以《学生手册》 线上考试为对象,根据功能需求开发整个信息化系统。
随着信息化管理技术不断发展,传统的《学生手册》考试已经无法适应,效率与预期相差甚远,因此需要开发一套操作方便,效率较高的《学生手册》线上考试系统。当前,21新世纪,人们已经进入了信息时代,人们获取信息的方式大大增加,摆脱了传统的报纸、电视、广播等媒体,而是从各种网络、自媒体平台上获取信息,这就导致日常生活中产生的数据信息十分巨大,尤其是对于《学生手册》 线上考试管理,更需要大量的信息[2]。本系统能为学生、辅导员提供一个《学生手册》 线上考试管理平台,就能够快速有效的帮助学生在线查询考试试卷、通知公告等,辅导员发布《学生手册》线上考试系统设计与实现、考试试题、考试试卷、在线考试等,并且可以让管理员能够轻松效率地添加所有的信息。系统开发的意义主要在于两个方面,一方面,系统上线后,能够为学生与辅导员带来很大便利,《学生手册》 线上考试管理涉及的数据量较大,要求精度高,采用计算机系统能够很好满足此需求,并且随着目前电脑的普及,方便用户使用。另一方面,通过自己动手操作设计系统,不仅可以提升自己的学习兴趣,也是在进入社会之前的一次很好的锻炼机会。
二、开发环境
开发语言:Java
框架:springboot
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7(一定要5.7版本)
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
三、系统功能设计
线上考试系统主要有管理员和学生、辅导员,三个功能模块:管理员模块、学生、辅导员模块。以下将对这三个功能的作用进行详细的剖析。
管理员模块:管理员在系统中的是核心用户,管理员登录后,可以对后台系统进行管理。主要功能有:系统首页、个人中心、学生管理、辅导员管理、学生成绩管理、考试试卷管理、考试试题管理、系统管理、在线考试管理等功能。管理员用例如图3-1所示。
学生:学生进入系统可以对系统首页、个人中心、学生成绩管理等进行操作。学生用例如图3-2所示。辅导员:辅导员进入系统可以对系统首页、个人中心、学生成绩管理、考试试题管理、考试试卷管理、在线考试管理等进行操作。辅导员用例如图3-3所示。
构图是系统的体系结构,体系结构是体系结构体系的一部分,体系结构体系是体系结构体系的重要组成部分。《学生手册》线上考试系统的整体结构设计如图3-4所示。
四、系统数据库设计
五、系统效果
六、核心代码
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.jlwl</groupId>
<!-- 导入项目的名称 -->
<artifactId>springboot05xx7</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot-schema</name>
<description>springboot学习框架</description>
<properties>
<java.version>1.8</java.version>
<fastjson.version>1.2.8</fastjson.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatisplus-spring-boot-starter</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.0.12</version>
</dependency>
<!-- FastJson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- <dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<scope>4.0</scope>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.0.jre8</version>
<scope>runtime</scope>
</dependency> -->
<!-- 百度人工智能 -->
<dependency>
<groupId>com.baidu.aip</groupId>
<artifactId>java-sdk</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.ExamrecordEntity;
import com.entity.view.ExamrecordView;
import com.service.ExamrecordService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;
/**
* 在线考试记录表
* 后端接口
* @author
* @email
* @date 2023-04-02 10:15:33
*/
@RestController
@RequestMapping("/examrecord")
public class ExamrecordController {
@Autowired
private ExamrecordService examrecordService;
/**
* 考试记录接口
*/
@RequestMapping("/groupby")
public R page2(@RequestParam Map<String, Object> params,ExamrecordEntity examrecord, HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
examrecord.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<ExamrecordEntity> ew = new EntityWrapper<ExamrecordEntity>();
PageUtils page = examrecordService.queryPageGroupBy(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, examrecord), params), params));
return R.ok().put("data", page);
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ExamrecordEntity examrecord,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
examrecord.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<ExamrecordEntity> ew = new EntityWrapper<ExamrecordEntity>();
PageUtils page = examrecordService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, examrecord), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ExamrecordEntity examrecord,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
examrecord.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<ExamrecordEntity> ew = new EntityWrapper<ExamrecordEntity>();
PageUtils page = examrecordService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, examrecord), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ExamrecordEntity examrecord){
EntityWrapper<ExamrecordEntity> ew = new EntityWrapper<ExamrecordEntity>();
ew.allEq(MPUtil.allEQMapPre( examrecord, "examrecord"));
return R.ok().put("data", examrecordService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ExamrecordEntity examrecord){
EntityWrapper< ExamrecordEntity> ew = new EntityWrapper< ExamrecordEntity>();
ew.allEq(MPUtil.allEQMapPre( examrecord, "examrecord"));
ExamrecordView examrecordView = examrecordService.selectView(ew);
return R.ok("查询在线考试记录表成功").put("data", examrecordView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ExamrecordEntity examrecord = examrecordService.selectById(id);
return R.ok().put("data", examrecord);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ExamrecordEntity examrecord = examrecordService.selectById(id);
return R.ok().put("data", examrecord);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ExamrecordEntity examrecord, HttpServletRequest request){
examrecord.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(examrecord);
examrecord.setUserid((Long)request.getSession().getAttribute("userId"));
examrecordService.insert(examrecord);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ExamrecordEntity examrecord, HttpServletRequest request){
examrecord.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(examrecord);
examrecord.setUserid((Long)request.getSession().getAttribute("userId"));
examrecordService.insert(examrecord);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody ExamrecordEntity examrecord, HttpServletRequest request){
//ValidatorUtils.validateEntity(examrecord);
examrecordService.updateById(examrecord);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
examrecordService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<ExamrecordEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));
}
int count = examrecordService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 当重新考试时,删除考生的某个试卷的所有考试记录
*/
@RequestMapping("/deleteRecords")
public R deleteRecords(@RequestParam Long userid,@RequestParam Long paperid){
examrecordService.delete(new EntityWrapper<ExamrecordEntity>().eq("paperid", paperid).eq("userid", userid));
return R.ok();
}
}