@POST @Produces(MediaType.APPLICATION_JSON) @Override public UserInfo SignUp( @QueryParam("password") String password, @QueryParam("username") String username, @QueryParam("email") String email, @QueryParam("qq") BigInteger qq, @QueryParam("account") Integer account, @QueryParam("faith") Integer faith) { Date firstLoginDate = new Date(); UserInfo userInfo = new UserInfo(); // UserDA userDA=new UserDA(); Integer id = userDA.createUser(password, username, firstLoginDate, email, qq, account, faith); BookUsers bookUsers = userDA.findUserByID(id); if (bookUsers != null) { userInfo.setEmail(bookUsers.getEmail()); userInfo.setFaith(bookUsers.getFaith()); userInfo.setFirstLogin(bookUsers.getFirstLogin()); userInfo.setQq(bookUsers.getQq()); userInfo.setAccount(bookUsers.getAccount()); userInfo.setUserName(bookUsers.getUsername()); } else { userInfo = null; } return userInfo; }
@PUT @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) @Override public UserInfo CompleteInfo( @PathParam("id") Integer id, @QueryParam("password") String password, @QueryParam("username") String username, @QueryParam("email") String email, @QueryParam("qq") BigInteger qq, @QueryParam("account") Integer account, @QueryParam("faith") Integer faith, @QueryParam("firlstlogin") Date firstLoginDate) { boolean flag; UserInfo userInfo = new UserInfo(); // UserDA userDA=new UserDA(); flag = userDA.editUser(id, password, username, firstLoginDate, email, qq, account, faith); if (flag) { BookUsers bookUsers = userDA.findUserByID(id); userInfo.setEmail(bookUsers.getEmail()); userInfo.setFaith(bookUsers.getFaith()); userInfo.setFirstLogin(bookUsers.getFirstLogin()); userInfo.setQq(bookUsers.getQq()); userInfo.setAccount(bookUsers.getAccount()); userInfo.setUserName(bookUsers.getUsername()); } else { userInfo = null; } return userInfo; }
@GET @Produces(MediaType.APPLICATION_JSON) @Override public UserInfo findByUserInfo(@QueryParam("id") Integer id) { // UserDA userDA=new UserDA(); BookUsers bookUsers = userDA.findUserByID(id); UserInfo userInfo = new UserInfo(); if (bookUsers != null) { userInfo.setEmail(bookUsers.getEmail()); userInfo.setFaith(bookUsers.getFaith()); userInfo.setFirstLogin(bookUsers.getFirstLogin()); userInfo.setQq(bookUsers.getQq()); userInfo.setAccount(bookUsers.getAccount()); userInfo.setUserName(bookUsers.getUsername()); } else { userInfo = null; } return userInfo; }