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

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

040023112402

050023112402

060023112402

070023112402

080023112402

532024473108

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

一、项目简述

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

二、项目运行

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
     */
@ResponseBody
@RequestMapping("/admin/user/resetPwd")
public Map<String, Object> restPwd(@RequestParam("id") Integer id) {
Map<String, Object> dataMap = new HashMap<>();
Boolean isSuccess = false;
if (id != null && id > 0) {
//根据id查询出用户
User user = userService.selectByPrimaryKey(id);
//开始重置密码,重置密码使用的Spring提供的工具类进行对密码123456进行加密
user.setPassword("123456");
//调用更新方法
int restPwd = userService.updateByPrimaryKey(user);
if (restPwd > 0) {
isSuccess = true;
dataMap.put("success", isSuccess);
return dataMap;
}
}
dataMap.put("success", isSuccess);
return dataMap;
}

}
package com.pengzhen.yixinli.controller.admin;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
        return "client/html/index";
}
return "admin/user/userList";
}

@ResponseBody
@RequestMapping("/admin/user/tableList")
public ServerLayResult userList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "keyword", defaultValue = "") String keyword) {
if (keyword == null || keyword.equals("")) {
//封装Json数据对象
ServerLayResult result = new ServerLayResult(0, "", userService.count(), userService.selectAll(page, limit));
return result;
} else if (keyword != null) {
ServerLayResult result = new ServerLayResult(0, "", userService.selectByUsername(keyword, page, limit).size(),
userService.selectByUsername(keyword, page, limit));
return result;
}
return null;
}

@ResponseBody
@RequestMapping("/admin/user/del")
public Map<String, Object> del(@RequestParam("id") Integer id) {
Map<String, Object> dataMap = new HashMap<>();
Boolean isSuccess = false;
if (id != null && id != 0) {
int del = userService.deleteByPrimaryKey(id);
if (del > 0) {
isSuccess = true;
dataMap.put("success", isSuccess);
return dataMap;
}
}
dataMap.put("success", isSuccess);
return dataMap;
}

/**
* 更新用户信息
*
* @param user
* @return
*/
@ResponseBody
@RequestMapping(value = "/admin/user/update", method = RequestMethod.POST)
public Map<String, Object> updateUser(@RequestBody User user) {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42


/**
* 修改密码
*/
@Controller
public class UpdatePasswordController {

private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private UserService userService;

@RequestMapping("/updatePwdViwe")
public String updatePwd() {
if (!LoginSession.getCurrentUser().getUsername().equals("admin")) {
return "client/html/index";
}
return "admin/system/pwdUpdate";
}


@ResponseBody
@RequestMapping("/admin/sysPwd/update")
public Map<String, Object> updatePwd(@RequestBody JSONObject json) {
Map<String, Object> dataMap = new HashMap<>();
boolean isSuccess = false;
JSONObject data = JSON.parseObject(json.toJSONString());
String oldPassword = data.getString("oldPassword");
String password = data.getString("password");
String repassword = data.getString("repassword");
logger.info("====>" + oldPassword + "--" + password + "--" + repassword);
//这里默认只能修改管理员密码
User byUsername = userService.getByUsername(LoginSession.getCurrentUser().getUsername());

logger.info("---->" + byUsername);
if (byUsername != null) {
//校验旧密码是否正确
if (!byUsername.getPassword().equals(oldPassword)) {
dataMap.put("scueess", isSuccess);
return dataMap;
}
//校验两次输入的密码是否匹配
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 */
@ResponseBody
@RequestMapping("/admin/notice/list")
public ServerLayResult<Notice> list(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
String keyword1, String keyword2) {
logger.info("" + keyword1 + "---->" + keyword2);
if (keyword1 != null && keyword1 != "" || keyword2 != null && keyword2 != "") {
List<Notice> notices = noticeService.selectByKeyWord(page, limit, keyword1, keyword2);
ServerLayResult result = new ServerLayResult(0, "", notices.size(), notices);
return result;
}
//封装数据
ServerLayResult result = new ServerLayResult(0, "", noticeService.count(), noticeService.selectAll(page, limit));
return result;
}


/**
* 根据ID删除公告
*
* @param id
* @return
*/
@ResponseBody
@RequestMapping("/admin/notice/del")
public Map<String, Object> delNotice(@RequestParam("id") int id) {
Map<String, Object> dataMap = new HashMap<>();
boolean isSuccess = noticeService.deleteByPrimaryKey(id);
dataMap.put("success", isSuccess);
return dataMap;
}


/**
* 更新公告
*
* @param notice
* @return
*/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33


/**
* 修改密码
*/
@Controller
public class UpdatePasswordController {

private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private UserService userService;

@RequestMapping("/updatePwdViwe")
public String updatePwd() {
if (!LoginSession.getCurrentUser().getUsername().equals("admin")) {
return "client/html/index";
}
return "admin/system/pwdUpdate";
}


@ResponseBody
@RequestMapping("/admin/sysPwd/update")
public Map<String, Object> updatePwd(@RequestBody JSONObject json) {
Map<String, Object> dataMap = new HashMap<>();
boolean isSuccess = false;
JSONObject data = JSON.parseObject(json.toJSONString());
String oldPassword = data.getString("oldPassword");
String password = data.getString("password");
String repassword = data.getString("repassword");
logger.info("====>" + oldPassword + "--" + password + "--" + repassword);
//这里默认只能修改管理员密码
User byUsername = userService.getByUsername(LoginSession.getCurrentUser().getUsername());
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
        User byUsername = userService.getByUsername(LoginSession.getCurrentUser().getUsername());

logger.info("---->" + byUsername);
if (byUsername != null) {
//校验旧密码是否正确
if (!byUsername.getPassword().equals(oldPassword)) {
dataMap.put("scueess", isSuccess);
return dataMap;
}
//校验两次输入的密码是否匹配
if (!password.equals(repassword)) {
dataMap.put("scueess", isSuccess);
return dataMap;
}
//更新数据库密码
//创建用户对象
User user = new User();
user.setId(byUsername.getId());
user.setUsername(byUsername.getUsername());
user.setPassword(password);
user.setAddress(byUsername.getAddress());
user.setEmail(byUsername.getEmail());
user.setPhone(byUsername.getPhone());
user.setTocheck(byUsername.getTocheck());
user.setUserType(byUsername.getUserType());
user.setName(byUsername.getName());
if (userService.updateByPrimaryKey(user) > 0) {
isSuccess = true;
dataMap.put("success", isSuccess);
return dataMap;
}
}
dataMap.put("success", isSuccess);
return dataMap;
}
}
package com.pengzhen.yixinli.controller.admin;


项目链接:
https://javayms.github.io?id=531422272105200bv
https://javayms.pages.dev?id=531422272105200bv