private void saveOrder(Order orderToSave) {
   valueList.put("_id", currentOrder.getOrderId());
   for (EditText fieldToSave : editFields) {
     if (fieldToSave.getText() != null) {
       valueList.put(fieldToSave.getTag().toString(), fieldToSave.getText().toString());
     }
   }
   orderToSave.setOrderValues(valueList);
   if (orderToSave.save()) {
     Toast toast =
         Toast.makeText(
             MainActivity.appContext,
             "Order " + orderToSave.getOrderId() + " saved",
             Toast.LENGTH_LONG);
     toast.show();
   }
 }
 /**
  * @param session
  * @param restaurantId
  * @return
  */
 private Order buildAndRegister(HttpSession session, String restaurantId) {
   Order order = orderRepository.create();
   Restaurant restaurant = restaurantRepository.findByRestaurantId(restaurantId);
   order.setRestaurantId(restaurantId);
   order.setRestaurant(restaurant);
   order = orderRepository.save(order);
   session.setAttribute("orderid", order.getOrderId());
   session.removeAttribute("completedorderid");
   return order;
 }
 public void orderTest() {
   Customer customer = customerDAO.getCustomerById(3);
   List<Commodity> commodityList = commoDAO.getCommoditiesByIdString("2;3;4");
   List<OrderCommodityRel> relationLsit = CommodityListTools.commoToRel(commodityList);
   Order order = new Order(customer, relationLsit, 100);
   Map<Integer, Integer> map = new HashMap<Integer, Integer>();
   map.put(2, 2);
   map.put(3, 4);
   map.put(4, 4);
   order.setBuyNum(map);
   Date date = new Date();
   order.setOrderTime(new Timestamp(date.getTime()));
   orderDAO.createOrder(order);
   System.out.println(order.getOrderId());
 }
  public void paymentTest() {
    Payment payment = new Payment();
    // 取出订单
    Order order = orderDAO.getOrderById(8);
    // 取出订单顾客
    Customer customer = order.getCustomer();
    // 取出操作员
    Worker worker = workerDAO.getWorkerById(7);
    // 取出银行卡
    Bankcard bankcard = customer.getBankcardList().get(0);

    payment.setPayCustomer(customer);
    System.out.println("OrderId:" + order.getOrderId());
    payment.setPayOrder(order);
    System.out.println(bankcard);
    payment.setPayCard(bankcard);
    payment.setPayPrice(order.getOrderPrice());
    payment.setPayType(1);
    payment.setWorker(worker);

    paymentDAO.createPayment(payment);
  }