@RequestProcessing(value="/admin/user/{userId}/abuse-point",method=HTTPRequestMethod.POST) @Before(adviceClass={StopwatchStartAdvice.class,AdminCheck.class}) @After(adviceClass=StopwatchEndAdvice.class) public void abusePoint(final HTTPRequestContext context,final HttpServletRequest request,final HttpServletResponse response,final String userId) throws Exception {
  final String pointStr=request.getParameter(Common.POINT);
  try {
    final int point=Integer.valueOf(pointStr);
    final JSONObject user=userQueryService.getUser(userId);
    final int currentPoint=user.optInt(UserExt.USER_POINT);
    if (currentPoint - point < 0) {
      final AbstractFreeMarkerRenderer renderer=new SkinRenderer();
      context.setRenderer(renderer);
      renderer.setTemplateName("admin/error.ftl");
      final Map<String,Object> dataModel=renderer.getDataModel();
      dataModel.put(Keys.MSG,langPropsService.get("insufficientBalanceLabel"));
      filler.fillHeaderAndFooter(request,response,dataModel);
      return;
    }
    final String memo=request.getParameter(Common.MEMO);
    final String transferId=pointtransferMgmtService.transfer(userId,Pointtransfer.ID_C_SYS,Pointtransfer.TRANSFER_TYPE_C_ABUSE_DEDUCT,point,memo);
    final JSONObject notification=new JSONObject();
    notification.put(Notification.NOTIFICATION_USER_ID,userId);
    notification.put(Notification.NOTIFICATION_DATA_ID,transferId);
    notificationMgmtService.addAbusePointDeductNotification(notification);
  }
 catch (  final Exception e) {
    final AbstractFreeMarkerRenderer renderer=new SkinRenderer();
    context.setRenderer(renderer);
    renderer.setTemplateName("admin/error.ftl");
    final Map<String,Object> dataModel=renderer.getDataModel();
    dataModel.put(Keys.MSG,e.getMessage());
    filler.fillHeaderAndFooter(request,response,dataModel);
    return;
  }
  response.sendRedirect(Latkes.getServePath() + "/admin/user/" + userId);
}

@ RequestProcessing ( value = "/admin/user/{userId}/abuse-point" , method = HTTPRequestMethod . POST ) @ Before ( adviceClass = { StopwatchStartAdvice . class , AdminCheck . class } ) @ After ( adviceClass = StopwatchEndAdvice . class ) public void abusePoint ( final HTTPRequestContext context , final HttpServletRequest request , final HttpServletResponse response , final String userId ) throws Exception { final String pointStr = request . getParameter ( Common . POINT ) ; try { final int point = Integer . valueOf ( pointStr ) ; final JSONObject user = userQueryService . getUser ( userId ) ; final int currentPoint = user . optInt ( UserExt . USER_POINT ) ; if ( currentPoint - point < 0 ) { final AbstractFreeMarkerRenderer renderer = new SkinRenderer ( ) ; context . setRenderer ( renderer ) ; renderer . setTemplateName ( "admin/error.ftl" ) ; final Map < String , Object > dataModel = renderer . getDataModel ( ) ; dataModel . put ( Keys . MSG , langPropsService . get ( "insufficientBalanceLabel" ) ) ; filler . fillHeaderAndFooter ( request , response , dataModel ) ; return ; } final String memo = request . getParameter ( Common . MEMO ) ; final String transferId = pointtransferMgmtService . transfer ( userId , Pointtransfer . ID_C_SYS , Pointtransfer . TRANSFER_TYPE_C_ABUSE_DEDUCT , point , memo ) ; final JSONObject notification = new JSONObject ( ) ; notification . put ( Notification . NOTIFICATION_USER_ID , userId ) ; notification . put ( Notification . NOTIFICATION_DATA_ID , transferId ) ; notificationMgmtService . addAbusePointDeductNotification ( notification ) ; } catch ( final Exception e ) { final AbstractFreeMarkerRenderer renderer = new SkinRenderer ( ) ; context . setRenderer ( renderer ) ; renderer . setTemplateName ( "admin/error.ftl" ) ; final Map < String , Object > dataModel = renderer . getDataModel ( ) ; dataModel . put ( Keys . MSG , e . getMessage ( ) ) ; filler . fillHeaderAndFooter ( request , response , dataModel ) ; return ; } response . sendRedirect ( Latkes . getServePath ( ) + "/admin/user/" + userId ) ; }
deducts a user ' s abuse point .
