/**
   * Updates the specified order.
   *
   * @param order the specified order
   * @throws ServiceException service exception
   */
  @Transactional
  public void updateOrder(final JSONObject order) throws ServiceException {
    try {
      final String orderId = order.optString(Keys.OBJECT_ID);

      orderRepository.update(orderId, order);
    } catch (final RepositoryException e) {
      LOGGER.log(Level.ERROR, "Updates order failed", e);

      throw new ServiceException(e);
    }
  }
  /**
   * Adds the specified order.
   *
   * @param order the specified order
   * @return order id
   * @throws ServiceException service exception
   */
  @Transactional
  public String addOrder(final JSONObject order) throws ServiceException {
    try {
      order.put(Order.ORDER_CONFIRM_TIME, 0);
      order.put(Order.ORDER_CREATE_TIME, System.currentTimeMillis());
      order.put(Order.ORDER_HANDLER_ID, "");
      order.put(Order.ORDER_STATUS, Order.ORDER_STATUS_C_INIT);

      return orderRepository.add(order);
    } catch (final RepositoryException e) {
      LOGGER.log(Level.ERROR, "Adds order failed", e);

      throw new ServiceException(e);
    }
  }