组织架构图,部门负责人、主次账号

pull/178/head
dxfeng 2 years ago
parent 79f64f7f93
commit 38656dde58

@ -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;
}

@ -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<String> 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, ",");
}
}

Loading…
Cancel
Save