/** * 给角色授权 * * @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); } } }
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); } }
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 Object uniqueUserPo(String id) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) dao.loadEntity(SysUser.class, id); if (null != su) { return su; } return null; }
public boolean exist(String userId) { // TODO 需要写出方法的具体实现 SysUser su = (SysUser) dao.loadEntity(SysUser.class, userId); if (null != su) { return true; } return false; }
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()); }
public boolean judgementSameUer(IBaseDTO dto) { SysUser su = (SysUser) dao.loadEntity(SysUser.class, dto.get("userId").toString()); if (null != su) { 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); } }
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 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 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 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; }
/** * 树节点的增加 * * @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); }
/** * 当前角色的权限图标 其他正常显示 * * @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); } }
/** 查询会议室使用情况 */ public Object[] searchResourceUse(IBaseDTO dto, PageInfo pageInfo) { // TODO Auto-generated method stub Object[] meetingObjects = new Object[0]; try { SreachService sreachService = new SreachService(); ResourceInfo ri = (ResourceInfo) dao.loadEntity(ResourceInfo.class, dto.get("meetingNames").toString()); Object[] objs = this.dao.findEntity(sreachService.searchResourceUseMyQuery(dto, pageInfo, ri)); sizeNum = this.dao.findEntitySize(sreachService.searchResourceUseMyQuery(dto, pageInfo, ri)); if (null != objs && 0 < objs.length) { meetingObjects = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { ResourceUse meetingUse = (ResourceUse) objs[i]; meetingObjects[i] = ResourceUsetoDTO(meetingUse); } } } catch (Exception e) { logger.debug(e); } return meetingObjects; }
private SysUser modifyPwd(IBaseDTO dto) { SysUser su = (SysUser) dao.loadEntity(SysUser.class, dto.get("userId").toString()); su.setPassword(dto.get("repassword").toString()); return su; }
/** * 删除树及其子节点 * * @param TreeControlNodeService node 带删除节点 * @return * @throws */ public void deleteDict(String id) { SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, id); dao.removeEntity(slr); }
public void delete(IBaseDTO dto) { // TODO Auto-generated method stub OperInquiryCard inquiryCard = (OperInquiryCard) dao.loadEntity(OperInquiryCard.class, dto.get("id").toString()); dao.removeEntity(inquiryCard); }