From 47773d4c8a35a36882a55a03ae3d5a3f7e7ddbcd Mon Sep 17 00:00:00 2001 From: Mlin Date: Mon, 30 Oct 2023 17:31:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=80=8F=E8=A7=8620231030?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OrgChartServiceImpl.java | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java index 36587533..02841e46 100644 --- a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java @@ -62,15 +62,15 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { String sql = "select id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) "; // 分部分权过滤 - DetachUtil detachUtil = new DetachUtil(user); - if (detachUtil.isDETACH()) { - String jclRoleLevels = detachUtil.getJclRoleLevels(); - if (StringUtils.isNotBlank(jclRoleLevels)) { - sql = "select id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) "; - } else { - sql = "select id, fnumber, fname, ftype from jcl_org_map where ftype = 0 "; - } - } +// DetachUtil detachUtil = new DetachUtil(user); +// if (detachUtil.isDETACH()) { +// String jclRoleLevels = detachUtil.getJclRoleLevels(); +// if (StringUtils.isNotBlank(jclRoleLevels)) { +// sql = "select id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) "; +// } else { +// sql = "select id, fnumber, fname, ftype from jcl_org_map where ftype = 0 "; +// } +// } rs.executeQuery(sql + " and fdateend > " + DBType.get(new RecordSet().getDBType()).currentDate() + " order by ftype , id,fdateend desc "); Set companySet = new HashSet<>(); while (rs.next()) { @@ -173,17 +173,16 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { } private void findCompanyItemByParantId(String id, int currentLevel, String level, RecordSet rs, List> list, String whereSql, boolean expand) { - String sql = "select id, fname, ftype, fparentid,fobjid,fecid,fnumber,fisvitual from jcl_org_map " + whereSql; - DetachUtil detachUtil = new DetachUtil(user); - if (detachUtil.isDETACH()) { - if ("0".equals(id)) { - sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")"; - } else { - sql += " and fparentid = " + id + " and ftype !=1"; - } - } else { - sql += " and fparentid = " + id; - } + String sql = "select id, fname, ftype, fparentid,fobjid,fecid,fnumber,fisvitual from jcl_org_map " + whereSql + " and fparentid = " + id; DetachUtil detachUtil = new DetachUtil(user); +// if (detachUtil.isDETACH()) { +// if ("0".equals(id)) { +// sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")"; +// } else { +// sql += " and fparentid = " + id + " and ftype !=1"; +// } +// } else { +// sql += " and fparentid = " + id; +// } rs.executeQuery(sql); List> currentList = new ArrayList<>(); while (rs.next()) { @@ -320,7 +319,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid,t.fisvitual from jcl_org_map t "; RecordSet rs = new RecordSet(); List> currentList = new ArrayList<>(); - DetachUtil detachUtil = new DetachUtil(user); +// DetachUtil detachUtil = new DetachUtil(user); for (String id:split) { String whereSql = userWhereSql(request2Map); String deptLeader = ""; @@ -334,31 +333,32 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { } } - if (detachUtil.isDETACH()) { - if ("0".equals(id)) { - whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")"; - } else { - if (StringUtils.isNotBlank(deptLeader)) { - deptLeader = deptLeader.split(",")[0]; - whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; - deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader)); - } else { - whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")) or (t.ftype =2 ) or (t.ftype = 3 ))"; - } - } - } else { +// if (detachUtil.isDETACH()) { +// if ("0".equals(id)) { +// whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")"; +// } else { +// if (StringUtils.isNotBlank(deptLeader)) { +// deptLeader = deptLeader.split(",")[0]; +// whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; +// deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader)); +// } else { +// whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")) or (t.ftype =2 ) or (t.ftype = 3 ))"; +// } +// } +// } else { if (StringUtils.isNotBlank(deptLeader)) { deptLeader = deptLeader.split(",")[0]; whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader)); } else { if (checkDeptManager(id.split("_")[0])){ - whereSql += " and t.fparentid = "+ id.split("_")[0] +" or t.fparentid = "+ id.split("_")[1]; +// whereSql += " and t.fparentid = "+ id.split("_")[0] +" or t.fparentid = "+ id.split("_")[1]; + whereSql += " and t.fparentid = "+ id.split("_")[1]; }else{ whereSql += " and t.fparentid = "+ id.split("_")[0]; } } - } +// } rs.executeQuery(sql + whereSql); while (rs.next()) { Map item = new HashMap<>(); @@ -469,21 +469,21 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { } } - DetachUtil detachUtil = new DetachUtil(user); - if (detachUtil.isDETACH()) { - if ("0".equals(id)) { -// sql += " and t.ftype = 1 and t.fparentid = " + id + " and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")"; - sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")"; - } else { - if (StringUtils.isNotBlank(deptLeader)) { - deptLeader = deptLeader.split(",")[0]; - sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; - deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader)); - } else { - sql += " and t.fparentid = " + id + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")) or (t.ftype =2) or (t.ftype = 3 ))"; - } - } - } else { +// DetachUtil detachUtil = new DetachUtil(user); +// if (detachUtil.isDETACH()) { +// if ("0".equals(id)) { +//// sql += " and t.ftype = 1 and t.fparentid = " + id + " and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")"; +// sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")"; +// } else { +// if (StringUtils.isNotBlank(deptLeader)) { +// deptLeader = deptLeader.split(",")[0]; +// sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; +// deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader)); +// } else { +// sql += " and t.fparentid = " + id + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")) or (t.ftype =2) or (t.ftype = 3 ))"; +// } +// } +// } else { if (StringUtils.isNotBlank(deptLeader)) { deptLeader = deptLeader.split(",")[0]; sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; @@ -491,7 +491,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { } else { sql += " and t.fparentid = " + id; } - } +// } rs.executeQuery(sql); List> currentList = new ArrayList<>(); while (rs.next()) { @@ -736,7 +736,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { //分部编制数 int bzs = 0; recordSet.execute("select sum(rs) as bzs from \n" + - "(select *,row_number() over(partition by bm order by modedatacreatedate desc,modedatacreatetime desc) as rank from uf_rybzb )\n" + + "(select *,row_number() over(partition by bm order by ny desc) as rank from uf_rybzb )\n" + "as A where A.rank=1 and A.bm in (\n" + "select id from HrmDepartment where subcompanyid1 in (" + allSupComIds + "))"); if (recordSet.next()) { @@ -753,7 +753,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { // 9、更新部门编制数 rs.execute("update p set p.fplan = q.rs from jcl_org_map p \n" + "inner join (select A.* from (\n" + - "select *,row_number() over(partition by bm order by modedatacreatedate desc,modedatacreatetime desc) as rank from uf_rybzb \n" + + "select *,row_number() over(partition by bm order by ny desc) as rank from uf_rybzb \n" + ")as A where A.rank=1) q on p.fobjid=q.bm and fdateend>getDate() and ftype=2"); } return "同步成功";