Exemple #1
0
  /** @param newPassword */
  @Override
  public void modifyPassword(Long userId, String newPassword) {

    String passwordWithSalt = SignUtils.createPassword(newPassword);

    User user = userDao.get(userId);
    user.setPassword(passwordWithSalt);

    userDao.update(user);
  }
Exemple #2
0
  /** 创建 */
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public Long create(User user) {

    user = userDao.create(user);
    return user.getId();
  }
Exemple #3
0
  /** @param userId */
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public String addOneAppForUser(Long userId, int appId) {

    User user = getUser(userId);
    String ownAppIds = user.getOwnApps();
    if (ownAppIds.contains(",")) {
      ownAppIds = ownAppIds + "," + appId;

    } else {
      ownAppIds = String.valueOf(appId);
    }
    user.setOwnApps(ownAppIds);
    userDao.update(user);

    return ownAppIds;
  }
Exemple #4
0
  /** @param userId */
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public String addOneAppForUser(Long userId, Long appId) {

    User user = getUser(userId);
    String ownAppIds = user.getOwnApps();
    if (!StringUtils.isBlank(ownAppIds)) {
      ownAppIds = ownAppIds + "," + appId;

    } else {
      ownAppIds = String.valueOf(appId);
    }
    user.setOwnApps(ownAppIds);
    Visitor visitor = ThreadContext.getSessionVisitor();
    visitor.setAppIds(user.getOwnApps());
    userDao.update(user);
    return ownAppIds;
  }
Exemple #5
0
  @Override
  public List<User> getAll() {

    return userDao.findAll();
  }
Exemple #6
0
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public void create(List<User> users) {

    userDao.create(users);
  }
Exemple #7
0
  /**
   * @param userId
   * @return
   */
  @Override
  public User getUser(Long userId) {

    return userDao.get(userId);
  }