上海中远重工组织架构图版本问题处理

上海中远重工组织架构图
Chengliang 9 months ago
parent 950f0bcac8
commit 48621c51e3

@ -24,4 +24,8 @@ public class ModeHrmResourceParam {
private String wbValue;
private String versionId;
}

@ -381,6 +381,8 @@ public class ChartServiceImpl extends Service implements ChartService {
String rootId = Util.null2String(params.get("rootId"));
String nbValue = Util.null2String(params.get("nbValue"));
String wbValue = Util.null2String(params.get("wbValue"));
String versionId = Util.null2String(params.get("versionId"));
@ -390,6 +392,7 @@ public class ChartServiceImpl extends Service implements ChartService {
.nbValue(nbValue)
.wbValue(wbValue)
.departmentId(departmentId)
.versionId(versionId)
.build();
String detauleType = Util.null2String(params.get("detailType"));
@ -397,8 +400,12 @@ public class ChartServiceImpl extends Service implements ChartService {
// 展示列表模块
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class, user).chartResourceList(build);
}else {
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class, user).chartResourceChart(build
);
if ("0".equals(versionId)) {
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class, user).chartResourceChart(build);
}else {
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class, user).chartResourceChartHt(build);
}
}
}
@ -1065,66 +1072,54 @@ public class ChartServiceImpl extends Service implements ChartService {
//当前人员版本存储todo 人员数据存在建模表)
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,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 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<>();
while (rs.next()) {
//正式员工
rs.executeQuery("select a.id,a.gh,a.xm,a.xb,a.bm,a.gw,a.sjhm,a.ygxz,a.zt,b.departmentname,c.subcompanyname,d.gwmc from uf_zsygrzbdd a \n" +
"left join hrmdepartment b on a.bm = b.id\n" +
"left join hrmsubcompany c on b.subcompanyid1 = c.id\n" +
"left join uf_zsyggwbd d on a.gw = d.id");
while(rs.next()) {
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.getString("workyear"));
insertList.add(rs.getString("usekind"));
insertList.add(rs.getString("managerstr"));
insertList.add(StringUtils.isBlank(rs.getString("status")) ? null : rs.getInt("status"));
insertList.add(rs.getString("sex"));
insertList.add(StringUtils.isBlank(rs.getString("accounttype")) ? null : rs.getInt("accounttype"));
insertList.add(StringUtils.isBlank(rs.getString("belongto")) ? null : rs.getInt("belongto"));
insertList.add(rs.getString("loginid"));
insertList.add(rs.getString("maritalstatus"));
insertList.add(rs.getString("telephone"));
insertList.add(rs.getString("mobile"));
insertList.add(rs.getString("mobilecall"));
insertList.add(rs.getString("email"));
insertList.add(rs.getString("locationname"));
insertList.add(rs.getString("resourcetype"));
insertList.add(rs.getString("startdate"));
insertList.add(rs.getString("enddate"));
insertList.add(StringUtils.isBlank(rs.getString("jobtitleid")) ? null : rs.getInt("jobtitleid"));
insertList.add(rs.getString("jobtitle"));
insertList.add(StringUtils.isBlank(rs.getString("joblevel")) ? null : rs.getInt("joblevel"));
insertList.add(StringUtils.isBlank(rs.getString("seclevel")) ? null : rs.getInt("seclevel"));
insertList.add(StringUtils.isBlank(rs.getString("departmentid")) ? null : rs.getInt("departmentid"));
insertList.add(rs.getString("department"));
insertList.add(StringUtils.isBlank(rs.getString("subcompanyid")) ? null : rs.getInt("subcompanyid"));
insertList.add(rs.getString("subcompany"));
insertList.add(rs.getString("costcenter"));
insertList.add(StringUtils.isBlank(rs.getString("manager")) ? null : rs.getInt("manager"));
insertList.add(StringUtils.isBlank(rs.getString("assistant")) ? null : rs.getInt("assistant"));
insertList.add(rs.getString("workcode"));
insertList.add(rs.getString("classification"));
insertList.add(currentDate);
insertList.add(rs.getString("policy"));
insertList.add(rs.getString("degree"));
insertList.add(Util.null2String(rs.getString("gh")));
insertList.add(Util.null2String(rs.getString("xm")));
insertList.add(Util.null2String(rs.getString("xb")));
insertList.add(Util.null2String(rs.getString("subcompanyname")));
insertList.add(Util.getIntValue(rs.getString("bm")));
insertList.add(Util.null2String(rs.getString("departmentname")));
insertList.add(Util.null2String(rs.getString("gwmc")));
insertList.add(Util.null2String(rs.getString("sjhm")));
insertList.add(Util.null2String(rs.getString("ygxz")));
insertList.add(Util.getIntValue(rs.getString("zt")));
insertList.add(StringUtils.isBlank(versionId) ? null : Util.getIntValue(versionId));
insertList.add(rs.getString("lastname"));
insertList.add(StringUtils.isBlank(rs.getString("companyworkyear")) ? null : rs.getString("companyworkyear"));
insertParamList.add(insertList);
}
String insertResourceSql = "insert into jcl_chart_resource(resourceid, creater, workyear, usekind, managerstr," +
"status, sex, accounttype,belongto, loginid, maritalstatus, telephone, mobile, mobilecall, email," +
"locationname, resourcetype, startdate, enddate, jobtitleid, jobtitle, joblevel,seclevel, departmentid," +
"department, subcompanyid, subcompany, costcenter,manager, assistant, workcode, classification, " +
"versiondate, policy, degree,versionid,lastname,companyworkyear) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
//外部员工
rs.executeQuery("select a.id,a.gh,a.xm,a.xb,a.bmbz,a.gw,a.lxfs,a.zt,b.departmentname,c.subcompanyname,d.gwmc from uf_qlwbrydngljmb a\n" +
"left join hrmdepartment b on a.bmbz = b.id\n" +
"left join hrmsubcompany c on b.subcompanyid1 = c.id\n" +
"left join uf_gwmc d on a.gw = d.gwbm");
while(rs.next()) {
insertList = new ArrayList<>();
insertList.add(Util.null2String(rs.getString("gh")));
insertList.add(Util.null2String(rs.getString("xm")));
insertList.add(Util.null2String(rs.getString("xb")));
insertList.add(Util.null2String(rs.getString("subcompanyname")));
insertList.add(Util.getIntValue(rs.getString("bmbz")));
insertList.add(Util.null2String(rs.getString("departmentname")));
insertList.add(Util.null2String(rs.getString("gwmc")));
insertList.add(Util.null2String(rs.getString("lxfs")));
insertList.add(Util.null2String(rs.getString("ygxz")));
insertList.add(Util.getIntValue(rs.getString("zt")));
insertList.add(StringUtils.isBlank(versionId) ? null : Util.getIntValue(versionId));
insertParamList.add(insertList);
}
String insertResourceSql = "insert into jcl_chart_resource(workcode, lastname,sex,subcompany,departmentid,department,jobtitle,mobile,usekind,status,versionid) " +
"values (?,?,?,?,?,?,?,?,?,?,?)";
insertData(recordSetTrans, insertResourceSql, insertParamList);
}
private void virtualDimension(RecordSetTrans recordSetTrans, String versionId, String currentUser, String currentDate, String fclass) {

@ -36,19 +36,69 @@ public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResour
Map<String, Object> dataMap = new HashMap<>(4);
List<ResourceListColumns> resourceListColumns = getTableColumns();
List<Integer> allSupDepartment = getAllSupDepartment(param.getDepartmentId());
List<ResourceChartVO> resourceChartVOS = new ArrayList<>();
if ("0".equals(param.getVersionId())) {
List<ResourceChartPO> resourceChartNb = new ArrayList<>(selectNbPerson(allSupDepartment,param.getNbValue()));
resourceChartVOS.addAll(convertToVO(resourceChartNb,"1"));
List<ResourceChartPO> resourceChartWb = new ArrayList<>(selectWbPerson(allSupDepartment,param.getWbValue()));
resourceChartVOS.addAll(convertToVO(resourceChartWb,"2"));
}else {
//历史版本
List<String> results = new ArrayList<>();
if (StringUtils.isNotEmpty(param.getNbValue())) {
results.addAll(Arrays.asList(param.getNbValue().split(",")));
}
List<ResourceChartPO> resourceChartNb = new ArrayList<>(selectNbPerson(allSupDepartment,param.getNbValue()));
List<ResourceChartVO> resourceChartVOS = convertToVO(resourceChartNb,"1");
List<ResourceChartPO> resourceChartWb = new ArrayList<>(selectWbPerson(allSupDepartment,param.getWbValue()));
resourceChartVOS.addAll(convertToVO(resourceChartWb,"2"));
if (StringUtils.isNotEmpty(param.getWbValue())) {
results.addAll(Arrays.asList(param.getWbValue().split(",")));
}
resourceChartVOS = selectPersonHt(allSupDepartment,results,param.getVersionId());
}
dataMap.put("columns", resourceListColumns);
dataMap.put("dataSource", resourceChartVOS);
return dataMap;
}
/**
*
* @param allSupDepartment
* @param versionId
* @return
*/
private List<ResourceChartVO> selectPersonHt(Collection<Integer> allSupDepartment,List<String> result,String versionId) {
//历史版本
List<ResourceChartVO> resourceChartVOS = new ArrayList<>();
if (CollectionUtil.isEmpty(result)){
return resourceChartVOS;
}
String workType = result.stream()
.map(s -> "'" + s + "'")
.collect(Collectors.joining(","));
RecordSet rs = new RecordSet();
String join = CollectionUtil.join(allSupDepartment, ",");
rs.executeQuery("select id,workcode,lastname,sex,subcompany,department,jobtitle,mobile,usekind,status,versionid \n" +
"from jcl_chart_resource where status < 4 and versionid = "+versionId+" and departmentid in ("+join+") and usekind in ("+workType+")");
while (rs.next()) {
ResourceChartVO build = ResourceChartVO.builder()
.id((long) Util.getIntValue(rs.getString("id")))
.workCode(Util.null2String(rs.getString("workcode")))
.lastName(Util.null2String(rs.getString("lastname")))
.sex("1".equals(Util.null2String(rs.getString("sex"))) ? "女" : "男")
.subcompanyName(Util.null2String(rs.getString("subcompany")))
.departmentName(Util.null2String(rs.getString("department")))
.jobTitle(Util.null2String(rs.getString("jobtitle")))
.mobile(Util.null2String(rs.getString("mobile")))
.build();
resourceChartVOS.add(build);
}
return resourceChartVOS;
}
@Override
public Map<String, Object> chartResourceChart(ModeHrmResourceParam param) {
List<ChartPO> dataList = new ArrayList<>();
@ -168,6 +218,7 @@ public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResour
RecordSet rs = new RecordSet();
String join = CollectionUtil.join(allSupDepartment, ",");
rs.executeQuery("select id,gh,xm,xb,bm,gw,sjhm from uf_zsygrzbdd where zt < 4 and bm in ("+join+") and ygxz in ("+workType+")");
while (rs.next()) {
ResourceChartPO build = ResourceChartPO.builder()
@ -366,4 +417,55 @@ public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResour
return Util.null2String(rs.getString("id"));
}
public Map<String, Object> chartResourceChartHt(ModeHrmResourceParam param) {
List<ChartPO> dataList = new ArrayList<>();
String departmentId = param.getDepartmentId();
RecordSet rs = new RecordSet();
rs.executeQuery("select departmentid,departmentname,fleader from jcl_chart_department where departmentid = ? and versionid = ?",param.getDepartmentId(),param.getVersionId());
//部门
ChartPO departmentChartPO = new ChartPO();
if (rs.next()) {
String fLeader = Util.null2String(rs.getString("fleader"));
departmentChartPO.setFtype("2");
departmentChartPO.setFobjid(departmentId);
departmentChartPO.setExpand("1");
departmentChartPO.setId("d_"+departmentId);
departmentChartPO.setFname(rs.getString("departmentname"));
departmentChartPO.setFleader(fLeader);
try {
departmentChartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(fLeader));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
//人员
List<Integer> allSupDepartment = getAllSupDepartment(param.getDepartmentId());
List<String> results = new ArrayList<>();
if (StringUtils.isNotEmpty(param.getNbValue())) {
results.addAll(Arrays.asList(param.getNbValue().split(",")));
}
if (StringUtils.isNotEmpty(param.getWbValue())) {
results.addAll(Arrays.asList(param.getWbValue().split(",")));
}
List<ResourceChartVO> resourceChartVOS = selectPersonHt(allSupDepartment, results, param.getVersionId());
resourceChartVOS.forEach(item -> {
ChartPO chartPO = getResourceChartPO(item,departmentChartPO.getId());
dataList.add(chartPO);
});
departmentChartPO.setFonjob(resourceChartVOS.size());
dataList.add(departmentChartPO);
Map<String, Object> result = new HashMap<>(4);
result.put("api_status", true);
result.put("data", dataList);
return result;
}
}

Loading…
Cancel
Save