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;
 }
 /**
  * 给角色授权
  *
  * @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);
     }
   }
 }
 private SysUser createPoByDTO(IBaseDTO dto) {
   SysUser su = new SysUser();
   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);
   Password_encrypt pe = new Password_encrypt();
   su.setPassword(
       null != dto.get("password") && !"".equals("password")
           ? pe.pw_encrypt(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;
 }
 /**
  * 当前角色的权限图标 其他正常显示
  *
  * @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);
   }
 }