@RequestMapping("/user_save")
 public ModelAndView saveUser(HttpServletRequest request) {
   String username = request.getParameter("username").trim();
   String realname = request.getParameter("realname").trim();
   String mobile = request.getParameter("mobile").trim();
   String weixinno = request.getParameter("weixinno").trim();
   String email = request.getParameter("email").trim();
   logger.info(
       "用户请求数据:"
           + "----email:"
           + email
           + "----weixinno:"
           + weixinno
           + "--------mobile:"
           + mobile
           + "----------realname:"
           + realname
           + "----username"
           + username);
   ModelAndView mv = new ModelAndView();
   if (StringUtils.isNoneBlank(email)
       && StringUtils.isNoneBlank(username)
       && StringUtils.isNoneBlank(mobile)
       && StringUtils.isNoneBlank(realname)) {
     TUser user = new TUser();
     user.setUsertype(1); // 管理平台用户
     user.setUsername(username);
     user.setEmail(email);
     user.setRealname(realname);
     user.setMobile(mobile);
     user.setWeixinno(weixinno);
     user.setPassword(Md5.md5("123456")); // 初始密码123456
     user.setRegtime(new Timestamp(new Date().getTime()));
     user.setUpdatetime(new Timestamp(new Date().getTime()));
     userService.saveUser(user);
     mv.setViewName("redirect:/user_list");
   }
   return mv;
 }
 @RequestMapping("/user_login")
 public ModelAndView login(HttpServletRequest request) throws IOException {
   String email = request.getParameter("email").trim();
   String password = request.getParameter("password").trim();
   logger.info("用户请求数据:" + email + "----------" + password);
   ModelAndView mv = new ModelAndView();
   if (StringUtils.isNoneBlank(email) && StringUtils.isNoneBlank(password)) {
     Map<String, Object> params = new HashMap<String, Object>();
     params.put("email", email);
     params.put("password", Md5.md5(password));
     TUser user = userService.queryUser(params);
     if (user != null) {
       // 验证用户名、密码
       HttpSession session = request.getSession();
       String uid = (String) session.getAttribute("userid");
       if (StringUtils.isBlank(uid)) {
         session.setAttribute("userid", String.valueOf(user.getId()));
         session.setAttribute("username", user.getUsername());
         session.setAttribute("email", user.getEmail());
       }
       // 记录日志信息
       TLog log = new TLog();
       log.setUsername(user.getUsername());
       log.setIp(NetworkUtil.getIpAddress(request)); // 获取客户端IP地址
       log.setMemo("登录成功!");
       log.setCreatetime(new Timestamp(new Date().getTime()));
       logService.saveLog(log);
       mv.addObject(user);
       mv.setViewName("index");
     } else {
       mv.addObject("msg", "请检查您的用户名密码!");
       mv.setViewName("login");
     }
   }
   return mv;
 }