feature/dxf #178

Merged
dxfeng merged 3 commits from feature/dxf into develop 2 years ago

@ -28,7 +28,17 @@ public class ChartPO {
private String fisvitual;
private String hasChildren;
// 在岗数
private Integer fonjob;
// 部门负责人
private String fleader;
// 人员主次账号
private String belongto;
private String id;
private String key;
public String getId() {
if (StringUtils.isNotBlank(ftype)) {
@ -50,6 +60,14 @@ public class ChartPO {
}
public String getFisvitual() {
// 人员、岗位不展示次字段
if (StringUtils.isNotBlank(ftype) && ("3".equals(ftype) || "4".equals(ftype))) {
return null;
}
return StringUtils.isBlank(fisvitual) ? "0" : fisvitual;
}
public String getKey() {
return getId();
}
}

@ -26,11 +26,11 @@ public class ResourceChartPO {
private String sex;
private Integer departmentId;
private String departmentId;
private Integer subcompanyid1;
private String subcompanyid1;
private Integer jobTitle;
private String jobTitle;
private Integer status;

@ -444,8 +444,22 @@
</select>
<select id="selectByDepartmentId" resultType="com.engine.organization.entity.hrmresource.po.ResourceChartPO">
select id,workcode,lastname,sex,departmentid,subcompanyid1,jobtitle,status,mobile
from hrmresource where departmentid = #{departmentId} and status &lt; 4
select a.id,
a.workcode,
a.lastname,
case when (sex is null or sex = '0') then '男' else '女' End as 'sex',
c.departmentmark as departmentid,
b.subcompanyname as subcompanyid1,
d.jobtitlename as jobtitle,
a.status,
a.mobile
from hrmresource a
left join hrmsubcompany b on a.subcompanyid1 = b.id
left join hrmdepartment c on a.departmentid = c.id
left join hrmjobtitles d on a.jobtitle = d.id
where a.departmentid = #{departmentId}
and a.status &lt; 4
order by a.id
</select>
</mapper>

@ -3,9 +3,11 @@ 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;
@ -186,14 +188,15 @@ public class ChartServiceImpl extends Service implements ChartService {
List<ChartPO> dataList = new ArrayList<>();
List<ChartPO> resourceList = new ArrayList<>();
Set<String> jobTitleSet = new HashSet<>();
int departmentOnJob = 0;
RecordSet rs = new RecordSet();
// TODO 查询当前实际的数据
String sql;
// 查询当当前部门下的人员
if ("0".equals(dimension)) {
sql = "select a.id,a.lastname as 'name' ,a.jobtitle from hrmresource a where a.departmentid = '" + departmentId + "'";
sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto from hrmresource a where a.departmentid = '" + departmentId + "'";
} else {
sql = "select a.id,a.lastname as 'name' ,a.jobtitle from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where b.departmentid = '" + departmentId + "'";
sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where b.departmentid = '" + departmentId + "'";
}
rs.executeQuery(sql);
while (rs.next()){
@ -201,11 +204,13 @@ public class ChartServiceImpl extends Service implements ChartService {
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("1");
chartPO.setExpand("0");
chartPO.setHasChildren("0");
chartPO.setBelongto(Util.null2String(rs.getString("belongto")));
resourceList.add(chartPO);
jobTitleSet.add(jobTitle);
@ -231,13 +236,16 @@ public class ChartServiceImpl extends Service implements ChartService {
List<ChartPO> chartPOS = resourceMap.get(chartPO.getId());
if (CollectionUtils.isNotEmpty(chartPOS)) {
dataList.addAll(chartPOS);
chartPO.setFonjob(chartPOS.size());
departmentOnJob += chartPO.getFonjob();
}
}
}
// 查询部门本身
sql = "select a.id,a.departmentname as 'name' from " + DEPARTMENT_TABLE + " a where id = '" + departmentId + "'";
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);
if(rs.next()){
String fLeader = Util.null2String(rs.getString("bmfzr"));
ChartPO chartPO = new ChartPO();
chartPO.setFtype("2");
chartPO.setFobjid(departmentId);
@ -246,6 +254,10 @@ public class ChartServiceImpl extends Service implements ChartService {
// 岗位处理后的ID
chartPO.setExpand("1");
chartPO.setHasChildren(CollectionUtils.isNotEmpty(dataList) ? "1" : "0");
chartPO.setFonjob(departmentOnJob);
// 部门负责人
chartPO.setFleader(getDepartmentLeader(fLeader));
dataList.add(chartPO);
}
@ -440,4 +452,19 @@ public class ChartServiceImpl extends Service implements ChartService {
}
return false;
}
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, ",");
}
}

@ -438,7 +438,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
list.add(ResourceListColumns.builder().title("姓名").dataIndex("lastName").key("lastName").build());
list.add(ResourceListColumns.builder().title("性别").dataIndex("sex").key("sex").build());
list.add(ResourceListColumns.builder().title("部门").dataIndex("departmentId").key("departmentId").build());
list.add(ResourceListColumns.builder().title("分部").dataIndex("subcompamyid1").key("subcompamyid1").build());
list.add(ResourceListColumns.builder().title("分部").dataIndex("subcompanyid1").key("subcompanyid1").build());
list.add(ResourceListColumns.builder().title("岗位").dataIndex("jobTitle").key("jobTitle").build());
//list.add(ResourceListColumns.builder().title("状态").dataIndex("status").key("status").build());
list.add(ResourceListColumns.builder().title("手机号").dataIndex("mobile").key("mobile").build());

Loading…
Cancel
Save