@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 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(); }