Exemple #1
0
 public String dept_permit_select() throws Exception {
   ContextHelper.isPermit("GLOBAL_PRVG_DEPT_FUNCTION");
   try {
     DepartmentDAO dao = new DepartmentDAO();
     map.clear();
     if (ContextHelper.getUserLoginInfo().getPermit_depts() == null)
       map.put("dept_code", ContextHelper.getUserLoginDept()); // 能选到自己的部门
     else map.put("dept_codes", ContextHelper.getUserLoginPermitDepts());
     this.setDepts(dao.list(map));
   } catch (Exception e) {
     log.error(this.getClass().getName() + "!dept_permit_select 读取数据错误:", e);
     throw new Exception(this.getClass().getName() + "!dept_permit_select 读取数据错误:", e);
   }
   return SUCCESS;
 }
Exemple #2
0
 public String dept_select_all() throws Exception {
   // ContextHelper.isPermit("SYS_SELECT_DEPT_LIST");
   try {
     if (ContextHelper.checkPermit("SYS_SELECT_DEPT_LIST")) {
       DepartmentDAO dao = new DepartmentDAO();
       this.setDepts(dao.list(null));
     } else {
       return dept_permit_select();
     }
   } catch (Exception e) {
     log.error(this.getClass().getName() + "!all_dept_select 读取数据错误:", e);
     throw new Exception(this.getClass().getName() + "!all_dept_select 读取数据错误:", e);
   }
   return SUCCESS;
 }
Exemple #3
0
 public String dept_select_limit() throws Exception {
   ContextHelper.isPermit("SYS_SELECT_DEPT_LIMIT_LIST");
   Integer permitType = ContextHelper.getPermitType("SYS_SELECT_DEPT_LIMIT_LIST");
   try {
     DepartmentDAO dao = new DepartmentDAO();
     if (ContextHelper.isAdmin() || permitType == 2) {
       this.setDepts(dao.list(null));
     } else if (permitType == 1) {
       // 则只显示自己对应的下级部门及直属上级部门
       if (dept_mode == 0) { // 以{dept_code的父部门}作为起始部门
         map.clear();
         map.put("dept_code", ContextHelper.getUserLoginInfo().getDept_code());
         this.setDepts(dao.list(map));
         String p_dept = ((Department) this.getDepts().get(0)).getParent_dept();
         if (ToolsUtil.isEmpty(p_dept)) { // 如父部门为空,则还是以本身作为起始
           this.setDepts(
               ToolsUtil.getTreeNode(
                   dao.list(null),
                   "dept_code",
                   "parent_dept",
                   ContextHelper.getUserLoginInfo().getDept_code(),
                   2,
                   true));
         } else {
           this.setDepts(
               ToolsUtil.getTreeNode(dao.list(null), "dept_code", "parent_dept", p_dept, 2, true));
         }
       } else { // 以自身部门为起始部门
         this.setDepts(
             ToolsUtil.getTreeNode(
                 dao.list(null),
                 "dept_code",
                 "parent_dept",
                 ContextHelper.getUserLoginInfo().getDept_code(),
                 3,
                 true));
       }
     } else if (permitType == 0) {
       map.clear();
       map.put("dept_code", ContextHelper.getUserLoginInfo().getDept_code());
       this.setDepts(dao.list(map));
     }
   } catch (Exception e) {
     log.error(this.getClass().getName() + "!limit_dept_select 读取数据错误:", e);
     throw new Exception(this.getClass().getName() + "!limit_dept_select 读取数据错误:", e);
   }
   return SUCCESS;
 }