From c7d9b53e13dc7293a22bacf62cc24e6a2d09a674 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 16 Jan 2025 17:14:33 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BD=93=E5=89=8D=E7=89=88=E6=9C=AC=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=202.=E5=8E=86=E5=8F=B2=E7=89=88=E6=9C=AC=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=203.=E5=8E=86=E5=8F=B2=E7=89=88=E6=9C=AC=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=204.=E5=8E=86=E5=8F=B2=E7=89=88=E6=9C=AC=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E8=B4=9F=E8=B4=A3=E4=BA=BA=205.=E4=BA=BA=E6=95=B0?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChartServiceImpl.java | 24 +++++++++++-------- .../impl/ModeHrmResourceServiceImpl.java | 17 +++++++++---- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 00526fe3..84bc589f 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -723,7 +723,8 @@ public class ChartServiceImpl extends Service implements ChartService { List jobList = new ArrayList<>(); List staffList = new ArrayList<>(); RecordSet rs = new RecordSet(); - rs.executeQuery("select on_job_num,staff_num from jcl_org_onjob where type = 2 and super_id = 0"); + rs.executeQuery("select on_job_num,staff_num from jcl_org_onjob a left join uf_shzg_zzjgkz b on a.data_id = b.bmbz\n" + + " where a.type = 2 and a.super_id = 0 and b.sfxs = 0"); while (rs.next()) { jobList.add(Util.getIntValue(rs.getString("on_job_num"),0)); staffList.add(Util.getIntValue(rs.getString("staff_num"),0)); @@ -972,11 +973,12 @@ public class ChartServiceImpl extends Service implements ChartService { " left join JCL_ORG_ONJOB d on a.id=d.data_id and d.type=1 "; deptQuerySql = "select a.id as departmentid, a.departmentmark, a.departmentname, a.subcompanyid1 as subcompanyid, " + "b.SUBCOMPANYNAME as subcompany,a.supdepid as supdepartmentid,c.departmentname as supdepartment," + - "a.canceled,a.departmentcode,a.coadjutant,a.tlevel,d.bmlx as isvirtual,a.bmfzr as fleader,e.on_job_num,e.staff_num " + + "a.canceled,a.departmentcode,a.coadjutant,a.tlevel,d.bmlx as isvirtual,d.bmfzr as fleader,e.on_job_num,e.staff_num,f.sfxs " + "from hrmdepartment a left join hrmsubcompany b on a.subcompanyid1 = b.id " + "left join hrmdepartment c on a.supdepid = c.id " + "left join hrmdepartmentdefined d on a.id=d.deptid " + - "left join JCL_ORG_ONJOB e on a.id=e.data_id and e.type=2 "; + "left join JCL_ORG_ONJOB e on a.id=e.data_id and e.type=2 " + + "left join uf_shzg_zzjgkz f on a.id = f.bmbz "; } else { subCompanyQuerySql = "select a.id as subcompanyid,\n" + @@ -1005,7 +1007,7 @@ public class ChartServiceImpl extends Service implements ChartService { " a.departmentcode,\n" + " a.coadjutant,\n" + " a.tlevel,\n" + - " a.bmfzr as fleader,\n" + + " a.bmfzr as fleader,\n" + " d.on_job_num,\n" + " d.staff_num" + " from hrmdepartment a\n" + @@ -1068,11 +1070,12 @@ public class ChartServiceImpl extends Service implements ChartService { insertList.add(StringUtils.isBlank(versionId) ? null : Util.getIntValue(versionId)); insertList.add(Util.getIntValue(rs.getString("on_job_num"),0)); insertList.add(Util.getIntValue(rs.getString("staff_num"),0)); + insertList.add(Util.getIntValue(rs.getString("sfxs"),1)); insertParamList.add(insertList); } String insertDeptSql = "insert into jcl_chart_department(creater, departmentid, departmentmark, departmentname, subcompanyid,\n" + " subcompany, supdepartmentid, supdepartment, canceled, departmentcode,\n" + - " coadjutant, fleader,versiondate, isvirtual,versionid,job_num,staff_num) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + " coadjutant, fleader,versiondate, isvirtual,versionid,job_num,staff_num,sfxs) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; insertData(recordSetTrans, insertDeptSql, insertParamList); @@ -1367,7 +1370,7 @@ public class ChartServiceImpl extends Service implements ChartService { " union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,showorder,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'"; } else { sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,0,showorder,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id and c.type=1 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,a.departmentname as name,'2' as type ,b.bmlx as isvitual,b.bmcj,showorder,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 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 + "'"; + " union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,b.bmcj,showorder,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 left join uf_shzg_zzjgkz d on a.id = d.bmbz 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 (d.sfxs != 1 and d.sfxs is not null) and subcompanyid1 = '" + fObjId + "'"; } } else { sql = "select a.id,a.subcompanyname as name,'1' as type,showorder,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 (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" + @@ -1385,7 +1388,7 @@ public class ChartServiceImpl extends Service implements ChartService { if (showVirtual) { sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'"; } else { - sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,b.bmcj,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'"; + sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,b.bmcj,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 left join uf_shzg_zzjgkz d on a.id = d.bmbz where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and (d.sfxs != 1 and d.sfxs is not null) and a.supdepid = '" + fObjId + "'"; } } else { sql = "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 (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'"; @@ -1409,8 +1412,9 @@ public class ChartServiceImpl extends Service implements ChartService { * 查询历史数据,子元素SQL * * @param sql 查询SQL - * @param fType 上级元素类型 + * @param fType 上级元素类型deptLevel * @param fObjId 上级元素ID + * todo 部门层级自定义字段未存储(显示未按颜色区分) * @return 查询SQL */ private String getLastTimeChildSql(String sql, String fType, String fObjId, String versionId) { @@ -1437,7 +1441,7 @@ public class ChartServiceImpl extends Service implements ChartService { " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num 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 " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num 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 " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num 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,a.job_num,a.staff_num 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 (a.sfxs = 0 or a.sfxs is null) and subcompanyid = '" + fObjId + "' and versionid = " + versionId; } } else { sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = " + versionId + @@ -1449,7 +1453,7 @@ public class ChartServiceImpl extends Service implements ChartService { if (showVirtual) { sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId; } else { - sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a 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,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and (a.sfxs = 0 or a.sfxs is null) and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId; } } else { sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and versionid = " + versionId; diff --git a/src/com/engine/organization/service/impl/ModeHrmResourceServiceImpl.java b/src/com/engine/organization/service/impl/ModeHrmResourceServiceImpl.java index 726cc778..dfb7e1e9 100644 --- a/src/com/engine/organization/service/impl/ModeHrmResourceServiceImpl.java +++ b/src/com/engine/organization/service/impl/ModeHrmResourceServiceImpl.java @@ -368,14 +368,23 @@ public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResour if (StringUtils.isBlank(ids)) { return ""; } + List leaderList = new ArrayList<>(); String[] split = ids.split(","); for (String s : split) { - String lastName = MapperProxyFactory.getProxy(SystemDataMapper.class).getScHrmResourceNameById(s); - if (StringUtils.isNotBlank(lastName)) { - leaderList.add(lastName); + //String lastName = MapperProxyFactory.getProxy(SystemDataMapper.class).getScHrmResourceNameById(s); + try { + ResourceComInfo resourceComInfo = new ResourceComInfo(); + String lastName = resourceComInfo.getLastname(s); + if (StringUtils.isNotBlank(lastName)) { + leaderList.add(lastName); + } + } catch (Exception e) { + e.printStackTrace(); } + } + return StringUtils.join(leaderList, ","); } @@ -432,7 +441,7 @@ public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResour departmentChartPO.setExpand("1"); departmentChartPO.setId("d_"+departmentId); departmentChartPO.setFname(rs.getString("departmentname")); - departmentChartPO.setFleader(fLeader); + departmentChartPO.setFleader(getDepartmentLeader(fLeader)); try { departmentChartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(fLeader)); } catch (Exception e) {