当前位置: 首页 > 编程日记 > 正文

Java项目:课程资源管理+在线考试平台(java+SSH+mysql+maven+tomcat)

源码获取:博客首页 "资源" 里下载!

一、项目简述

功能包括: 管理员可以增删改查教材、教材商、入库教材、用户(用 户包括学生和教师)可以对教材商、教材进行。xcel的导入 导出操作。教师可以领取入库的教材,可以退还教材。学 生只能在对应的教师那里领取教材,并且可以退还教材、 查询自己已经领取的教材。并且对已领教材付款等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Struts+Spring+Hibernate + html+ css + JavaScript + JQuery + Ajax等等。

登录控制层:

@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<>();}
}

考试管理控制器:

/*** 考试管理控制器*/
@RestController
public class ExamInfoController {@Resource(name = "examInfoService")private IExamInfoService examInfoService;/*** 教师 查询考试列表*/@RequestMapping(value = "/examinfo/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=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 examInfoService.qryPage(param, pageNo, pageSize);}/*** 教师 添加新的考试信息*/@RequestMapping(value = "/examinfo/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.teacher})public Result<ExamInfo> insert(HttpRequest request) {ExamInfo exam = new ExamInfo();exam.setTestPaperId(request.getInteger("test_paper_id"));exam.setClassId(request.getString("class_id"));exam.setState(1);exam.setTime(request.getInteger("time"));exam.setEffTime(DateUtils.toDate(request.getString("eff_time"), DateConst.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI));exam.setExpTime(DateUtils.toDate(request.getString("exp_time"), DateConst.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI));exam.setUpdateTime(new Date());return examInfoService.insert(exam);}/*** 教师 更新考试信息*/@RequestMapping(value = "/examinfo/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.teacher})public Result<ExamInfo> update(HttpRequest request) {ExamInfo exam = new ExamInfo();exam.setExamId(request.getInteger("exam_id"));exam.setTestPaperId(request.getInteger("test_paper_id"));exam.setClassId(request.getString("class_id"));exam.setState(1);exam.setTime(request.getInteger("time"));exam.setEffTime(DateUtils.toDate(request.getString("eff_time"), DateConst.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI));exam.setExpTime(DateUtils.toDate(request.getString("exp_time"), DateConst.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI));exam.setUpdateTime(new Date());exam.setUpdateTime(new Date());return examInfoService.update(exam);}/*** 教师 新建状态的考试信息可以删除*/@RequestMapping(value = "/examinfo/del", method = RequestMethod.POST, produces = {"application/json;charset=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 examInfoService.del(examIdList);}/*** 教师 发布考试信息*/@RequestMapping(value = "/examinfo/release", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.teacher})public Result<ExamInfo> updateState(HttpRequest request) {return examInfoService.release(request.getInteger("exam_id"));}/*** 学生 查询考试试题分组列表*/@RequestMapping(value = "/examinfo/qryExamQueGroupList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.student, RoleEnum.teacher})public Result<TestPaperQuestionGroup> qryExamQueGroupList(HttpRequest request) {return examInfoService.qryExamQueGroupList(request.getInteger("exam_id"));}/*** 学生 查询考试试题列表*/@RequestMapping(value = "/examinfo/qryExamQuestionList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.student})public Result<StudentExamQuestionRecord> qryExamQuestionList(HttpRequest request) {return examInfoService.qryExamQuestionList(request.getInteger("exam_id"), request.getString("student_id"), request.getInteger("question_group_id"));}/*** 教师 判卷查询试题列表*/@RequestMapping(value = "/examinfo/qryMarkQueList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.teacher})public Result<StudentExamQuestionRecord> qryMarkQueList(HttpRequest request) {return examInfoService.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;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.teacher})public Result<ExamInfo> updateQueScore(HttpRequest request) {StudentExamQuestionRecord record = new StudentExamQuestionRecord();record.setExamId(request.getInteger("exam_id"));record.setStudentId(request.getString("student_id"));record.setQuestionGroupId(request.getInteger("question_group_id"));record.setQuestionId(request.getLong("question_id"));record.setScore(request.getFloat("score"));record.setCorrect(request.getBoolean("correct"));return examInfoService.updateQueScore(record);}/*** 教师 完成评分*/@RequestMapping(value = "/examinfo/complete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.teacher})public Result<ExamInfo> complete(HttpRequest request) {return examInfoService.complete(request.getInteger("exam_id"),request.getString("student_id"));}}

院系管理控制器:

/*** 院系管理控制器*/
@RestController
public class DepartmentController {@Resource(name = "departmentService")private IDepartmentService departmentService;/*** 查询所有院系*/@RequestMapping(value = "/department/qryAllList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.admin})public ListResult<Department> qryAllList() {return departmentService.qryAllList();}/*** 管理员 查询院系列表*/@RequestMapping(value = "/department/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.admin})public ListResult<Department> 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("department_id")) {param.put("department_id", request.getString("department_id"));}if (request.containsKey("department_name")) {param.put("department_name", request.getString("department_name"));}return departmentService.qryPage(param, pageNo, pageSize);}/*** 管理员 添加院系*/@RequestMapping(value = "/department/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.admin})public Result<Department> insert(HttpRequest request) {Department department = new Department();department.setDepartmentId(request.getString("department_id"));department.setDepartmentName(request.getString("department_name"));department.setUpdateTime(new Date());return departmentService.insert(department);}/*** 管理员 更新院系*/@RequestMapping(value = "/department/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.admin})public Result<Department> update(HttpRequest request) {Department department = new Department();department.setDepartmentId(request.getString("department_id"));department.setDepartmentName(request.getString("department_name"));department.setUpdateTime(new Date());return departmentService.update(department);}/*** 管理员 删除院系*/@RequestMapping(value = "/department/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})@RoleAnnotation(types = {RoleEnum.admin})public Result<Department> del(HttpRequest request) {List<String> departmentIdList = new ArrayList<>();JSONArray array = request.getJSONArray("department_id_list");for (int i = 0; i < array.size(); i++) {departmentIdList.add(array.getString(i));}return departmentService.del(departmentIdList);}
}

源码获取:博客首页 "资源" 里下载!

相关文章:

python twisted 笔记

2019独角兽企业重金招聘Python工程师标准>>> 1.Twisted框架构建简单的C/S 要写一个基于twisted框架的服务器&#xff0c;你要实现事件处理器&#xff0c;它处理诸如一个新的客户端连接、新的数据到达和客户端连接中断等情况。 在Twisted中,你的事件处理器定义在一个…

决策树J48算法

1. J48原理 2. 举例 3. 总结 1. J48原理 基于从上到下的策略&#xff0c;递归的分治策略&#xff0c;选择某个属性放置在根节点&#xff0c;为每个可能的属性值产生一个分支&#xff0c;将实例分成多个子集&#xff0c;每个子集对应一个根节点的分支&#xff0c;然后在每个分支…

分布式系统 一致性模型的介绍 以及 zookeeper的 “线性一致性“ 讨论

文章目录1. 一致性 概览1.1 分布式系统的 “正确性”1.2 线性一致性(Linearizability)1.3 顺序一致性(Sequential consistency)1.4 因果一致性(Casual consistency)1.5 最终一致性(Eventual consistency)2. Zookeeper 的 “线性一致性” 问题3. 参考一致性算是分布式系统的定位…

Java项目:(小程序)全套商城系统(spring+spring mvc+mybatis+layui+微信小程)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 本系统功能包括: 商品模块: 商品添加、规格设置&#xff0c;商品上下架等 订单模块: 下单、购物车、支付&#xff0c;发货、收货、评 退款等 营销模块: 积分、优惠券、分销、砍价、拼团、秒 多…

【转】[退役]纪念我的ACM——headacher@XDU

转自&#xff1a;http://hi.baidu.com/headacher/item/5a2ce1d50609091b20e25022 退役了&#xff0c;是时候总结一下我ACM的生涯了。虽然很舍不得&#xff0c;但这段回忆很值得纪念。ACM生涯虽然结束&#xff0c;但是新生活总要继续&#xff0c;还有很多东西需要我去学习&#…

VMware扩大硬盘后修改Linux逻辑卷大小

一、背景随着业务的不断成熟&#xff0c;数据库积累的数据也越来越多了。前些天发现服务器的磁盘将要满了。因此向虚拟化管理员申请增加磁盘空间。由于这个系统是建立在威睿的vSphere平台上的&#xff0c;因此虚拟化管理员只简单地通过 VMware vSphere Client 扩大了磁盘空间&a…

axios与ajax区别

1.jQuery ajax $.ajax({ type: POST, url: url, data: data, dataType: dataType, success: function () {}, error: function () {}});优缺点&#xff1a; 本身是针对MVC的编程,不符合现在前端MVVM的浪潮基于原生的XHR开发&#xff0c;XHR本身的架构不清晰&#xff0c;已经有…

单机 “5千万以上“ 工业级 LRU cache 实现

文章目录前言工业级 LRU Cache1. 基本架构2. 基本操作2.1 insert 操作2.2 高并发下 insert 的一致性/性能 保证2.3 Lookup操作2.4 shard 对 cache Lookup 性能的影响2.4 Erase 操作2.5 内存维护3. 优化前言 近期做了很多 Cache 优化相关的事情&#xff0c;因为对存储引擎较为熟…

Java项目:校园人力人事资源管理系统(java+Springboot+ssm+mysql+jsp+maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 校园人力资源管理系统&#xff1a;学校部门管理&#xff0c;教室管理&#xff0c;学历信息管理&#xff0c;职务&#xff0c;教师职称&#xff0c;奖励&#xff0c;学历&#xff0c;社会关系&#xff0c;工作…

GPS部标平台的架构设计(十)-基于Asp.NET MVC构建GPS部标平台

在当前很多的GPS平台当中&#xff0c;有很多是基于asp.NETsiverlight开发的遗留项目&#xff0c;代码混乱而又难以维护&#xff0c;各种耦合和关联&#xff0c;要命的是界面也没见到比Javascript做的控件有多好看&#xff0c;随着需求的增多&#xff0c;平台已经臃肿不堪。 设计…

关于CSDN不给任何通知强制关闭我的6年博客,我深表痛心

关于CSDN不给任何通知强制关闭我的6年博客&#xff0c;我深表痛心。最近有很长一段时间没有去csdn博客了&#xff0c; 前几天去看的时候发现博客被封闭了。 我联系了管理员&#xff0c;但是没有得到任何回复。 我猜想&#xff0c;可能是不是我在博客文章里面加入 自己网站的网…

Vue 环境搭建(win10)

1.安装node node官网安装地址 推荐安装稳定版本&#xff08;LTS&#xff09;以及安装路径为系统盘&#xff08;C&#xff09; 查看node安装成功否 注释&#xff1a;以下命令使用 命令提示符&#xff08;管理员&#xff09;权限,win10 对user权限的限制了访问权限。node -v 查看…

Java项目:化妆品商城系统(java+Springboot+ssm+mysql+jsp+maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 本系统主要实现的功能有&#xff1a; 网上商城系统&#xff0c;前台后台管理&#xff0c;用户注册&#xff0c;登录&#xff0c;上架展示&#xff0c;分组展示&#xff0c;搜索&#xff0c;收…

python 绘图脚本系列简单记录

简单记录平时画图用到的python 便捷小脚本 1. 从单个文件输入 绘制坐标系图 #!/usr/bin/python # coding: utf-8 import matplotlib.pyplot as plt import numpy as np import matplotlib as mpl import sysfile_name1 sys.argv[1] data_title sys.argv[2] print(file_name1…

iOS-c语言小练习01

// // main.c // C&#xff0d;变量的地址 // // Created by cgq on 15/4/9. // Copyright (c) 2015年 cgq. All rights reserved. // #include <stdio.h> //访问变量的地址 void test1() { char a A; int b 44; printf("a的值&#xff1a;%d\n",a); pri…

蓝桥杯 【基础练习】 十六进制转八进制

问题描述给定n个十六进制正整数&#xff0c;输出它们对应的八进制数。输入格式输入的第一行为一个正整数n &#xff08;1<n<10&#xff09;。接下来n行&#xff0c;每行一个由0~9、大写字母A~F组成的字符串&#xff0c;表示要转换的十六进制正整数&#xff0c;每个十六进…

泛在网:泛在网

ylbtech-泛在网&#xff1a;泛在网泛在网络来源于拉丁语Ubiquitous&#xff0c;从字面上看就是广泛存在的&#xff0c;无所不在的网络。也就是人置身于无所不在的网络之中&#xff0c;实现人在任何时间、地点&#xff0c;使用任何网络与任何人与物的信息交换&#xff0c;基于个…

Mac 从Makefile 编译 Rocksdb 源码的一些注意事项

文章目录前言Makefile 编译流程1. 平台变量/环境变量的初始化。2. 编译需要的源码文件变量初始化。3. include 目录的设置。4. 编译的执行逻辑。问题记录1&#xff1a;可能的打包命令ar 失效问题5. 执行具体的编译指令问题记录2: jar 包编译前言 最近在Mac 本地编译Rocksdb 过…

Java项目:在线考试系统(单选,多选,判断,填空,简答题)(java+Springboot+ssm+mysql+html+maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 功能&#xff1a; 学生信息 班级 专业 学号 姓名 在线考试 成绩查询 个人信息 密码修改 教师管理 教师编号 姓名 所教科目 题库管理 单选题 多选题 填空题 判断题&#xff0c;简答题&#xff08;人工…

看了极光推送技术原理的几点思考

看了极光推送技术原理的几点思考 分类&#xff1a; android2012-11-26 20:50 16586人阅读 评论(18) 收藏 举报目录(?)[] 移动互联网应用现状 因为手机平台本身、电量、网络流量的限制&#xff0c;移动互联网应用在设计上跟传统 PC 上的应用很大不一样&#xff0c;需要根据手机…

查询远程或本地计算机的登录账户

用下面这个函数能获取远程或本地电脑的当前登录用户&#xff0c;同时附加了它的计算机名&#xff0c;所以当你查询多台电脑时将知道结果从哪里来。function Get-LoggedOnUser {param([String[]]$ComputerName $env:COMPUTERNAME)$ComputerName | ForEach-Object {(quser /SERV…

LIS ZOJ - 4028

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode4028 memset超时 这题竟然是一个差分约束 好吧呢 对于每一个a[i], l < a[i] < r 那么设一个源点s 使 l < a[i] - s < r 是不是就能建边了 然后对于每一个f[i] 如果前面有一个相等的f[j] 则肯定 a[i…

存储引擎 K/V 分离下的index回写问题

前言 近期在做on nvme hash引擎相关的事情&#xff0c;对于非全序的数据集的存储需求&#xff0c;相比于我们传统的LSM或者B-tree的数据结构来说 能够减少很多维护全序上的计算/存储资源。当然我们要保证hash场景下的高写入能力&#xff0c;append-only 还是比较友好的选择。 …

经典贪心法:时间序列问题及其全局最优性证明

贪心算法是指在对问题求解时&#xff0c;总做出在当前看来是最好的选择。也就是说&#xff0c;不从整体上加以考虑&#xff0c;它所作出的仅仅是在某种意义上的局部最优解。一旦贪心算法求出了一个可行解&#xff0c;就要确定这个算法是否找到了最优解。为此&#xff0c;要么证…

Java项目:在线水果商城系统(java+JSP+Spring+SpringMVC +MyBatis+html+mysql)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 功能&#xff1a; 区分为管理员用户和普通用户&#xff0c;普通用户&#xff1a;用户注册登录&#xff0c;首页水果展示&#xff0c;商品分类展示&#xff0c;购物车添加&#xff0c;下单&…

曲苑杂坛--收缩数据库文件

很多人在删除大量数据后收缩数据库&#xff0c;却发现没法收缩到预期效果。 由于使用DBCC SHRINKFILE来收缩数据文件时&#xff0c;是针对数据区来收缩&#xff0c;因此可以先使用DBCC SHOWFILESTATS来查看文件中未使用的分区数(TotalExtents-UsedExtents)&#xff0c;如果删除…

python字典去重

今天实习的web大表哥说帮我看环境不过前提是要我帮他写个python合并列表的demo,大概思路就是利用zip库进行keys和values的遍历&#xff0c;然后在输出就行key1{name1:小明,name2:小红} key2{小明:[men,20],小红:[women,30]} for k,v in zip(key1.values(),key1.keys()):for i, …

关于 线程模型中经常使用的 __sync_fetch_and_add 原子操作的性能

最近从 kvell 这篇论文中看到一些单机存储引擎的优秀设计&#xff0c;底层存储硬件性能在不远的未来可能不再是主要的性能瓶颈&#xff0c;反而高并发下的CPU可能是软件性能的主要限制。像BPS/AEP/Optane-SSD 等Intel 推出的硬件存储栈已经能够在延时上接近DRAM的量级&#xff…

R 语言爬虫 之 cnblog博文爬取

Cnbolg Crawl a). 加载用到的R包 ##library packages needed in this case library(proto) library(gsubfn) ## Warning in doTryCatch(return(expr), name, parentenv, handler): 无法载入共享目标对象‘/Library/Frameworks/R.framework/Resources/modules//R_X11.so’&#…

Java项目:宿舍管理系统(java+jsp+SSM+Spring+mysql)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 功能&#xff1a;包括学生管理&#xff0c;班级管理&#xff0c;宿舍管理&#xff0c;人员信息维 护。维修登记&#xff0c;卫生管理&#xff0c;访客管理等等。 二、项目运行 环境配置&am…