public static List<String[]> getAllUserByRole(Integer[] roleId) throws Exception { String ids = "", names = ""; for (Integer id : roleId) { if (id == 1) id = 11; RoleForm rf = RoleBo.getInstance().findRoleUser(id + ""); if (rf == null) continue; ids += rf.getUserCode(); names += rf.getUserName(); } List<String[]> userList = new ArrayList<String[]>(); String[] strIds = ids.split(","); String[] strNames = names.split(","); HashSet<String> idSet = new HashSet<String>(); for (int i = 0; i < strIds.length; i++) { if (idSet.contains(strIds[i])) { continue; } else { idSet.add(strIds[i]); String[] temp = {strIds[i], strNames[i]}; userList.add(temp); } } return userList; }
public static ArrayList getAtomRole(Long userId) { ArrayList roleList = new ArrayList(); try { UserBo ub = UserBo.getInstance(); UserForm uf = ub.find(userId.toString()); Iterator it = uf.getRoles().iterator(); while (it.hasNext()) { RoleForm rf = (RoleForm) it.next(); // if(rf.getRoleType().equals("A")||rf.getRoleType().equals("B")){ roleList.add(rf.getId()); // } } } catch (Exception e) { e.printStackTrace(); } return roleList; }