From ef6f21c636ec66519855a81a3250ce293823c068 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 18 Aug 2022 15:17:59 +0800 Subject: [PATCH] =?UTF-8?q?BUG=E4=BF=AE=E5=A4=8D=EF=BC=8C=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OrgChartServiceImpl.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) 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;