From d068aa6bc1cb5962993c54e12dead1874136fc6f Mon Sep 17 00:00:00 2001 From: dxfeng Date: Wed, 2 Aug 2023 11:29:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E6=A0=91=E7=BB=93=E6=9E=84=E5=B1=95=E5=BC=80=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E3=80=81=E5=88=86=E9=83=A8=E5=88=A0=E9=99=A4?= =?UTF-8?q?BUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChartServiceImpl.java | 42 ++++++++++--------- .../service/impl/CompServiceImpl.java | 9 ++++ 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 94b6d9ca..4f005b5a 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -523,15 +523,16 @@ public class ChartServiceImpl extends Service implements ChartService { * @param expandedKeys 完整的上级ID集合 * @param expandedKeyStr 需要展开的树ID */ - private void addParentTreeId(List expandedKeys,String expandedKeyStr){ - if(StringUtils.isNotBlank(expandedKeyStr)) { - String[] split = expandedKeyStr.split(","); - for (String s : split) { - try { - // 上级分部ID - String subcompanyid1 = new DepartmentComInfo().getSubcompanyid1(s); + private void addParentTreeId(List expandedKeys,String expandedKeyStr) { + if (StringUtils.isNotBlank(expandedKeyStr)) { + expandedKeyStr = expandedKeyStr.replace("d", ""); + try { + String[] array; + // 上级分部ID + String subcompanyid1 = new DepartmentComInfo().getSubcompanyid1(expandedKeyStr); + if (StringUtils.isNotBlank(subcompanyid1)) { String allSupCompany = new SubCompanyComInfo().getAllSupCompany(subcompanyid1); - String[] array = allSupCompany.split(","); + array = allSupCompany.split(","); for (String supCompany : array) { if (StringUtils.isBlank(supCompany)) { continue; @@ -539,22 +540,23 @@ public class ChartServiceImpl extends Service implements ChartService { expandedKeys.add("s" + supCompany); } expandedKeys.add("s" + subcompanyid1); + } - // 上级部门ID - String allSupDepartment = new DepartmentComInfo().getAllSupDepartment(s); - array = allSupDepartment.split(","); - for (String supDepartment : array) { - if (StringUtils.isBlank(supDepartment)) { - continue; - } - expandedKeys.add("d" + supDepartment); + // 上级部门ID + String allSupDepartment = new DepartmentComInfo().getAllSupDepartment(expandedKeyStr); + array = allSupDepartment.split(","); + for (String supDepartment : array) { + if (StringUtils.isBlank(supDepartment)) { + continue; } - - expandedKeys.add("d" + s); - } catch (Exception e) { - throw new RuntimeException(e); + expandedKeys.add("d" + supDepartment); } + + expandedKeys.add("d" + expandedKeyStr); + } catch (Exception e) { + throw new RuntimeException(e); } + } } diff --git a/src/com/engine/organization/service/impl/CompServiceImpl.java b/src/com/engine/organization/service/impl/CompServiceImpl.java index 94933d3d..2c7aabb4 100644 --- a/src/com/engine/organization/service/impl/CompServiceImpl.java +++ b/src/com/engine/organization/service/impl/CompServiceImpl.java @@ -153,6 +153,15 @@ public class CompServiceImpl extends Service implements CompService { @Override public Map deleteByIds(Map params) { HasRightUtil.hasRight(user, RIGHT_NAME, false); + RecordSet rs = new RecordSet(); + HashMap returnMap = new HashMap<>(2); + rs.executeQuery("select id from HrmDepartment where subcompanyid1 =" + Util.null2String(params.get("id"))); + if (rs.next()) { + returnMap.put("status", "-1"); + returnMap.put("message", SystemEnv.getHtmlLabelName(81683, user.getLanguage())); + return returnMap; + } + return ServiceUtil.getService(OrganizationServiceImpl.class, user).delSubCompany(params, user); }