当前位置:   article > 正文

基于javaweb的在线心理测评系统设计和实现(java+springboot+ssm+mysql+jsp)_基于web的心理测评系统设计与实现

基于web的心理测评系统设计与实现

基于javaweb的在线心理测评系统设计和实现(java+springboot+ssm+mysql+jsp)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

20220519002745

20220519002746

20220519002748

20220519002749

20220519002750

基于javaweb+springboot的在线心理测评系统设计和实现(java+Springboot+ssm+mysql+jsp+maven)

一、项目简述

本系统主要实现的功能有: 在线测评,在线留言,在线文章浏览。,在线公告,后台 评论管理,用户管理,测评管理,分值管理,测评结果查 询等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: Springboot+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + maven等等

登录控制层:

@RestController

public class LoginController {

@Resource(name = “loginService”)

private ILoginService loginService;

/**

  • 用户登录调用 在登陆成功生成两个token 同时返回各自首页

*/

@RequestMapping(value = “/login/login”, method = RequestMethod.POST, produces = {“application/json;charset=UTF-8”})

public Result 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 check() {

return new Result<>();

/**

  • token 续约

*/

@RequestMapping(value = “/login/refresh”, method = RequestMethod.POST, produces = {“application/json;charset=UTF-8”})

public Result 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 exit(HttpRequest request) {

String urlId = request.getString(“url_id”);

if (StringUtils.isNotEmpty(urlId)) {

TokenCache.getInstance().remove(urlId);

return new Result<>();

管理员和用户信息控制层:

/**

  • 管理员信息

*/

@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 qryUserInfo() {

return userService.qryUserInfo();

/**

  • 更新用户信息

*/

@RequestMapping(value = “/user/update”, method = RequestMethod.POST, produces = {“application/json;charset=UTF-8”})

public Result update(HttpRequest request) {

User user = new User();

user.setUserId(request.getString(“user_id”));

user.setName(request.getString(“name”));

user.setSex(request.getInteger(“sex”));

user.setType(User.UserType.get(request.getInteger(“type”)));

return userService.update(user, ImageUtil.stringToBytes(request.getString(“user_image”)));

/**

  • 更新用户密码

*/

@RequestMapping(value = “/user/updatePwd”, method = RequestMethod.POST, produces = {“application/json;charset=UTF-8”})

public Result updatePwd(HttpRequest request) {

return userService.updatePwd(request.getString(“old_pwd”), request.getString(“pwd”));

管理员控制层:

/**

  • 管理员控制器

*/

@RestController

public class AdminController {

@Resource(name = “adminService”)

private IAdminService adminService;

/**

  • 管理员 查询管理员列表

*/

@RequestMapping(value = “/admin/qryPage”, method = RequestMethod.POST, produces = {“application/json;charset=UTF-8”})

@RoleAnnotation(types = {RoleEnum.admin})

public ListResult 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 adminService.qryPage(param, pageNo, pageSize);

/**

  • 管理员 添加管理员

*/

@RequestMapping(value = “/admin/add”, method = RequestMethod.POST, produces = {“application/json;charset=UTF-8”})

@RoleAnnotation(types = {RoleEnum.admin})

public Result insert(HttpRequest request) {

Admin admin = new Admin();

admin.setLoginName(request.getString(“login_name”));

admin.setName(request.getString(“admin_name”));

admin.setPwd(request.getString(“login_name”));

admin.setSex(request.getInteger(“sex”));

admin.setUpdateTime(new Date());

return adminService.insert(admin, ImageUtil.stringToBytes(request.getString(“admin_image”)));

/**

  • 管理员 更新管理员

*/

@RequestMapping(value = “/admin/update”, method = RequestMethod.POST, produces = {“application/json;charset=UTF-8”})

@RoleAnnotation(types = {RoleEnum.admin})

public Result update(HttpRequest request) {

Admin admin = new Admin();

admin.setLoginName(request.getString(“login_name”));

admin.setName(request.getString(“admin_name”));

admin.setPwd(request.getString(“login_name”));

admin.setSex(request.getInteger(“sex”));

admin.setUpdateTime(new Date());

return adminService.update(admin, ImageUtil.stringToBytes(request.getString(“admin_image”)));

/**

  • 管理员 删除管理员

*/

@RequestMapping(value = “/admin/del”, method = RequestMethod.POST, produces = {“application/json;charset=UTF-8”})

@RoleAnnotation(types = {RoleEnum.admin})

public Result del(HttpRequest request) {

List adminIdList = new ArrayList<>();

JSONArray array = request.getJSONArray(“admin_id_list”);

for (int i = 0; i < array.size(); i++) {

adminIdList.add(array.getString(i));

return adminService.del(adminIdList);


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/366404?site
推荐阅读
相关标签
  

闽ICP备14008679号