diff --git a/src/com/engine/organization/entity/chart/ChartPO.java b/src/com/engine/organization/entity/chart/ChartPO.java index 46055172..e3b08876 100644 --- a/src/com/engine/organization/entity/chart/ChartPO.java +++ b/src/com/engine/organization/entity/chart/ChartPO.java @@ -31,6 +31,12 @@ public class ChartPO { // 在岗数 private Integer fonjob; + // 部门负责人 + private String fleader; + + // 人员主次账号 + private String belongto; + private String id; private String key; @@ -54,6 +60,10 @@ public class ChartPO { } public String getFisvitual() { + // 人员、岗位不展示次字段 + if (StringUtils.isNotBlank(ftype) && ("3".equals(ftype) || "4".equals(ftype))) { + return null; + } return StringUtils.isBlank(fisvitual) ? "0" : fisvitual; } diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index ea2203c7..c15b19c2 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -3,9 +3,11 @@ package com.engine.organization.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.organization.entity.chart.ChartPO; +import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.service.ChartService; import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.OrganizationAssert; +import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; @@ -192,9 +194,9 @@ public class ChartServiceImpl extends Service implements ChartService { String sql; // 查询当当前部门下的人员 if ("0".equals(dimension)) { - sql = "select a.id,a.lastname as 'name' ,a.jobtitle from hrmresource a where a.departmentid = '" + departmentId + "'"; + sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto from hrmresource a where a.departmentid = '" + departmentId + "'"; } else { - sql = "select a.id,a.lastname as 'name' ,a.jobtitle from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where b.departmentid = '" + departmentId + "'"; + sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where b.departmentid = '" + departmentId + "'"; } rs.executeQuery(sql); while (rs.next()){ @@ -206,8 +208,9 @@ public class ChartServiceImpl extends Service implements ChartService { chartPO.setFname(rs.getString("name")); // 岗位处理后的ID chartPO.setParentId(departmentId + "_" + jobTitle); - chartPO.setExpand("1"); + chartPO.setExpand("0"); chartPO.setHasChildren("0"); + chartPO.setBelongto(Util.null2String(rs.getString("belongto"))); resourceList.add(chartPO); jobTitleSet.add(jobTitle); @@ -239,9 +242,10 @@ public class ChartServiceImpl extends Service implements ChartService { } } // 查询部门本身 - sql = "select a.id,a.departmentname as 'name' from " + DEPARTMENT_TABLE + " a where 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); if(rs.next()){ + String fLeader = Util.null2String(rs.getString("bmfzr")); ChartPO chartPO = new ChartPO(); chartPO.setFtype("2"); chartPO.setFobjid(departmentId); @@ -251,6 +255,9 @@ public class ChartServiceImpl extends Service implements ChartService { chartPO.setExpand("1"); chartPO.setHasChildren(CollectionUtils.isNotEmpty(dataList) ? "1" : "0"); chartPO.setFonjob(departmentOnJob); + + // 部门负责人 + chartPO.setFleader(getDepartmentLeader(fLeader)); dataList.add(chartPO); } @@ -445,4 +452,19 @@ public class ChartServiceImpl extends Service implements ChartService { } return false; } + + private String getDepartmentLeader(String ids) { + 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); + } + } + return StringUtils.join(leaderList, ","); + } }