Esempio n. 1
0
 @RequestMapping("basicInfo")
 public ModelAndView basicInfo(HttpSession session) {
   ModelAndView mv = new ModelAndView("profile/basicInfo");
   UserSession userSession = (UserSession) session.getAttribute("userSession");
   ThirdPartyAccount qq =
       tpaService.findByUidAndType(
           userSession.getUser().getUid(), ThirdPartyAccount.ACCOUNT_TYPE_QQ);
   ThirdPartyAccount weibo =
       tpaService.findByUidAndType(
           userSession.getUser().getUid(), ThirdPartyAccount.ACCOUNT_TYPE_XINLANG);
   mv.addObject("qq", qq == null ? "" : qq.getHeadIconBig());
   mv.addObject("weibo", weibo == null ? "" : weibo.getHeadIconBig());
   return mv;
 }
Esempio n. 2
0
 @RequestMapping("/updateBasicInfo")
 @ResponseBody
 public Object updateBasicInfo(User u, int headIcon, HttpSession session) {
   Map<String, Object> map = new HashMap<String, Object>();
   UserSession userSession = (UserSession) session.getAttribute("userSession");
   User user = userSession.getUser();
   try {
     user.setAddress(u.getAddress());
     user.setHeadIconUsed(headIcon);
     if (headIcon != 0) {
       ThirdPartyAccount tpa = tpaService.findByUidAndType(user.getUid(), headIcon);
       if (tpa != null) {
         user.setHeadIconBig(tpa.getHeadIconBig());
       } else {
         user.setHeadIconBig(null);
       }
     } else {
       user.setHeadIconBig(user.getHeadIconLocal());
     }
     user.setBirthday(u.getBirthday());
     user.setQq(u.getQq());
     user.setSex(u.getSex());
     userService.update(user);
     map.put("success", true);
     map.put("message", "保存成功");
   } catch (Exception e) {
     LOG.error("更新个人信息失败,用户ID:" + user.getUid(), e);
     map.put("success", false);
     map.put("message", "未知错误");
   }
   return map;
 }