コード例 #1
0
  @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;
  }
コード例 #2
0
  @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;
  }
コード例 #3
0
 @DELETE
 @Produces(MediaType.APPLICATION_JSON)
 @Override
 public boolean removeUser(@QueryParam("id") Integer id) {
   boolean flag;
   // UserDA userDA=new UserDA();
   flag = userDA.removeUser(id);
   return flag;
 }
コード例 #4
0
  @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;
  }