@Override public int createShopUser(User user) { // TODO Auto-generated method stub dao.create(user); Area a = a_dao.GetByName("鼓楼区", "南京"); if (a == null) { a = a_dao.findAll().get(0); } Shop shop = new Shop(); shop.setArea(a); shop.setShopname("shop of " + user.getUsername()); shop.setUser(user); shop_dao.create(shop); return user.getUserid(); }
@Override public void createUser(User user, String tokenCode) { dao.create(user); Token token = new Token(); token.setUserid(user.getUserid()); token.setTokencode(tokenCode); Calendar cal = Calendar.getInstance(); // ȡ��ǰ���ڡ� Date currentDate = cal.getTime(); cal.add(Calendar.DAY_OF_MONTH, +30); // ȡ��ǰ���ڵĺ�30��. token.setCreatedatetime(currentDate); token.setExpiredatetime(cal.getTime()); tokendao.createTokenCode(token); }
@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; }