晶优组织架构图重写
This commit is contained in:
parent
28884f06a9
commit
8d9303f07c
|
|
@ -1,5 +1,8 @@
|
|||
package com.engine.organization.entity.jingyou;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -28,6 +31,13 @@ public class JyChart {
|
|||
private String fleaderlv;
|
||||
private String fleaderst;
|
||||
|
||||
protected static final RecordSet rs = new RecordSet();
|
||||
|
||||
// 提供静态方法来获取 RecordSet 实例
|
||||
public static RecordSet getRecordSet() {
|
||||
return rs;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -69,6 +79,22 @@ public class JyChart {
|
|||
}
|
||||
|
||||
public String getFobjid() {
|
||||
// 根据EcId获取聚才林ID
|
||||
if (StringUtils.isNotBlank(fecid) && StringUtils.isNotBlank(id)) {
|
||||
if (id.startsWith("s_")) {
|
||||
// 查询聚才林分部的ID
|
||||
rs.executeQuery("select id from jcl_org_comp where ec_company = ?",fecid);
|
||||
if(rs.next()){
|
||||
return rs.getString("id");
|
||||
}
|
||||
} else if (id.startsWith("d_")) {
|
||||
// 查询聚才林分部的ID
|
||||
rs.executeQuery("select id from jcl_org_dept where ec_department = ?",fecid);
|
||||
if(rs.next()){
|
||||
return rs.getString("id");
|
||||
}
|
||||
}
|
||||
}
|
||||
return fobjid;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,49 @@
|
|||
package com.engine.organization.entity.jingyou;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/07/19
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class JyCompanyChart extends JyChart{
|
||||
public class JyCompanyChart extends JyChart {
|
||||
|
||||
@Override
|
||||
public String getFleadername() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFplan() {
|
||||
RecordSet rs = getRecordSet();
|
||||
rs.executeQuery("select sum(staff_num) as num from jcl_org_staff");
|
||||
if(rs.next()){
|
||||
return String.valueOf(Convert.toInt(rs.getString("num"),0));
|
||||
}
|
||||
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFonjob() {
|
||||
RecordSet rs = getRecordSet();
|
||||
// 查询在岗数
|
||||
rs.executeQuery("select count(id) as fonjob from hrmresource where status <4 ");
|
||||
if(rs.next()){
|
||||
return rs.getString("fonjob");
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,65 @@
|
|||
package com.engine.organization.entity.jingyou;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/07/19
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class JyDepartmentChart extends JyChart{
|
||||
public class JyDepartmentChart extends JyChart {
|
||||
@Override
|
||||
public String getFplan() {
|
||||
RecordSet rs = getRecordSet();
|
||||
String fecid = super.getFecid();
|
||||
ArrayList<String> ids = new ArrayList<>();
|
||||
new DepartmentComInfo().getAllChildDeptByDepId(ids,fecid);
|
||||
ids.add(fecid);
|
||||
String idsStr = StringUtils.join(ids, ",");
|
||||
rs.executeQuery("select sum(staff_num) as num from jcl_org_staff where dept_id in(" + idsStr + ")");
|
||||
if (rs.next()) {
|
||||
return String.valueOf(Convert.toInt(rs.getString("num"),0));
|
||||
}
|
||||
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFonjob() {
|
||||
RecordSet rs = getRecordSet();
|
||||
String fecid = super.getFecid();
|
||||
if (StringUtils.isNotBlank(fecid)) {
|
||||
ArrayList<String> ids = new ArrayList<>();
|
||||
new DepartmentComInfo().getAllChildDeptByDepId(ids,fecid);
|
||||
ids.add(fecid);
|
||||
String idsStr = StringUtils.join(ids, ",");
|
||||
|
||||
// 查询在岗数
|
||||
rs.executeQuery("select count(id) as fonjob from hrmresource where status <4 and departmentid in (" + idsStr + ")");
|
||||
if (rs.next()) {
|
||||
return rs.getString("fonjob");
|
||||
}
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFleadername() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,47 @@
|
|||
package com.engine.organization.entity.jingyou;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/07/19
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class JyJobChart extends JyChart{
|
||||
public class JyJobChart extends JyChart {
|
||||
@Override
|
||||
public String getFplan() {
|
||||
RecordSet rs = getRecordSet();
|
||||
rs.executeQuery("select sum(staff_num) as num from jcl_org_staff where job_id = ?",getFecid());
|
||||
if(rs.next()){
|
||||
return String.valueOf(Convert.toInt(rs.getString("num"),0));
|
||||
}
|
||||
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFonjob() {
|
||||
RecordSet rs = getRecordSet();
|
||||
String fecid = super.getFecid();
|
||||
if (StringUtils.isNotBlank(fecid)) {
|
||||
// 查询在岗数
|
||||
rs.executeQuery("select count(a.id) as fonjob from hrmresource a inner join cus_fielddata b on a.id = b.id and b.scope ='hrmcustomfieldbyinfotype' and b.scopeid ='-1' where a.status <4 and b.field100002 = ?", fecid);
|
||||
if (rs.next()) {
|
||||
return rs.getString("fonjob");
|
||||
}
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,38 @@
|
|||
package com.engine.organization.entity.jingyou;
|
||||
|
||||
import com.engine.organization.service.impl.JyChartServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/07/19
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class JyResourceChart extends JyChart{
|
||||
public class JyResourceChart extends JyChart {
|
||||
@Override
|
||||
public String getFleaderjob() {
|
||||
String parentId = getParentId();
|
||||
if (StringUtils.isNotBlank(parentId)) {
|
||||
String chartId = JyChartServiceImpl.getChartId(parentId);
|
||||
if (StringUtils.isNotBlank(chartId)) {
|
||||
RecordSet rs = getRecordSet();
|
||||
rs.executeQuery("select job_name from jcl_org_job where id = ?", chartId);
|
||||
if (rs.next()) {
|
||||
return rs.getString("job_name");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,66 @@
|
|||
package com.engine.organization.entity.jingyou;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/07/19
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class JySubCompanyChart extends JyChart{
|
||||
public class JySubCompanyChart extends JyChart {
|
||||
|
||||
@Override
|
||||
public String getFplan() {
|
||||
RecordSet rs = getRecordSet();
|
||||
ArrayList<String> ids = new ArrayList<>();
|
||||
String fecid = super.getFecid();
|
||||
new SubCompanyComInfo().getSubCompanyLists(fecid, ids);
|
||||
ids.add(fecid);
|
||||
String idsStr = StringUtils.join(ids, ",");
|
||||
rs.executeQuery("select sum(staff_num) as num from jcl_org_staff where comp_id in(" + idsStr + ")");
|
||||
if (rs.next()) {
|
||||
return String.valueOf(Convert.toInt(rs.getString("num"),0));
|
||||
}
|
||||
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFonjob() {
|
||||
String fecid = super.getFecid();
|
||||
if (StringUtils.isNotBlank(fecid)) {
|
||||
RecordSet rs = getRecordSet();
|
||||
ArrayList<String> ids = new ArrayList<>();
|
||||
new SubCompanyComInfo().getSubCompanyLists(fecid,ids);
|
||||
ids.add(fecid);
|
||||
String idsStr = StringUtils.join(ids, ",");
|
||||
|
||||
// 查询在岗数
|
||||
rs.executeQuery("select count(id) as fonjob from hrmresource where status <4 and subcompanyid1 in (" + idsStr + ")");
|
||||
if (rs.next()) {
|
||||
return rs.getString("fonjob");
|
||||
}
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFleadername() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package com.engine.organization.service.impl;
|
|||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.jingyou.JyChart;
|
||||
import com.engine.organization.entity.jingyou.JyOrgSelectItem;
|
||||
import com.engine.organization.entity.jingyou.*;
|
||||
import com.engine.organization.service.OrgChartService;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
|
@ -17,14 +17,13 @@ import java.util.*;
|
|||
* @date: 2022/7/7
|
||||
* @description: 组织架构图ServiceImpl
|
||||
**/
|
||||
public class JyChartServiceImpl extends Service {
|
||||
|
||||
private RecordSet grs = new RecordSet();
|
||||
public class JyChartServiceImpl extends Service implements OrgChartService {
|
||||
|
||||
private static final String COMPANY_RIGHT = "OrgChart:All";
|
||||
private static final String USER_RIGHT = "OrgPerspective:All";
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getOptionCondition(Map<String, Object> request2Map, User user) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
|
|
@ -69,7 +68,7 @@ public class JyChartServiceImpl extends Service {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCompanyData(Map<String, Object> request2Map, User user) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
boolean hasRight = HasRightUtil.hasRight(user, COMPANY_RIGHT, true);
|
||||
|
|
@ -108,11 +107,11 @@ public class JyChartServiceImpl extends Service {
|
|||
item.setFname(rs.getString("companyname"));
|
||||
item.setFtype("0");
|
||||
item.setFnumber(rs.getString("companycode"));
|
||||
item.setFobjid(rs.getString("id"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand("1");
|
||||
chartList.add(item);
|
||||
buildSubCompanyData(item.getFobjid(), "0", item.getId(), currentLevel, chartList);
|
||||
buildSubCompanyData(item.getFecid(), "0", item.getId(), currentLevel, chartList);
|
||||
}
|
||||
} else if (root.startsWith("s_")) {
|
||||
// 分部
|
||||
|
|
@ -124,12 +123,12 @@ public class JyChartServiceImpl extends Service {
|
|||
item.setFname(rs.getString("subcompanyname"));
|
||||
item.setFtype("1");
|
||||
item.setFnumber(rs.getString("subcompanycode"));
|
||||
item.setFobjid(rs.getString("id"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand("1");
|
||||
chartList.add(item);
|
||||
buildSubCompanyData(rs.getString("companyid"), item.getFobjid(), item.getId(), currentLevel, chartList);
|
||||
buildDepartmentData(item.getFobjid(), "0", item.getId(), currentLevel, chartList);
|
||||
buildSubCompanyData(rs.getString("companyid"), item.getFecid(), item.getId(), currentLevel, chartList);
|
||||
buildDepartmentData(item.getFecid(), "0", item.getId(), currentLevel, chartList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,6 +139,7 @@ public class JyChartServiceImpl extends Service {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user) {
|
||||
String ids = (String) request2Map.get("ids");
|
||||
Set<JyChart> chartList = new LinkedHashSet<>();
|
||||
|
|
@ -157,12 +157,12 @@ public class JyChartServiceImpl extends Service {
|
|||
item.setFname(rs.getString("subcompanyname"));
|
||||
item.setFtype("1");
|
||||
item.setFnumber(rs.getString("subcompanycode"));
|
||||
item.setFobjid(rs.getString("id"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand("0");
|
||||
chartList.add(item);
|
||||
buildSubCompanyData(rs.getString("companyid"), item.getFobjid(), item.getId(), 0, chartList);
|
||||
buildDepartmentData(item.getFobjid(), "0", item.getId(), 0, chartList);
|
||||
buildSubCompanyData(rs.getString("companyid"), item.getFecid(), item.getId(), 0, chartList);
|
||||
buildDepartmentData(item.getFecid(), "0", item.getId(), 0, chartList);
|
||||
}
|
||||
} else if (splitId.startsWith("d_")) {
|
||||
// 分部
|
||||
|
|
@ -175,12 +175,149 @@ public class JyChartServiceImpl extends Service {
|
|||
jyChart.setFname(rs.getString("departmentmark"));
|
||||
jyChart.setFtype("2");
|
||||
jyChart.setFnumber(rs.getString("departmentcode"));
|
||||
jyChart.setFobjid(rs.getString("id"));
|
||||
jyChart.setFecid(rs.getString("id"));
|
||||
jyChart.setFisvitual("0");
|
||||
jyChart.setExpand("0");
|
||||
chartList.add(jyChart);
|
||||
String subCompanyId = rs.getString("subcompanyid1");
|
||||
buildDepartmentData(subCompanyId, jyChart.getFobjid(), jyChart.getId(), 0, chartList);
|
||||
buildDepartmentData(subCompanyId, jyChart.getFecid(), jyChart.getId(), 0, chartList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("api_status", true);
|
||||
result.put("data", chartList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getUserData(Map<String, Object> request2Map, User user) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
boolean hasRight = HasRightUtil.hasRight(user, USER_RIGHT, true);
|
||||
result.put("hasRight", hasRight);
|
||||
if (!hasRight) {
|
||||
return result;
|
||||
}
|
||||
String root = (String) request2Map.get("root"); // 根节点
|
||||
String level = (String) request2Map.get("level"); // 显示层级
|
||||
int currentLevel = Convert.toInt(level, 3);
|
||||
// 维度
|
||||
String fclass = (String) request2Map.get("fclass");
|
||||
|
||||
// 当前维度
|
||||
boolean currentDimension = "0".equals(fclass);
|
||||
|
||||
String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织
|
||||
if (StringUtils.isBlank(fisvitual)) {
|
||||
fisvitual = "0";
|
||||
}
|
||||
|
||||
|
||||
Set<JyChart> chartList = new LinkedHashSet<>();
|
||||
if (currentDimension) {
|
||||
if ("0".equals(root)) {
|
||||
// 集团
|
||||
rs.executeQuery("select * from hrmcompany");
|
||||
if (rs.next()) {
|
||||
JyCompanyChart item = new JyCompanyChart();
|
||||
item.setId("0");
|
||||
item.setFname(rs.getString("companyname"));
|
||||
item.setFtype("0");
|
||||
item.setFnumber(rs.getString("companycode"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand("1");
|
||||
chartList.add(item);
|
||||
buildSubCompanyUserData(item.getFecid(), "0", item.getId(), currentLevel, chartList);
|
||||
}
|
||||
} else if (root.startsWith("s_")) {
|
||||
// 分部
|
||||
String chartId = getChartId(root);
|
||||
rs.executeQuery("select * from hrmsubcompany where id = ?", chartId);
|
||||
if (rs.next()) {
|
||||
JySubCompanyChart item = new JySubCompanyChart();
|
||||
item.setId("s_" + rs.getString("id"));
|
||||
item.setFname(rs.getString("subcompanyname"));
|
||||
item.setFtype("1");
|
||||
item.setFnumber(rs.getString("subcompanycode"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand("1");
|
||||
chartList.add(item);
|
||||
buildSubCompanyUserData(rs.getString("companyid"), item.getFecid(), item.getId(), currentLevel, chartList);
|
||||
buildDepartmentUserData(item.getFecid(), "0", item.getId(), currentLevel, chartList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result.put("api_status", true);
|
||||
result.put("data", chartList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> asyncUserData(Map<String, Object> request2Map, User user) {
|
||||
String ids = (String) request2Map.get("ids");
|
||||
Set<JyChart> chartList = new LinkedHashSet<>();
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
String[] splitIds = ids.split(",");
|
||||
for (String splitId : splitIds) {
|
||||
if (splitId.startsWith("s_")) {
|
||||
// 分部
|
||||
String chartId = getChartId(splitId);
|
||||
rs.executeQuery("select * from hrmsubcompany where id = ?", chartId);
|
||||
if (rs.next()) {
|
||||
JySubCompanyChart item = new JySubCompanyChart();
|
||||
item.setId("s_" + rs.getString("id"));
|
||||
item.setParentId(splitId);
|
||||
item.setFname(rs.getString("subcompanyname"));
|
||||
item.setFtype("1");
|
||||
item.setFnumber(rs.getString("subcompanycode"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand("0");
|
||||
chartList.add(item);
|
||||
buildSubCompanyUserData(rs.getString("companyid"), item.getFecid(), item.getId(), 0, chartList);
|
||||
buildDepartmentUserData(item.getFecid(), "0", item.getId(), 0, chartList);
|
||||
}
|
||||
} else if (splitId.startsWith("d_")) {
|
||||
// 部门
|
||||
String chartId = getChartId(splitId);
|
||||
rs.executeQuery("select * from hrmdepartment where id = ?", chartId);
|
||||
if (rs.next()) {
|
||||
JyDepartmentChart jyChart = new JyDepartmentChart();
|
||||
jyChart.setId("d_" + rs.getString("id"));
|
||||
jyChart.setParentId(splitId);
|
||||
jyChart.setFname(rs.getString("departmentmark"));
|
||||
jyChart.setFtype("2");
|
||||
jyChart.setFnumber(rs.getString("departmentcode"));
|
||||
jyChart.setFecid(rs.getString("id"));
|
||||
jyChart.setFisvitual("0");
|
||||
jyChart.setExpand("0");
|
||||
chartList.add(jyChart);
|
||||
String subCompanyId = rs.getString("subcompanyid1");
|
||||
buildDepartmentUserData(subCompanyId, jyChart.getFecid(), jyChart.getId(), 0, chartList);
|
||||
buildJobUserData(jyChart.getFecid(), jyChart.getId(), 0, chartList);
|
||||
}
|
||||
}else if (splitId.startsWith("j_")) {
|
||||
// 岗位
|
||||
String chartId = getChartId(splitId);
|
||||
rs.executeQuery("select * from jcl_org_job where id = ?", chartId);
|
||||
if (rs.next()) {
|
||||
JyJobChart jyChart = new JyJobChart();
|
||||
jyChart.setId("j_" + rs.getString("id"));
|
||||
jyChart.setParentId(splitId);
|
||||
jyChart.setFname(rs.getString("job_name"));
|
||||
jyChart.setFtype("3");
|
||||
jyChart.setFnumber(rs.getString("job_no"));
|
||||
jyChart.setFecid(rs.getString("id"));
|
||||
jyChart.setFisvitual("0");
|
||||
jyChart.setExpand("0");
|
||||
chartList.add(jyChart);
|
||||
buildResourceUserData(jyChart.getFecid(), jyChart.getId(), 0, chartList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -205,20 +342,17 @@ public class JyChartServiceImpl extends Service {
|
|||
item.setFname(rs.getString("subcompanyname"));
|
||||
item.setFtype("1");
|
||||
item.setFnumber(rs.getString("subcompanycode"));
|
||||
item.setFobjid(rs.getString("id"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand(currentLevel > 0 ? "1" : "0");
|
||||
chartList.add(item);
|
||||
subCompanyList.add(item);
|
||||
}
|
||||
chartList.addAll(subCompanyList);
|
||||
|
||||
for (JyChart jyChart : subCompanyList) {
|
||||
buildSubCompanyData(companyId, jyChart.getFobjid(), jyChart.getId(), currentLevel - 1, chartList);
|
||||
buildDepartmentData(jyChart.getFobjid(), "0", jyChart.getId(), currentLevel - 1, chartList);
|
||||
buildSubCompanyData(companyId, jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
|
||||
buildDepartmentData(jyChart.getFecid(), "0", jyChart.getId(), currentLevel - 1, chartList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void buildDepartmentData(String subCompanyId, String parentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
|
||||
|
|
@ -234,22 +368,118 @@ public class JyChartServiceImpl extends Service {
|
|||
item.setFname(rs.getString("departmentmark"));
|
||||
item.setFtype("2");
|
||||
item.setFnumber(rs.getString("departmentcode"));
|
||||
item.setFobjid(rs.getString("id"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand(currentLevel > 0 ? "1" : "0");
|
||||
chartList.add(item);
|
||||
departmentList.add(item);
|
||||
}
|
||||
chartList.addAll(departmentList);
|
||||
for (JyChart jyChart : departmentList) {
|
||||
buildDepartmentData(subCompanyId, jyChart.getFobjid(), jyChart.getId(), currentLevel - 1, chartList);
|
||||
buildDepartmentData(subCompanyId, jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
|
||||
}
|
||||
}
|
||||
|
||||
void buildSubCompanyUserData(String companyId, String parentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
|
||||
if (currentLevel < 0) {
|
||||
return;
|
||||
}
|
||||
rs.executeQuery("select * from hrmsubcompany where companyid = " + companyId + " and ifnull(supsubcomid,0) = " + parentId + " and ifnull(canceled,0) = 0 order by showorder ,showOrderOfTree");
|
||||
List<JySubCompanyChart> subCompanyList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
JySubCompanyChart item = new JySubCompanyChart();
|
||||
item.setId("s_" + rs.getString("id"));
|
||||
item.setParentId(chartPid);
|
||||
item.setFname(rs.getString("subcompanyname"));
|
||||
item.setFtype("1");
|
||||
item.setFnumber(rs.getString("subcompanycode"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand(currentLevel > 0 ? "1" : "0");
|
||||
subCompanyList.add(item);
|
||||
}
|
||||
chartList.addAll(subCompanyList);
|
||||
|
||||
for (JySubCompanyChart jyChart : subCompanyList) {
|
||||
buildSubCompanyUserData(companyId, jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
|
||||
buildDepartmentUserData(jyChart.getFecid(), "0", jyChart.getId(), currentLevel - 1, chartList);
|
||||
}
|
||||
}
|
||||
|
||||
void buildDepartmentUserData(String subCompanyId, String parentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
|
||||
if (currentLevel < 0) {
|
||||
return;
|
||||
}
|
||||
String sql = "select * from hrmdepartment where subcompanyid1 = " + subCompanyId + " and ifnull(supdepid,0) = " + parentId + " and ifnull(canceled,0) = 0 order by showorder ,showorderoftree";
|
||||
rs.executeQuery(sql);
|
||||
List<JyDepartmentChart> departmentList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
JyDepartmentChart item = new JyDepartmentChart();
|
||||
item.setId("d_" + rs.getString("id"));
|
||||
item.setParentId(chartPid);
|
||||
item.setFname(rs.getString("departmentmark"));
|
||||
item.setFtype("2");
|
||||
item.setFnumber(rs.getString("departmentcode"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand(currentLevel > 0 ? "1" : "0");
|
||||
departmentList.add(item);
|
||||
}
|
||||
chartList.addAll(departmentList);
|
||||
for (JyDepartmentChart jyChart : departmentList) {
|
||||
buildDepartmentUserData(subCompanyId, jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
|
||||
buildJobUserData(jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
|
||||
}
|
||||
}
|
||||
|
||||
void buildJobUserData(String departmentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
|
||||
if (currentLevel < 0) {
|
||||
return;
|
||||
}
|
||||
rs.executeQuery("select * from jcl_org_job where ec_department = ? and ifnull(forbidden_tag,0)=0 order by show_order ", departmentId);
|
||||
List<JyJobChart> jobList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
JyJobChart item = new JyJobChart();
|
||||
item.setId("j_" + rs.getString("id"));
|
||||
item.setParentId(chartPid);
|
||||
item.setFname(rs.getString("job_name"));
|
||||
item.setFtype("3");
|
||||
item.setFnumber(rs.getString("job_no"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand(currentLevel > 0 ? "1" : "0");
|
||||
jobList.add(item);
|
||||
}
|
||||
chartList.addAll(jobList);
|
||||
for (JyJobChart jyChart : jobList) {
|
||||
// 查询人员
|
||||
buildResourceUserData(jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getChartId(String id) {
|
||||
void buildResourceUserData(String jobId, String chartPid, int currentLevel, Set<JyChart> chartList) {
|
||||
if (currentLevel < 0) {
|
||||
return;
|
||||
}
|
||||
rs.executeQuery("select a.id,a.lastname from hrmresource a inner join cus_fielddata b on a.id = b.id and b.scope ='hrmcustomfieldbyinfotype' and b.scopeid ='-1' where b.field100002 = ?", jobId);
|
||||
List<JyResourceChart> resourceList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
JyResourceChart item = new JyResourceChart();
|
||||
item.setId("r_" + rs.getString("id"));
|
||||
item.setParentId(chartPid);
|
||||
item.setFname(rs.getString("lastname"));
|
||||
item.setFtype("4");
|
||||
item.setFnumber(rs.getString("hrmresource"));
|
||||
item.setFecid(rs.getString("id"));
|
||||
item.setFisvitual("0");
|
||||
item.setExpand(currentLevel > 0 ? "1" : "0");
|
||||
resourceList.add(item);
|
||||
}
|
||||
chartList.addAll(resourceList);
|
||||
}
|
||||
|
||||
|
||||
public static String getChartId(String id) {
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
String[] split = id.split("_");
|
||||
if (split.length == 2) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue