组织透视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) "; String sql = "select id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) ";
// 分部分权过滤 // 分部分权过滤
DetachUtil detachUtil = new DetachUtil(user); // DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) { // if (detachUtil.isDETACH()) {
String jclRoleLevels = detachUtil.getJclRoleLevels(); // String jclRoleLevels = detachUtil.getJclRoleLevels();
if (StringUtils.isNotBlank(jclRoleLevels)) { // if (StringUtils.isNotBlank(jclRoleLevels)) {
sql = "select id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) "; // sql = "select id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) ";
} else { // } else {
sql = "select id, fnumber, fname, ftype from jcl_org_map where ftype = 0 "; // 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 "); rs.executeQuery(sql + " and fdateend > " + DBType.get(new RecordSet().getDBType()).currentDate() + " order by ftype , id,fdateend desc ");
Set<OrgSelectItem> companySet = new HashSet<>(); Set<OrgSelectItem> companySet = new HashSet<>();
while (rs.next()) { 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) { 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; String sql = "select id, fname, ftype, fparentid,fobjid,fecid,fnumber,fisvitual from jcl_org_map " + whereSql + " and fparentid = " + id; DetachUtil detachUtil = new DetachUtil(user);
DetachUtil detachUtil = new DetachUtil(user); // if (detachUtil.isDETACH()) {
if (detachUtil.isDETACH()) { // if ("0".equals(id)) {
if ("0".equals(id)) { // sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")";
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")"; // } else {
} else { // sql += " and fparentid = " + id + " and ftype !=1";
sql += " and fparentid = " + id + " and ftype !=1"; // }
} // } else {
} else { // sql += " and fparentid = " + id;
sql += " and fparentid = " + id; // }
}
rs.executeQuery(sql); rs.executeQuery(sql);
List<Map<String, Object>> currentList = new ArrayList<>(); List<Map<String, Object>> currentList = new ArrayList<>();
while (rs.next()) { 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 "; 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(); RecordSet rs = new RecordSet();
List<Map<String, Object>> currentList = new ArrayList<>(); List<Map<String, Object>> currentList = new ArrayList<>();
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 deptLeader = ""; String deptLeader = "";
@ -334,31 +333,32 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
} }
} }
if (detachUtil.isDETACH()) { // if (detachUtil.isDETACH()) {
if ("0".equals(id)) { // if ("0".equals(id)) {
whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")"; // whereSql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")";
} else { // } else {
if (StringUtils.isNotBlank(deptLeader)) { // if (StringUtils.isNotBlank(deptLeader)) {
deptLeader = deptLeader.split(",")[0]; // deptLeader = deptLeader.split(",")[0];
whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; // whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader)); // deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader));
} else { // } 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 ))"; // 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 { // } else {
if (StringUtils.isNotBlank(deptLeader)) { if (StringUtils.isNotBlank(deptLeader)) {
deptLeader = deptLeader.split(",")[0]; deptLeader = deptLeader.split(",")[0];
whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader)); deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader));
} else { } else {
if (checkDeptManager(id.split("_")[0])){ 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{ }else{
whereSql += " and t.fparentid = "+ id.split("_")[0]; whereSql += " and t.fparentid = "+ id.split("_")[0];
} }
} }
} // }
rs.executeQuery(sql + whereSql); rs.executeQuery(sql + whereSql);
while (rs.next()) { while (rs.next()) {
Map<String, Object> item = new HashMap<>(); Map<String, Object> item = new HashMap<>();
@ -469,21 +469,21 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
} }
} }
DetachUtil detachUtil = new DetachUtil(user); // DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) { // if (detachUtil.isDETACH()) {
if ("0".equals(id)) { // 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.fparentid = " + id + " and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")";
sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")"; // sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")";
} else { // } else {
if (StringUtils.isNotBlank(deptLeader)) { // if (StringUtils.isNotBlank(deptLeader)) {
deptLeader = deptLeader.split(",")[0]; // deptLeader = deptLeader.split(",")[0];
sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; // sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader)); // deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader));
} else { // } else {
sql += " and t.fparentid = " + id + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")) or (t.ftype =2) or (t.ftype = 3 ))"; // sql += " and t.fparentid = " + id + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")) or (t.ftype =2) or (t.ftype = 3 ))";
} // }
} // }
} else { // } else {
if (StringUtils.isNotBlank(deptLeader)) { if (StringUtils.isNotBlank(deptLeader)) {
deptLeader = deptLeader.split(",")[0]; deptLeader = deptLeader.split(",")[0];
sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' "; sql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
@ -491,7 +491,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
} else { } else {
sql += " and t.fparentid = " + id; sql += " and t.fparentid = " + id;
} }
} // }
rs.executeQuery(sql); rs.executeQuery(sql);
List<Map<String, Object>> currentList = new ArrayList<>(); List<Map<String, Object>> currentList = new ArrayList<>();
while (rs.next()) { while (rs.next()) {
@ -736,7 +736,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
//分部编制数 //分部编制数
int bzs = 0; int bzs = 0;
recordSet.execute("select sum(rs) as bzs from \n" + 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" + "as A where A.rank=1 and A.bm in (\n" +
"select id from HrmDepartment where subcompanyid1 in (" + allSupComIds + "))"); "select id from HrmDepartment where subcompanyid1 in (" + allSupComIds + "))");
if (recordSet.next()) { if (recordSet.next()) {
@ -753,7 +753,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
// 9、更新部门编制数 // 9、更新部门编制数
rs.execute("update p set p.fplan = q.rs from jcl_org_map p \n" + rs.execute("update p set p.fplan = q.rs from jcl_org_map p \n" +
"inner join (select A.* from (\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"); ")as A where A.rank=1) q on p.fobjid=q.bm and fdateend>getDate() and ftype=2");
} }
return "同步成功"; return "同步成功";

Loading…
Cancel
Save