组织架构图搜索BUG修复
This commit is contained in:
parent
ab61cde4a7
commit
1a47555a80
|
|
@ -21,7 +21,7 @@
|
|||
Set<Long> jobSet = new HashSet<>();
|
||||
Set<Long> departmentSet = new HashSet<>();
|
||||
Set<Long> companySet = new HashSet<>();
|
||||
rs.executeQuery("select id, parent_job from jcl_org_job where id not in( select ifnull(parent_job, '') from jcl_org_job where delete_type =0) and delete_type =0");
|
||||
rs.executeQuery("select id, parent_job from jcl_org_job where id not in( select ifnull(parent_job, '') from jcl_org_job where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
|
||||
while (rs.next()) {
|
||||
Long jobId = Long.parseLong(Util.null2String(rs.getString("id")));
|
||||
JobPO jobPO = MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId);
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
}
|
||||
}
|
||||
// 刷新部门
|
||||
rs.executeQuery("select id, parent_dept from jcl_org_dept where id not in( select ifnull(parent_dept , '') from jcl_org_dept where delete_type =0) and delete_type =0");
|
||||
rs.executeQuery("select id, parent_dept from jcl_org_dept where id not in( select ifnull(parent_dept , '') from jcl_org_dept where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
|
||||
while (rs.next()) {
|
||||
Long departmentId = Long.parseLong(Util.null2String(rs.getString("id")));
|
||||
DepartmentPO deptById = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
}
|
||||
|
||||
// 刷新分部
|
||||
rs.executeQuery("select id, parent_company from jcl_org_comp where id not in( select ifnull(parent_company , '') from jcl_org_comp where delete_type =0) and delete_type =0");
|
||||
rs.executeQuery("select id, parent_company from jcl_org_comp where id not in( select ifnull(parent_company , '') from jcl_org_comp where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
|
||||
while (rs.next()) {
|
||||
Long companyId = Long.parseLong(Util.null2String(rs.getString("id")));
|
||||
CompPO compPO = MapperProxyFactory.getProxy(CompMapper.class).listById(companyId);
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ public class JobBO {
|
|||
SearchTree tree = new SearchTree();
|
||||
tree.setCanClick(true);
|
||||
tree.setCanceled(false);
|
||||
tree.setIcon("icon-coms-Branch");
|
||||
tree.setIcon("icon-coms-content-o");
|
||||
tree.setId(item.getId().toString());
|
||||
tree.setIsParent(false);
|
||||
tree.setIsVirtual("0");
|
||||
|
|
|
|||
|
|
@ -3,10 +3,8 @@ package com.engine.organization.service.impl;
|
|||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.scheme.po.GradePO;
|
||||
import com.engine.organization.entity.scheme.po.LevelPO;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.scheme.GradeMapper;
|
||||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
import com.engine.organization.service.OrgChartService;
|
||||
|
|
@ -15,7 +13,6 @@ import com.engine.organization.util.db.DBType;
|
|||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -148,7 +145,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
findCompanyItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, currentLevel + 1 <= Integer.parseInt(level));
|
||||
|
||||
// 分部数据,构建层级关系
|
||||
reBuildTreeList(list);
|
||||
reBuildTreeList(list, root);
|
||||
|
||||
result.put("api_status", true);
|
||||
result.put("data", list);
|
||||
|
|
@ -275,7 +272,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
findUserItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, currentLevel + 1 <= Integer.parseInt(level));
|
||||
|
||||
// 分部数据,构建层级关系
|
||||
reBuildTreeList(list);
|
||||
reBuildTreeList(list, root);
|
||||
|
||||
result.put("api_status", true);
|
||||
result.put("data", list);
|
||||
|
|
@ -460,31 +457,15 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
|
||||
|
||||
private void reBuildTreeList(List<Map<String, Object>> list) {
|
||||
private void reBuildTreeList(List<Map<String, Object>> list, String root) {
|
||||
// 分部数据,构建层级关系
|
||||
Set<String> idSet = list.stream().filter(item -> "1".equals(Util.null2String(item.get("ftype")))).map(item -> Util.null2String(item.get("id"))).collect(Collectors.toSet());
|
||||
list.forEach(item -> {
|
||||
if ("1".equals(Util.null2String(item.get("ftype"))) && !idSet.contains(Util.null2String(item.get("parentId")))) {
|
||||
item.put("parentId", "0");
|
||||
item.put("fobjparentId", "0");
|
||||
if (!root.equals(Util.null2String(item.get("id"))) && "1".equals(Util.null2String(item.get("ftype"))) && !idSet.contains(Util.null2String(item.get("parentId")))) {
|
||||
item.put("parentId", root);
|
||||
item.put("fobjparentId", root);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String convertJobNameById(String jobId) {
|
||||
String jobName = "";
|
||||
if (StringUtils.isNotBlank(jobId)) {
|
||||
try {
|
||||
Long id = Long.parseLong(jobId);
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(id);
|
||||
if (null != jobById) {
|
||||
jobName = jobById.getJobName();
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
new BaseBean().writeLog("组织架构图,岗位转换异常", e);
|
||||
}
|
||||
}
|
||||
return jobName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue