Merge pull request 'feature/dxf' (#194) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/194
This commit is contained in:
commit
024d2a1591
|
|
@ -4,7 +4,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -24,9 +23,7 @@ public class CompanyTreePO {
|
|||
private String key;
|
||||
|
||||
public boolean getIsLeaf() {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from hrmsubcompany where (canceled is null or canceled != '1') and supsubcomid = ?",id);
|
||||
return !rs.next();
|
||||
return isLeaf;
|
||||
}
|
||||
|
||||
public String getpId() {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ 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.entity.chart.history.DepartmentHistory;
|
||||
import com.engine.organization.entity.chart.history.SubcompanyHistory;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.service.ChartService;
|
||||
|
|
@ -17,7 +15,6 @@ import org.apache.commons.collections.CollectionUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
|
@ -238,9 +235,9 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
}
|
||||
} else {
|
||||
if (hasVirtualFields) {
|
||||
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,fleader as bmfzr,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where a.id = '" + departmentId + "' and versionid = " + versionId;
|
||||
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,fleader as bmfzr,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where a." + DEPARTMENT_ID + " = '" + departmentId + "' and versionid = " + versionId;
|
||||
} else {
|
||||
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name from " + DEPARTMENT_TABLE + " a where a.id = '" + departmentId + "' and versionid = " + versionId;
|
||||
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name from " + DEPARTMENT_TABLE + " a where a." + DEPARTMENT_ID + " = '" + departmentId + "' and versionid = " + versionId;
|
||||
}
|
||||
}
|
||||
rs.executeQuery(sql);
|
||||
|
|
@ -386,7 +383,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
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 " +
|
||||
return "select companyvirtualid as id,companyname as name,'0' as type from " + COMPANY_TABLE + " where " +
|
||||
" versionid = " + versionId + " and companyvirtualid = " + dimension;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -560,16 +557,16 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
insertData(insertDeptSql,insertParamList);
|
||||
|
||||
//当前岗位版本存储
|
||||
rs.executeQuery("select a.id as jobid,a.job_name as jobname,a.ec_department as departmentid," +
|
||||
rs.executeQuery("select b.id as jobid,b.JOBTITLENAME as jobname,a.ec_department as departmentid," +
|
||||
"c.departmentname as department,a.ec_company as subcompanyid,d.subcompanyname as subcompany," +
|
||||
"b.jobresponsibility,a.forbidden_tag as canceled,a.job_no as jobcode,a.description " +
|
||||
"from jcl_org_job a left join hrmjobtitles b on a.ec_jobtitle = b.id " +
|
||||
"from jcl_org_job a inner join hrmjobtitles b on a.ec_jobtitle = b.id " +
|
||||
"left join hrmdepartment c on a.ec_department=c.id " +
|
||||
"left join hrmsubcompany d on a.ec_company=d.id");
|
||||
insertParamList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
insertList = new ArrayList<>();
|
||||
insertList.add(rs.getString("jobid"));
|
||||
insertList.add(StringUtils.isBlank(rs.getString("jobid"))?null:rs.getString("jobid"));
|
||||
insertList.add(currentUser);
|
||||
insertList.add(rs.getString("jobname"));
|
||||
insertList.add(rs.getString("departmentid"));
|
||||
|
|
@ -591,13 +588,12 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
//当前人员版本存储
|
||||
rs.executeQuery("select a.id as resourceid,workyear,usekind,managerstr,status,sex,accounttype,belongto," +
|
||||
"loginid,maritalstatus,a.telephone,mobile,mobilecall,email,b.locationname,resourcetype,startdate," +
|
||||
"enddate,c.id as jobtitleid,d.JOBTITLENAME as jobtitle,joblevel,seclevel,departmentid,e.departmentname as department," +
|
||||
"enddate,d.id as jobtitleid,d.JOBTITLENAME as jobtitle,joblevel,seclevel,departmentid,e.departmentname as department," +
|
||||
"a.subcompanyid1 as subcompanyid,f.subcompanyname as subcompany,a.costcenterid as costcenter," +
|
||||
"a.managerid as manager,a.assistantid as assistant,workcode,classification,policy," +
|
||||
"degree,a.lastname,a.companyworkyear from hrmresource a " +
|
||||
"left join hrmlocations b on a.locationid = b.id " +
|
||||
"left join jcl_org_job c on a.jobtitle = c.id " +
|
||||
"left join hrmjobtitles d on c.ec_jobtitle = d.id " +
|
||||
"left join hrmjobtitles d on a.jobtitle = d.id " +
|
||||
"left join hrmdepartment e on a.departmentid = e.id " +
|
||||
"left join hrmsubcompany f on a.subcompanyid1=f.id");
|
||||
insertParamList = new ArrayList<>();
|
||||
|
|
@ -605,7 +601,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
insertList = new ArrayList<>();
|
||||
insertList.add(StringUtils.isBlank(rs.getString("resourceid")) ? null : rs.getInt("resourceid"));
|
||||
insertList.add(currentUser);
|
||||
insertList.add(StringUtils.isBlank(rs.getString("workyear")) ? null : rs.getInt("workyear"));
|
||||
insertList.add(StringUtils.isBlank(rs.getString("workyear")) ? null : rs.getString("workyear"));
|
||||
insertList.add(rs.getString("usekind"));
|
||||
insertList.add(rs.getString("managerstr"));
|
||||
insertList.add(StringUtils.isBlank(rs.getString("status")) ? null : rs.getInt("status"));
|
||||
|
|
@ -710,7 +706,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
insertParamList.add(insertList);
|
||||
}
|
||||
String insertVirtualSubComSql = "insert into jcl_chart_subcompanyvirtual(subcompanyvirtualid, creater, " +
|
||||
"subcompanyname, subcompanycode,subcompanydesc, supsubcompany, supsubcomid, company, companyid," +
|
||||
"subcompanyname, subcompanycode,subcompanydesc, supsubcompany, supsubcompanyid, company, companyid," +
|
||||
"canceled, virtualtype, tlevel, showorder, versiondate,versionid) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
insertData(insertVirtualSubComSql,insertParamList);
|
||||
|
||||
|
|
@ -719,7 +715,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
"b.DEPARTMENTNAME as supdeptment,b.SUPDEPID as supdepid,a.allsupdepid,c.SUBCOMPANYNAME as subcompany," +
|
||||
"a.SUBCOMPANYID1 as subcompanyid,a.canceled,a.virtualtype,a.tlevel,a.showorder from hrmdepartmentvirtual a " +
|
||||
"left join hrmdepartmentvirtual b on a.SUPDEPID = b.id " +
|
||||
"left join hrmsubcompanyvirtual c on a.SUBCOMPANYID1 = c.id where a.companyid = ",fclass);
|
||||
"left join hrmsubcompanyvirtual c on a.SUBCOMPANYID1 = c.id where a.virtualtype = ?",fclass);
|
||||
insertParamList = new ArrayList<>();
|
||||
while (rs.next()){
|
||||
insertList = new ArrayList<>();
|
||||
|
|
@ -757,13 +753,15 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
insertList.add(StringUtils.isBlank(rs.getString("subcompanyid")) ? null : rs.getInt("subcompanyid"));
|
||||
insertList.add(StringUtils.isBlank(rs.getString("departmentid")) ? null : rs.getInt("departmentid"));
|
||||
insertList.add(rs.getString("managerstr"));
|
||||
insertList.add(rs.getString("virtualtype"));
|
||||
//insertList.add(rs.getString("virtualtype"));
|
||||
insertList.add(currentDate);
|
||||
insertList.add(StringUtils.isBlank(versionId) ? null : Util.getIntValue(versionId));
|
||||
insertParamList.add(insertList);
|
||||
}
|
||||
String insertVirtualHrmSql = "insert into jcl_chart_resource(resourceid,MANAGER,subcompanyid," +
|
||||
"departmentid,managerstr,virtualtype,versiondate,versionid) values (?,?,?,?,?,?,?,?)";
|
||||
"departmentid,managerstr," +
|
||||
//"virtualtype," +
|
||||
"versiondate,versionid) values (?,?,?,?,?,?,?)";
|
||||
insertData(insertVirtualHrmSql,insertParamList);
|
||||
}
|
||||
|
||||
|
|
@ -911,7 +909,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
}
|
||||
} else {
|
||||
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
|
||||
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepartmentid is null or supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
|
||||
" union select " + DEPARTMENT_ID + " as 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 subcompanyid = '" + fObjId + "' and versionid = " + versionId;
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
|
|
@ -922,7 +920,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
|
||||
}
|
||||
} else {
|
||||
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
|
||||
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and versionid = " + versionId;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '0'";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).build());
|
||||
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf("select id from hrmsubcompany where (canceled is null or canceled != '1') and supsubcomid = ?", rs.getString("id"))).build());
|
||||
}
|
||||
result.put("api_status", true);
|
||||
result.put("fclasslist", fclasslist);
|
||||
|
|
@ -111,21 +111,21 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
boolean isSearchCurrent = StringUtils.isBlank(id) || "0".equals(id);
|
||||
String sql;
|
||||
if (isSearchCurrent) {
|
||||
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "'";
|
||||
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = ? ";
|
||||
if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) {
|
||||
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "' and companyid = '" + fclass + "'";
|
||||
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = ? and companyid = '" + fclass + "'";
|
||||
}
|
||||
} else {
|
||||
sql = "select id as id, id as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcompanyid", "0") + " = '" + subcompany + "'";
|
||||
sql = "select subcompanyid as id, id as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcompanyid", "0") + " = ? ";
|
||||
if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) {
|
||||
sql = "select id as id, id as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcompanyid", "0") + " = '" + subcompany + "' and companyid = '" + fclass + "'";
|
||||
sql = "select subcompanyvirtualid as id, id as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcompanyid", "0") + " = ? and companyid = '" + fclass + "'";
|
||||
}
|
||||
// 添加时间轴条件
|
||||
sql += " and versionid = " + id;
|
||||
}
|
||||
rs.executeQuery(sql);
|
||||
rs.executeQuery(sql,subcompany);
|
||||
while (rs.next()) {
|
||||
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).build());
|
||||
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf(sql, rs.getString("id"))).build());
|
||||
}
|
||||
result.put("companyTree", companyTree);
|
||||
return result;
|
||||
|
|
@ -701,6 +701,19 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
return fieldname;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断树是否为叶子节点
|
||||
*
|
||||
* @param sql 查询下级元素SQL
|
||||
* @param treeId 当前元素ID
|
||||
* @return
|
||||
*/
|
||||
private boolean judgeTreeLeaf(String sql, String treeId) {
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery(sql, treeId);
|
||||
return !recordSet.next();
|
||||
}
|
||||
|
||||
static class OrgSelectItem {
|
||||
private Integer key;
|
||||
private String id;
|
||||
|
|
|
|||
Loading…
Reference in New Issue