运行环境说明
jdk版本:1.8 及以上
ide工具:IDEA ,微信小程序开发工具
数据库: mysql5.7 (必须5.7)
编程语言: Java
tomcat: 8.0 及以上
java框架:SSM
maven: 3.6.1
前端:layui ,微信
详细技术:HTML+CSS+JS+JSP+JAVA+SSM+MYSQL+JQUERY+MAVEN+微信开发工具
用户微信端的主要功能有:
1.用户注册和登陆系统
2.查看系统的公告信息
3.查看自习室列表,查看自习室详情,收藏自习室
4.在线预定自习室,可以选择自习室的座位,对自习室进行评价
5.预定自习室提交订单,在线支付
6.用户个人中心修改个人资料,查看我的收藏,我的订单
7.可以对完成的订单进行评价
8.退出登陆
管理员的主要功能有:
1.管理员输入账户登陆后台
2.个人中心:管理员修改密码和账户信息
3.用户管理:对注册的用户信息进行添加,删除,修改,查询
4.自习室管理:对系统的自习室信息进行添加,修改,删除,查询
5.公告管理:对自习室的公告进行添加,修改,删除,查询
6.轮播图管理:对系统轮播图进行添加,修改,查询,删除
12.订单管理:查看用户在线预约的自习室座位订单信息
13.退出系统
具体实现截图
详细视频演示
请联系我获取更详细的演示视频
代码参考
@IgnoreAuth @PostMapping(value = "/login") public R login(String username, String password, String captcha, HttpServletRequest request) { UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username)); if(user==null || !user.getPassword().equals(password)) { return R.error("账号或密码不正确"); } String token = tokenService.generateToken(user.getId(),username, "users", user.getRole()); return R.ok().put("token", token); } @Override public String generateToken(Long userid,String username, String tableName, String role) { TokenEntity tokenEntity = this.selectOne(new EntityWrapper<TokenEntity>().eq("userid", userid).eq("role", role)); String token = CommonUtil.getRandomString(32); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.HOUR_OF_DAY, 1); if(tokenEntity!=null) { tokenEntity.setToken(token); tokenEntity.setExpiratedtime(cal.getTime()); this.updateById(tokenEntity); } else { this.insert(new TokenEntity(userid,username, tableName, role, token, cal.getTime())); } return token; } /** * 权限(Token)验证 */ @Component public class AuthorizationInterceptor implements HandlerInterceptor { public static final String LOGIN_TOKEN_KEY = "Token"; @Autowired private TokenService tokenService; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { //支持跨域请求 response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization"); response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); // 跨域时会首先发送一个OPTIONS请求,这里我们给OPTIONS请求直接返回正常状态 if (request.getMethod().equals(RequestMethod.OPTIONS.name())) { response.setStatus(HttpStatus.OK.value()); return false; } IgnoreAuth annotation; if (handler instanceof HandlerMethod) { annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class); } else { return true; } //从header中获取token String token = request.getHeader(LOGIN_TOKEN_KEY); /** * 不需要验证权限的方法直接放过 */ if(annotation!=null) { return true; } TokenEntity tokenEntity = null; if(StringUtils.isNotBlank(token)) { tokenEntity = tokenService.getTokenEntity(token); } if(tokenEntity != null) { request.getSession().setAttribute("userId", tokenEntity.getUserid()); request.getSession().setAttribute("role", tokenEntity.getRole()); request.getSession().setAttribute("tableName", tokenEntity.getTablename()); request.getSession().setAttribute("username", tokenEntity.getUsername()); return true; } PrintWriter writer = null; response.setCharacterEncoding("UTF-8"); response.setContentType("application/json; charset=utf-8"); try { writer = response.getWriter(); writer.print(JSONObject.toJSONString(R.error(401, "请先登录"))); } finally { if(writer != null){ writer.close(); } } // throw new EIException("请先登录", 401); return false; } }