Package com.skyline.user.model

Examples of com.skyline.user.model.User


  public ModelAndView checkFindPswdToken(@PathVariable String tokenStr) {
    ModelAndView mav = new ModelAndView();
    EmailToken token = emailTokenService.checkToken(tokenStr);
    if (token != null) {
      WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_STAT, FindPswdStat.CHECKED_TOKEN);
      User user = accountInfoService.getAccountInfoByUserID(token.getUserId());
      WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_USER, user);
      WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_CHECKED_TOKEN_ID, token.getId());
      mav.setViewName(ViewPaths.USER_RESETPASSWORD);
    } else {
      // 验证出错
View Full Code Here


   */
  @RequestMapping(value = "/getNewFeeds", method = RequestMethod.POST)
  @SuppressWarnings("unchecked")
  public @ResponseBody
  List<DBObject> getNewFeeds(HttpServletRequest request) {
    User user = (User) WebHelper.getSessionAttribute(request, Constant.SESSION_USER);
    List<Fan> fans = (List<Fan>) WebHelper.getSessionAttribute(request, Constant.SESSION_IDOLS);
    // 用户已经登陆
    if (user != null && user.getId() != 0 && fans != null) {
      List<Long > idolIds=new ArrayList<Long>();
      for(Fan fan : fans){
        idolIds.add(fan.getIdolId());
        //System.out.println(fan.getIdolId());
      }
      Long lastQueryTime = (Long) WebHelper.getSessionAttribute(request, Constant.SESSION_LAST_QUERY_TIME);
      WebHelper.setSessionAttribute(request, Constant.SESSION_LAST_QUERY_TIME, (new Date()).getTime());
      //System.out.println(lastQueryTime);
      return subscribedFeedService.getNewFeeds(idolIds, user.getId(), lastQueryTime);
    }
    // 用户没有登陆
    //1315899033276
    //1320173733432
    //1320147706910
View Full Code Here

   * @return
   */
  @RequestMapping(value = "/password/reset", method = RequestMethod.POST)
  public ModelAndView resetPassword(String newPassword, String newPasswordConfirm) {
    ModelAndView mav = new ModelAndView();
    User userInSession = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_FIND_PSWD_USER);
    FindPswdStat findPswdStat = (FindPswdStat) WebHelper.getSessionAttribute(null, Constant.SESSION_FIND_PSWD_STAT);
    if (userInSession != null && findPswdStat != null
        && (findPswdStat.equals(FindPswdStat.ANSWERED_QUESTION) || findPswdStat.equals(FindPswdStat.CHECKED_TOKEN))) {

      if (newPassword.equals(newPasswordConfirm)) {
        accountInfoService.restPassword(userInSession.getId(), newPassword);
        if (findPswdStat.equals(FindPswdStat.CHECKED_TOKEN)) {
          Long tokenId = (Long) WebHelper.getSessionAttribute(null, Constant.SESSION_FIND_PSWD_CHECKED_TOKEN_ID);
          emailTokenService.updateToken(tokenId);
        }
        WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_STAT, FindPswdStat.FINISHED);
View Full Code Here

  }

  @RequestMapping(value = "/password/modify", method = RequestMethod.GET)
  public ModelAndView modifyPasswordRequest() {
    ModelAndView mav = new ModelAndView();
    User userInSession = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (userInSession != null && userInSession.getId() != 0) {
      mav.setViewName(ViewPaths.USER_MODIFYPASSWORD);
    }
    return mav;
  }
View Full Code Here

   * @return
   */
  @RequestMapping(value = "/password/modify", method = RequestMethod.POST)
  public ModelAndView modifyPasswordExecute(String password, String newPassword, String newPasswordConfirm) {
    ModelAndView mav = new ModelAndView();
    User userInSession = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    Long triedTime = (Long) WebHelper.getSessionAttribute(null, Constant.SESSION_MIDIFY_PSWD_TRY_TIME);
    if (triedTime == null) {
      triedTime = (long) 0;
    }
    if (userInSession != null && userInSession.getId() != 0 && triedTime < 2) {
      if (newPassword.equals(newPasswordConfirm)) {
        mav.addObject("errorMessage", "您两次所输入的密码不一致,请重试!");
      } else {
        boolean modifyResult = accountInfoService.modifyPassword(userInSession.getEmail(), password, newPassword);
        if (modifyResult == false) {
          WebHelper.setSessionAttribute(null, Constant.SESSION_MIDIFY_PSWD_TRY_TIME, triedTime + 1);
          mav.addObject("errorMessage", "您所输入的密码不正确,请重试!");
          mav.setViewName(ViewPaths.USER_MODIFYPASSWORD);
        } else {
View Full Code Here

  Integer listMessagePageSize;

  @RequestMapping(value = "/add", method = RequestMethod.POST)
  @ResponseBody
  public long addShortMessage(String text) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null || user.getId() == 0) {
      return 0;
    } else {
      return shortMessageService.addShortMessage(user.getId(), user.getNickname(), user.getPortrait(), text);
    }
  }
View Full Code Here

  }
 
  @RequestMapping(value = "/forward", method = RequestMethod.POST)
  @ResponseBody
  public long forwardShortMessage(String comment,long id) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null || user.getId() == 0) {
      return 0;
    } else {
      long forwardId= shortMessageService.forwardShortMessage(id, user.getId(), user.getNickname(), user.getPortrait(),comment);
      return forwardId;
    }
  }
View Full Code Here

  //FIXME 不要相对路径
  @RequestMapping(value = "/delete/{id}/{curpage}", method = RequestMethod.GET)
  public RedirectView deleteShortMessage(@PathVariable long id,@PathVariable int curpage) {
    RedirectView rv = new RedirectView();
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user != null && user.getId() != 0) {
      shortMessageService.deleteShortMessage(id, user.getId());
      rv.setUrl("../../owner/" + user.getId() + ".html?curpage="+curpage);
    }
    return rv;
  }
View Full Code Here

 
  @RequestMapping(value = "/myWo", method = RequestMethod.GET)
  public ModelAndView myWo() {
    ModelAndView mav = new ModelAndView();
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null || user.getId() == 0) {
      /*
       * throw new NotLoginException();
       * 似乎在很多情况下都不能使用NotLoginException,不然的话,会在我们的系统中输出过多的这类异常
       */
      mav.setViewName(ViewPaths.USER_LOGIN);
 
View Full Code Here

  }

  @RequestMapping(value = "/{ownerId}", method = RequestMethod.GET)
  public ModelAndView wo(@PathVariable long ownerId) {
    ModelAndView mav = new ModelAndView();
    User user = (User) personalInfoService.getPersonInfoByUserID(ownerId);

    if (user == null) {
      throw new NoResourceException();
    } else {
      mav.setViewName(ViewPaths.WO_WO);
View Full Code Here

TOP

Related Classes of com.skyline.user.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.