From 08a803c58a4a08a7afbf3599a5bb032215e28c25 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 10 Apr 2024 10:59:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=BA=E8=83=9C=E9=A1=B9=E7=9B=AE=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=9E=B6=E6=9E=84=E5=9B=BE=E4=BA=8C=E5=BC=80=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E5=B0=81=E7=89=88=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChartServiceImpl.java | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index eda5af50..3f1a34af 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -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 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,15 +137,27 @@ 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 (null != topChartPO) { - findChildData(topChartPO, dataList, Integer.parseInt(depth), id, hideDepartment); + // 向下查询数据 (顺胜区分) + 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); return result; @@ -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(true) + .isLeaf(false) //.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,7 +1697,11 @@ public class ChartServiceImpl extends Service implements ChartService { if (selectDepth == 1) { return true; } - return currentDepth < selectDepth + 1; + if(isRealDimension) { + return currentDepth < selectDepth + 1; + } + + return currentDepth < selectDepth; } /**