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 planTest() { Worker worker = workerDAO.getWorkerById(6); Department department = depDAO.getDepartment(2); Date date = new Date(); new Timestamp(date.getTime()); // plan creating Plan plan = new Plan(); plan.setWorker(worker); // worker plan.setDepartment(department); // department // set several timestamp attributes plan.setCreateTime(new Timestamp(date.getTime())); plan.setBeginTime(new Timestamp(date.getTime())); plan.setEndTime(new Timestamp(date.getTime())); // planCommodityRel creating PlanCommodityRel relation1 = new PlanCommodityRel(); Commodity commodity1 = commoDAO.getCommodityById(1); relation1.setCommodity(commodity1); relation1.setPlan(plan); relation1.setPlanNum(50); relation1.setSinglePrice(8); PlanCommodityRel relation2 = new PlanCommodityRel(); Commodity commodity2 = commoDAO.getCommodityById(2); relation2.setCommodity(commodity2); relation2.setPlan(plan); relation2.setPlanNum(50); relation2.setSinglePrice(8); PlanCommodityRel relation3 = new PlanCommodityRel(); Commodity commodity3 = commoDAO.getCommodityById(3); relation3.setCommodity(commodity3); relation3.setPlan(plan); relation3.setPlanNum(50); relation3.setSinglePrice(8); plan.getPlanCommodityRelList().add(relation1); plan.getPlanCommodityRelList().add(relation2); plan.getPlanCommodityRelList().add(relation3); planDAO.createPlan(plan); }
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); }