组织透视20231030

feature/jiazhao_nodetach
Mlin 2 years ago
parent 91235a3a41
commit 47773d4c8a

@ -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<OrgSelectItem> 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<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> 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<String, Object> 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<Map<String, Object>> 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 "同步成功";

Loading…
Cancel
Save