组织架构图,回溯详细信息 #189

Merged
dxfeng merged 1 commits from feature/dxf into develop 2 years ago

@ -29,6 +29,8 @@ public class ChartServiceImpl extends Service implements ChartService {
public String SUB_COMPANY_DEFINED_TABLE = ""; public String SUB_COMPANY_DEFINED_TABLE = "";
public String DEPARTMENT_TABLE = ""; public String DEPARTMENT_TABLE = "";
public String DEPARTMENT_DEFINED_TABLE = ""; public String DEPARTMENT_DEFINED_TABLE = "";
public String SUB_COMPANY_ID = "''";
public String DEPARTMENT_ID = "''";
/** /**
* *
@ -196,6 +198,7 @@ public class ChartServiceImpl extends Service implements ChartService {
String departmentId = rootId.split("_")[1]; String departmentId = rootId.split("_")[1];
String detauleType = Util.null2String(params.get("detauleType")); String detauleType = Util.null2String(params.get("detauleType"));
if (!"chart".equals(detauleType)) { if (!"chart".equals(detauleType)) {
// 展示列表模块
return ServiceUtil.getService(HrmResourceServiceImpl.class, user).chartResourceList(Integer.parseInt(departmentId)); return ServiceUtil.getService(HrmResourceServiceImpl.class, user).chartResourceList(Integer.parseInt(departmentId));
} }
@ -208,10 +211,10 @@ public class ChartServiceImpl extends Service implements ChartService {
String showJobStr = Util.null2String(params.get("showJob")); String showJobStr = Util.null2String(params.get("showJob"));
boolean showJob = "1".equals(showJobStr); boolean showJob = "1".equals(showJobStr);
//版本id //版本id
String id = Util.null2String(params.get("id")); String versionId = Util.null2String(params.get("id"));
// 初始化表名 // 初始化表名
initTableNameByClass(dimension, id); initTableNameByClass(dimension, versionId);
List<ChartPO> dataList = new ArrayList<>(); List<ChartPO> dataList = new ArrayList<>();
List<ChartPO> jobTitleList = new ArrayList<>(); List<ChartPO> jobTitleList = new ArrayList<>();
@ -220,12 +223,20 @@ public class ChartServiceImpl extends Service implements ChartService {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
// TODO 查询当前实际的数据 // TODO 查询当前实际的数据
String sql; String sql;
if (isRealTime) {
// 查询部门本身 // 查询部门本身
if (hasVirtualFields) { if (hasVirtualFields) {
sql = "select a.id,a.departmentname as name,b.bmfzr,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'"; sql = "select a.id,a.departmentname as name,b.bmfzr,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'";
} else { } else {
sql = "select a.id,a.departmentname as name,b.bmfzr from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'"; sql = "select a.id,a.departmentname as name,b.bmfzr from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'";
} }
} else {
if (hasVirtualFields) {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,fleader as bmfzr,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where a.id = '" + departmentId + "' and versionid = " + versionId;
} else {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,fleader as bmfzr from " + DEPARTMENT_TABLE + " a where a.id = '" + departmentId + "' and versionid = " + versionId;
}
}
rs.executeQuery(sql); rs.executeQuery(sql);
ChartPO departmentChartPO = new ChartPO(); ChartPO departmentChartPO = new ChartPO();
if (rs.next()) { if (rs.next()) {
@ -245,7 +256,11 @@ public class ChartServiceImpl extends Service implements ChartService {
if (showJob) { if (showJob) {
// 查询部门下的岗位 // 查询部门下的岗位
if (isRealTime) {
sql = "select a.id,a.jobtitlename as name from hrmjobtitles a inner join jcl_org_job b on a.id = b.ec_jobtitle where b.ec_department = '" + departmentId + "'"; sql = "select a.id,a.jobtitlename as name from hrmjobtitles a inner join jcl_org_job b on a.id = b.ec_jobtitle where b.ec_department = '" + departmentId + "'";
}else{
sql = "select jobid as id ,jobname as name from jcl_chart_job where departmentid = '" + departmentId + "' and versionid = " + versionId;
}
rs.executeQuery(sql); rs.executeQuery(sql);
while (rs.next()) { while (rs.next()) {
ChartPO chartPO = new ChartPO(); ChartPO chartPO = new ChartPO();
@ -260,12 +275,20 @@ public class ChartServiceImpl extends Service implements ChartService {
jobTitleList.add(chartPO); jobTitleList.add(chartPO);
} }
if ("0".equals(dimension)) { // 遍历岗位、查询对应岗位下的人员
if (isRealTime) {
if (isRealDimension) {
sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? and a.jobtitle = ?"; sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? and a.jobtitle = ?";
} else { } else {
sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? and a.jobtitle = ?"; sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? and a.jobtitle = ?";
} }
// 遍历岗位、查询对应岗位下的人员 } else {
//if (isRealDimension) {
// sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? and a.jobtitle = ?";
//} else {
// sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? and a.jobtitle = ?";
//}
}
for (ChartPO jobTitlePO : jobTitleList) { for (ChartPO jobTitlePO : jobTitleList) {
resourceNum = 0; resourceNum = 0;
rs.executeQuery(sql, departmentId, jobTitlePO.getFobjid()); rs.executeQuery(sql, departmentId, jobTitlePO.getFobjid());
@ -359,12 +382,12 @@ public class ChartServiceImpl extends Service implements ChartService {
} else { } else {
if (hasVirtualFields) { if (hasVirtualFields) {
if (showVirtual) { if (showVirtual) {
return "select id,subcompanyname as name,'1' as type,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root; return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root;
} else { } else {
return "select id,subcompanyname as name,'1' as type,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root + " and (isvirtual is null or isvirtual != '1')"; return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root + " and (isvirtual is null or isvirtual != '1')";
} }
} else { } else {
return "select id,subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root; return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root;
} }
} }
} }
@ -468,12 +491,12 @@ public class ChartServiceImpl extends Service implements ChartService {
case "0": case "0":
if (hasVirtualFields) { if (hasVirtualFields) {
if (showVirtual) { if (showVirtual) {
sql = "select a.id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = "+versionId; sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId;
} else { } else {
sql = "select a.id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and (isvirtual is null or isvirtual != '1') and versionid = "+versionId; sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and (isvirtual is null or isvirtual != '1') and versionid = " + versionId;
} }
} else { } else {
sql = "select a.id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = "+versionId; sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId;
} }
if(!isRealDimension){ if(!isRealDimension){
sql += " and companyid = " + fObjId; sql += " and companyid = " + fObjId;
@ -482,26 +505,26 @@ public class ChartServiceImpl extends Service implements ChartService {
case "1": case "1":
if (hasVirtualFields) { if (hasVirtualFields) {
if (showVirtual) { if (showVirtual) {
sql = "select a.id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select a.id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = "+versionId; " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
} else { } else {
sql = "select a.id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = "+versionId + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select a.id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and (isvirtual is null or isvirtual != '1') and subcompanyid = '" + fObjId + "' and versionid = "+versionId; " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and (isvirtual is null or isvirtual != '1') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
} }
} else { } else {
sql = "select a.id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = "+versionId + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepartmentid is null or supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = "+versionId; " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepartmentid is null or supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
} }
break; break;
case "2": case "2":
if (hasVirtualFields) { if (hasVirtualFields) {
if (showVirtual) { if (showVirtual) {
sql = "select a.id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = "+versionId; sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
} else { } else {
sql = "select a.id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '" + fObjId + "' and versionid = "+versionId; sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
} }
} else { } else {
sql = "select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = "+versionId; sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
} }
break; break;
default: default:
@ -593,11 +616,15 @@ public class ChartServiceImpl extends Service implements ChartService {
COMPANY_TABLE = "hrmcompany"; COMPANY_TABLE = "hrmcompany";
SUB_COMPANY_TABLE = "jcl_chart_subcompany"; SUB_COMPANY_TABLE = "jcl_chart_subcompany";
DEPARTMENT_TABLE = "jcl_chart_department"; DEPARTMENT_TABLE = "jcl_chart_department";
SUB_COMPANY_ID = "subcompanyid";
DEPARTMENT_ID = "departmentid";
hasVirtualFields = true; hasVirtualFields = true;
} else { } else {
COMPANY_TABLE = "jcl_chart_companyvirtual"; COMPANY_TABLE = "jcl_chart_companyvirtual";
SUB_COMPANY_TABLE = "jcl_chart_subcompanyvirtual"; SUB_COMPANY_TABLE = "jcl_chart_subcompanyvirtual";
DEPARTMENT_TABLE = "jcl_chart_departmentvirtual"; DEPARTMENT_TABLE = "jcl_chart_departmentvirtual";
SUB_COMPANY_ID = "subcompanyvirtualid";
DEPARTMENT_ID = "departmentvirtualid";
// 其他维度,无虚拟组织 // 其他维度,无虚拟组织
hasVirtualFields = false; hasVirtualFields = false;
} }

Loading…
Cancel
Save