聚才林岗位分权 #36

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

@ -19,12 +19,14 @@ import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.util.OrganizationFormItemUtil; import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.tree.SearchTreeUtil; import com.engine.organization.util.tree.SearchTreeUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.general.Util; import weaver.general.Util;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author:dxfeng * @author:dxfeng
@ -134,6 +136,9 @@ public class JobBrowserService extends BrowserService {
* @return * @return
*/ */
private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) { private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) {
// 分权
DetachUtil detachUtil = new DetachUtil(user.getUID());
List<Long> jclRoleLevelList = Arrays.asList(detachUtil.getJclRoleLevels().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
List<TreeNode> treeNodes = new ArrayList<>(); List<TreeNode> treeNodes = new ArrayList<>();
if (StringUtils.isBlank(params.getId())) { if (StringUtils.isBlank(params.getId())) {
// 集团总部 // 集团总部
@ -142,18 +147,32 @@ public class JobBrowserService extends BrowserService {
treeNodes.add(topGroup); treeNodes.add(topGroup);
} else { } else {
// 分部存在下级的ID // 分部存在下级的ID
List<String> compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs(); List<String> compHasSubs;
if (detachUtil.isDETACH()) {
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList);
} else {
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
}
// 部门存在下级的ID // 部门存在下级的ID
List<String> hasSubDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).hasSubs(); List<String> hasSubDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).hasSubs();
if ("0".equals(params.getId())) { if ("0".equals(params.getId())) {
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listParent(); List<CompPO> compList;
if (detachUtil.isDETACH()) {
compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList);
detachUtil.filterCompanyList(compList);
}else{
compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
}
// 获取顶层分部 // 获取顶层分部
compList.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item)); compList.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
} else if ("1".equals(params.getType())) { } else if ("1".equals(params.getType())) {
// 当前节点下的元素 // 当前节点下的元素
CompPO compBuild = CompPO.builder().parentCompany(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build(); CompPO compBuild = CompPO.builder().parentCompany(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "show_order"); List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "show_order");
if (detachUtil.isDETACH()) {
detachUtil.filterCompanyList(compList);
}
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order"); List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item)); compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));

@ -32,6 +32,8 @@ public interface CompMapper {
List<String> hasSubs(); List<String> hasSubs();
List<String> hasDetachSubs(@Param("companyIds") Collection<Long> companyIds);
/** /**
* *
* *

@ -442,6 +442,25 @@
#{uuid} #{uuid}
</foreach> </foreach>
</select> </select>
<select id="hasDetachSubs" resultType="java.lang.String">
select parent_company
from jcl_org_comp
where forbidden_tag = 0
and delete_type = 0
and id in
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
union
select parent_comp
from jcl_org_dept
where forbidden_tag = 0
and delete_type = 0
and parent_comp in
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO"> <update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
update jcl_org_comp update jcl_org_comp

Loading…
Cancel
Save