/** * 给角色授权 * * @param roleId * @param TreeService rights * @return */ public void impowerRole(String roleId, TreeService rights) { // TODO Auto-generated method stub SysRole sr = (SysRole) dao.loadEntity(SysRole.class, roleId); Set s = sr.getSysRightRoles(); Iterator i = s.iterator(); while (i.hasNext()) { SysRightRole srr = (SysRightRole) i.next(); dao.removeEntity(srr); } dao.flush(); // String rootName = rights.getRoot().getId(); Map registry = rights.getRegistry(); Iterator iterator = registry.keySet().iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); ViewTreeControlNode node = (ViewTreeControlNode) registry.get(key); String nodeType = node.getType(); if (nodeType == null) nodeType = ""; // 是角色图标 类型是leaf_right_% if (SysStaticParameter.RICON.equalsIgnoreCase(node.getTmpIcon()) && nodeType.indexOf("leaf_right") != -1) { SysRightRole dbsrr = new SysRightRole(); dbsrr.setId(ks.getNext("SYS_RIGHT_ROLE")); dbsrr.setSysRole(sr); SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, node.getId()); dbsrr.setSysLeafRight(slr); dao.saveEntity(dbsrr); } } }
/** * 根据ID返回详细信息 * * @param * @return * @throws */ public List treeList(IBaseDTO dto, PageInfo pi, String id) { List list = new ArrayList(); LeafRightSearch lrs = new LeafRightSearch(); Object[] result = (Object[]) dao.findEntity(lrs.treeList(dto, pi, id)); num = dao.findEntitySize(lrs.treeList(dto, pi, id)); for (int i = 0, size = result.length; i < size; i++) { SysLeafRight slr = (SysLeafRight) result[i]; DynaBeanDTO dbd = new DynaBeanDTO(); dbd.set("id", slr.getId()); dbd.set("treeId", slr.getId()); dbd.set("treeType", slr.getType()); dbd.set("label", slr.getLabel()); dbd.set("nickName", slr.getNickName()); String remark = slr.getRemark() == null ? "" : slr.getRemark(); if (remark.length() > 15) { remark = remark.substring(0, 15); } dbd.set("remark", remark); dbd.set("icon", slr.getIcon()); list.add(dbd); } return list; }
/** * 添加用户 用户标识: 2 -系统用户 1 -一般用户 0 -冻结用户 -1 -删除用户 系统用户和删除用户不在查询中显示其信息 * * @param dto */ public void insertUser(IBaseDTO dto) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) createPoByDTO(dto); SysUserInfo sui = (SysUserInfo) createSUIByDTO(dto); sui.setSysUser(su); dao.saveEntity(su); dao.saveEntity(sui); }
public void deleteRoleRights(String roleId, String treeId) { Object[] o = dao.findEntity(searchHelp.searchRightRole(roleId, treeId)); for (int i = 0; i < o.length; i++) { SysRightRole srr = (SysRightRole) o[i]; dao.removeEntity(srr); } dao.flush(); }
public void updateUser(IBaseDTO dto) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) modifyPoByDTO(dto); SysUserInfo sui = (SysUserInfo) createSUIByDTO(dto); // sui.setSysUser(su); dao.saveEntity(su); // sui.setSysUser(su); // dao.updateEntity(sui); dao.saveEntity(sui); }
public IBaseDTO uniqueUser(String id) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) dao.loadEntity(SysUser.class, id); SysUserInfo sui = (SysUserInfo) dao.loadEntity(SysUserInfo.class, id); if (null != su) { IBaseDTO dto = createDTOByPo(su); dto = createDTOByPo(sui, dto); return dto; } return null; }
public void grantRoleRights(String roleId, List<String> leafRightIds) { SysRole sr = (SysRole) dao.loadEntity(SysRole.class, roleId); for (int i = 0; i < leafRightIds.size(); i++) { SysRightRole srr = new SysRightRole(); // System.out.println(leafRightIds.get(i)); SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, leafRightIds.get(i)); srr.setId(ks.getNext("SYS_RIGHT_ROLE")); srr.setSysRole(sr); srr.setSysLeafRight(slr); dao.saveEntity(srr); } }
/** * 树节点的修改 * * @param IBaseDTO dto 是BaseTree 和 ViewTreeDict的信息 * @return * @throws */ public boolean updateDict(IBaseDTO dto) { SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, dto.get("id").toString()); slr.setLabel(dto.get("label").toString()); slr.setNickName(dto.get("nickName").toString()); slr.setRemark(dto.get("remark").toString()); slr.setDeleteMark(dto.get("deleteMark").toString()); slr.setIcon(dto.get("icon").toString()); slr.setType(dto.get("treeType").toString()); dao.updateEntity(slr); return true; }
public int listUserSize(IBaseDTO dto) { // TODO 需要写出方法的具体实现 UserHelp uh = new UserHelp(); MyQuery mq = uh.ListUserMQ(dto); int i = dao.findEntitySize(mq); return i; }
public void thawUser(String id) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) dao.loadEntity(SysUser.class, id); if (null != su) { su.setDeleteMark("1"); } }
private SysUser modifyPoByDTO(IBaseDTO dto) { SysUser su = (SysUser) dao.loadEntity(SysUser.class, dto.get("userId").toString()); // su.setUserId(null !=dto.get("userId") && !"".equals("userId")? // dto.get("userId").toString():""); SysRole sr = new SysRole(); sr.setId(dto.get("sysRole").toString()); su.setSysRole(sr); SysGroup sg = new SysGroup(); sg.setId(dto.get("sysGroup").toString()); su.setSysGroup(sg); su.setPassword( null != dto.get("password") && !"".equals("password") ? dto.get("password").toString() : ""); SysDepartment sd = new SysDepartment(); if (null != dto.get("departmentId") && !"".equals("departmentId")) sd.setId(dto.get("departmentId").toString()); su.setSysDepartment(sd); su.setUserName( null != dto.get("userName") && !"".equals("userName") ? dto.get("userName").toString() : ""); su.setDeleteMark( null != dto.get("freezeMark") && !"".equals("freezeMark") ? dto.get("freezeMark").toString() : ""); su.setRemark( null != dto.get("remark") && !"".equals("remark") ? dto.get("remark").toString() : ""); // su.setIsSys("0"); return su; }
public boolean exist(String userId) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) dao.loadEntity(SysUser.class, userId); if (null != su) { return true; } return false; }
public boolean judgementSameUer(IBaseDTO dto) { SysUser su = (SysUser) dao.loadEntity(SysUser.class, dto.get("userId").toString()); if (null != su) { return true; } else { return false; } }
public Object uniqueUserPo(String id) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) dao.loadEntity(SysUser.class, id); if (null != su) { return su; } return null; }
public void update(IBaseDTO dto) { // TODO Auto-generated method stub OperInquiryCard inquiryCard = (OperInquiryCard) dao.loadEntity(OperInquiryCard.class, dto.get("id").toString()); inquiryCard.setAlternatives(dto.get("alternatives").toString()); inquiryCard.setDictQuestionType(dto.get("questionType").toString()); inquiryCard.setQuestion(dto.get("question").toString()); }
/** * 树节点的增加 * * @param IBaseDTO dto 是BaseTree 和 ViewTreeDict的信息 * @return * @throws */ public void addDict(IBaseDTO dto, String treeId) { SysLeafRight slr = new SysLeafRight(); BaseTree bt = (BaseTree) dao.loadEntity(BaseTree.class, treeId); slr.setId(ks.getNext("sys_leaf_right")); slr.setBaseTree(bt); slr.setType(dto.get("treeType").toString()); slr.setLabel(dto.get("label").toString()); slr.setNickName(dto.get("nickName").toString()); slr.setRemark(dto.get("remark").toString()); slr.setIcon(dto.get("icon").toString()); slr.setDeleteMark(dto.get("deleteMark").toString()); slr.setIcon((String) dto.get("icon")); dao.saveEntity(slr); }
public boolean haveSameResourceName(String resourceName) { MeetingSearchHelp msh = new MeetingSearchHelp(); int i = dao.findEntitySize(msh.searchSameResourceName(resourceName)); if (i > 0) { return true; } else { return false; } }
/** * 删除资源基本信息 * * @param dto */ public void deleteResourceInfo(String meetingId) { try { ResourceInfo resourceInfo = (ResourceInfo) dao.loadEntity(ResourceInfo.class, meetingId); this.dao.removeEntity(resourceInfo); } catch (Exception e) { logger.debug(e); } }
/** * 更新资源基本信息 * * @param dto */ public void updateResourceInfo(IBaseDTO dto) { // TODO Auto-generated method stub try { dao.updateEntity(updateMeetingInfo(dto)); } catch (Exception e) { logger.debug(e); e.printStackTrace(); } }
public List<LabelValueBean> getLabelList() { MeetingSearchHelp msh = new MeetingSearchHelp(); Object[] objs = dao.findEntity(msh.searchMeetingRoom()); List l = new ArrayList(); for (int i = 0, size = objs.length; i < size; i++) { ResourceInfo ri = (ResourceInfo) objs[i]; DynaBeanDTO dbd = new DynaBeanDTO(); l.add(new LabelValueBean(ri.getResourceName(), ri.getId())); } return l; }
public IBaseDTO getInquiryCardInfo(String id) { // TODO Auto-generated method stub OperInquiryCard po = (OperInquiryCard) dao.loadEntity(OperInquiryCard.class, id); IBaseDTO dto = new DynaBeanDTO(); dto.set("questionType", po.getDictQuestionType()); dto.set("question", po.getQuestion()); dto.set("alternatives", po.getAlternatives()); dto.set("id", po.getId()); dto.set("createTime", TimeUtil.getTheTimeStr(po.getCreateTime(), "yyyy-MM-dd")); return dto; }
/** * 给用户批量授权 * * @param roleId * @param TreeService rights * @return */ public void impowerBatchPerson2Role(String roleId, TreeService rights) { // TODO Auto-generated method stub SysRole sr = (SysRole) dao.loadEntity(SysRole.class, roleId); // String rootName = rights.getRoot().getId(); Map registry = rights.getRegistry(); Iterator iterator = registry.keySet().iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); ViewTreeControlNode node = (ViewTreeControlNode) registry.get(key); String nodeType = node.getType(); if (nodeType == null) nodeType = ""; // 是角色图标 类型是leaf_right_% if (SysStaticParameter.RICON.equalsIgnoreCase(node.getTmpIcon()) && nodeType.indexOf("batchRightUser") != -1) { SysUser su = (SysUser) dao.loadEntity(SysUser.class, node.getId()); su.setSysRole(sr); dao.saveEntity(su); } } }
public boolean check(String userId, String password) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) dao.loadEntity(SysUser.class, userId); Password_encrypt pe = new Password_encrypt(); if (null != su && pe.pw_encrypt(password).equals(su.getPassword()) && su.getDeleteMark().equals(NOT_DELETED)) { return true; } return false; }
public boolean deleteUser(String id) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) dao.loadEntity(SysUser.class, id); if (null != su) { if (su.getIsSys().equals("1")) { return false; } su.setDeleteMark("-1"); // 删除标志-1 return true; } return false; }
/** * 根据ID返回详细信息 * * @param * @return * @throws */ public IBaseDTO treeInfo(String id) { SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, id); IBaseDTO dto = new DynaBeanDTO(); dto.set("id", slr.getId()); dto.set("treeId", slr.getId()); dto.set("treeType", slr.getType()); dto.set("label", slr.getLabel()); dto.set("nickName", slr.getNickName()); dto.set("remark", slr.getRemark()); return dto; }
/** @param id 树中加入的label 为:IVR栏目名称维护 的id */ public void initIvrModele() { try { String sql = "select label,nickName from base_tree where parent_id = '" + keyModuleId + "'"; RowSet rs = dao.getRowSetByJDBCsql(sql); try { rs.beforeFirst(); while (rs.next()) { ivrModule.put(rs.getString("nickName"), rs.getString("label")); } } catch (SQLException e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); } }
/** 获得受理工号列表 */ public List userQuery(String sql) { System.out.println("sql :" + sql); RowSet rs = dao.getRowSetByJDBCsql(sql); List<SysUser> list = new ArrayList<SysUser>(); try { rs.beforeFirst(); while (rs.next()) { SysUser su = new SysUser(); su.setUserId(rs.getString("user_id")); list.add(su); } } catch (SQLException e) { e.printStackTrace(); } return list; }
public List<IBaseDTO> listUser(IBaseDTO dto, PageInfo pi) { // TODO 需要写出方法的具体实现 UserHelp uh = new UserHelp(); Object[] o = dao.findEntity(uh.listUserMQ(dto, pi)); ArrayList l = new ArrayList(); if (null != o && o.length > 0) { for (Object oo : o) { SysUser su = ((SysUser) oo); IBaseDTO tdto = createDTOByPo(su); IBaseDTO gdto = this.groupService.uniqueGroup(su.getSysGroup().getId()); IBaseDTO rdto = this.roleService.getRoleInfo(su.getSysRole().getId()); tdto.set("groupName", gdto.get("name")); tdto.set("roleName", rdto.get("name")); l.add(tdto); } return l; } return l; }
/** * 当前角色的权限图标 其他正常显示 * * @param roleId * @param TreeService rights * @return */ public void impowerRoleIcon(String roleId, TreeService rights, String tmpIcon) { SysRole sr = (SysRole) dao.loadEntity(SysRole.class, roleId); Map registry = rights.getRegistry(); Iterator keys = registry.keySet().iterator(); Iterator it = sr.getSysRightRoles().iterator(); // 清除临时图标 while (keys.hasNext()) { // System.out.println("+++++++++++++++++++++"+registry.get((String)keys.next()).getClass()); ViewTreeControlImpowerNode node = (ViewTreeControlImpowerNode) registry.get((String) keys.next()); node.setTmpIcon(null); } // 给角色拥有的权限赋图标 while (it.hasNext()) { SysRightRole srr = (SysRightRole) it.next(); String leafRightId = srr.getSysLeafRight().getId(); ViewTreeControlImpowerNode lnode = (ViewTreeControlImpowerNode) registry.get(leafRightId); if (lnode != null) lnode.setTmpIcon(tmpIcon); } }
/** * 得到叶子节点权限列表 * * @param nodeId * @return List<SysLeafRight> */ public List<DynaBeanDTO> getLeafRightByNodeId(String nodeId) { List<DynaBeanDTO> rights = new ArrayList<DynaBeanDTO>(); if (nodeId != null) { String hql = "from SysLeafRight where a.baseTree.id = '" + nodeId + "' order by a.nickName"; MyQuery mq = new MyQueryImpl(); mq.setHql(hql); Object[] o = dao.findEntity(searchHelp.searchLeafRightByNodeId(nodeId)); DynaBeanDTO dto = null; for (int i = 0; i < o.length; i++) { dto = new DynaBeanDTO(); SysLeafRight right = (SysLeafRight) o[i]; dto.set("id", right.getId()); dto.set("treeId", right.getBaseTree().getId()); dto.set("treeName", right.getBaseTree().getLabel()); dto.set("type", right.getType()); dto.set("nickName", right.getNickName()); dto.set("deleteMark", right.getDeleteMark()); dto.set("remark", right.getRemark()); rights.add(dto); } } return rights; }