透视图分权、部门负责人展示

jcgj
dxfeng 2 years ago
parent 33c16237b0
commit 11e1b340cd

@ -97,10 +97,14 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("fleaderjob", ""); item.put("fleaderjob", "");
item.put("fleader", ""); item.put("fleader", "");
} else { } else {
item.put("fleadername", Util.null2String(rs.getString("fleadername"))); //item.put("fleadername", Util.null2String(rs.getString("fleadername")));
item.put("fleaderimg", Util.null2String(rs.getString("fleaderimg"))); //item.put("fleaderimg", Util.null2String(rs.getString("fleaderimg")));
item.put("fleaderjob", Util.null2String(rs.getString("fleaderjob"))); //item.put("fleaderjob", Util.null2String(rs.getString("fleaderjob")));
item.put("fleader", Util.null2String(rs.getString("fleader"))); //item.put("fleader", Util.null2String(rs.getString("fleader")));
item.put("fleader", "");
item.put("fleaderimg", "");
item.put("fleadername", "");
item.put("fleaderjob", "");
} }
item.put("fplan", rs.getString("fplan")); item.put("fplan", rs.getString("fplan"));
@ -136,13 +140,13 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
DetachUtil detachUtil = new DetachUtil(user); DetachUtil detachUtil = new DetachUtil(user);
for (String id : split) { for (String id : split) {
String whereSql = userWhereSql(request2Map); String whereSql = userWhereSql(request2Map);
String bmfzr = ""; String deptLeader = "";
if (id.contains("_")) { if (id.contains("_")) {
whereSql += " and t.id != '" + id.split("_")[1] + "'"; whereSql += " and t.id != '" + id.split("_")[1] + "'";
} else if (Integer.parseInt(id) > 100000000 && Integer.parseInt(id) < 200000000) { } else if (Integer.parseInt(id) > 100000000 && Integer.parseInt(id) < 200000000) {
rs.executeQuery("select bmfzr from hrmdepartmentdefined where deptid =? ", Integer.parseInt(id) - 100000000); rs.executeQuery(sql + whereSql + " and id = ? ", id);
if (rs.next()) { if (rs.next()) {
bmfzr = rs.getString("bmfzr"); deptLeader = rs.getString("fleader");
} }
} }
@ -151,21 +155,19 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
if ("0".equals(id)) { if ("0".equals(id)) {
whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")"; whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")";
} else { } else {
if (StringUtils.isNotBlank(bmfzr)) { if (StringUtils.isNotBlank(deptLeader)) {
bmfzr = bmfzr.split(",")[0]; deptLeader = deptLeader.split(",")[0];
//whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))"; whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
whereSql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' "; deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader));
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else { } else {
whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")) or (t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))"; whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")) or (t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))";
} }
} }
} else { } else {
if (StringUtils.isNotBlank(bmfzr)) { if (StringUtils.isNotBlank(deptLeader)) {
bmfzr = bmfzr.split(",")[0]; deptLeader = deptLeader.split(",")[0];
//whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype =2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))"; whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
whereSql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' "; deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader));
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else { } else {
whereSql += " and t.fparentid = " + id.split("_")[0]; whereSql += " and t.fparentid = " + id.split("_")[0];
} }
@ -183,14 +185,18 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("fplan", rs.getString("fplan")); item.put("fplan", rs.getString("fplan"));
item.put("fonjob", rs.getString("fonjob")); item.put("fonjob", rs.getString("fonjob"));
item.put("fnumber", rs.getString("fnumber")); item.put("fnumber", rs.getString("fnumber"));
item.put("fleader", rs.getString("fleader")); //item.put("fleader", rs.getString("fleader"));
item.put("fleaderimg", rs.getString("fleaderimg")); //item.put("fleaderimg", rs.getString("fleaderimg"));
item.put("fleadername", rs.getString("fleadername")); //item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderjob", rs.getString("fleaderjob")); //item.put("fleaderjob", rs.getString("fleaderjob"));
item.put("fleader", "");
item.put("fleaderimg", "");
item.put("fleadername", "");
item.put("fleaderjob", "");
item.put("fobjid", rs.getString("fobjid")); item.put("fobjid", rs.getString("fobjid"));
item.put("fisvitual", rs.getString("fisvitual")); item.put("fisvitual", rs.getString("fisvitual"));
if (bmfzr.equals(item.get("id"))) { if (deptLeader.equals(item.get("id"))) {
item.put("id", id + "_" + bmfzr); item.put("id", id + "_" + deptLeader);
item.put("parentId", id); item.put("parentId", id);
item.put("hasChildren", hasChildren(id, false)); item.put("hasChildren", hasChildren(id, false));
} else { } else {
@ -242,14 +248,14 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
"(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,fleader,fleaderimg,\n" + "(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,fleader,fleaderimg,\n" +
" fleadername,fleaderjobid,fleaderjob,fparentid,fobjparentid,\n" + " fleadername,fleaderjobid,fleaderjob,fparentid,fobjparentid,\n" +
" fplan,fonjob,fisvitual,fdatebegin,fdateend)\n" + " fplan,fonjob,fisvitual,fdatebegin,fdateend)\n" +
"select a.id+100000000,2,a.id,a.uuid,0,'行政维度',a.DEPARTMENTCODE,a.departmentname,substr(b.bmfzr,0,instr(b.bmfzr,',',1)-1),c.messagerurl,\n" + "select a.id+100000000,2,a.id,a.uuid,0,'行政维度',a.DEPARTMENTCODE,a.departmentname,regexp_substr(b.bmfzr,'[^,]+',1,1),c.messagerurl,\n" +
" c.lastname,c.jobtitle,d.jobtitlemark,\n" + " c.lastname,c.jobtitle,d.jobtitlemark,\n" +
" (case nvl(a.supdepid,0) when 0 then a.subcompanyid1 else a.supdepid+100000000 end),\n" + " (case nvl(a.supdepid,0) when 0 then a.subcompanyid1 else a.supdepid+100000000 end),\n" +
" (case nvl(a.supdepid,0) when 0 then a.subcompanyid1 else a.supdepid end),\n" + " (case nvl(a.supdepid,0) when 0 then a.subcompanyid1 else a.supdepid end),\n" +
" 0,0,0,TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd'), TO_DATE('2099-12-31','yyyy-MM-dd')\n" + " 0,0,0,TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd'), TO_DATE('2099-12-31','yyyy-MM-dd')\n" +
"from HrmDepartment a\n" + "from HrmDepartment a\n" +
"left join hrmdepartmentdefined b on a.id=b.deptid\n" + "left join hrmdepartmentdefined b on a.id=b.deptid\n" +
"left join hrmresource c on to_char(substr(b.bmfzr,0,instr(b.bmfzr,',',1)-1))=to_char(c.ID)\n" + "left join hrmresource c on to_char(regexp_substr(b.bmfzr,'[^,]+',1,1))=to_char(c.ID)\n" +
"left join hrmjobtitles d on c.JOBTITLE=d.id\n" + "left join hrmjobtitles d on c.JOBTITLE=d.id\n" +
"where nvl(a.canceled,0) <> 1"; "where nvl(a.canceled,0) <> 1";
rs.execute(bmSql); rs.execute(bmSql);
@ -426,12 +432,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand, String type, String parentDeptId) { private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand, String type, String parentDeptId) {
String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from junc_org_map t " + whereSql; String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from junc_org_map t " + whereSql;
String bmfzr = ""; String deptLeader = "";
String manageDeptId = ""; String manageDeptId = "";
if ("2".equals(type)) { if ("2".equals(type)) {
rs.executeQuery("select bmfzr from hrmdepartmentdefined where deptid =? ", parentDeptId); rs.executeQuery(sql +" and t.ftype = '2' and t.fobjid = '" + parentDeptId + "'");
if (rs.next()) { if (rs.next()) {
bmfzr = rs.getString("bmfzr"); deptLeader = rs.getString("fleader");
} }
} }
@ -450,21 +456,19 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
if ("0".equals(id)) { if ("0".equals(id)) {
sql += " and t.ftype = 1 and t.fparentid = " + id + " and t.fobjid in(" + detachUtil.getCompanyIds() + ")"; sql += " and t.ftype = 1 and t.fparentid = " + id + " and t.fobjid in(" + detachUtil.getCompanyIds() + ")";
} else { } else {
if (StringUtils.isNotBlank(bmfzr)) { if (StringUtils.isNotBlank(deptLeader)) {
bmfzr = bmfzr.split(",")[0]; deptLeader = deptLeader.split(",")[0];
//sql += " and ((t.fparentid = " + id + " and t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))"; sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
sql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' "; deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader));
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else { } else {
sql += " and t.fparentid = " + id + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")) or (t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))"; sql += " and t.fparentid = " + id + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")) or (t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))";
} }
} }
} else { } else {
if (StringUtils.isNotBlank(bmfzr)) { if (StringUtils.isNotBlank(deptLeader)) {
bmfzr = bmfzr.split(",")[0]; deptLeader = deptLeader.split(",")[0];
//sql += " and ((t.fparentid = " + id + " and t.ftype =2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))"; sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
sql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' "; deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader));
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else { } else {
sql += " and t.fparentid = " + id; sql += " and t.fparentid = " + id;
} }
@ -491,15 +495,16 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("expand", expand ? "1" : "0"); item.put("expand", expand ? "1" : "0");
item.put("fobjid", rs.getString("fobjid")); item.put("fobjid", rs.getString("fobjid"));
item.put("fecid", rs.getString("fecid")); item.put("fecid", rs.getString("fecid"));
item.put("fleader", rs.getString("fleader"));
item.put("fleaderimg", rs.getString("fleaderimg")); item.put("fleader", "");
item.put("fleadername", rs.getString("fleadername")); item.put("fleaderimg", "");
item.put("fleaderjob", rs.getString("fleaderjob")); item.put("fleadername", "");
item.put("fleaderjob", "");
item.put("fisvitual", rs.getString("fisvitual")); item.put("fisvitual", rs.getString("fisvitual"));
if (bmfzr.equals(item.get("id"))) { if (deptLeader.equals(item.get("id"))) {
item.put("id", id + "_" + bmfzr); item.put("id", id + "_" + deptLeader);
item.put("parentId", id); item.put("parentId", id);
item.put("hasChildren", hasChildren(id, false)); item.put("hasChildren", hasChildren(id, false));
} else { } else {

Loading…
Cancel
Save