示例#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);
  }
示例#2
0
  /** 创建 */
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public Long create(User user) {

    user = userDao.create(user);
    return user.getId();
  }
示例#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;
  }
示例#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;
  }