一、项目简述
功能:卡管理,卡消费,卡充值,图书借阅,消费,记录,注销等等功能。
二、项目运行
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP + Servlet + html+ css + JavaScript + JQuery + Ajax 等等
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
}/*** 角色修改表单提交处理* @param request* @param role* @return*/@RequestMapping(value="/edit",method=RequestMethod.POST)@ResponseBodypublic Result<Boolean> edit(Role role){//用统一验证实体方法验证是否合法CodeMsg validate = ValidateEntityUtil.validate(role);Code() != Code()){(validate);}Role existRole = roleService.Id());if(existRole == null){
return "redirect:update_userinfo";}/*** 修改密码页面* @return*/@RequestMapping(value="/update_pwd",method=RequestMethod.GET)public String updatePwd(){return "admin/system/update_pwd";}/*** 修改密码表单提交* @param oldPwd* @param newPwd* @return*/
model.addAttribute("userTotal", al());model.addAttribute("operatorLogTotal", al());model.addAttribute("databaseBackupTotal", al());model.addAttribute("onlineUserTotal", lineUserCount);return "admin/system/index";}/*** 注销登录* @return*/@RequestMapping(value="/logout")public String logout(){Integer loginType = (Integer) ("loginType");if(loginType == Code()){User loginedUser = LoginedUser();if(loginedUser != null){
modelMap.addAttribute("user", user);return "user/edit";}//查询所有@PostMapping("/query")@ResponseBodypublic Map<String, Object> query(@RequestBody User user) {List<User> list = userService.query(user);Integer count = unt(user);Instance().success().page(list, count).getMap();}//跳转列表页面@GetMapping("/list")public String list() {return "user/list";}
}
登录控制层:
@Controller
public class LoginController {@Autowiredprivate UserService userService;@Autowired
@PostMapping("/login")@ResponseBodypublic Map<String, Object> login(String userName, String password, String captcha, String type, HttpSession session) {//判断用户名、密码、用户类型、验证码是否为空if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password) || StringUtils.isEmpty(captcha) || StringUtils.isEmpty(type)) {Instance().error("用户名或密码不能为空").getMap();}//获取系统生成的验证码String _captcha = (String) Attribute("captcha");//先判断验证码是否正确if (!(LowerCase()).equals(_LowerCase())) {//验证码错误Instance().error("验证码错误").getMap();}//判断用户类型if ("1".equals(type)) { //管理员验证登录User user = userService.login(userName, MD5(password)); //对密码进行加密处理,因为数据库中存储的是加密后的密码if (user != null) {session.setAttribute("user", user);session.setAttribute("type", 1);Instance().success().add("data", user).getMap();} else {Instance().error("用户名或密码错误").getMap();
Session().setAttribute("loginType",type);//销毁session中的验证码Session().setAttribute("admin_login", null);//将登陆记录写入日志库operaterLogService.add("用户【"+username+"】于【" + FormatterDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "】登录系统!");log.info("员工成功登录,user = " + byJobNumber);}return Result.success(true);}/*** 登录成功后的系统主页* @param model* @return*/@RequestMapping(value="/index")public String index(Model model){model.addAttribute("operatorLogs", operaterLogService.findLastestLog(10));model.addAttribute("userTotal", al());model.addAttribute("operatorLogTotal", al());model.addAttribute("databaseBackupTotal", al());model.addAttribute("onlineUserTotal", lineUserCount);return "admin/system/index";
@Autowiredprivate MenuService menuService;@Autowiredprivate OperaterLogService operaterLogService;@Autowiredprivate RoleService roleService;/*** 分页搜索角色列表* @param model* @param role* @param pageBean* @return*/@RequestMapping(value="/list")public String list(Model model,Role role,PageBean<Role> pageBean){model.addAttribute("title", "角色列表");model.addAttribute("name", Name());model.addAttribute("pageBean", roleService.findByName(role, pageBean));return "admin/role/list";}
orderAuth.setOrderSn(orderSn);orderAuth.setPhone(phone);orderAuthService.save(orderAuth);AppConfig.ORDER_AUTH = 1;return Result.success(true);}/*** 删除操作日志,可删除多个* @param ids* @return*/@RequestMapping(value="/delete_operator_log",method=RequestMethod.POST)@ResponseBodypublic Result<Boolean> delete(String ids){
if(newPwd.length()<4 || newPwd.length()>32){(CodeMsg.ADMIN_USER_PWD_LENGTH_ERROR);}loginedUser.setPassword(newPwd);//保存数据库userService.save(loginedUser);//更新sessionSessionUtil.set(SessionConstant.SESSION_USER_LOGIN_KEY, loginedUser);}else{Staff loginedStaff = LoginedStaff();Staff staff = staffService.Id());if(!Password().equals(oldPwd)){(CodeMsg.ADMIN_USER_UPDATE_PWD_ERROR);}if(StringUtils.isEmpty(newPwd)){(CodeMsg.ADMIN_USER_UPDATE_PWD_EMPTY);}staff.setPassword(newPwd);CodeMsg codeMsg = ValidateEntityUtil.validate(staff);if (Code() != Code()){(codeMsg);}
* 清空整个日志* @return*/@RequestMapping(value="/delete_all_operator_log",method=RequestMethod.POST)@ResponseBodypublic Result<Boolean> deleteAll(){operaterLogService.deleteAll();return Result.success(true);}
}
用户管理操作控制层:
/*** 用户管理操作*/
@Controller
@RequestMapping("/user")
/*** 角色添加表单提交处理* @param role* @return*/@RequestMapping(value="/add",method=RequestMethod.POST)@ResponseBodypublic Result<Boolean> add(Role role){//用统一验证实体方法验证是否合法CodeMsg validate = ValidateEntityUtil.validate(role);Code() != Code()){(validate);}if(roleService.save(role) == null){(CodeMsg.ADMIN_ROLE_ADD_ERROR);}
本文发布于:2024-02-04 00:17:13,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170698391752038.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |