组织架构图部门详细列表接口修改 (1.增加人员点击信息跳转,2.修复数据加载效率问题导致图展示不全;3.解除默认不展示岗位功能)

pull/237/head
Chengliang 12 months ago
parent fcb53a4ff0
commit 5da821d653

@ -5,6 +5,7 @@ import com.engine.organization.entity.department.param.DeptSearchParam;
import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.department.vo.SingleDeptTreeVO; import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
import com.engine.organization.entity.searchtree.SearchTree; import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -32,17 +33,21 @@ public class DepartmentBO {
* @return * @return
*/ */
public static List<DepartmentListDTO> buildDeptDTOShowNames(Collection<DepartmentListDTO> list) { public static List<DepartmentListDTO> buildDeptDTOShowNames(Collection<DepartmentListDTO> list) {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
return list.stream().peek(e -> { return list.stream().peek(e -> {
e.setSubCompanyName((null == e.getSubCompanyId1() || 0 == e.getSubCompanyId1()) ? "" : subCompanyComInfo.getSubCompanyname(Util.null2String(e.getSubCompanyId1()))); List<DepartmentListDTO> children = e.getChildren();
e.setSupDepName((null == e.getSupDepId() || 0 == e.getSupDepId()) ? "" : departmentComInfo.getDepartmentname(Util.null2String(e.getSupDepId()))); if (CollectionUtils.isNotEmpty(children)){
List<DepartmentListDTO> collect = children.stream().peek(item -> item.setBmfzr(getEmployeeNameById(item.getId()))).collect(Collectors.toList());
e.setChildren(collect);
}
e.setBmfzr(getEmployeeNameById(e.getId())); e.setBmfzr(getEmployeeNameById(e.getId()));
} }
).collect(Collectors.toList()); ).collect(Collectors.toList());
} }
public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list, String orderType) { public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list, String orderType) {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
// 递归添加父级数据 // 递归添加父级数据
List<DepartmentListDTO> dtoList = list.stream().map(e -> List<DepartmentListDTO> dtoList = list.stream().map(e ->
DepartmentListDTO DepartmentListDTO
@ -53,6 +58,8 @@ public class DepartmentBO {
.departmentCode(e.getDepartmentCode()) .departmentCode(e.getDepartmentCode())
.subCompanyId1(e.getSubCompanyId1()) .subCompanyId1(e.getSubCompanyId1())
.supDepId(e.getSupDepId()) .supDepId(e.getSupDepId())
.subCompanyName((null == e.getSubCompanyId1() || 0 == e.getSubCompanyId1()) ? "" : subCompanyComInfo.getSubCompanyname(Util.null2String(e.getSubCompanyId1())))
.supDepName((null == e.getSupDepId() || 0 == e.getSupDepId()) ? "" : departmentComInfo.getDepartmentname(Util.null2String(e.getSupDepId())))
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder()) .showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
.canceled(null == e.getCanceled() ? 0 : e.getCanceled()) .canceled(null == e.getCanceled() ? 0 : e.getCanceled())
.orderType(orderType) .orderType(orderType)
@ -189,7 +196,7 @@ public class DepartmentBO {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new OrganizationRunTimeException(e);
} }
return StringUtils.join(employeeNameById, ","); return StringUtils.join(employeeNameById, ",");
} }

@ -26,7 +26,7 @@ public interface JclOrgCustomTemplateMapper {
int updateByPrimaryKey(JclOrgCustomTemplatePO record); int updateByPrimaryKey(JclOrgCustomTemplatePO record);
List<JclOrgCustomTemplatePO> listAll(); List<JclOrgCustomTemplatePO> listAllByCreator(@Param("creator") Integer creator);
List<Long> listAllId(); List<Long> listAllId();

@ -28,10 +28,10 @@
from jcl_org_custom_template from jcl_org_custom_template
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="listAll" resultMap="BaseResultMap"> <select id="listAllByCreator" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from jcl_org_custom_template order by id from jcl_org_custom_template where creator = #{creator} order by id
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

@ -28,6 +28,8 @@ import com.engine.organization.util.excel.ExcelUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -104,7 +106,7 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
List<String> headerList = new ArrayList<>(); List<String> headerList = new ArrayList<>();
List<Object> headerNameList = new ArrayList<>(); List<Object> headerNameList = new ArrayList<>();
OrganizationWeaTable<HrmResourceVO> table = new OrganizationWeaTable<>(user, HrmResourceVO.class); OrganizationWeaTable<HrmResourceVO> table = new OrganizationWeaTable<>(user, HrmResourceVO.class);
String sqlWhere = " where 1 = 1 and t.status < 4 and (t.accounttype is null or t.accounttype != 1)"; String sqlWhere = " where 1 = 1 and (t.accounttype is null or t.accounttype != 1)";
// 分权查询 // 分权查询
DetachUtil detachUtil = new DetachUtil(user); DetachUtil detachUtil = new DetachUtil(user);
String parentCompanyIds = detachUtil.getJclRoleLevels(); String parentCompanyIds = detachUtil.getJclRoleLevels();
@ -215,10 +217,11 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
@Override @Override
public XSSFWorkbook departmentExport() { public XSSFWorkbook departmentExport() {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String orderSql = PageInfoSortUtil.getSortSql("", " showorder "); String orderSql = PageInfoSortUtil.getSortSql("", " showorder ");
List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql); List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
new DetachUtil(user).filterDepartmentList(allList); new DetachUtil(user).filterDepartmentList(allList);
Map<Integer, DepartmentPO> poMaps = allList.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
List<DepartmentListDTO> dtoList = allList.stream().map(e -> List<DepartmentListDTO> dtoList = allList.stream().map(e ->
DepartmentListDTO DepartmentListDTO
.builder() .builder()
@ -226,8 +229,10 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
.departmentMark(e.getDepartmentMark()) .departmentMark(e.getDepartmentMark())
.departmentName(e.getDepartmentName()) .departmentName(e.getDepartmentName())
.departmentCode(e.getDepartmentCode()) .departmentCode(e.getDepartmentCode())
.subCompanyName(0 == e.getSubCompanyId1() ? "" : MapperProxyFactory.getProxy(CompMapper.class).listById(e.getSubCompanyId1()).getSubCompanyName()) .subCompanyId1(e.getSubCompanyId1())
.supDepName(null == poMaps.get(e.getSupDepId()) ? "" : poMaps.get(e.getSupDepId()).getDepartmentName()) .supDepId(e.getSupDepId())
.subCompanyName((null == e.getSubCompanyId1() || 0 == e.getSubCompanyId1()) ? "" : subCompanyComInfo.getSubCompanyname(Util.null2String(e.getSubCompanyId1())))
.supDepName((null == e.getSupDepId() || 0 == e.getSupDepId()) ? "" : departmentComInfo.getDepartmentname(Util.null2String(e.getSupDepId())))
.bmfzr(DepartmentBO.getEmployeeNameById(e.getId())) .bmfzr(DepartmentBO.getEmployeeNameById(e.getId()))
.canceled(null == e.getCanceled() ? 0 : e.getCanceled()) .canceled(null == e.getCanceled() ? 0 : e.getCanceled())
.build()).collect(Collectors.toList()); .build()).collect(Collectors.toList());

@ -686,7 +686,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
infoPOList.add(ExtendInfoPO.builder().viewAttr(1).id(null).fieldName("createTime").fieldNameDesc("创建时间").fieldType("date").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(2).isrequired(0).isSystemDefault(0).build()); infoPOList.add(ExtendInfoPO.builder().viewAttr(1).id(null).fieldName("createTime").fieldNameDesc("创建时间").fieldType("date").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(2).isrequired(0).isSystemDefault(0).build());
Map<String, Object> tabInfoMap = new HashMap<>(); Map<String, Object> tabInfoMap = new HashMap<>();
tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, false, true)); tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, false, true));
List<JclOrgCustomTemplatePO> jclOrgCustomTemplatePOS = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).listAll(); List<JclOrgCustomTemplatePO> jclOrgCustomTemplatePOS = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).listAllByCreator(user.getUID());
List<Integer> isUsed = new ArrayList<>(); List<Integer> isUsed = new ArrayList<>();
AtomicInteger index = new AtomicInteger(0); AtomicInteger index = new AtomicInteger(0);
List<Map<String, Object>> collect = jclOrgCustomTemplatePOS.stream().map(item -> { List<Map<String, Object>> collect = jclOrgCustomTemplatePOS.stream().map(item -> {

Loading…
Cancel
Save