组织架构图显示部门

pull/204/head
dxfeng 2 years ago
parent ec7bd987b2
commit 2bcc0ae131

@ -94,6 +94,8 @@ public class ChartServiceImpl extends Service implements ChartService {
//版本id //版本id
String id = Util.null2String(params.get("id")); String id = Util.null2String(params.get("id"));
boolean hideDepartment = "1".equals(Util.null2String(params.get("hidedept")));
// 初始化表名 // 初始化表名
initTableNameByClass(dimension, id); initTableNameByClass(dimension, id);
@ -121,12 +123,13 @@ public class ChartServiceImpl extends Service implements ChartService {
topChartPO.setExpand("1"); topChartPO.setExpand("1");
topChartPO.setFisvitual(rs.getString("isvitual")); topChartPO.setFisvitual(rs.getString("isvitual"));
topChartPO.setHasChildren(getHasChildren(topChartPO.getFtype(), topChartPO.getFobjid()).toString()); topChartPO.setHasChildren(getHasChildren(topChartPO.getFtype(), topChartPO.getFobjid()).toString());
dataList.add(topChartPO); filterAndAddData(dataList, topChartPO, hideDepartment);
//dataList.add(topChartPO);
} }
// 向下查询数据 // 向下查询数据
if (null != topChartPO) { if (null != topChartPO) {
findChildData(topChartPO, dataList, Integer.parseInt(depth), id); findChildData(topChartPO, dataList, Integer.parseInt(depth), id, hideDepartment);
} }
@ -148,6 +151,7 @@ public class ChartServiceImpl extends Service implements ChartService {
showVirtual = "1".equals(isVirtual); showVirtual = "1".equals(isVirtual);
//版本id //版本id
String versionId = Util.null2String(params.get("id")); String versionId = Util.null2String(params.get("id"));
boolean hideDepartment = "1".equals(Util.null2String(params.get("hidedept")));
// 初始化表名 // 初始化表名
initTableNameByClass(dimension, versionId); initTableNameByClass(dimension, versionId);
@ -184,7 +188,8 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO.setExpand("0"); chartPO.setExpand("0");
chartPO.setFisvitual(rs.getString("isvitual")); chartPO.setFisvitual(rs.getString("isvitual"));
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString()); chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());
dataList.add(chartPO); filterAndAddData(dataList, chartPO, hideDepartment);
//dataList.add(chartPO);
} }
} }
} }
@ -404,8 +409,6 @@ public class ChartServiceImpl extends Service implements ChartService {
public Map<String, Object> versionRecord(Map<String, Object> params, User user) { public Map<String, Object> versionRecord(Map<String, Object> params, User user) {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
// 维度 // 维度
@ -1140,8 +1143,9 @@ public class ChartServiceImpl extends Service implements ChartService {
* @param topChartPO * @param topChartPO
* @param dataList * @param dataList
* @param selectDepth * @param selectDepth
* @param hideDepartment
*/ */
private void findChildData(ChartPO topChartPO, List<ChartPO> dataList, Integer selectDepth, String versionId) { private void findChildData(ChartPO topChartPO, List<ChartPO> dataList, Integer selectDepth, String versionId, boolean hideDepartment) {
String fType = topChartPO.getFtype(); String fType = topChartPO.getFtype();
String fObjId = topChartPO.getFobjid(); String fObjId = topChartPO.getFobjid();
String sql = ""; String sql = "";
@ -1166,11 +1170,12 @@ public class ChartServiceImpl extends Service implements ChartService {
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); filterAndAddData(currentList, chartPO, hideDepartment);
//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, versionId); findChildData(chartPO, dataList, selectDepth, versionId, hideDepartment);
} }
} }
dataList.addAll(currentList); dataList.addAll(currentList);
@ -1390,6 +1395,7 @@ public class ChartServiceImpl extends Service implements ChartService {
/** /**
* *
*
* @param versionId ID * @param versionId ID
* @param dimension * @param dimension
* @param subCompany ID * @param subCompany ID
@ -1401,4 +1407,22 @@ public class ChartServiceImpl extends Service implements ChartService {
recordSet.executeQuery(sql); recordSet.executeQuery(sql);
return !recordSet.next(); return !recordSet.next();
} }
/**
*
*
* @param currentList
* @param chartPO
* @param hideDepartment
*/
private void filterAndAddData(List<ChartPO> currentList, ChartPO chartPO, boolean hideDepartment) {
if (hideDepartment) {
if ("2".equals(chartPO.getFtype())) {
return;
}
}
currentList.add(chartPO);
}
} }

Loading…
Cancel
Save