一、项目简述
功能包括: 管理员可以增删改查教材、教材商、入库教材、用户(用 户包括学生和教师)可以对教材商、教材进行。xcel的导入 导出操作。教师可以领取入库的教材,可以退还教材。学 生只能在对应的教师那里领取教材,并且可以退还教材、 查询自己已经领取的教材。并且对已领教材付款等等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Struts+Spring+Hibernate + html+ css + JavaScript + JQuery + Ajax等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
}
/**
* 管理员 查询院系列表
*/
@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"})
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));
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"));
*/
@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();
@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) {
/**
* 教师 完成评分
*/
@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})
}
/**
* 管理员 添加院系
*/
@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) {
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"));
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.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);