@RequestProcessing(value="/member/{userName}/points",method=HTTPRequestMethod.GET) @Before(adviceClass={StopwatchStartAdvice.class,AnonymousViewCheck.class,UserBlockCheck.class}) @After(adviceClass=StopwatchEndAdvice.class) public void showHomePoints(final HTTPRequestContext context,final HttpServletRequest request,final HttpServletResponse response,final String userName) throws Exception {
  final JSONObject user=(JSONObject)request.getAttribute(User.USER);
  request.setAttribute(Keys.TEMAPLTE_DIR_NAME,Symphonys.get("skinDirName"));
  final AbstractFreeMarkerRenderer renderer=new SkinRenderer();
  context.setRenderer(renderer);
  renderer.setTemplateName("/home/points.ftl");
  final Map<String,Object> dataModel=renderer.getDataModel();
  filler.fillHeaderAndFooter(request,response,dataModel);
  String pageNumStr=request.getParameter("p");
  if (Strings.isEmptyOrNull(pageNumStr) || !Strings.isNumeric(pageNumStr)) {
    pageNumStr="1";
  }
  final int pageNum=Integer.valueOf(pageNumStr);
  final int pageSize=Symphonys.getInt("userHomePointsCnt");
  final int windowSize=Symphonys.getInt("userHomePointsWindowSize");
  fillHomeUser(dataModel,user);
  avatarQueryService.fillUserAvatarURL(user);
  final String followingId=user.optString(Keys.OBJECT_ID);
  dataModel.put(Follow.FOLLOWING_ID,followingId);
  final JSONObject userPointsResult=pointtransferQueryService.getUserPoints(user.optString(Keys.OBJECT_ID),pageNum,pageSize);
  final List<JSONObject> userPoints=CollectionUtils.<JSONObject>jsonArrayToList(userPointsResult.optJSONArray(Keys.RESULTS));
  dataModel.put(Common.USER_HOME_POINTS,userPoints);
  final boolean isLoggedIn=(Boolean)dataModel.get(Common.IS_LOGGED_IN);
  if (isLoggedIn) {
    final JSONObject currentUser=(JSONObject)dataModel.get(Common.CURRENT_USER);
    final String followerId=currentUser.optString(Keys.OBJECT_ID);
    final boolean isFollowing=followQueryService.isFollowing(followerId,user.optString(Keys.OBJECT_ID));
    dataModel.put(Common.IS_FOLLOWING,isFollowing);
  }
  user.put(UserExt.USER_T_CREATE_TIME,new Date(user.getLong(Keys.OBJECT_ID)));
  final int pointsCnt=userPointsResult.optInt(Pagination.PAGINATION_RECORD_COUNT);
  final int pageCount=(int)Math.ceil((double)pointsCnt / (double)pageSize);
  final List<Integer> pageNums=Paginator.paginate(pageNum,pageSize,pageCount,windowSize);
  if (!pageNums.isEmpty()) {
    dataModel.put(Pagination.PAGINATION_FIRST_PAGE_NUM,pageNums.get(0));
    dataModel.put(Pagination.PAGINATION_LAST_PAGE_NUM,pageNums.get(pageNums.size() - 1));
  }
  dataModel.put(Pagination.PAGINATION_CURRENT_PAGE_NUM,pageNum);
  dataModel.put(Pagination.PAGINATION_PAGE_COUNT,pageCount);
  dataModel.put(Pagination.PAGINATION_PAGE_NUMS,pageNums);
}

@ RequestProcessing ( value = "/member/{userName}/points" , method = HTTPRequestMethod . GET ) @ Before ( adviceClass = { StopwatchStartAdvice . class , AnonymousViewCheck . class , UserBlockCheck . class } ) @ After ( adviceClass = StopwatchEndAdvice . class ) public void showHomePoints ( final HTTPRequestContext context , final HttpServletRequest request , final HttpServletResponse response , final String userName ) throws Exception { final JSONObject user = ( JSONObject ) request . getAttribute ( User . USER ) ; request . setAttribute ( Keys . TEMAPLTE_DIR_NAME , Symphonys . get ( "skinDirName" ) ) ; final AbstractFreeMarkerRenderer renderer = new SkinRenderer ( ) ; context . setRenderer ( renderer ) ; renderer . setTemplateName ( "/home/points.ftl" ) ; final Map < String , Object > dataModel = renderer . getDataModel ( ) ; filler . fillHeaderAndFooter ( request , response , dataModel ) ; String pageNumStr = request . getParameter ( "p" ) ; if ( Strings . isEmptyOrNull ( pageNumStr ) || ! Strings . isNumeric ( pageNumStr ) ) { pageNumStr = "1" ; } final int pageNum = Integer . valueOf ( pageNumStr ) ; final int pageSize = Symphonys . getInt ( "userHomePointsCnt" ) ; final int windowSize = Symphonys . getInt ( "userHomePointsWindowSize" ) ; fillHomeUser ( dataModel , user ) ; avatarQueryService . fillUserAvatarURL ( user ) ; final String followingId = user . optString ( Keys . OBJECT_ID ) ; dataModel . put ( Follow . FOLLOWING_ID , followingId ) ; final JSONObject userPointsResult = pointtransferQueryService . getUserPoints ( user . optString ( Keys . OBJECT_ID ) , pageNum , pageSize ) ; final List < JSONObject > userPoints = CollectionUtils . < JSONObject > jsonArrayToList ( userPointsResult . optJSONArray ( Keys . RESULTS ) ) ; dataModel . put ( Common . USER_HOME_POINTS , userPoints ) ; final boolean isLoggedIn = ( Boolean ) dataModel . get ( Common . IS_LOGGED_IN ) ; if ( isLoggedIn ) { final JSONObject currentUser = ( JSONObject ) dataModel . get ( Common . CURRENT_USER ) ; final String followerId = currentUser . optString ( Keys . OBJECT_ID ) ; final boolean isFollowing = followQueryService . isFollowing ( followerId , user . optString ( Keys . OBJECT_ID ) ) ; dataModel . put ( Common . IS_FOLLOWING , isFollowing ) ; } user . put ( UserExt . USER_T_CREATE_TIME , new Date ( user . getLong ( Keys . OBJECT_ID ) ) ) ; final int pointsCnt = userPointsResult . optInt ( Pagination . PAGINATION_RECORD_COUNT ) ; final int pageCount = ( int ) Math . ceil ( ( double ) pointsCnt / ( double ) pageSize ) ; final List < Integer > pageNums = Paginator . paginate ( pageNum , pageSize , pageCount , windowSize ) ; if ( ! pageNums . isEmpty ( ) ) { dataModel . put ( Pagination . PAGINATION_FIRST_PAGE_NUM , pageNums . get ( 0 ) ) ; dataModel . put ( Pagination . PAGINATION_LAST_PAGE_NUM , pageNums . get ( pageNums . size ( ) - 1 ) ) ; } dataModel . put ( Pagination . PAGINATION_CURRENT_PAGE_NUM , pageNum ) ; dataModel . put ( Pagination . PAGINATION_PAGE_COUNT , pageCount ) ; dataModel . put ( Pagination . PAGINATION_PAGE_NUMS , pageNums ) ; }
shows user home points page .
