Java项目:在线考试系统(单选,多选,判断,填空,简答题)(java+Springboot+ssm+mysql+html+maven)
Posted qq_1334611189
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java项目:在线考试系统(单选,多选,判断,填空,简答题)(java+Springboot+ssm+mysql+html+maven)相关的知识,希望对你有一定的参考价值。
功能:
学生信息 班级 专业 学号 姓名 在线考试 成绩查询 个人信息 密码修改 教师管理 教师编号 姓名 所教科目 题库管理 单选题 多选题 填空题 判断题,简答题(人工阅卷) 试卷管理 新建试卷 在试库中选择试题 试卷设置 发布试卷 考试管理 发布考试计划 学生考试 自动阅卷 人工阅卷 个人信息 密码修改 管理员 学生管理 教师管理 管理员管理 院系管理 班级管理 个人信息 密码修改。
科目控制器:
/**
* 科目控制器
*/
@RestController
public class AcademicsController
@Resource(name = "academicsService")
private IAcademicsService academicsService;
/**
* 分页查询科目列表
*/
@RequestMapping(value = "/academics/qryPage", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@RoleAnnotation(types = RoleEnum.admin)
public ListResult<Academics> qryPage(HttpRequest request)
Map<String, Object> param = new HashMap<>();
int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
if (request.containsKey("academics_id"))
param.put("academics_id", request.getString("academics_id"));
if (request.containsKey("academics_name"))
param.put("academics_name", request.getString("academics_name"));
return academicsService.qryPage(param, pageNo, pageSize);
/**
* 管理员 添加新科目
*/
@RequestMapping(value = "/academics/add", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@RoleAnnotation(types = RoleEnum.admin)
public Result<Academics> insert(HttpRequest request)
Academics academics = new Academics();
academics.setAcademicsId(request.getString("academics_id"));
academics.setAcademicsName(request.getString("academics_name"));
academics.setUpdateTime(new Date());
return academicsService.insert(academics);
/**
* 管理员 更新科目
*/
@RequestMapping(value = "/academics/update", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@RoleAnnotation(types = RoleEnum.admin)
public Result<Academics> update(HttpRequest request)
Academics academics = new Academics();
academics.setAcademicsId(request.getString("academics_id"));
academics.setAcademicsName(request.getString("academics_name"));
academics.setUpdateTime(new Date());
return academicsService.update(academics);
/**
* 管理员 删除科目
*/
@RequestMapping(value = "/academics/del", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@RoleAnnotation(types = RoleEnum.admin)
public Result<Academics> del(HttpRequest request)
List<String> academicsIdList = new ArrayList<>();
JSONArray array = request.getJSONArray("academics_id_list");
for (int i = 0; i < array.size(); i++)
academicsIdList.add(array.getString(i));
return academicsService.del(academicsIdList);
/**
* 管理员 查询所有科目
*/
@RequestMapping(value = "/academics/qryAllList", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@RoleAnnotation(types = RoleEnum.admin)
public ListResult<Academics> qryAllList()
return academicsService.qryAllList();
公共界面控制器:
/**
* 公共界面控制
*/
@Controller
public class CommonhtmlController
/**
* 个人资料管理
*/
@RequestMapping(value = "/common/userinfomanage")
public String userinfomanage()
return "common/userinfomanage/userinfomanage";
/**
* 个人资料密码
*/
@RequestMapping(value = "/common/pwdmanage")
public String pwdmanage()
return "common/pwdmanage/pwdmanage";
登录控制器:
@RestController
public class LoginController
@Resource(name = "loginService")
private ILoginService loginService;
/**
* 用户登录调用 在登陆成功生成两个token 同时返回各自首页
* * 学生 student/student
* * 老师 teacher/teacher
* * 管理员 admin/admin
*/
@RequestMapping(value = "/login/login", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Result<Token> login(HttpRequest request)
return loginService.login(request.getString("login_name"), request.getString("pwd"));
/**
* 登录检查
*/
@RequestMapping(value = "/login/check", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Result<Token> check()
return new Result<>();
/**
* token 续约
*/
@RequestMapping(value = "/login/refresh", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Result<Token> refresh(HttpRequest request)
String refreshToken = request.getString("refresh_token");
String urlId = request.getString("url_id");
Token token = TokenCache.getInstance().get(urlId);
if(token == null)
ExceptionHelper.error(ErrorCode.ERROR_CODE_0003);
try
Claims claims = TokenUtils.parseToken(refreshToken);
if (StringUtils.isNotEmpty((String.valueOf(claims.getOrDefault("student_id", "")))))
claims.put("student_id", SessionContext.get("student_id"));
if (StringUtils.isNotEmpty((String.valueOf(claims.getOrDefault("teacher_id", "")))))
claims.put("teacher_id", SessionContext.get("teacher_id"));
if (StringUtils.isNotEmpty((String.valueOf(claims.getOrDefault("login_name", "")))))
claims.put("login_name", SessionContext.get("login_name"));
claims.put("name", claims.get("name"));
token.setToken(TokenUtils.createToken(claims, TokenUtils.expireTime));
token.setRefreshToken(TokenUtils.createToken(claims, TokenUtils.long_expireTime));
TokenCache.getInstance().add(token);
catch (Exception e)
ExceptionHelper.error(ErrorCode.ERROR_CODE_0003);
return new Result<>(token);
/**
* 退出系统
*/
@RequestMapping(value = "/login/exit", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Result<Token> exit(HttpRequest request)
String urlId = request.getString("url_id");
if (StringUtils.isNotEmpty(urlId))
TokenCache.getInstance().remove(urlId);
return new Result<>();
以上是关于Java项目:在线考试系统(单选,多选,判断,填空,简答题)(java+Springboot+ssm+mysql+html+maven)的主要内容,如果未能解决你的问题,请参考以下文章
十分钟手把手教你设计简单易用的组件级考试题(单选多选填空图片),建议收藏