diff --git a/src/com/engine/organization/entity/chart/ChartPO.java b/src/com/engine/organization/entity/chart/ChartPO.java index 5495144b..e3b08876 100644 --- a/src/com/engine/organization/entity/chart/ChartPO.java +++ b/src/com/engine/organization/entity/chart/ChartPO.java @@ -28,7 +28,17 @@ public class ChartPO { private String fisvitual; private String hasChildren; + // 在岗数 + private Integer fonjob; + + // 部门负责人 + private String fleader; + + // 人员主次账号 + private String belongto; + private String id; + private String key; public String getId() { if (StringUtils.isNotBlank(ftype)) { @@ -50,6 +60,14 @@ public class ChartPO { } public String getFisvitual() { + // 人员、岗位不展示次字段 + if (StringUtils.isNotBlank(ftype) && ("3".equals(ftype) || "4".equals(ftype))) { + return null; + } return StringUtils.isBlank(fisvitual) ? "0" : fisvitual; } + + public String getKey() { + return getId(); + } } diff --git a/src/com/engine/organization/entity/hrmresource/po/ResourceChartPO.java b/src/com/engine/organization/entity/hrmresource/po/ResourceChartPO.java index 63868f50..48b68d96 100644 --- a/src/com/engine/organization/entity/hrmresource/po/ResourceChartPO.java +++ b/src/com/engine/organization/entity/hrmresource/po/ResourceChartPO.java @@ -26,11 +26,11 @@ public class ResourceChartPO { private String sex; - private Integer departmentId; + private String departmentId; - private Integer subcompanyid1; + private String subcompanyid1; - private Integer jobTitle; + private String jobTitle; private Integer status; diff --git a/src/com/engine/organization/mapper/resource/HrmResourceMapper.xml b/src/com/engine/organization/mapper/resource/HrmResourceMapper.xml index e7d48fa6..56208857 100644 --- a/src/com/engine/organization/mapper/resource/HrmResourceMapper.xml +++ b/src/com/engine/organization/mapper/resource/HrmResourceMapper.xml @@ -444,8 +444,22 @@ \ No newline at end of file diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 006e5580..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; @@ -186,14 +188,15 @@ public class ChartServiceImpl extends Service implements ChartService { List dataList = new ArrayList<>(); List resourceList = new ArrayList<>(); Set jobTitleSet = new HashSet<>(); + int departmentOnJob = 0; RecordSet rs = new RecordSet(); // TODO 查询当前实际的数据 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()){ @@ -201,11 +204,13 @@ public class ChartServiceImpl extends Service implements ChartService { ChartPO chartPO = new ChartPO(); chartPO.setFtype("4"); chartPO.setFobjid(rs.getString("id")); + chartPO.setId(chartPO.getFobjid()); 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); @@ -231,13 +236,16 @@ public class ChartServiceImpl extends Service implements ChartService { List chartPOS = resourceMap.get(chartPO.getId()); if (CollectionUtils.isNotEmpty(chartPOS)) { dataList.addAll(chartPOS); + chartPO.setFonjob(chartPOS.size()); + departmentOnJob += chartPO.getFonjob(); } } } // 查询部门本身 - 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); @@ -246,6 +254,10 @@ public class ChartServiceImpl extends Service implements ChartService { // 岗位处理后的ID chartPO.setExpand("1"); chartPO.setHasChildren(CollectionUtils.isNotEmpty(dataList) ? "1" : "0"); + chartPO.setFonjob(departmentOnJob); + + // 部门负责人 + chartPO.setFleader(getDepartmentLeader(fLeader)); dataList.add(chartPO); } @@ -440,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, ","); + } } diff --git a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java index 1680200d..c7d054eb 100644 --- a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java @@ -438,7 +438,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic list.add(ResourceListColumns.builder().title("姓名").dataIndex("lastName").key("lastName").build()); list.add(ResourceListColumns.builder().title("性别").dataIndex("sex").key("sex").build()); list.add(ResourceListColumns.builder().title("部门").dataIndex("departmentId").key("departmentId").build()); - list.add(ResourceListColumns.builder().title("分部").dataIndex("subcompamyid1").key("subcompamyid1").build()); + list.add(ResourceListColumns.builder().title("分部").dataIndex("subcompanyid1").key("subcompanyid1").build()); list.add(ResourceListColumns.builder().title("岗位").dataIndex("jobTitle").key("jobTitle").build()); //list.add(ResourceListColumns.builder().title("状态").dataIndex("status").key("status").build()); list.add(ResourceListColumns.builder().title("手机号").dataIndex("mobile").key("mobile").build());