@Override public void delUser(String id) throws Exception { userDao.delUser(id); this.userRoleDao.delUserRoleByUserId(id); this.userSystemDao.delByUserId(id); this.userRoleDao.delUserRoleByUserId(id); ACL acl = new ACL(); acl.setReleaseId(id); acl.setReleaseSn(ACL.USER); aclDao.delAcl(acl); }
@Override public void updateUser(User user) throws Exception { userDao.updateUser(user); this.userSystemDao.delByUserId(user.getId()); String systemIds = user.getSystemIds(); if (StringUtils.isNotBlank(systemIds)) { String[] syses = systemIds.split(","); for (String sys : syses) { UserSystem userSystem = new UserSystem(); userSystem.setSystemId(sys); userSystem.setId(UUIDGenerator.generate()); userSystem.setUserId(user.getId()); this.userSystemDao.insertUserSystem(userSystem); } } }
@Override public PagerModel<User> getPagerModel(User user, Query query) throws Exception { PagerModel<User> pm = userDao.getPagerModel(user, query); for (User ur : pm.getDatas()) { List<Role> list = this.userRoleDao.getRolesByUserId(ur.getId()); if (list != null && list.size() > 0) { StringBuffer s = new StringBuffer(); for (int i = 0, len = list.size(); i < len; i++) { if (i != 0) { s.append(","); } s.append(list.get(i).getName()); } ur.setRoles(s.toString()); } } return pm; }
@Override public User getUserById(String id) throws Exception { UserSystem userSystem = new UserSystem(); userSystem.setUserId(id); List<UserSystem> list = this.userSystemDao.getAll(userSystem); StringBuffer systemIds = new StringBuffer(""); if (list != null && list.size() > 0) { for (int i = 0, len = list.size(); i < len; i++) { if (i != 0) { systemIds.append(","); } systemIds.append(list.get(i).getSystemId()); } } User user = userDao.getUserById(id); if (user != null && systemIds.length() > 0) { user.setSystemIds(systemIds.toString()); Department department = this.departmentDao.getDepartmentById(user.getDepartmentId()); if (department != null) { user.setDeptName(department.getName()); } } return user; }
@Override public User login(String username, String password) throws Exception { return userDao.login(username, password); }
@Override public List<User> getUserByDeptIdAndRoleSn(String deptId, String roleSn) throws PrivilegeException { return userDao.getUserByDeptIdAndRoleSn(deptId, roleSn); }
/** * 通过系统标识得到系统下面的所有的人 * * @param systemSn 系统标识 * @return */ public List<User> getSystemUsersBySystemSn(String systemSn) { return userDao.getSystemUsersBySystemSn(systemSn); }
@Override public List<User> getUsersByPrivilegeVo(PrivilegeVo vo) throws Exception { return userDao.getUsersByPrivilegeVo(vo); }