コード例 #1
0
 @RequestMapping("/totalQuery")
 @ResponseBody
 public String totalQuery(HttpServletRequest request, HttpServletResponse response) {
   try {
     String data = actionDataStatService.query();
     return RequestUtils.successReturn(data);
   } catch (Exception e) {
     e.printStackTrace();
     return RequestUtils.failReturn("exception");
   }
 }
コード例 #2
0
  @RequestMapping("/query")
  @ResponseBody
  public String query(HttpServletRequest request, HttpServletResponse response) {
    String sDate = request.getParameter("startDate");
    String eDate = request.getParameter("endDate");
    // 默认查询一周的数据
    if (StringUtils.isEmpty(sDate) || StringUtils.isEmpty(eDate)) {
      eDate = DateUtils.getNextDay(new Date(), "1", DateUtils.PATTERN_YYYYMMDD);
      sDate = DateUtils.getNextDay(new Date(), "-7", DateUtils.PATTERN_YYYYMMDD);
    }
    log.info("[ActionDataStatController] method=statQuery,sDate=" + sDate + ",eDate=" + eDate);

    try {
      String data = actionDataStatService.queryStatResultByDate(sDate, eDate);
      return RequestUtils.successReturn(data);
    } catch (Exception e) {
      e.printStackTrace();
      return RequestUtils.failReturn("exception");
    }
  }