예제 #1
0
 /**
  * 查询图书馆的整体统计信息
  *
  * @throws IOException
  */
 @RequestMapping(value = "/library/summary")
 public void summary(final HttpServletRequest request, final HttpServletResponse response)
     throws IOException {
   try {
     JSONObject result = new JSONObject();
     // 解决跨域
     String callback = request.getParameter("callback");
     int bookCount = libraryService.getBookCount();
     int libraryCount = libraryService.getLibraryCount();
     int userCount = libraryService.getUserCount();
     result.put(Constants.STATUS, 1);
     result.put(Constants.MSG, "【查询成功】有料哦!");
     result.put("bookCount", bookCount);
     result.put("bookCount", libraryCount);
     result.put("bookCount", userCount);
     getJson(request, response, callback, result.toString());
     return;
   } catch (Exception e) {
     logger.error("图书馆统计信息查询异常 " + e);
     String callback = request.getParameter("callback");
     JSONObject result = new JSONObject();
     try {
       result.put(Constants.STATUS, -1);
       result.put(Constants.MSG, "靠,服务歇菜了!");
     } catch (JSONException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
     }
     getJson(request, response, callback, result.toString());
   }
 }
예제 #2
0
  @RequestMapping(value = "/user/index")
  public String index(final HttpServletRequest request, final HttpServletResponse response) {
    UserInfo userInfo = getLoginUserInfo(cacheService, request, response);
    if (null != userInfo) {
      request.setAttribute("userInfo", userInfo);
    }
    String query = "";
    if (request.getParameter("query") != null) {
      query = request.getParameter("query");
    }
    int bookCount = libraryService.getBookCount();
    int libraryCount = libraryService.getLibraryCount();
    int userCount = libraryService.getUserCount();

    List<BookVo> bookList = libraryService.getBookList(query);
    request.setAttribute("bookList", bookList);
    request.setAttribute("bookCount", bookCount);
    request.setAttribute("libraryCount", libraryCount);
    request.setAttribute("userCount", userCount);
    return "index.jsp";
  }