@Override
	public int addOrder(OrderOfDetail ood) {

		Order order = null;
		OrderOfDishes ofDishes = null;

		if (null == ood) {
			return -1;
		}

		order = new Order();

		order.setUserId(ood.getUserId());
		order.setTotalPrice(ood.getTotalPrice());
		order.setRestId(ood.getRestId());
		order.setState(OrderState.NOTPAY);
		order.setRemarks(ood.getRemarks());
		order.setCreateTime(DateFormat.getCurrentTime());
		order.setPayTime(DateFormat.getCurrentTime());
		try {
			orderDao.addOrder(order);
			Set<Map.Entry<String, List<DishDetail>>> dishSet = ood.dishs
					.entrySet();

			for (Iterator<Map.Entry<String, List<DishDetail>>> iterator = dishSet
					.iterator(); iterator.hasNext();) {

				List<DishDetail> dishs = iterator.next().getValue();

				for (int i = 0; i < dishs.size(); i++) {
					ofDishes = new OrderOfDishes();
					ofDishes.setDishId(dishs.get(i).getDishId());
					ofDishes.setNum(dishs.get(i).getNum());
					ofDishes.setSubtotal(dishs.get(i).getSubtotal());
					ofDishes.setOrderId(order.getOrderId());
					orderOfDishesDao.addDish(ofDishes);
				}
			}

		} catch (Exception e) {
			logger.warn("", e);
			return -1;
		}

		return 1;

	}