Merge pull request 'feature/dxf' (#188) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/188
This commit is contained in:
commit
bfa3d147fc
|
|
@ -40,6 +40,16 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
*/
|
*/
|
||||||
boolean hasVirtualFields;
|
boolean hasVirtualFields;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否实际组织维度
|
||||||
|
*/
|
||||||
|
boolean isRealDimension;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否即时数据
|
||||||
|
*/
|
||||||
|
boolean isRealTime;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getCompanyData(Map<String, Object> params) {
|
public Map<String, Object> getCompanyData(Map<String, Object> params) {
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
@ -67,7 +77,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
String id = Util.null2String(params.get("id"));
|
String id = Util.null2String(params.get("id"));
|
||||||
|
|
||||||
// 初始化表名
|
// 初始化表名
|
||||||
initTableNameByClass(dimension);
|
initTableNameByClass(dimension, id);
|
||||||
|
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
List<ChartPO> dataList = new ArrayList<>();
|
List<ChartPO> dataList = new ArrayList<>();
|
||||||
|
|
@ -75,10 +85,10 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
|
|
||||||
ChartPO topChartPO = null;
|
ChartPO topChartPO = null;
|
||||||
//查询当前实际数据
|
//查询当前实际数据
|
||||||
if("0".equals(id)){
|
if (isRealTime) {
|
||||||
sql = getRealTimeTopSql(root, dimension);
|
sql = getRealTimeTopSql(root, dimension);
|
||||||
}else {
|
} else {
|
||||||
sql = getLastTimeTopSql(root,dimension,id);
|
sql = getLastTimeTopSql(root, dimension, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
rs.executeQuery(sql);
|
rs.executeQuery(sql);
|
||||||
|
|
@ -98,7 +108,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
|
|
||||||
// 向下查询数据
|
// 向下查询数据
|
||||||
if (null != topChartPO) {
|
if (null != topChartPO) {
|
||||||
findChildData(topChartPO, dataList,Integer.parseInt(depth));
|
findChildData(topChartPO, dataList, Integer.parseInt(depth), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -108,7 +118,6 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> asyncCompanyData(Map<String, Object> params) {
|
public Map<String, Object> asyncCompanyData(Map<String, Object> params) {
|
||||||
|
|
||||||
|
|
@ -119,9 +128,11 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
// 是否展示虚拟组织
|
// 是否展示虚拟组织
|
||||||
String isVirtual = Util.null2String(params.get("fisvitual"));
|
String isVirtual = Util.null2String(params.get("fisvitual"));
|
||||||
showVirtual = "1".equals(isVirtual);
|
showVirtual = "1".equals(isVirtual);
|
||||||
|
//版本id
|
||||||
|
String id = Util.null2String(params.get("id"));
|
||||||
|
|
||||||
// 初始化表名
|
// 初始化表名
|
||||||
initTableNameByClass(dimension);
|
initTableNameByClass(dimension, id);
|
||||||
|
|
||||||
String ids = (String) params.get("ids");
|
String ids = (String) params.get("ids");
|
||||||
List<ChartPO> dataList = new ArrayList<>();
|
List<ChartPO> dataList = new ArrayList<>();
|
||||||
|
|
@ -149,15 +160,15 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
} else if (s.startsWith("d")) {
|
} else if (s.startsWith("d")) {
|
||||||
if (hasVirtualFields) {
|
if (hasVirtualFields) {
|
||||||
if (showVirtual) {
|
if (showVirtual) {
|
||||||
rs.executeQuery( "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'");
|
rs.executeQuery("select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'");
|
||||||
} else {
|
} else {
|
||||||
rs.executeQuery( "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'");
|
rs.executeQuery("select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rs.executeQuery( "select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'");
|
rs.executeQuery("select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (rs.next()){
|
while (rs.next()) {
|
||||||
ChartPO chartPO = new ChartPO();
|
ChartPO chartPO = new ChartPO();
|
||||||
chartPO.setFtype(rs.getString("type"));
|
chartPO.setFtype(rs.getString("type"));
|
||||||
chartPO.setFobjid(rs.getString("id"));
|
chartPO.setFobjid(rs.getString("id"));
|
||||||
|
|
@ -184,7 +195,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
OrganizationAssert.isFalse(StringUtils.isBlank(rootId) || !rootId.startsWith("d_"), "数据有误,未查询到对应数据");
|
OrganizationAssert.isFalse(StringUtils.isBlank(rootId) || !rootId.startsWith("d_"), "数据有误,未查询到对应数据");
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,10 +207,11 @@ 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
|
||||||
|
String id = Util.null2String(params.get("id"));
|
||||||
|
|
||||||
// 初始化表名
|
// 初始化表名
|
||||||
initTableNameByClass(dimension);
|
initTableNameByClass(dimension, id);
|
||||||
|
|
||||||
List<ChartPO> dataList = new ArrayList<>();
|
List<ChartPO> dataList = new ArrayList<>();
|
||||||
List<ChartPO> jobTitleList = new ArrayList<>();
|
List<ChartPO> jobTitleList = new ArrayList<>();
|
||||||
|
|
@ -209,14 +221,14 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
// TODO 查询当前实际的数据
|
// TODO 查询当前实际的数据
|
||||||
String sql;
|
String sql;
|
||||||
// 查询部门本身
|
// 查询部门本身
|
||||||
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 + "'";
|
||||||
}
|
}
|
||||||
rs.executeQuery(sql);
|
rs.executeQuery(sql);
|
||||||
ChartPO departmentChartPO = new ChartPO();
|
ChartPO departmentChartPO = new ChartPO();
|
||||||
if(rs.next()){
|
if (rs.next()) {
|
||||||
String fLeader = Util.null2String(rs.getString("bmfzr"));
|
String fLeader = Util.null2String(rs.getString("bmfzr"));
|
||||||
departmentChartPO.setFtype("2");
|
departmentChartPO.setFtype("2");
|
||||||
departmentChartPO.setFobjid(departmentId);
|
departmentChartPO.setFobjid(departmentId);
|
||||||
|
|
@ -283,7 +295,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
dataList.add(jobTitlePO);
|
dataList.add(jobTitlePO);
|
||||||
}
|
}
|
||||||
departmentChartPO.setHasChildren(CollectionUtils.isNotEmpty(jobTitleList) ? "1" : "0");
|
departmentChartPO.setHasChildren(CollectionUtils.isNotEmpty(jobTitleList) ? "1" : "0");
|
||||||
}else {
|
} else {
|
||||||
// 直接查询岗位下的人员
|
// 直接查询岗位下的人员
|
||||||
sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? ";
|
sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? ";
|
||||||
rs.executeQuery(sql, departmentId);
|
rs.executeQuery(sql, departmentId);
|
||||||
|
|
@ -320,32 +332,40 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
@Override
|
@Override
|
||||||
public String selectVersionDate(String id) {
|
public String selectVersionDate(String id) {
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
rs.executeQuery("select recorddate from jcl_org_chartversion where id = ?",id);
|
rs.executeQuery("select recorddate from jcl_org_chartversion where id = ?", id);
|
||||||
rs.next();
|
rs.next();
|
||||||
return rs.getString("recorddate");
|
return rs.getString("recorddate");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取历史顶部元素sql
|
* 获取历史顶部元素sql
|
||||||
|
*
|
||||||
* @param root
|
* @param root
|
||||||
* @param dimension 维度ID
|
* @param dimension 维度ID
|
||||||
* @param vesionId
|
* @param versionId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getLastTimeTopSql(String root, String dimension, String vesionId) {
|
private String getLastTimeTopSql(String root, String dimension, String versionId) {
|
||||||
if ("0".equals(root)) {
|
if ("0".equals(root)) {
|
||||||
//查询集团维度历史版本
|
//查询集团维度历史版本
|
||||||
if ("0".equals(dimension)) {
|
if (isRealDimension) {
|
||||||
//组织维度
|
//组织维度
|
||||||
return "select id,companyname as name,'0' as type from hrmcompany";
|
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE;
|
||||||
} else {
|
} else {
|
||||||
//查询其他维度集团版本信息
|
//查询其他维度集团版本信息
|
||||||
return "select id,companyname as name,'0' as type from jcl_chart_companyvirtual where " +
|
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE + " where " +
|
||||||
" versionid = "+vesionId+" and companyvirtualid = "+dimension;
|
" versionid = " + versionId + " and companyvirtualid = " + dimension;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (hasVirtualFields) {
|
||||||
|
if (showVirtual) {
|
||||||
|
return "select id,subcompanyname as name,'1' as type,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root;
|
||||||
|
} 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')";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return "select id,subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root;
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
return "select id,subcompanyname as name,'1' as type from jcl_chart_subcompanyvirtual where " +
|
|
||||||
" versionid= "+vesionId+" and subcompanyvirtualid"+root;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -359,7 +379,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
private String getRealTimeTopSql(String root, String dimension) {
|
private String getRealTimeTopSql(String root, String dimension) {
|
||||||
if ("0".equals(root)) {
|
if ("0".equals(root)) {
|
||||||
// 查询集团数据
|
// 查询集团数据
|
||||||
if ("0".equals(dimension)) {
|
if (isRealDimension) {
|
||||||
// 查询实际集团表
|
// 查询实际集团表
|
||||||
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE;
|
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -381,16 +401,14 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询实时数据,子节点元素
|
* 查询实时数据,子元素SQL
|
||||||
*
|
*
|
||||||
* @param topChartPO 父级元素
|
* @param sql 查询SQL
|
||||||
* @param dataList 所有元素集合
|
* @param fType 上级元素类型
|
||||||
* @param selectDepth 所选部门层级
|
* @param fObjId 上级元素ID
|
||||||
|
* @return 查询SQL
|
||||||
*/
|
*/
|
||||||
private void findChildData(ChartPO topChartPO, List<ChartPO> dataList,Integer selectDepth) {
|
private String getRealTimeChildSql(String sql, String fType, String fObjId) {
|
||||||
String fType = topChartPO.getFtype();
|
|
||||||
String fObjId = topChartPO.getFobjid();
|
|
||||||
String sql = "";
|
|
||||||
if (StringUtils.isNotBlank(fType)) {
|
if (StringUtils.isNotBlank(fType)) {
|
||||||
switch (fType) {
|
switch (fType) {
|
||||||
case "0":
|
case "0":
|
||||||
|
|
@ -433,6 +451,82 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询历史数据,子元素SQL
|
||||||
|
*
|
||||||
|
* @param sql 查询SQL
|
||||||
|
* @param fType 上级元素类型
|
||||||
|
* @param fObjId 上级元素ID
|
||||||
|
* @return 查询SQL
|
||||||
|
*/
|
||||||
|
private String getLastTimeChildSql(String sql, String fType, String fObjId, String versionId) {
|
||||||
|
if (StringUtils.isNotBlank(fType)) {
|
||||||
|
switch (fType) {
|
||||||
|
case "0":
|
||||||
|
if (hasVirtualFields) {
|
||||||
|
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;
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
if(!isRealDimension){
|
||||||
|
sql += " and companyid = " + fObjId;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
if (hasVirtualFields) {
|
||||||
|
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 +
|
||||||
|
" 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;
|
||||||
|
} 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 +
|
||||||
|
" 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;
|
||||||
|
}
|
||||||
|
} 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 +
|
||||||
|
" 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;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
if (hasVirtualFields) {
|
||||||
|
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;
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询实时数据,子节点元素
|
||||||
|
*
|
||||||
|
* @param topChartPO 父级元素
|
||||||
|
* @param dataList 所有元素集合
|
||||||
|
* @param selectDepth 所选部门层级
|
||||||
|
*/
|
||||||
|
private void findChildData(ChartPO topChartPO, List<ChartPO> dataList, Integer selectDepth,String versionId) {
|
||||||
|
String fType = topChartPO.getFtype();
|
||||||
|
String fObjId = topChartPO.getFobjid();
|
||||||
|
String sql = "";
|
||||||
|
if (isRealTime) {
|
||||||
|
sql = getRealTimeChildSql(sql, fType, fObjId);
|
||||||
|
} else {
|
||||||
|
sql = getLastTimeChildSql(sql, fType, fObjId,versionId);
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(sql)) {
|
if (StringUtils.isNotBlank(sql)) {
|
||||||
List<ChartPO> currentList = new ArrayList<>();
|
List<ChartPO> currentList = new ArrayList<>();
|
||||||
|
|
@ -448,12 +542,12 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());
|
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());
|
||||||
chartPO.setDepartmentDepth(getDepartmentDepth(chartPO, topChartPO));
|
chartPO.setDepartmentDepth(getDepartmentDepth(chartPO, topChartPO));
|
||||||
// 小于、等于所选层级元素展开
|
// 小于、等于所选层级元素展开
|
||||||
chartPO.setExpand(inDepth(selectDepth,chartPO.getDepartmentDepth()) ? "1" : "0");
|
chartPO.setExpand(inDepth(selectDepth, chartPO.getDepartmentDepth()) ? "1" : "0");
|
||||||
currentList.add(chartPO);
|
currentList.add(chartPO);
|
||||||
}
|
}
|
||||||
for (ChartPO chartPO : currentList) {
|
for (ChartPO chartPO : currentList) {
|
||||||
if (inDepth(selectDepth, chartPO.getDepartmentDepth())) {
|
if (inDepth(selectDepth, chartPO.getDepartmentDepth())) {
|
||||||
findChildData(chartPO, dataList, selectDepth);
|
findChildData(chartPO, dataList, selectDepth,versionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dataList.addAll(currentList);
|
dataList.addAll(currentList);
|
||||||
|
|
@ -466,30 +560,47 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
/**
|
/**
|
||||||
* 根据维度初始化表名
|
* 根据维度初始化表名
|
||||||
*
|
*
|
||||||
* @param fClass 所选维度
|
* @param dimension 所选维度
|
||||||
*/
|
*/
|
||||||
public void initTableNameByClass(String fClass) {
|
public void initTableNameByClass(String dimension, String id) {
|
||||||
if (StringUtils.isBlank(fClass) || "0".equals(fClass)) {
|
isRealDimension = StringUtils.isBlank(dimension) || "0".equals(dimension);
|
||||||
COMPANY_TABLE = "hrmcompany";
|
isRealTime = StringUtils.isBlank(id) || "0".equals(id);
|
||||||
SUB_COMPANY_TABLE = "hrmsubcompany";
|
if (isRealTime) {
|
||||||
SUB_COMPANY_DEFINED_TABLE = "hrmsubcompanydefined";
|
if (isRealDimension) {
|
||||||
DEPARTMENT_TABLE = "hrmdepartment";
|
COMPANY_TABLE = "hrmcompany";
|
||||||
DEPARTMENT_DEFINED_TABLE = "hrmdepartmentdefined";
|
SUB_COMPANY_TABLE = "hrmsubcompany";
|
||||||
RecordSet rs = new RecordSet();
|
SUB_COMPANY_DEFINED_TABLE = "hrmsubcompanydefined";
|
||||||
rs.executeQuery("select count(1) as num from hrm_formfield where (GROUPID =6 and FIELDNAME = 'fblx') or (GROUPID =7 and FIELDNAME = 'bmlx')");
|
DEPARTMENT_TABLE = "hrmdepartment";
|
||||||
if (rs.next()) {
|
DEPARTMENT_DEFINED_TABLE = "hrmdepartmentdefined";
|
||||||
String num = rs.getString("num");
|
RecordSet rs = new RecordSet();
|
||||||
hasVirtualFields = "2".equals(num);
|
rs.executeQuery("select count(1) as num from hrm_formfield where (GROUPID =6 and FIELDNAME = 'fblx') or (GROUPID =7 and FIELDNAME = 'bmlx')");
|
||||||
|
if (rs.next()) {
|
||||||
|
String num = rs.getString("num");
|
||||||
|
hasVirtualFields = "2".equals(num);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
hasVirtualFields = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
COMPANY_TABLE = "hrmcompanyvirtual";
|
||||||
|
SUB_COMPANY_TABLE = "hrmsubcompanyvirtual";
|
||||||
|
DEPARTMENT_TABLE = "hrmdepartmentvirtual";
|
||||||
|
// 其他维度,无虚拟组织
|
||||||
hasVirtualFields = false;
|
hasVirtualFields = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
COMPANY_TABLE = "hrmcompanyvirtual";
|
if (isRealDimension) {
|
||||||
SUB_COMPANY_TABLE = "hrmsubcompanyvirtual";
|
COMPANY_TABLE = "hrmcompany";
|
||||||
DEPARTMENT_TABLE = "hrmdepartmentvirtual";
|
SUB_COMPANY_TABLE = "jcl_chart_subcompany";
|
||||||
// 其他维度,无虚拟组织
|
DEPARTMENT_TABLE = "jcl_chart_department";
|
||||||
hasVirtualFields = false;
|
hasVirtualFields = true;
|
||||||
|
} else {
|
||||||
|
COMPANY_TABLE = "jcl_chart_companyvirtual";
|
||||||
|
SUB_COMPANY_TABLE = "jcl_chart_subcompanyvirtual";
|
||||||
|
DEPARTMENT_TABLE = "jcl_chart_departmentvirtual";
|
||||||
|
// 其他维度,无虚拟组织
|
||||||
|
hasVirtualFields = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -502,35 +613,35 @@ public class ChartServiceImpl extends Service implements ChartService {
|
||||||
* @return boolean 包含子元素:true,不包含子元素:false
|
* @return boolean 包含子元素:true,不包含子元素:false
|
||||||
*/
|
*/
|
||||||
private Boolean getHasChildren(String fType, String fObjId) {
|
private Boolean getHasChildren(String fType, String fObjId) {
|
||||||
String sql = "";
|
//String sql = "";
|
||||||
if (StringUtils.isNotBlank(fType)) {
|
//if (StringUtils.isNotBlank(fType)) {
|
||||||
switch (fType) {
|
// switch (fType) {
|
||||||
case "0":
|
// case "0":
|
||||||
sql = "select id from " + SUB_COMPANY_TABLE + " where (supsubcomid is null or supsubcomid = '0') and companyid = '" + fObjId + "'";
|
// sql = "select id from " + SUB_COMPANY_TABLE + " where (supsubcomid is null or supsubcomid = '0') and companyid = '" + fObjId + "'";
|
||||||
break;
|
// break;
|
||||||
case "1":
|
// case "1":
|
||||||
if (hasVirtualFields && !showVirtual) {
|
// if (hasVirtualFields && !showVirtual) {
|
||||||
sql = "select a.id from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "' union select a.id from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'";
|
// sql = "select a.id from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "' union select a.id from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'";
|
||||||
} else {
|
// } else {
|
||||||
sql = "select id from " + SUB_COMPANY_TABLE + " where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "' union select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
|
// sql = "select id from " + SUB_COMPANY_TABLE + " where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "' union select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
case "2":
|
// case "2":
|
||||||
if (hasVirtualFields && !showVirtual) {
|
// if (hasVirtualFields && !showVirtual) {
|
||||||
sql = "select a.id from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'";
|
// sql = "select a.id from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'";
|
||||||
} else {
|
// } else {
|
||||||
sql = "select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
|
// sql = "select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
if (StringUtils.isNotBlank(sql)) {
|
//if (StringUtils.isNotBlank(sql)) {
|
||||||
RecordSet rs = new RecordSet();
|
// RecordSet rs = new RecordSet();
|
||||||
rs.executeQuery(sql);
|
// rs.executeQuery(sql);
|
||||||
return rs.next();
|
// return rs.next();
|
||||||
}
|
//}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,9 +106,22 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
||||||
subcompany = "0";
|
subcompany = "0";
|
||||||
}
|
}
|
||||||
String fclass = Util.null2String(params.get("fclass"));
|
String fclass = Util.null2String(params.get("fclass"));
|
||||||
String sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "'";
|
String id = Util.null2String(params.get("id"));
|
||||||
if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) {
|
// 是否展示当前数据
|
||||||
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "' and companyid = '" + fclass + "'";
|
boolean isSearchCurrent = StringUtils.isBlank(id) || "0".equals(id);
|
||||||
|
String sql;
|
||||||
|
if (isSearchCurrent) {
|
||||||
|
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "'";
|
||||||
|
if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) {
|
||||||
|
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "' and companyid = '" + fclass + "'";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sql = "select id as id, id as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcompanyid", "0") + " = '" + subcompany + "'";
|
||||||
|
if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) {
|
||||||
|
sql = "select id as id, id as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcompanyid", "0") + " = '" + subcompany + "' and companyid = '" + fclass + "'";
|
||||||
|
}
|
||||||
|
// 添加时间轴条件
|
||||||
|
sql += " and versionid = " + id;
|
||||||
}
|
}
|
||||||
rs.executeQuery(sql);
|
rs.executeQuery(sql);
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue