示例#1
0
 public Member registerMember(User user, Member member, String ip, Integer groupId) {
   member.setRegisterIp(ip);
   member.setLastLoginIp(ip);
   if (groupId != null) {
     member.addToGroups(this.groupService.findById(groupId));
   }
   this.userService.save(user);
   member.setUser(user);
   save(member);
   user.setMember(member);
   return member;
 }
示例#2
0
  public Member updateMember(User user, Member member, Integer groupId, Integer siteId) {
    if (findById(user.getId()) != null) {
      member = update(member);
    } else {
      member.setUser(user);
      member = save(member);
      user.setMember(member);
    }
    this.userService.update(user);
    if ((groupId != null) && (!groupId.equals(member.getGroup(siteId).getId()))) {
      member.getGroups().remove(member.getGroup(siteId));
      member.addToGroups(this.groupService.findById(groupId));
    }

    return member;
  }
示例#3
0
 public void updateLoginInfo(User user, String lastLoginIp) {
   Member member = findById(user.getId());
   if (member != null) {
     member.setLastLoginIp(lastLoginIp);
     member.setLastLoginTime(new Timestamp(System.currentTimeMillis()));
     if (member.getRegisterIp() == null) {
       member.setRegisterIp(lastLoginIp);
     }
     member.setLoginCount(Integer.valueOf(member.getLoginCount().intValue() + 1));
   }
 }
示例#4
0
 public Member save(Member bean) {
   bean.init();
   this.dao.save(bean);
   return bean;
 }