部门、岗位接口开发;代码合并

pull/27/MERGE^2
dxfeng 3 years ago
commit 33f5ec9458

@ -9,7 +9,6 @@ import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.employee.EmployeeMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import weaver.general.StringUtil;
import java.util.*;
import java.util.stream.Collectors;
@ -27,19 +26,8 @@ public class DepartmentBO {
// 递归添加父级数据
Map<Long, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
List<DepartmentListDTO> dtoList = list.stream().map(e -> DepartmentListDTO.builder()
.id(e.getId())
.deptNo(e.getDeptNo())
.deptName(e.getDeptName())
.deptNameShort(e.getDeptNameShort())
.parentComp(e.getParentComp() + "")// 命名
.parentDept(e.getParentDept())
.parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName())
.deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
.showOrder(e.getShowOrder())
.forbiddenTag(e.getForbiddenTag())
.build()
).collect(Collectors.toList());
List<DepartmentListDTO> dtoList = list.stream().map(e -> DepartmentListDTO.builder().id(e.getId()).deptNo(e.getDeptNo()).deptName(e.getDeptName()).deptNameShort(e.getDeptNameShort()).parentComp(e.getParentComp() + "")// 命名
.parentDept(e.getParentDept()).parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName()).deptPrincipal(getEmployeeNameById(e.getDeptPrincipal())).showOrder(e.getShowOrder()).forbiddenTag(e.getForbiddenTag()).build()).collect(Collectors.toList());
Map<Long, List<DepartmentListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentDept() && 0 != item.getParentDept()).collect(Collectors.groupingBy(DepartmentListDTO::getParentDept));
return dtoList.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).collect(Collectors.toList());
}
@ -56,19 +44,8 @@ public class DepartmentBO {
dealParentData(addedList, po, poMaps);
}
List<DepartmentListDTO> dtoList = addedList.stream().map(e -> DepartmentListDTO.builder()
.id(e.getId())
.deptNo(e.getDeptNo())
.deptName(e.getDeptName())
.deptNameShort(e.getDeptNameShort())
.parentComp(e.getParentComp() + "")// 命名
.parentDept(e.getParentDept())
.parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName())
.deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
.showOrder(e.getShowOrder())
.forbiddenTag(e.getForbiddenTag())
.build()
).collect(Collectors.toList());
List<DepartmentListDTO> dtoList = addedList.stream().map(e -> DepartmentListDTO.builder().id(e.getId()).deptNo(e.getDeptNo()).deptName(e.getDeptName()).deptNameShort(e.getDeptNameShort()).parentComp(e.getParentComp() + "")// 命名
.parentDept(e.getParentDept()).parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName()).deptPrincipal(getEmployeeNameById(e.getDeptPrincipal())).showOrder(e.getShowOrder()).forbiddenTag(e.getForbiddenTag()).build()).collect(Collectors.toList());
Map<Long, List<DepartmentListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentDept() && 0 != item.getParentDept()).collect(Collectors.groupingBy(DepartmentListDTO::getParentDept));
return dtoList.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).collect(Collectors.toList());
}
@ -77,38 +54,23 @@ public class DepartmentBO {
if (null == param) {
return null;
}
return DepartmentPO.builder()
.id(param.getId() == null ? 0 : param.getId())
.deptNo(param.getDeptNo())
.deptName(param.getDeptName())
.deptNameShort(param.getDeptNameShort())
.parentComp(param.getParentComp())
.parentDept(param.getParentDept())
.deptPrincipal(param.getDeptPrincipal())
.showOrder(param.getShowOrder())
.forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1)
.description(param.getDescription())
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())
.creator(employeeId).build();
return DepartmentPO.builder().id(param.getId() == null ? 0 : param.getId()).deptNo(param.getDeptNo()).deptName(param.getDeptName()).deptNameShort(param.getDeptNameShort()).parentComp(param.getParentComp()).parentDept(param.getParentDept()).deptPrincipal(param.getDeptPrincipal()).showOrder(param.getShowOrder()).forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1).description(param.getDescription()).deleteType(0).createTime(new Date()).updateTime(new Date()).creator(employeeId).build();
}
public static List<SingleDeptTreeVO> buildSingleDeptTreeVOS(List<DepartmentPO> departmentPOs) {
public static List<SingleDeptTreeVO> buildSingleDeptTreeVOS(List<DepartmentPO> departmentPOs, Long parentComp) {
if (CollectionUtils.isEmpty(departmentPOs)) {
return Collections.emptyList();
}
return departmentPOs.stream().map(e -> SingleDeptTreeVO.builder()
.id(e.getId())
.deptName(e.getDeptName())
.parentDeptName(null == e.getParentDept() ? null : getDeptNameById(e.getParentDept().intValue()))
.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
.children(recursiveData(e.getId()))
.build()
).filter(item -> StringUtil.isEmpty(item.getParentDeptName())).collect(Collectors.toList());
List<SingleDeptTreeVO> singleDeptTreeVOS = departmentPOs.stream().map(e -> SingleDeptTreeVO.builder().id(e.getId()).deptName(e.getDeptName()).parentComp(e.getParentComp()).parentDept(e.getParentDept()).parentDeptName(e.getParentDept() == null ? "" : getDeptNameById(e.getParentDept().intValue())).deptPrincipalName(getEmployeeNameById((long) e.getDeptPrincipal())).build()).collect(Collectors.toList());
//获取非一级部门
Map<Long, List<SingleDeptTreeVO>> collects = singleDeptTreeVOS.stream().filter(item -> !parentComp.equals(item.getParentComp()) && null != item.getParentDept()).collect(Collectors.groupingBy(SingleDeptTreeVO::getParentDept));
return singleDeptTreeVOS.stream().map(e -> {
e.setChildren(collects.get(e.getId()));
return e;
}).filter(item -> parentComp.equals(item.getParentComp())).collect(Collectors.toList());
}
public static List<SearchTree> buildListToSearchTree(List<DepartmentPO> departmentPOS) {
@ -173,27 +135,5 @@ public class DepartmentBO {
}
}
/**
*
*
* @param parentDeptId
* @return
*/
public static List<SingleDeptTreeVO> recursiveData(long parentDeptId) {
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptListByPId(parentDeptId);
if (CollectionUtils.isEmpty(departmentPOS)) {
return Collections.emptyList();
}
return departmentPOS.stream().map(e -> SingleDeptTreeVO.builder()
.id(e.getId())
.deptName(e.getDeptName())
.parentDeptName(getDeptNameById(e.getParentDept().intValue()))
.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
.children(recursiveData(e.getId()))
.build()
).collect(Collectors.toList());
}
}

@ -18,6 +18,6 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class QuerySingleDeptListParam extends BaseQueryParam {
private int parentComp;
private Long parentComp;
}

@ -29,6 +29,10 @@ public class SingleDeptTreeVO {
@TableTitle(title = "部门名称", dataIndex = "deptName", key = "deptName")
private String deptName;
private Long parentComp; //上级分部
private Long parentDept; //上级部门id
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName")
private String parentDeptName; //上级部门

@ -15,7 +15,7 @@ import java.util.Map;
**/
public interface DepartmentMapper {
List<DepartmentPO> getDeptListByCompId(@Param("parentComp") int parentComp);
List<DepartmentPO> getDeptListByCompId();
List<DepartmentPO> getDeptListByPId(@Param("PId") Long PId);

@ -35,10 +35,9 @@
</sql>
<select id="getDeptListByCompId" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select t.id, t.dept_name, t.parent_dept, t.dept_principal
select t.id, t.dept_name, t.parent_dept, t.dept_principal,t.parent_dept,t.parent_comp
from jcl_org_dept t
where delete_type = 0
and parent_comp = #{parentComp}
</select>
<select id="getDeptListByPId" resultType="com.engine.organization.entity.department.po.DepartmentPO">

@ -80,10 +80,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
//1.查询分部下所有部门
PageUtil.start(param.getCurrent(), param.getPageSize());
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptListByCompId(param.getParentComp());
//PageUtil.start(param.getCurrent(), param.getPageSize());
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptListByCompId();
PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS);
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS,param.getParentComp());
PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS, SingleDeptTreeVO.class);
pageInfos.setTotal(pageInfo.getTotal());
pageInfos.setPageNum(param.getCurrent());

@ -2,6 +2,8 @@ package com.engine.organization.service.impl;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom;
import com.cloudstore.eccom.pc.table.WeaTablePopedom;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
@ -42,6 +44,10 @@ public class SchemeServiceImpl extends Service implements SchemeService {
String sqlWhere = buildSqlWhere(params);
table.setSqlwhere(sqlWhere);
WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
checkboxpopedom.setShowmethod("com.engine.organization.util.ConfigTrans.getCheckBoxPopedom");
checkboxpopedom.setPopedompara("column:forbidden_tag");
table.setCheckboxpopedom(checkboxpopedom);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();

@ -0,0 +1,17 @@
package com.engine.organization.util;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/5/27
* @Version V1.0
**/
public class ConfigTrans {
public static String getCheckBoxPopedom(String status) {
if ("0".equals(status))
return "true";
else
return "false";
}
}
Loading…
Cancel
Save