基于javaweb的SpringBoot前后端分离疫情防疫平台设计和实现(java+springmvc+vue+node.js+mybatis+mysql+springboot+maven)

运行环境

Java≥8、MySQL≥5.7、Node.js≥14

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可

❗没学过node.js的不要搞前后端分离项目

适用

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

功能说明

240123052402

250123052402

270123052402

280123052402

290123052402

300123052402

310123052402

320123052402

330123052402

340123052402

350123052402

360123052402

380123052402

390123052402

400123052402

410123052402

420123052402

基于javaweb的SpringBoot前后端分离疫情防疫平台设计和实现(java+springmvc+vue+node.js+mybatis+mysql+springboot+maven)

主要技术:Java、springmvc、VUE、node.js、mybatis、mysql、jquery、layui、bootstarp、JavaScript、html、css、jsp、log4j等一些常见的基本技术。 主要模块功能有:

管理员用户登录:用户登录。

用户信息: 用户信息数据的列表查看、修改和删除、用户绑定角色来显示对应的菜单显示。

角色管理:角色信息数据的列表查看、修改和删除、每个角色可以设置不同菜单显示、超级管理员拥有最高权限。

菜单管理: 菜单信息数据的列表查看、修改和删除、可以通过用户角色来设置

菜单权限:根据用户绑定角色、角色绑定菜单显示、以及基础菜单的添加、修改和删除操作。

实时疫情状态:通过echarts图标来模拟实现数据驱动标识、实时显示疫情分布图和感染人员信息等。

历史行程管理:每日登记管理:外出报备管理:复工申请管理:审核信息管理:

通知公告管理:管理员发布一些通知公告信息以及管理查看等

这个系统主要功能截图如下:

登录之后进入系统首页:目前系统主要功能如下

用户管理模块:用户添加、修改、删除、查询等基本操作

角色管理模块、通过用户绑定角色、角色控制菜单显示、灵活控制菜单。

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
	/**
* 修改角色
*/
@SysLog("修改角色")
@PostMapping("/update")
@RequiresPermissions("sys:role:update")
public R update(@RequestBody SysRoleEntity role){
ValidatorUtils.validateEntity(role);

role.setCreateUserId(getUserId());
sysRoleService.update(role);

return R.ok();
}

/**
* 删除角色
*/
@SysLog("删除角色")
@PostMapping("/delete")
@RequiresPermissions("sys:role:delete")
public R delete(@RequestBody Long[] roleIds){
sysRoleService.deleteBatch(roleIds);

return R.ok();
}
}
/**
* .
*
* Thm
*
* !
*/

package io.renren.modules.sys.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
    @ApiOperation("登录")
public R login(@RequestBody LoginForm form){
//表单校验
ValidatorUtils.validateEntity(form);

//用户登录
long userId = userService.login(form);

//生成token
String token = jwtUtils.generateToken(userId);

Map<String, Object> map = new HashMap<>();
map.put("token", token);
map.put("expire", jwtUtils.getExpire());

return R.ok(map);
}

}
/**
* .
*
* ToworkApply
*
* !
*/

package io.renren.modules.sys.controller;



@RestController
@RequestMapping("/sys/toworkApply")
public class ToworkApplyController extends AbstractController {
@Autowired
private ToworkApplyService ToworkApplyService;

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
 * 保存云存储配置信息
*/
@PostMapping("/saveConfig")
@RequiresPermissions("sys:oss:all")
public R saveConfig(@RequestBody CloudStorageConfig config){
//校验类型
ValidatorUtils.validateEntity(config);

if(config.getType() == Constant.CloudService.QINIU.getValue()){
//校验七牛数据
ValidatorUtils.validateEntity(config, QiniuGroup.class);
}else if(config.getType() == Constant.CloudService.ALIYUN.getValue()){
//校验阿里云数据
ValidatorUtils.validateEntity(config, AliyunGroup.class);
}else if(config.getType() == Constant.CloudService.QCLOUD.getValue()){
//校验腾讯云数据
ValidatorUtils.validateEntity(config, QcloudGroup.class);
}

sysConfigService.updateValueByKey(KEY, new Gson().toJson(config));

return R.ok();
}


/**
* 上传文件
*/
@PostMapping("/upload")
@RequiresPermissions("sys:oss:all")
public R upload(@RequestParam("file") MultipartFile file) throws Exception {
if (file.isEmpty()) {
throw new RRException("上传文件不能为空");
}

//上传文件
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
String url = OSSFactory.build().uploadSuffix(file.getBytes(), suffix);

//保存文件信息
SysOssEntity ossEntity = new SysOssEntity();
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
	Object result = point.proceed();
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;

//保存日志
saveSysLog(point, time);

return result;
}

private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();

SysLogEntity sysLog = new SysLogEntity();
SysLog syslog = method.getAnnotation(SysLog.class);
if(syslog != null){
//注解上的描述
sysLog.setOperation(syslog.value());
}

//请求的方法名
String className = joinPoint.getTarget().getClass().getName();
String methodName = signature.getName();
sysLog.setMethod(className + "." + methodName + "()");

//请求的参数
Object[] args = joinPoint.getArgs();
try{
String params = new Gson().toJson(args);
sysLog.setParams(params);
}catch (Exception e){

}

//获取request
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
//设置IP地址
sysLog.setIp(IPUtils.getIpAddr(request));

//用户名
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
sysLog.setUsername(username);

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

//获取图片验证码
BufferedImage image = sysCaptchaService.getCaptcha(uuid);

ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
IOUtils.closeQuietly(out);
}

/**
* 登录
*/
@PostMapping("/sys/login")
public Map<String, Object> login(@RequestBody SysLoginForm form)throws IOException {
boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
// if(!captcha){
// return R.error("验证码不正确");
// }

//用户信息
SysUserEntity user = sysUserService.queryByUserName(form.getUsername());

//账号不存在、密码错误
if(user == null || !user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) {
return R.error("账号或密码不正确");
}

//账号锁定
if(user.getStatus() == 0){
return R.error("账号已被锁定,请联系管理员");
}

//生成token,并保存到数据库
R r = sysUserTokenService.createToken(user.getUserId());
return r;
}


/**
* 退出
*/
@PostMapping("/sys/logout")
public R logout() {
sysUserTokenService.logout(getUserId());
return R.ok();
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
52
53
    if(StringUtils.isBlank(token)){
return null;
}

return new OAuth2Token(token);
}

@Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
if(((HttpServletRequest) request).getMethod().equals(RequestMethod.OPTIONS.name())){
return true;
}

return false;
}

@Override
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
//获取请求token,如果token不存在,直接返回401
String token = getRequestToken((HttpServletRequest) request);
if(StringUtils.isBlank(token)){
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());

String json = new Gson().toJson(R.error(HttpStatus.SC_UNAUTHORIZED, "invalid token"));

httpResponse.getWriter().print(json);

return false;
}

return executeLogin(request, response);
}

@Override
protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) {
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setContentType("application/json;charset=utf-8");
httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
try {
//处理登录失败的异常
Throwable throwable = e.getCause() == null ? e : e.getCause();
R r = R.error(HttpStatus.SC_UNAUTHORIZED, throwable.getMessage());

String json = new Gson().toJson(r);
httpResponse.getWriter().print(json);
} catch (IOException e1) {

}

return false;


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