You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weaver-hrm-organization/src/com/engine/organization/service/impl/ChartServiceImpl.java

587 lines
28 KiB
Java

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;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import java.util.*;
/**
* @author:dxfeng
* @createTime: 2023/06/29
* @version: 1.0
*/
public class ChartServiceImpl extends Service implements ChartService {
private static final String COMPANY_RIGHT = "OrgChart:All";
public String COMPANY_TABLE = "";
public String SUB_COMPANY_TABLE = "";
public String SUB_COMPANY_DEFINED_TABLE = "";
public String DEPARTMENT_TABLE = "";
public String DEPARTMENT_DEFINED_TABLE = "";
/**
*
*/
boolean showVirtual = false;
/**
*
*/
boolean hasVirtualFields;
@Override
public Map<String, Object> getCompanyData(Map<String, Object> params) {
Map<String, Object> result = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, COMPANY_RIGHT, true);
result.put("hasRight", hasRight);
if (!hasRight) {
return result;
}
// 根结点
String root = Util.null2String(params.get("root"));
root = StringUtils.isBlank(root) ? "0" : root;
// 维度
String dimension = Util.null2String(params.get("fclass"));
dimension = StringUtils.isBlank(dimension) ? "0" : dimension;
// 是否展示虚拟组织
String isVirtual = Util.null2String(params.get("fisvitual"));
showVirtual = "1".equals(isVirtual);
String depth = Util.null2String(params.get("level"));
2 years ago
//版本id
String id = Util.null2String(params.get("id"));
// 初始化表名
initTableNameByClass(dimension);
RecordSet rs = new RecordSet();
List<ChartPO> dataList = new ArrayList<>();
String sql = "";
ChartPO topChartPO = null;
2 years ago
//查询当前实际数据
if("0".equals(id)){
sql = getRealTimeTopSql(root, dimension);
}else {
sql = getLastTimeTopSql(root,dimension,id);
}
rs.executeQuery(sql);
// 封装顶部节点
if (rs.next()) {
topChartPO = new ChartPO();
topChartPO.setFtype(rs.getString("type"));
topChartPO.setFobjid(rs.getString("id"));
topChartPO.setFname(rs.getString("name"));
topChartPO.setParentId(null);
topChartPO.setExpand("1");
topChartPO.setFisvitual(rs.getString("isvitual"));
topChartPO.setHasChildren(getHasChildren(topChartPO.getFtype(), topChartPO.getFobjid()).toString());
dataList.add(topChartPO);
}
// 向下查询数据
if (null != topChartPO) {
findChildData(topChartPO, dataList,Integer.parseInt(depth));
}
result.put("api_status", true);
result.put("data", dataList);
return result;
}
2 years ago
@Override
public Map<String, Object> asyncCompanyData(Map<String, Object> params) {
// 维度
String dimension = Util.null2String(params.get("fclass"));
dimension = StringUtils.isBlank(dimension) ? "0" : dimension;
// 是否展示虚拟组织
String isVirtual = Util.null2String(params.get("fisvitual"));
showVirtual = "1".equals(isVirtual);
// 初始化表名
initTableNameByClass(dimension);
String ids = (String) params.get("ids");
List<ChartPO> dataList = new ArrayList<>();
if (StringUtils.isNotBlank(ids)) {
RecordSet rs = new RecordSet();
String[] split = ids.split(",");
for (String s : split) {
//TODO 查询当前实际数据
if (s.contains("_")) {
String fObjId = s.split("_")[1];
if (s.startsWith("s")) {
if (hasVirtualFields) {
if (showVirtual) {
rs.executeQuery("select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and a.supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'");
} else {
rs.executeQuery("select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'");
}
} else {
rs.executeQuery("select a.id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'");
}
} else if (s.startsWith("d")) {
if (hasVirtualFields) {
if (showVirtual) {
rs.executeQuery( "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'");
} else {
rs.executeQuery( "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'");
}
} else {
rs.executeQuery( "select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'");
}
}
while (rs.next()){
ChartPO chartPO = new ChartPO();
chartPO.setFtype(rs.getString("type"));
chartPO.setFobjid(rs.getString("id"));
chartPO.setFname(rs.getString("name"));
chartPO.setParentId(s);
chartPO.setExpand("0");
chartPO.setFisvitual(rs.getString("isvitual"));
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());
dataList.add(chartPO);
}
}
}
}
Map<String, Object> result = new HashMap<>();
result.put("api_status", true);
result.put("data", dataList);
return result;
}
@Override
public Map<String, Object> getDepartmentDetail(Map<String, Object> params) {
String rootId = Util.null2String(params.get("rootId"));
OrganizationAssert.isFalse(StringUtils.isBlank(rootId) || !rootId.startsWith("d_"), "数据有误,未查询到对应数据");
String departmentId = rootId.split("_")[1];
String detauleType = Util.null2String(params.get("detauleType"));
if(!"chart".equals(detauleType)){
return ServiceUtil.getService(HrmResourceServiceImpl.class, user).chartResourceList(Integer.parseInt(departmentId));
}
// 维度
String dimension = Util.null2String(params.get("fclass"));
dimension = StringUtils.isBlank(dimension) ? "0" : dimension;
// 是否显示岗位
String showJobStr = Util.null2String(params.get("showJob"));
boolean showJob = "1".equals(showJobStr);
// 初始化表名
initTableNameByClass(dimension);
List<ChartPO> dataList = new ArrayList<>();
List<ChartPO> jobTitleList = new ArrayList<>();
int departmentOnJob = 0;
int resourceNum;
RecordSet rs = new RecordSet();
// TODO 查询当前实际的数据
String sql;
// 查询部门本身
if(hasVirtualFields){
sql = "select a.id,a.departmentname as name,b.bmfzr,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'";
}else {
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);
ChartPO departmentChartPO = new ChartPO();
if(rs.next()){
String fLeader = Util.null2String(rs.getString("bmfzr"));
departmentChartPO.setFtype("2");
departmentChartPO.setFobjid(departmentId);
departmentChartPO.setId(rootId);
departmentChartPO.setFname(rs.getString("name"));
// 岗位处理后的ID
departmentChartPO.setExpand("1");
departmentChartPO.setFisvitual(rs.getString("isvitual"));
// 部门负责人
departmentChartPO.setFleader(getDepartmentLeader(fLeader));
dataList.add(departmentChartPO);
}
if (showJob) {
// 查询部门下的岗位
sql = "select a.id,a.jobtitlename as name from hrmjobtitles a inner join jcl_org_job b on a.id = b.ec_jobtitle where b.ec_department = '" + departmentId + "'";
rs.executeQuery(sql);
while (rs.next()) {
ChartPO chartPO = new ChartPO();
chartPO.setFtype("3");
chartPO.setFobjid(rs.getString("id"));
chartPO.setId(departmentId + "_" + chartPO.getFobjid());
chartPO.setFname(rs.getString("name"));
// 岗位处理后的ID
chartPO.setParentId(rootId);
chartPO.setExpand("1");
chartPO.setHasChildren("1");
jobTitleList.add(chartPO);
}
if ("0".equals(dimension)) {
sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? and a.jobtitle = ?";
} else {
sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? and a.jobtitle = ?";
}
// 遍历岗位、查询对应岗位下的人员
for (ChartPO jobTitlePO : jobTitleList) {
resourceNum = 0;
rs.executeQuery(sql, departmentId, jobTitlePO.getFobjid());
while (rs.next()) {
String jobTitle = Util.null2String(rs.getString("jobtitle"));
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("0");
chartPO.setHasChildren("0");
chartPO.setBelongto(Util.null2String(rs.getString("belongto")));
chartPO.setCompanyWorkYear(rs.getString("companyworkyear"));
try {
chartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(chartPO.getId()));
} catch (Exception e) {
throw new RuntimeException(e);
}
resourceNum++;
dataList.add(chartPO);
}
jobTitlePO.setFonjob(resourceNum);
departmentOnJob += resourceNum;
dataList.add(jobTitlePO);
}
departmentChartPO.setHasChildren(CollectionUtils.isNotEmpty(jobTitleList) ? "1" : "0");
}else {
// 直接查询岗位下的人员
sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? ";
rs.executeQuery(sql, departmentId);
while (rs.next()) {
ChartPO chartPO = new ChartPO();
chartPO.setFtype("4");
chartPO.setFobjid(rs.getString("id"));
chartPO.setId(chartPO.getFobjid());
chartPO.setFname(rs.getString("name"));
// 岗位处理后的ID
chartPO.setParentId(rootId);
chartPO.setExpand("0");
chartPO.setHasChildren("0");
chartPO.setBelongto(Util.null2String(rs.getString("belongto")));
chartPO.setCompanyWorkYear(rs.getString("companyworkyear"));
try {
chartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(chartPO.getId()));
} catch (Exception e) {
throw new RuntimeException(e);
}
dataList.add(chartPO);
departmentOnJob++;
}
}
departmentChartPO.setFonjob(departmentOnJob);
Map<String, Object> result = new HashMap<>();
result.put("api_status", true);
result.put("data", dataList);
return result;
}
2 years ago
@Override
public String selectVersionDate(String id) {
RecordSet rs = new RecordSet();
rs.executeQuery("select recorddate from jcl_org_chartversion where id = ?",id);
rs.next();
return rs.getString("recorddate");
}
/**
* sql
* @param root
* @param dimension ID
2 years ago
* @param vesionId
2 years ago
* @return
*/
2 years ago
private String getLastTimeTopSql(String root, String dimension, String vesionId) {
2 years ago
if ("0".equals(root)) {
2 years ago
//查询集团维度历史版本
if ("0".equals(dimension)) {
//组织维度
return "select id,companyname as name,'0' as type from hrmcompany";
} else {
//查询其他维度集团版本信息
return "select id,companyname as name,'0' as type from jcl_chart_companyvirtual where " +
" versionid = "+vesionId+" and companyvirtualid = "+dimension;
}
}else {
return "select id,subcompanyname as name,'1' as type from jcl_chart_subcompanyvirtual where " +
" versionid= "+vesionId+" and subcompanyvirtualid"+root;
2 years ago
}
}
/**
* ,SQL
*
* @param root ID
* @param dimension ID
* @return SQL
*/
private String getRealTimeTopSql(String root, String dimension) {
if ("0".equals(root)) {
// 查询集团数据
if ("0".equals(dimension)) {
// 查询实际集团表
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE;
} else {
// 查询其他维度集团信息
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE + " where id = '" + dimension + "'";
}
} else {
if (hasVirtualFields) {
if (showVirtual) {
return "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where a.id = '" + root + "'";
} else {
return "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where a.id = '" + root + "' and (b.fblx is null or b.fblx!='1')";
}
} else {
return "select id,subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " where id = '" + root + "'";
}
}
}
/**
* ,
*
* @param topChartPO
* @param dataList
* @param selectDepth
*/
private void findChildData(ChartPO topChartPO, List<ChartPO> dataList,Integer selectDepth) {
String fType = topChartPO.getFtype();
String fObjId = topChartPO.getFobjid();
String sql = "";
if (StringUtils.isNotBlank(fType)) {
switch (fType) {
case "0":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '" + fObjId + "'";
} else {
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and (b.fblx is null or b.fblx != '1') and a.companyid = '" + fObjId + "'";
}
} else {
sql = "select a.id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '" + fObjId + "'";
}
break;
case "1":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and a.supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
} else {
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'";
}
} else {
sql = "select a.id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
}
break;
case "2":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'";
} else {
sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'";
}
} else {
sql = "select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
}
break;
default:
break;
}
}
if (StringUtils.isNotBlank(sql)) {
List<ChartPO> currentList = new ArrayList<>();
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql);
while (recordSet.next()) {
ChartPO chartPO = new ChartPO();
chartPO.setFtype(recordSet.getString("type"));
chartPO.setFobjid(recordSet.getString("id"));
chartPO.setFname(recordSet.getString("name"));
chartPO.setParentId(topChartPO.getId());
chartPO.setFisvitual(recordSet.getString("isvitual"));
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());
chartPO.setDepartmentDepth(getDepartmentDepth(chartPO, topChartPO));
// 小于、等于所选层级元素展开
chartPO.setExpand(inDepth(selectDepth,chartPO.getDepartmentDepth()) ? "1" : "0");
currentList.add(chartPO);
}
for (ChartPO chartPO : currentList) {
if (inDepth(selectDepth, chartPO.getDepartmentDepth())) {
findChildData(chartPO, dataList, selectDepth);
}
}
dataList.addAll(currentList);
}
}
/**
*
*
* @param fClass
*/
public void initTableNameByClass(String fClass) {
if (StringUtils.isBlank(fClass) || "0".equals(fClass)) {
COMPANY_TABLE = "hrmcompany";
SUB_COMPANY_TABLE = "hrmsubcompany";
SUB_COMPANY_DEFINED_TABLE = "hrmsubcompanydefined";
DEPARTMENT_TABLE = "hrmdepartment";
DEPARTMENT_DEFINED_TABLE = "hrmdepartmentdefined";
RecordSet rs = new RecordSet();
rs.executeQuery("select count(1) as num from hrm_formfield where (GROUPID =6 and FIELDNAME = 'fblx') or (GROUPID =7 and FIELDNAME = 'bmlx')");
if (rs.next()) {
String num = rs.getString("num");
hasVirtualFields = "2".equals(num);
} else {
hasVirtualFields = false;
}
} else {
COMPANY_TABLE = "hrmcompanyvirtual";
SUB_COMPANY_TABLE = "hrmsubcompanyvirtual";
DEPARTMENT_TABLE = "hrmdepartmentvirtual";
// 其他维度,无虚拟组织
hasVirtualFields = false;
}
}
/**
*
*
* @param fType
* @param fObjId ID
* @return boolean true,false
*/
private Boolean getHasChildren(String fType, String fObjId) {
String sql = "";
if (StringUtils.isNotBlank(fType)) {
switch (fType) {
case "0":
sql = "select id from " + SUB_COMPANY_TABLE + " where (supsubcomid is null or supsubcomid = '0') and companyid = '" + fObjId + "'";
break;
case "1":
if (hasVirtualFields && !showVirtual) {
sql = "select a.id from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "' union select a.id from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'";
} else {
sql = "select id from " + SUB_COMPANY_TABLE + " where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "' union select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
}
break;
case "2":
if (hasVirtualFields && !showVirtual) {
sql = "select a.id from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'";
} else {
sql = "select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
}
break;
default:
break;
}
}
if (StringUtils.isNotBlank(sql)) {
RecordSet rs = new RecordSet();
rs.executeQuery(sql);
return rs.next();
}
return false;
}
/**
*
*
* @param ids ID
* @return
*/
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, ",");
}
/**
*
*
* @param selectDepth
* @param currentDepth
*/
private boolean inDepth(Integer selectDepth, Integer currentDepth) {
if (selectDepth == 1) {
return true;
}
return currentDepth < selectDepth + 1;
}
/**
*
*
* @param chartPO
* @param parentChart
*/
private Integer getDepartmentDepth(ChartPO chartPO, ChartPO parentChart) {
if ("2".equals(chartPO.getFtype())) {
if ("1".equals(parentChart.getFtype())) {
return 2;
}
return parentChart.getDepartmentDepth() + 1;
}
return 0;
}
}