Merge pull request 'feature/dxf' (#191) from feature/dxf into develop

Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/191
This commit is contained in:
dxfeng 2023-07-12 16:14:49 +08:00
commit 7e0553c0d2
1 changed files with 46 additions and 42 deletions

View File

@ -233,7 +233,7 @@ public class ChartServiceImpl extends Service implements ChartService {
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;
} else {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,fleader as bmfzr 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.id = '" + departmentId + "' and versionid = " + versionId;
}
}
rs.executeQuery(sql);
@ -277,38 +277,19 @@ public class ChartServiceImpl extends Service implements ChartService {
// 遍历岗位查询对应岗位下的人员
if (isRealTime) {
if (isRealDimension) {
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 = ?";
sql = "select a.id,a.lastname as name ,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 = ?";
sql = "select a.id,a.lastname as name ,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 = ?";
}
} else {
//if (isRealDimension) {
// 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 = ?";
//}
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 a.jobtitleid = ? and versionid = " + versionId;
}
for (ChartPO jobTitlePO : jobTitleList) {
resourceNum = 0;
rs.executeQuery(sql, departmentId, jobTitlePO.getFobjid());
String parentId = 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);
}
ChartPO chartPO = getResourceChartPO(rs.getString("id"), rs.getString("name"), parentId, rs.getString("belongto"), rs.getString("companyworkyear"));
resourceNum++;
dataList.add(chartPO);
}
@ -319,25 +300,18 @@ public class ChartServiceImpl extends Service implements ChartService {
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 = ? ";
if (isRealTime) {
if (isRealDimension) {
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? ";
} else {
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid 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;
}
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);
}
ChartPO chartPO = getResourceChartPO(rs.getString("id"), rs.getString("name"), rootId, rs.getString("belongto"), rs.getString("companyworkyear"));
dataList.add(chartPO);
departmentOnJob++;
}
@ -359,6 +333,36 @@ public class ChartServiceImpl extends Service implements ChartService {
return rs.getString("recorddate");
}
/**
* 构建人员图谱元素
*
* @param id 人员ID
* @param name 人员名称
* @param parentId 父级ID
* @param belongTo 是否次账号
* @param companyWorkYear 司龄
* @return
*/
private ChartPO getResourceChartPO(String id, String name, String parentId, String belongTo, String companyWorkYear) {
ChartPO chartPO = new ChartPO();
chartPO.setFtype("4");
chartPO.setFobjid(id);
chartPO.setId(chartPO.getFobjid());
chartPO.setFname(name);
// 岗位处理后的ID
chartPO.setParentId(parentId);
chartPO.setExpand("0");
chartPO.setHasChildren("0");
chartPO.setBelongto(Util.null2String(belongTo));
chartPO.setCompanyWorkYear(companyWorkYear);
try {
chartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(chartPO.getId()));
} catch (Exception e) {
throw new RuntimeException(e);
}
return chartPO;
}
/**
* 获取历史顶部元素sql
*