private void setOrderCountInfo(OrderCountInfo orderCountInfo, Order order) {

    orderCountInfo.setOrderCount(orderCountInfo.getOrderCount() + 1);
    orderCountInfo.setCoinAmount(Arith.add(order.getCoinAmount(), orderCountInfo.getCoinAmount()));
    orderCountInfo.setCouponsAmount(
        Arith.add(order.getCouponsAmount(), orderCountInfo.getCouponsAmount()));
    orderCountInfo.setGoodsAmount(
        Arith.add(order.getGoodsAmount(), orderCountInfo.getGoodsAmount()));
    orderCountInfo.setGoodsTransportAmount(
        Arith.add(order.getGoodsTransportAmount(), orderCountInfo.getGoodsTransportAmount()));
    orderCountInfo.setRealAmount(Arith.add(order.getRealAmount(), orderCountInfo.getRealAmount()));
  }
  public Map<String, Object> getGridData(HttpServletRequest request, SysUnits sysUnits) {

    Map<String, Object> gridData = new HashMap<String, Object>();

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("unitId", sysUnits.getId());
    map.put("unitType", sysUnits.getUnitType());
    map.put("zoneCode", sysUnits.getZoneCode() + "%");

    String startDay_str = request.getParameter("startDay");
    String endDay_str = request.getParameter("endDay");
    String unitName = request.getParameter("unitName");

    List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
    if (null != startDay_str
        && !startDay_str.equals("")
        && null != endDay_str
        && !endDay_str.equals("")) {

      map.put("startDay", DateUtil.toDate(startDay_str, DateUtil.YYYY_MM_DD));
      map.put("endDay", DateUtil.toDate(endDay_str, DateUtil.YYYY_MM_DD));
      if (null != unitName && !"".equals(unitName)) {

        map.put("unitName", "%" + unitName + "%");
      }
      dataList = orderCountDao.getListMap(map);
    }

    if (null != dataList && !dataList.isEmpty()) {

      for (Map<String, Object> countData : dataList) {

        List<OrderCountInfo> infoList =
            orderCountInfoDao.getListByCountId(Long.valueOf(countData.get("ID") + ""));

        countData.put(
            "AVG_AMOUNT",
            Arith.div(
                null == countData.get("GOODS_AMOUNT")
                    ? 0d
                    : Double.valueOf(countData.get("GOODS_AMOUNT") + ""),
                null == countData.get("ORDER_COUNT")
                    ? 0d
                    : Double.valueOf(countData.get("ORDER_COUNT") + "")));
        if (null != infoList && !infoList.isEmpty()) {

          for (OrderCountInfo orderCountInfo : infoList) {

            int infoType = orderCountInfo.getInfoType();
            countData.put("ORDER_COUNT_" + infoType, orderCountInfo.getOrderCount());
            countData.put("REAL_AMOUNT_" + infoType, orderCountInfo.getRealAmount());
            countData.put("GOODS_AMOUNT_" + infoType, orderCountInfo.getGoodsAmount());
            countData.put("COIN_AMOUNT_" + infoType, orderCountInfo.getCoinAmount());
            countData.put(
                "GOODS_TRANSPORT_AMOUNT_" + infoType, orderCountInfo.getGoodsTransportAmount());
            countData.put("COUPONS_AMOUNT_" + infoType, orderCountInfo.getCouponsAmount());
            countData.put(
                "AVG_AMOUNT_" + infoType,
                Arith.div(
                    orderCountInfo.getGoodsAmount(),
                    Double.valueOf(orderCountInfo.getOrderCount())));
          }
        }
      }
    }
    long totalRows = null == dataList ? 0 : dataList.size();
    gridData.put("Rows", dataList);
    gridData.put("Total", totalRows);
    return gridData;
  }
  public Map<String, Object> getTodayGridData(HttpServletRequest request, SysUnits sysUnits) {

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("unitId", sysUnits.getId());

    String startTime = request.getParameter("startTime");
    String endTime = request.getParameter("endTime");
    map.put("startTime", startTime);
    map.put("endTime", endTime);

    List<Order> orderList = orderDao.getTodayCountList(map);

    List<OrderCountInfo> dataList = new ArrayList<OrderCountInfo>();

    //// 汇总方式 0:有效订单、1:在线支付、2:线下支付、3:电话外卖、4:拒收订单
    OrderCountInfo orderCountInfo = new OrderCountInfo(); // 总订单
    orderCountInfo.setInfoType(-1);

    OrderCountInfo valiCountInfo = new OrderCountInfo(); // 有效订单
    valiCountInfo.setInfoType(0);

    OrderCountInfo jushouCountInfo = new OrderCountInfo(); // 拒收订单
    jushouCountInfo.setInfoType(4);

    OrderCountInfo onlineCountInfo = new OrderCountInfo(); // 线上订单
    onlineCountInfo.setInfoType(1);

    OrderCountInfo offlineCountInfo = new OrderCountInfo(); // 线下订单
    offlineCountInfo.setInfoType(2);

    if (null != orderList && !orderList.isEmpty()) {

      for (Order order : orderList) {

        setOrderCountInfo(orderCountInfo, order);
        if (order.getDeliveryerStatus() == 12) { // 有效订单

          setOrderCountInfo(valiCountInfo, order);
        } else if (order.getDeliveryerStatus() == -11) { // 拒收订单

          setOrderCountInfo(jushouCountInfo, order);
        }

        if (order.getPayType() == 0) { // 线下支付

          setOrderCountInfo(offlineCountInfo, order);
        } else if (order.getPayType() == 1) {

          setOrderCountInfo(onlineCountInfo, order);
        }
      }
    }

    dataList.add(orderCountInfo);
    dataList.add(valiCountInfo);
    dataList.add(jushouCountInfo);
    dataList.add(onlineCountInfo);
    dataList.add(offlineCountInfo);

    Map<String, Object> countData = new HashMap<String, Object>();
    countData.put("Rows", dataList);
    countData.put("Total", null != dataList ? dataList.size() : 0);
    return countData;
  }