public void payServiceTest() { Worker worker = workerDAO.getWorkerById(7); Order order = orderDAO.getOrderById(8); Bankcard bankcard = bankcardDAO.getCardById(2); PayStatus status = payService.payForOrder(order, worker, bankcard); System.out.println(status.toString()); }
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); }