Beispiel #1
0
  @Override
  public Order bookService(int uerid, int serviceid, int number) {
    // TODO Auto-generated method stub
    com.zyl.centre.entity.Service serv = m_dao.getServiceByid(serviceid);
    User user = findUserByUserid(uerid);
    Order ord = new Order();
    ord.setUser(user);
    ord.setCreatetime(new Date());
    ord.setNumber(number);
    ord.setSumprice(number * serv.getPrice());
    ord.setSubmitusername(user.getUsername());
    ord.setState(0);
    ord.setOrdphone(user.getPhone());
    ord_dao.create(ord);

    Serviceordrel ordrel = new Serviceordrel();
    ordrel.setDate(new Date());
    ordrel.setOrder(ord);
    ordrel.setService(serv);
    ordrel.setId(new ServiceordrelId(ord.getOrderid(), serv.getServiceid()));
    rel_dao.create(ordrel);
    return ord;
  }