Beispiel #1
0
 public String nextSequenceNumber() {
   try {
     Integer id = authRepository.nextSequenceNumber();
     if (null == id) {
       authRepository.initSequenceNumber();
       id = 1000;
     } else {
       authRepository.updateSequenceNumber(id + 1);
     }
     return String.format("%d", id);
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
 }
Beispiel #2
0
 public void updateAccount(Account acount) throws AuthServerException {
   try {
     authRepository.updateAuth(acount);
   } catch (Exception e) {
     throw new AuthServerException("修改账号信息出错!");
   }
 }
Beispiel #3
0
 public void suspendAccount(Account account) throws AuthServerException {
   try {
     authRepository.suspendAuth(account.getId());
   } catch (Exception e) {
     throw new AuthServerException("暂停账号信息出错!");
   }
 }
Beispiel #4
0
 public void resetAccount(Account acount) throws AuthServerException {
   try {
     authRepository.resetAuth(acount.getPassword(), acount.getId());
   } catch (Exception e) {
     throw new AuthServerException("重置密码出错!");
   }
 }
Beispiel #5
0
 public Account accountById(String id) throws AuthServerException {
   try {
     Account acct = authRepository.Authbyid(id);
     return acct;
   } catch (Exception e) {
     throw new AuthServerException("获取账号信息出错!");
   }
 }
Beispiel #6
0
 public Account accountByEmail(String account, String status) throws AuthServerException {
   try {
     Account acct = authRepository.Authbyemail(account, status);
     return acct;
   } catch (Exception e) {
     throw new AuthServerException("获取账号信息出错!");
   }
 }
Beispiel #7
0
 public int totalAccounts(Map<String, String> condition) throws AuthServerException {
   try {
     int i = authRepository.totalAuth(condition);
     return i;
   } catch (Exception e) {
     throw new AuthServerException("获取总数失败!");
   }
 }
Beispiel #8
0
 public Account createAccount(Account acount) throws AuthServerException {
   try {
     Account account = acount;
     account.setStatus("2");
     account.setId(nextSequenceNumber());
     Account accountd = authRepository.Authbyemail(acount.getEmail(), "1");
     if (accountd != null) {
       throw new AuthServerException("该邮箱账号已被激活使用,请检查修改!");
     }
     authRepository.insertAuth(account);
     return account;
   } catch (AuthServerException e) {
     throw new AuthServerException(e.getMessage());
   } catch (Exception e) {
     throw new AuthServerException("创建账号失败!");
   }
 }
Beispiel #9
0
 public List<Map<String, Object>> listAccounts(Map<String, String> condition, int start, int limit)
     throws AuthServerException {
   try {
     List<Map<String, Object>> ml = authRepository.listAuth(condition, start, limit);
     return ml;
   } catch (Exception e) {
     throw new AuthServerException("获取账号列表失败!");
   }
 }