diff --git a/src/com/engine/organization/entity/hrmresource/bo/ResourceChartBO.java b/src/com/engine/organization/entity/hrmresource/bo/ResourceChartBO.java index 48d08b7e..d464f067 100644 --- a/src/com/engine/organization/entity/hrmresource/bo/ResourceChartBO.java +++ b/src/com/engine/organization/entity/hrmresource/bo/ResourceChartBO.java @@ -3,6 +3,8 @@ package com.engine.organization.entity.hrmresource.bo; import com.engine.organization.entity.hrmresource.po.ResourceChartPO; import com.engine.organization.entity.hrmresource.vo.ResourceChartVO; import com.engine.organization.transmethod.HrmResourceTransMethod; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; import weaver.general.Util; import java.util.ArrayList; @@ -19,13 +21,14 @@ public class ResourceChartBO { List resourceChartVOS = new ArrayList<>(); for (ResourceChartPO resourceChartPO : resourceChartPOS) { ResourceChartVO resourceChartVO = new ResourceChartVO(); + resourceChartVO.setId(resourceChartPO.getId()); resourceChartVO.setWorkCode(resourceChartPO.getWorkCode()); resourceChartVO.setLastName(resourceChartPO.getLastName()); resourceChartVO.setSex("1".equals(resourceChartPO.getSex()) ? "女" : "男"); resourceChartVO.setDepartmentName(HrmResourceTransMethod.getDepartmentName(Util.null2String(resourceChartPO.getDepartmentId()))); resourceChartVO.setSubcompanyName(HrmResourceTransMethod.getCompanyName(Util.null2String(resourceChartPO.getSubcompanyid1()))); - resourceChartVO.setJobTitle(HrmResourceTransMethod.getJobName(Util.null2String(resourceChartPO.getJobTitle()))); + resourceChartVO.setJobTitle(selectCustomName(resourceChartPO.getId())); resourceChartVO.setStatus(resourceChartPO.getStatus()); resourceChartVO.setMobile(resourceChartPO.getMobile()); resourceChartVOS.add(resourceChartVO); @@ -34,4 +37,25 @@ public class ResourceChartBO { } + /** + * 上海港湾二开 查询自定义职位名称 uf_zwxxjmb + */ + private static String selectCustomName(long id){ + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + String scopeid = bb.getPropValue("hrmOrganization", "scopeid"); + String fieldid = bb.getPropValue("hrmOrganization", "fieldid"); + String jobName = ""; + rs.executeQuery("select c.zwmc as jobname from hrmresource a \n" + + "left join cus_fielddata b on a.id = b.id and b.scopeid = "+scopeid+"\n" + + "left join uf_zwxxjmb c on b."+fieldid+" = c.id\n" + + "where a.status < 4 and a.id = ?",id); + if (rs.next()){ + jobName = rs.getString("jobname"); + } + + return jobName; + } + + } diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 748702ec..5f32410b 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -320,11 +320,23 @@ public class ChartServiceImpl extends Service implements ChartService { departmentChartPO.setHasChildren(CollectionUtils.isNotEmpty(jobTitleList) ? "1" : "0"); } else { // 直接查询岗位下的人员 + BaseBean bb = new BaseBean(); + String scopeid = bb.getPropValue("hrmOrganization", "scopeid"); + String fieldid = bb.getPropValue("hrmOrganization", "fieldid"); + if (isRealTime) { if (isRealDimension) { - sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,b.jobtitlename as jobname from hrmresource a left join hrmjobtitles b on a.jobtitle=b.id where a.status < 4 and a.departmentid = ? "; + sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,c.zwmc as jobname \n" + + " from hrmresource a \n" + + " left join cus_fielddata b on a.id = b.id and b.scopeid = +"+scopeid+"\n" + + " left join uf_zwxxjmb c on b."+fieldid+" = c.id\n" + + " where a.status < 4 and a.departmentid = ?"; } else { - sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,c.jobtitlename as jobname from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid left join hrmjobtitles c on a.jobtitle=c.id where a.status < 4 and b.departmentid = ? "; + sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,d.zwmc as jobname \n" + + " from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid \n" + + " left join cus_fielddata c on a.id = c.id and c.scopeid = +"+scopeid+"\n" + + " left join uf_zwxxjmb d on c."+fieldid+" = d.id\n" + + " where a.status < 4 and b.departmentid = ?"; } } else { sql = "select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and versionid = " + versionId;