// 统计课程订单
  @RequestMapping(value = "/{coachID}/count", method = RequestMethod.GET)
  public Object countOrderLinesByCoach(
      @PathVariable Integer coachID,
      @RequestParam(value = "order_status", required = false) String orderStatus,
      @RequestParam(value = "start_date") String startDate,
      @RequestParam(value = "end_date") String endDate,
      Pageable pageable) {
    CoachEntity coachEntity = coachService.findOne(coachID);
    Validate.notNull(coachEntity, "coach id is invalid");

    DateTime startDateTime = (null == startDate ? null : DateTime.parse(startDate));
    DateTime endDateTime = (null == endDate ? null : DateTime.parse(endDate));

    List<OrderLineEntity> orderLines =
        orderLineService.findByOrderLineStatus(coachID, orderStatus, startDateTime, endDateTime);

    Integer totalNumber = 0;
    long totalMoney = 0l;

    for (OrderLineEntity orderLineEntity : orderLines) {
      totalNumber++;
      totalMoney += orderLineEntity.getAmount();
    }
    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("total_number", totalNumber);
    map.put("total_money", totalMoney);

    return map;
  }
  // 根据条件筛选课程订单
  @SuppressWarnings("unchecked")
  @RequestMapping(value = "/{coachID}", method = RequestMethod.GET)
  public PageImpl<OrderLine> findOrderLinesByCoach(
      @PathVariable Integer coachID,
      @RequestParam(value = "order_status", required = false) String orderStatus,
      @RequestParam(value = "start_date") String startDate,
      @RequestParam(value = "end_date") String endDate,
      Pageable pageable) {
    CoachEntity coachEntity = coachService.findOne(coachID);
    Validate.notNull(coachEntity, "coach id is invalid");

    DateTime startDateTime = (null == startDate ? null : DateTime.parse(startDate));
    DateTime endDateTime = (null == endDate ? null : DateTime.parse(endDate));

    List<OrderLineEntity> orderLines =
        orderLineService.findByOrderLineStatus(coachID, orderStatus, startDateTime, endDateTime);

    Integer start = (pageable.getPageNumber() * pageable.getPageSize());
    Integer end;
    if ((pageable.getPageNumber() + 1) * pageable.getPageSize() > orderLines.size()) {
      end = orderLines.size();
    } else {
      end = ((pageable.getPageNumber() + 1) * pageable.getPageSize());
    }
    List<OrderLineEntity> show = orderLines.subList(start, end);

    return ModelConvertUtils.getPageByOrderLineEntity(show, pageable, orderLines.size());
  }