功能:
学生信息 班级 专业 学号 姓名 在线考试 成绩查询 个人信息 密码修改 教师管理 教师编号 姓名 所教科目 题库管理 单选题 多选题 填空题 判断题,简答题(人工阅卷) 试卷管理 新建试卷 在试库中选择试题 试卷设置 发布试卷 考试管理 发布考试计划 学生考试 自动阅卷 人工阅卷 个人信息 密码修改 管理员 学生管理 教师管理 管理员管理 院系管理 班级管理 个人信息 密码修改。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
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"));
}
@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);
}
}
统一管理学生 教师 管理员信息 :
/**
* 统一管理学生 教师 管理员信息
*/
@RestController
public class UserController {
统一管理学生 教师 管理员信息 :
/**
* 统一管理学生 教师 管理员信息
*/
@RestController
public class UserController {
@Resource(name = "userService")
private IUserService userService;
/**
* 查询用户信息
* 先判断用户类型 在查询用户信息
*/
@RequestMapping(value = "/user/qryUserInfo", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public Result<User> qryUserInfo() {
return userService.qryUserInfo();
}
/**
* 更新用户信息
*/
@RequestMapping(value = "/user/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public Result<User> update(HttpRequest request) {
User user = new User();
user.setUserId(request.getString("user_id"));
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;
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);
}
/**
* 退出系统
* 统一管理学生 教师 管理员信息
*/
@RestController
public class UserController {
@Resource(name = "userService")
private IUserService userService;
/**
* 查询用户信息
* 先判断用户类型 在查询用户信息
*/
@RequestMapping(value = "/user/qryUserInfo", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public Result<User> qryUserInfo() {
return userService.qryUserInfo();
}
/**
* 更新用户信息
*/
@RequestMapping(value = "/user/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public Result<User> update(HttpRequest request) {
*/
@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"));
}
*/
@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);
}
}
统一管理学生 教师 管理员信息 :
/**
* 统一管理学生 教师 管理员信息
*/
@RestController
public class UserController {
@Resource(name = "userService")
private IUserService userService;
/**
* 查询用户信息
* 先判断用户类型 在查询用户信息
*/
@RequestMapping(value = "/user/qryUserInfo", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public Result<User> qryUserInfo() {
return userService.qryUserInfo();
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 DepartmentController {
@Resource(name = "departmentService")
private IDepartmentService departmentService;
/**
* 查询所有院系
*/
@RequestMapping(value = "/department/qryAllList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})