public void convert() {
   // param dateString looks like:2016.2.23
   String dateString = "2016.2.23";
   Date date = new Date();
   DateFormat sdf = new SimpleDateFormat("yyyy.M.d");
   try {
     date = sdf.parse(dateString);
   } catch (ParseException e) {
     e.printStackTrace();
   }
   Timestamp timestamp = new Timestamp(date.getTime());
   System.out.println(timestamp);
 }
 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 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);
  }