Package com.ourlinc.helloworld.model

Examples of com.ourlinc.helloworld.model.User


   * @throws IOException
   */
  @RequestMapping
  String canceljoin(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    String actId = request.getParameter("actId");
    Activity act = m_ActivityService.getActivity(actId);
    if (null == act) {
      request.setAttribute("errorMsg", "找不到id=" + actId + "的活动");
      return "error";
    }
    user.cancelActivity(act);
    user.flush();
    response.sendRedirect("/activity/index.jspx");
    return null;
  }
View Full Code Here


    String email = request.getParameter("email");
    String password = request.getParameter("password");
    if (null == email || null == password) {
      return "user/adminlogin";
    }
    User admin = m_UserService.login(email.trim().toLowerCase(), Misc
        .md5Hash(password.trim()));
    if (null == admin || User.ADMIN != admin.getAuthority()) {
      request.setAttribute("errorMsg", "你的email和密码不符,请再试一次");
      request.setAttribute("email", email);
      request.setAttribute("password", password);
      return "user/adminlogin";
    }
View Full Code Here

   * @throws IOException
   */
  @RequestMapping
  String userinfo(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    String email = request.getParameter("email");
    String password = request.getParameter("password");
    String repassword = request.getParameter("repassword");
    String username = request.getParameter("username");
    String department = request.getParameter("department");
    String birthday = request.getParameter("birthday");
    String entryDate = request.getParameter("entryDate");
    String leaveDate = request.getParameter("leaveDate");
    String editUserId = request.getParameter("editUserId");
    // 返回页面展示
    if (null == email || null == username || null == department
        || null == birthday || null == entryDate) {
      String id = request.getParameter("id");
      User u = m_UserService.getUser(id);
      if (null == u) {
        return "error";
      }
      List<Activity> list = u.getActivities();
      request.setAttribute("actList", list);
      request.setAttribute("editUser", u);
      return "user/userinfo";
    }
    // 真正修改

    User editUser = m_UserService.getUser(editUserId);
    List<Activity> list0 = editUser.getActivities();
    if ("".equals(email) || "".equals(username) || "".equals(department)
        || "".equals(birthday) || "".equals(entryDate)) {
      request.setAttribute("editUser", editUser);
      request.setAttribute("actList", list0);
      request.setAttribute("errorMsg", "请填写必填的信息!");
      return "user/userinfo";
    }
    // 管理员不能修改管理员
    if (editUser.isAdmin() && editUser.getId() != user.getId()) {
      request.setAttribute("errorMsg", "你不能修改其他管理员的信息");
      request.setAttribute("editUser", editUser);
      request.setAttribute("actList", list0);
      return "user/userinfo";
    }

    // 检查邮箱相同
    if (!email.equals(editUser.getEmail())) {
      User u = m_UserService.getUserByEmail(email);
      if (null != u) {
        request.setAttribute("errorMsg", "邮箱已经被注册");
        request.setAttribute("editUser", editUser);
        request.setAttribute("actList", list0);
        return "user/userinfo";
View Full Code Here

   * @throws IOException
   */
  @RequestMapping
  String editaccount(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    String email = request.getParameter("email");
    String password = request.getParameter("password");
    String repassword = request.getParameter("repassword");
    String department = request.getParameter("department");
    String birthday = request.getParameter("birthday");
    // 返回页面进行展示
    if (null == email || null == password || null == repassword
        || null == department || null == birthday) {
      request.setAttribute("userLogin", user);
      return "user/editaccount";
    }
    // 修改个人信息
    Date dBirthday = WebUtils.strFormatDate(birthday);
    if (!email.equals(user.getEmail())) {
      // 检查邮件是否重复
      User u = m_UserService.getUserByEmail(email);
      if (null != u) {
        request.setAttribute("userLogin", user);
        request.setAttribute("errorMsg", "邮箱已经被注册");
        return "user/editaccount";
      }
View Full Code Here

   * @throws IOException
   */
  @RequestMapping
  String myact(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    ResultPage<Activity> rp = user.listMyAct();
    rp.setPageSize(20);
    String p = request.getParameter("p");
    int intp = WebUtils.toInt(p);
    rp.gotoPage(intp);
    request.setAttribute("list", rp);
View Full Code Here

   * @throws IOException
   */
  @RequestMapping
  String myactover(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    ResultPage<Activity> rp = user.listMyActOver();
    rp.setPageSize(20);
    String p = request.getParameter("p");
    int intp = WebUtils.toInt(p);
    rp.gotoPage(intp);
    request.setAttribute("list", rp);
View Full Code Here

   * @throws IOException
   */
  @RequestMapping
  String myactcancel(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    ResultPage<Activity> rp = user.listMyActCancel();
    rp.setPageSize(20);
    String p = request.getParameter("p");
    int intp = WebUtils.toInt(p);
    rp.gotoPage(intp);
    request.setAttribute("list", rp);
View Full Code Here

  String checkemail_aj(HttpServletRequest request,
      HttpServletResponse response) {
    String email = WebUtils.toString(request.getParameter("email")).trim()
        .toLowerCase();
    if (email.length() > 0) {
      User user = m_UserService.getUserByEmail(email);
      response.setContentType("text/plain;charset=UTF-8");
      response.setHeader("Cache-Control", "no-cache");
      String htmlDoc = (null != user) ? "邮箱已经存在!" : "用户名可以使用!";
      try {
        response.getWriter().write(htmlDoc);
View Full Code Here

   * @throws IOException
   */
  @RequestMapping
  String sendemail(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    String email = request.getParameter("email");
    String password = request.getParameter("password");
    String actId = request.getParameter("actId");
    String op = request.getParameter("op");
    String[] toAddresses = request.getParameterValues("toAddresses");
    String smtpHost = EmailConfig.getValue("smtpHost");
    String needAuth = EmailConfig.getValue("needAuth");
    ResultPage<User> rp = m_UserService.listUser();
    rp.setPageSize(1000);
    rp.gotoPage(1);
    Activity act = m_ActivityService.getActivity(actId);
    // 返回页面
    if (WebUtils.isEmptyString(email) || null == act) {
      request.setAttribute("actMsg", (null == act) ? "找不到该活动!" : "操作成功!");
      request.setAttribute("email", user.getEmail());
      request.setAttribute("actId", actId);
      request.setAttribute("list", rp);
      request.setAttribute("op", op);
      request.setAttribute("smtpHost", smtpHost);
      request.setAttribute("needAuth", needAuth);
      return "activity/sendemail";
    }
    // 发送邮件
    boolean flag = false;
    Mail mail = new Mail(email, password);
    try {
      if ("add".equals(op)) {
        mail.send(email, toAddresses, null, "活动通知", EmailTemplates
            .buildAddContent(act.getTime(), act.getTitle(), act
                .getId()));
      } else if ("edit".equals(op)) {
        mail.send(email, toAddresses, null, "活动修改通知", EmailTemplates
            .buildEditContent(act.getTime(), act.getTitle(),
                EmailConfig.getValue("editContent"), act
                    .getId()));
      } else if ("cancel".equals(op)) {
        mail.send(email, toAddresses, null, "活动取消通知", EmailTemplates
            .buildCancelContent(act.getTime(), act.getTitle()));
      }
      flag = true;
    } catch (Exception e) {
      e.printStackTrace();
    }
    // 发送邮件失败
    if (!flag) {
      request.setAttribute("actMsg", "发送邮件失败!");
      request.setAttribute("email", user.getEmail());
      request.setAttribute("actId", actId);
      request.setAttribute("list", rp);
      request.setAttribute("op", op);
      request.setAttribute("smtpHost", smtpHost);
      request.setAttribute("needAuth", needAuth);
View Full Code Here

   * @throws IOException
   */
  @RequestMapping
  String postcomment(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    String actId = request.getParameter("actId");
    String content = request.getParameter("content");
    Activity act = m_ActivityService.getActivity(actId);
    if (null == act || null == content) {
      request.setAttribute("errorMsg", "找不到id=" + actId + "的活动");
View Full Code Here

TOP

Related Classes of com.ourlinc.helloworld.model.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.