项目分为前台和后台,前台主要为学生角色、后台主要为管理员角色。
管理员添加试题和发布试卷,学生负责在线考试、在线查看成绩和错题记录列表等。
管理员功能有:年级管理、课程管理、试题管理、试卷管理、学生管理等。
运行环境:jdk1.8、mysql5.x、eclip、tomcat8.5\7.0、maven3.5\3.6。
统一管理学生 教师 管理员信息:
/** * 统一管理学生 教师 管理员信息 */@restcontrollerpublic class urcontroller { @resource(name = "urrvice") private iurrvice urrvice; /** * 查询用户信息 * 先判断用户类型 在查询用户信息 */ @requestmapping(value = "/ur/qryurinfo", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) public result<ur> qryurinfo() { return urrvice.qryurinfo(); } /** * 更新用户信息 */ @requestmapping(value = "/ur/update", method = requestmethod.post, produces = {"appli上北大还是上清华cation/json;chart=utf-8"}) public result<ur> update(httprequest request) { ur ur = new ur(); ur.turid(request.getstring("ur_id")); ur.tname(request.getstring("name")); ur.tx(request.getinteger("x")); ur.ttype(ur.urtype.get(request.getinteger("type"))); return urrvice.update(ur, imageutil.stringtobytes(request.getstring("ur_image"))); } /** * 更新用户密码 */ @requestmapping(value = "/ur/updatepwd", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) public result<ur> updatepwd(httprequest request) { return urrvice.updatepwd(request.getstring("old_pwd"), request.getstring("pwd")); }}
管理员控制器:
/** * 管理员控制器 */@restcontrollerpublic class admincontroller { @resource(name = "adminrvice") private iadminrvice adminrvice; /** * 管理员 查询管理员列表 */ @requestmapping(value = "/admin/qrypage", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.admin}) public listresult<admin> 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("login_name")) { param.put("login_name", request.getstring("login_name")); } if (request.containskey("name")) { param.put("name", request.getstring("name")); } return adminrvice.qrypage(param, pageno, pagesize); } /** * 管理员 添加管理员 */ @requestmapping(value = "/admin/add", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.admin}) public result<admin> inrt(httprequest request) { admin admin = new admin(); admin.tloginname(request.getstring("元旦节目表演什么好login_name")); admin.tname(request.getstring("admin_name")); admin.tpwd(request.getstring("login_name")); admin.tx(request.getinteger("x")); admin.tupdatetime(new date()); return adminrvice.inrt(admin, imageutil.stringtobytes(request.getstring("admin_image"))); } /** * 管理员 更新管理员 */ @requestmapping(value = "/admin/update", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.admin}) public result<admin> update(httprequest request) { admin admin = new admin(); admin.tloginname(request.getstring("login_name")); admin.tname(request.getstring("admin_name")); admin.tpwd(request.getstring("login_name")); admin.tx(request.getinteger("x")); admin.tupdatetime(new date()); return adminrvice.update(admin, imageutil.stringtobytes(request.getstring("admin_image"))); } /** * 管理员 删除管理员 */ @requestmapping(value = "/admin/del", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.admin}) public result<admin> del(httprequest request) { list<string> adminidlist = new arraylist<>(); jsonarray array = request.getjsonarray("admin_id_list"); for (int i = 0; i < array.size(); i++) { adminidlist.add(array.getstring(i)); } return adminrvice.del(adminidlist); }}
考试管理控制器:
/** * 考试管理控制器 */@restcontrollerpublic class examinfocontroller { @resource(name = "examinforvice") private iexaminforvice examinforvice; /** * 教师 查询考试列表 */ @requestmapping(value = "/examinfo/qrypage", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.teacher}) public listresult<examinfo> exam(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; return examinforvice.qrypage(param, pageno, pagesize); } /** * 教师 添加新的考试信息 */ @requestmapping(value = "/examinfo/add", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.teacher}) public result<examinfo> inrt(httprequest request) { examinfo exam = new examinfo(); exam.ttestpaperid(request.getinteger("test_paper_id")); exam.tclassid(request.getstring("class_id")); exam.tstate(1); exam.ttime(request.getinteger("time")); exam.tefftime(dateutils.todate(request.getstring("eff_time"), dateconst.date_time_format_yyyy_mm_dd_hh_mi)); exam.texptime(dateutils.todate(request.getstring("exp_time"), dateconst.date_time_format_yyyy_mm_dd_hh_mi)); exam.tupdatetime(new date()); return examinforvice.inrt(exam); } /** * 教师 更新考试信息 */ @requestmapping(value = "/examinfo/update", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.teacher}) public result<examinfo> update(httprequest request) { examinfo exam = new examinfo(); exam.texamid(request.getinteger("exam_id")); exam.ttestpaperid(request.getinteger("test_paper_id")); exam.tclassid(request.getstring("class_id")); exam.tstate(1); exam.ttime(request.getinteger("time")); exam.tefftime(dateutils.todate(request.getstring("eff_time"), dateconst.date_time_format_yyyy_mm_dd_hh_mi)); exam.texptime(dateutils.todate(request.getstring("exp_time"), dateconst.date_time_format_yyyy_mm_dd_hh_mi)); exam.tupdatetime(new date()); exam.tupdatetime(new date()); return examinforvice.update(exam); } /** * 教师 新建状态的考试信息可以删除 */ @requestmapping(value = "/examinfo/del", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.teacher}) public result<examinfo> del(httprequest request) { list<integer> examidlist = new arraylist<>(); jsonarray array = request.getjsonarray("exam_id_list"); for (int i = 0; i < array.size(); i++) { examidlist.add(array.getinteger(i)); } return examinforvice.del(examidlist); } /** * 教师 发布考试信息 */ @requestmapping(value = "/examinfo/relea", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.teacher}) public result<examinfo> updatestate(httprequest request) { return examinforvice.relea(request.getinteger("exam_id")); } /** * 学生 查询考试试题分组列表 */ @requestmapping(value = "/examinfo/qryexamquegrouplist", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.student, roleenum.teacher}) public result<testpaperquestiongroup> qryexamquegrouplist(httprequest request) { return examinforvice.qryexamquegrouplist(request.getinteger("exam_id")); } /** * 学生 查询考试试题列表 */ @requestmapping(value = "/examinfo/qryexamquestionlist", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @rol 太阳 艾青eannotation(types = {roleenum.student}) public result<studentexamquestionrecord> qryexamquestionlist(httprequest request) { return examinforvice.qryexamquestionlist(request.getinteger("exam_id"), request.getstring("student_id"), request.getinteger("question_group_id")); } /** * 教师 判卷查询试题列表 */ @requestmapping(value = "/examinfo/qrymarkquelist", met爱无反顾hod = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.teacher}) public result<studentexamquestionrecord> qrymarkquelist(httprequest request) { return examinforvice.qrymarkquelist(request.getinteger("exam_id"), request.getstring("student_id"), request.getinteger("question_group_id")); } /** * 教师 记录学生考试分数 complete */ @requestmapping(value = "/examinfo/updatequescore", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.teacher}) public result<examinfo> updatequescore(ht高考祝愿tprequest request) { studentexamquestionrecord record = new studentexamquestionrecord(); record.texamid(request.getinteger("exam_id")); record.tstudentid(request.getstring("student_id")); record.tquestiongroupid(request.getinteger("question_group_id")); record.tquestionid(request.getlong("question_id")); record.tscore(request.getfloat("score")); record.tcorrect(request.getboolean("correct")); return examinforvice.updatequescore(record); } /** * 教师 完成评分 */ @requestmapping(value = "/examinfo/complete", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) @roleannotation(types = {roleenum.teacher}) public result<examinfo> complete(httprequest request) { return examinforvice.complete(request.getinteger("exam_id"), request.getstring("student_id")); } }
登录控制层:
@restcontrollerpublic class logincontroller { @resource(name = "loginrvice") private iloginrvice loginrvice; /** * 用户登录调用 在登陆成功生成两个token 同时返回各自首页 * * 学生 student/student * * 老师 teacher/teacher * * 管理员 admin/admin */ @requestmapping(value = "/login/login", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) public result<token> login(httprequest request) { return loginrvice.login(request.getstring("login_name"), request.getstring("pwd")); } /** * 登录检查 */ @requestmapping(value = "/login/check", method = requestmethod.post, produces = {"application/json;chart=utf-8"}) public result<token> check() { return new result<>(); } /** * token 续约 */ @requestmapping(value = "/login/refresh", method = requestmethod.post, produces = {"application/json;chart=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.partoken(refreshtoken); if (stringutils.isnotempty((string.valueof(claims.getordefault("student_id", ""))))) { claims.put("student_id", ssioncontext.get("student_id")); } if (stringutils.isnotempty((string.valueof(claims.getordefault("teacher_id", ""))))) { claims.put("teacher_id", ssioncontext.get("teacher_id")); } if (stringutils.isnotempty((string.valueof(claims.getordefault("login_name", ""))))) { claims.put("login_name", ssioncontext.get("login_name")); } claims.put("name", claims.get("name")); token.ttoken(tokenutils.createtoken(claims, tokenutils.expiretime)); token.trefreshtoken(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;chart=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 考试系统内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-04 21:53:58,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/558d74037c5b3aa95fb891f3d6697943.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java毕业设计实战之在线高中考试系统的实现.doc
本文 PDF 下载地址:Java毕业设计实战之在线高中考试系统的实现.pdf
留言与评论(共有 0 条评论) |