基于javaweb的SpringBoot大学生兼职系统(java+springboot+html+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

030023462402

040023462402

050023462402

060023462402

070023462402

080023462402

基于javaweb的SpringBoot大学生兼职系统(java+springboot+html+maven+mysql)

环境要求:

JDK8 mysql 5.7 maven eclipse/idea

关于数据库导入 在mysql中创建数据库test,然后在数据库下执行sql文件,即parttimeplatform.sql

数据库相关配置: 打开application.yml文件,修改所有配置中数据库的ip地址、端口号、username、password等;

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
@RequestMapping(value = "/list")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object list(String condition) {
List<Map<String, Object>> list = this.dictService.list(condition);
return super.warpObject(new DictWarpper(list));
}

/**
* 字典详情
*/
@RequestMapping(value = "/detail/{dictId}")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object detail(@PathVariable("dictId") Integer dictId) {
return dictService.selectById(dictId);
}

/**
* 修改字典
*/
@BussinessLog(value = "修改字典", key = "dictName,dictValues", dict = DictMap.class)
@RequestMapping(value = "/update")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object update(Integer dictId, String dictCode, String dictName, String dictTips, String dictValues) {
if (ToolUtil.isOneEmpty(dictId, dictCode, dictName, dictValues)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
dictService.editDict(dictId, dictCode, dictName, dictTips, dictValues);
return SUCCESS_TIP;
}

/**
* 删除字典记录
*/
@BussinessLog(value = "删除字典记录", key = "dictId", dict = DictMap.class)
@RequestMapping(value = "/delete")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object delete(@RequestParam Integer dictId) {

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
        throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
User user = this.userService.selectById(userId);
model.addAttribute(user);
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
LogObjectHolder.me().set(user);
return PREFIX + "user_view.html";
}

/**
* 跳转到修改密码界面
*/
@RequestMapping("/user_chpwd")
public String chPwd() {
return PREFIX + "user_chpwd.html";
}

/**
* 修改当前用户的密码
*/
@RequestMapping("/changePwd")
@ResponseBody
public Object changePwd(@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) {
if (!newPwd.equals(rePwd)) {
throw new ServiceException(BizExceptionEnum.TWO_PWD_NOT_MATCH);
}
Integer userId = ShiroKit.getUser().getId();
User user = userService.selectById(userId);
String oldMd5 = ShiroKit.md5(oldPwd, user.getSalt());
if (user.getPassword().equals(oldMd5)) {
String newMd5 = ShiroKit.md5(newPwd, user.getSalt());
user.setPassword(newMd5);
user.updateById();
return SUCCESS_TIP;
} else {
throw new ServiceException(BizExceptionEnum.OLD_PWD_NOT_RIGHT);
}
}

/**
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

/**
* 全局的的异常拦截器(拦截所有的控制器)(带有@RequestMapping注解的方法上都会拦截)
*
*/
@ControllerAdvice
@Order(-1)
public class GlobalExceptionHandler {

private Logger log = LoggerFactory.getLogger(this.getClass());

/**
* 拦截业务异常
*/
@ExceptionHandler(ServiceException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public ErrorResponseData bussiness(ServiceException e) {
LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e));
getRequest().setAttribute("tip", e.getMessage());
log.error("业务异常:", e);
return new ErrorResponseData(e.getCode(), e.getMessage());
}

/**
* 用户未登录异常
*/
@ExceptionHandler(AuthenticationException.class)
@ResponseStatus(HttpStatus.UNAUTHORIZED)
public String unAuth(AuthenticationException e) {
log.error("用户未登陆:", e);
return "/login.html";
}

/**
* 账号被冻结异常
*/
@ExceptionHandler(DisabledAccountException.class)
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
49
50
51
@RequestMapping(value = "/add")
@BussinessLog(value = "菜单新增", key = "name", dict = MenuDict.class)
@ResponseBody
public ResponseData add(@Valid Menu menu, BindingResult result) {
if (result.hasErrors()) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}

//判断是否存在该编号
String existedMenuName = ConstantFactory.me().getMenuNameByCode(menu.getCode());
if (ToolUtil.isNotEmpty(existedMenuName)) {
throw new ServiceException(BizExceptionEnum.EXISTED_THE_MENU);
}

//设置父级菜单编号
menuSetPcode(menu);

menu.setStatus(MenuStatus.ENABLE.getCode());
this.menuService.insert(menu);
return SUCCESS_TIP;
}

/**
* 删除菜单
*/
@Permission(Const.ADMIN_NAME)
@RequestMapping(value = "/remove")
@BussinessLog(value = "删除菜单", key = "menuId", dict = MenuDict.class)
@ResponseBody
public ResponseData remove(@RequestParam Long menuId) {
if (ToolUtil.isEmpty(menuId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}

//缓存菜单的名称
LogObjectHolder.me().set(ConstantFactory.me().getMenuName(menuId));

this.menuService.delMenuContainSubMenus(menuId);
return SUCCESS_TIP;
}

/**
* 查看菜单
*/
@RequestMapping(value = "/view/{menuId}")
@ResponseBody
public ResponseData view(@PathVariable Long menuId) {
if (ToolUtil.isEmpty(menuId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
this.menuService.selectById(menuId);
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

/**
* 删除字典记录
*/
@BussinessLog(value = "删除字典记录", key = "dictId", dict = DictMap.class)
@RequestMapping(value = "/delete")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object delete(@RequestParam Integer dictId) {

//缓存被删除的名称
LogObjectHolder.me().set(ConstantFactory.me().getDictName(dictId));

this.dictService.delteDict(dictId);
return SUCCESS_TIP;
}

}
/**
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.controller;

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
49
50
 */
@Permission
@RequestMapping("/user_edit/{userId}")
public String userEdit(@PathVariable Integer userId, Model model) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
assertAuth(userId);
User user = this.userService.selectById(userId);
model.addAttribute(user);
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
LogObjectHolder.me().set(user);
return PREFIX + "user_edit.html";
}

/**
* 跳转到查看用户详情页面
*/
@RequestMapping("/user_info")
public String userInfo(Model model) {
Integer userId = ShiroKit.getUser().getId();
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
User user = this.userService.selectById(userId);
model.addAttribute(user);
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
LogObjectHolder.me().set(user);
return PREFIX + "user_view.html";
}

/**
* 跳转到修改密码界面
*/
@RequestMapping("/user_chpwd")
public String chPwd() {
return PREFIX + "user_chpwd.html";
}

/**
* 修改当前用户的密码
*/
@RequestMapping("/changePwd")
@ResponseBody
public Object changePwd(@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) {
if (!newPwd.equals(rePwd)) {
throw new ServiceException(BizExceptionEnum.TWO_PWD_NOT_MATCH);
}


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