@ -102,11 +102,15 @@ public class ChartServiceImpl extends Service implements ChartService {
//版本id
String id = Util . null2String ( params . get ( "id" ) ) ;
//顺胜二开 虚拟维度增加部门根节点 查询时以部门根节点为主
String department = Util . null2String ( params . get ( "department" ) ) ;
boolean hideDepartment = "1" . equals ( Util . null2String ( params . get ( "hidedept" ) ) ) ;
// 初始化表名
initTableNameByClass ( dimension , id ) ;
RecordSet rs = new RecordSet ( ) ;
List < ChartPO > dataList = new ArrayList < > ( ) ;
String sql = "" ;
@ -114,7 +118,7 @@ public class ChartServiceImpl extends Service implements ChartService {
ChartPO topChartPO = null ;
//查询当前实际数据
if ( isRealTime ) {
sql = getRealTimeTopSql ( root , dimension );
sql = getRealTimeTopSql ( root , dimension ,department );
} else {
sql = getLastTimeTopSql ( root , dimension , id ) ;
}
@ -133,14 +137,26 @@ public class ChartServiceImpl extends Service implements ChartService {
topChartPO . setExpand ( "1" ) ;
topChartPO . setFisvitual ( rs . getString ( "isvitual" ) ) ;
topChartPO . setHasChildren ( getHasChildren ( topChartPO . getFtype ( ) , topChartPO . getFobjid ( ) ) . toString ( ) ) ;
if ( ! isRealDimension & & "2" . equals ( topChartPO . getFtype ( ) ) ) {
ChartDepartmentModeVO departmentModeVO = selectModeInfo ( rs . getString ( "id" ) ) ;
topChartPO . setColorCheck ( departmentModeVO . getColorCheck ( ) ) ;
}
filterAndAddData ( dataList , topChartPO , hideDepartment ) ;
//dataList.add(topChartPO);
}
// 向下查询数据
// 向下查询数据 (顺胜区分)
if ( isRealDimension ) {
if ( null ! = topChartPO ) {
findChildData ( topChartPO , dataList , Integer . parseInt ( depth ) , id , hideDepartment ) ;
}
} else {
if ( null ! = topChartPO & & ! "2" . equals ( depth ) ) {
topChartPO . setDepartmentDepth ( 1 ) ;
findChildData ( topChartPO , dataList , Integer . parseInt ( depth ) , id , hideDepartment ) ;
}
}
result . put ( "api_status" , true ) ;
result . put ( "data" , dataList ) ;
@ -200,8 +216,11 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO . setOnJobNum ( isRealTime ? Util . getIntValue ( rs . getString ( "on_job_num" ) , 0 ) : Util . getIntValue ( rs . getString ( "job_num" ) , 0 ) ) ;
chartPO . setStaffNum ( Util . getIntValue ( rs . getString ( "staff_num" ) , 0 ) ) ;
filterAndAddData ( dataList , chartPO , hideDepartment ) ;
//dataList.add(chartPO);
//顺胜二开 虚拟维度部门颜色设置
if ( ! isRealDimension & & "2" . equals ( chartPO . getFtype ( ) ) ) {
ChartDepartmentModeVO departmentModeVO = selectModeInfo ( rs . getString ( "id" ) ) ;
chartPO . setColorCheck ( departmentModeVO . getColorCheck ( ) ) ;
}
}
}
}
@ -532,7 +551,7 @@ public class ChartServiceImpl extends Service implements ChartService {
. disabled ( false )
. value ( rs . getString ( "value" ) )
. title ( rs . getString ( "title" ) )
. isLeaf ( tru e)
. isLeaf ( fals e)
//.isLeaf(judgeTreeLeaf(versionId, dimension, rs.getString("id")))
. level ( 1 )
. build ( )
@ -1349,7 +1368,7 @@ public class ChartServiceImpl extends Service implements ChartService {
* @param dimension 维 度 ID
* @return 查 询 SQL
* /
private String getRealTimeTopSql ( String root , String dimension ) {
private String getRealTimeTopSql ( String root , String dimension ,String department ) {
if ( "0" . equals ( root ) ) {
// 查询集团数据
if ( isRealDimension ) {
@ -1368,7 +1387,8 @@ public class ChartServiceImpl extends Service implements ChartService {
}
} else {
return "select a.id,a.subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=1 where a.id = '" + root + "' order by a.showorder,a.id" ;
//return "select a.id,a.subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=1 where a.id = '" + root + "' order by a.showorder,a.id";
return "select a.id,a.departmentname as name,'2' as type,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=2 where a.id = '" + department + "' order by a.showorder,a.id" ;
}
}
}
@ -1535,7 +1555,6 @@ public class ChartServiceImpl extends Service implements ChartService {
// 小于、等于所选层级元素展开
chartPO . setExpand ( inDepth ( selectDepth , chartPO . getDepartmentDepth ( ) ) ? "1" : "0" ) ;
filterAndAddData ( currentList , chartPO , hideDepartment ) ;
//currentList.add(chartPO);
}
@ -1678,9 +1697,13 @@ public class ChartServiceImpl extends Service implements ChartService {
if ( selectDepth = = 1 ) {
return true ;
}
if ( isRealDimension ) {
return currentDepth < selectDepth + 1 ;
}
return currentDepth < selectDepth ;
}
/ * *
* 获 取 当 前 部 门 层 级
*