public int getConsumeRecordSum(int userId, String startDate, String endDate, String consumeType) {
    // TODO Auto-generated method stub
    Date sdate =
        StringTool.isEmpty(startDate) ? null : DateFormatUtil.stringToDate(startDate, "yyyy-MM-dd");
    Date edate =
        StringTool.isEmpty(endDate) ? null : DateFormatUtil.stringToDate(endDate, "yyyy-MM-dd");

    return dao.getConsumeRecordSum(userId, sdate, edate, consumeType);
  }
 public int deleteConsumeRecords(String[] ids, int userId) {
   // TODO Auto-generated method stub
   try {
     return dao.deleteConsumeRecords(ids, userId);
   } catch (Exception e) {
     // TODO: handle exception
     e.printStackTrace();
     return -1;
   }
 }
  public List<ConsumeType> getConsumeType(String userId) {
    // TODO Auto-generated method stub
    List<ConsumeType> base = dao.getBaseConsumeType();
    List<ConsumeType> duc = dao.getUserConsumeType(userId);

    if (base == null || base.size() <= 0) {
      if (duc == null || duc.size() <= 0) {
        return null;
      } else {
        return duc;
      }
    } else {
      if (duc == null || duc.size() <= 0) {
        return base;
      } else {
        duc.addAll(base);
      }
    }

    return duc;
  }
  public List<ConsumeItem> getConsumeRecords(
      int userId,
      String startDate,
      String endDate,
      int pageStart,
      int pageCount,
      String consumeType) {
    // TODO Auto-generated method stub
    Date sdate =
        StringTool.isEmpty(startDate) ? null : DateFormatUtil.stringToDate(startDate, "yyyy-MM-dd");
    Date edate =
        StringTool.isEmpty(endDate) ? null : DateFormatUtil.stringToDate(endDate, "yyyy-MM-dd");

    return dao.getConsumeRecords(userId, sdate, edate, pageStart, pageCount, consumeType);
  }
  @Override
  public DataGrid<ConsumeItem> getConsumeRecord(
      String userId,
      String startDate,
      String endDate,
      int pageStart,
      int pageCount,
      String consumeType) {
    // TODO Auto-generated method stub
    Date sdate =
        StringTool.isEmpty(startDate) ? null : DateFormatUtil.stringToDate(startDate, "yyyy-MM-dd");
    Date edate =
        StringTool.isEmpty(endDate) ? null : DateFormatUtil.stringToDate(endDate, "yyyy-MM-dd");

    try {
      return dao.getConsumeRecord(userId, sdate, edate, pageStart, pageCount, consumeType);
    } catch (Exception e) {
      // TODO: handle exception
      e.printStackTrace();
      return new DataGrid<>();
    }
  }
 @SuppressWarnings("deprecation")
 public List<ConsumeFifteen3DPieChartView> getFifteenConsumeForPieChart(
     int userId, Date startDate, Date endDate) {
   // TODO Auto-generated method stub
   return dao.getFifteenConsumeForPieChart(userId, startDate, endDate);
 }
  public List<ConsumeFifteen3DChartView> getFifteenConsume(int userId, Date start, Date end) {
    // TODO Auto-generated method stub

    return dao.getFifteenConsume(userId, start, end);
  }
 public int addUserDefineConsumeType(String userId, String name) {
   // TODO Auto-generated method stub
   return dao.addUserDefineConsumeType(userId, name);
 }
 public int addConsumeDetail(Consume c) {
   // TODO Auto-generated method stub
   return dao.addConsumeDetailRd(c);
 }
 @Override
 public List<ConsumeFifteen3DPieChartView> getFifteenConsumeForPieChart(
     String userId, Date startDate, Date endDate) {
   // TODO Auto-generated method stub
   return dao.getFifteenConsumeForPieChart(userId, startDate, endDate);
 }