diff --git a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java index 32777b72..76bf5010 100644 --- a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java @@ -22,21 +22,13 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { private RecordSet grs = new RecordSet(); + private static final String COMPANY_RIGHT = "OrgChart:All"; + private static final String USER_RIGHT = "OrgPerspective:All"; + @Override public Map getOptionCondition(Map request2Map, User user) { Map result = new HashMap<>(); RecordSet rs = new RecordSet(); - String type = (String) request2Map.get("type"); - String rightName = "OrgChart:All"; - // 组织透视 - if ("user".equals(type)) { - rightName = "OrgPerspective:All"; - } - boolean hasRight = HasRightUtil.hasRight(user, rightName, true); - result.put("hasRight", hasRight); - if (!hasRight) { - return result; - } rs.executeQuery("select id, companyname from HrmCompanyVirtual order by id"); List> fclasslist = new ArrayList<>(); @@ -102,6 +94,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { @Override public Map getCompanyData(Map request2Map, User user) { + Map result = new HashMap<>(); + boolean hasRight = HasRightUtil.hasRight(user, COMPANY_RIGHT, true); + result.put("hasRight", hasRight); + if (!hasRight) { + return result; + } String root = (String) request2Map.get("root"); // 根节点 String level = (String) request2Map.get("level"); // 显示层级 @@ -140,7 +138,6 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { findCompanyItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, true); } - Map result = new HashMap<>(); result.put("api_status", true); result.put("data", list); return result; @@ -205,6 +202,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { @Override public Map getUserData(Map request2Map, User user) { + Map result = new HashMap<>(); + boolean hasRight = HasRightUtil.hasRight(user, USER_RIGHT, true); + result.put("hasRight", hasRight); + if (!hasRight) { + return result; + } String root = (String) request2Map.get("root"); // 根节点 String level = (String) request2Map.get("level"); // 显示层级 if (StringUtils.isBlank(level)) { @@ -249,7 +252,6 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { findUserItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, true); } - Map result = new HashMap<>(); result.put("api_status", true); result.put("data", list); return result;