Search in sources :

Example 1 with PmphRoleVO

use of com.bc.pmpheep.back.vo.PmphRoleVO in project pmph by BCSquad.

the class PmphUserServiceImpl method getListPmphUser.

@Override
public PageResult<PmphUserManagerVO> getListPmphUser(PageParameter<PmphUserManagerVO> pageParameter, Long groupId) throws CheckedServiceException {
    String name = pageParameter.getParameter().getName();
    if (StringUtil.notEmpty(name)) {
        pageParameter.getParameter().setName(name);
    }
    String path = pageParameter.getParameter().getPath();
    Long departmentId = pageParameter.getParameter().getDepartmentId();
    if (StringUtil.notEmpty(path) && ObjectUtil.notNull(departmentId)) {
        pageParameter.getParameter().setPath(path + "-" + java.lang.String.valueOf(departmentId) + '-');
    }
    PageResult<PmphUserManagerVO> pageResult = new PageResult<>();
    PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
    int total = pmphUserDao.getListPmphUserTotal(pageParameter);
    if (total > 0) {
        List<PmphUserManagerVO> list = pmphUserDao.getListPmphUser(pageParameter);
        for (PmphUserManagerVO pmphUserManagerVO : list) {
            List<PmphRoleVO> pmphRoles = pmphRoleDao.listPmphUserRoleByUserId(pmphUserManagerVO.getId());
            pmphUserManagerVO.setPmphRoles(pmphRoles);
        }
        pageResult.setRows(list);
    }
    pageResult.setTotal(total);
    // 设置职位
    if (null != pageResult.getRows() && pageResult.getRows().size() > 0 && null != groupId) {
        // 清空职位
        for (PmphUserManagerVO pmphUserManagerVO : pageResult.getRows()) {
            pmphUserManagerVO.setPosition("无");
        }
        PmphGroup pmphGroup = pmphGroupService.getPmphGroupById(groupId);
        Long bookId = pmphGroup.getBookId();
        if (null != bookId && bookId.intValue() > 0) {
            Textbook textbook = textbookService.getTextbookById(bookId);
            Material material = materialService.getMaterialById(textbook.getMaterialId());
            List<MaterialProjectEditorVO> projects = materialProjectEditorService.listMaterialProjectEditors(textbook.getMaterialId());
            for (PmphUserManagerVO pmphUserManagerVO : pageResult.getRows()) {
                Long pmphUserId = pmphUserManagerVO.getId();
                String posotion = null;
                if (material.getDirector().intValue() == pmphUserId.intValue()) {
                    posotion = "主任";
                }
                if (null != projects && projects.size() > 0) {
                    for (MaterialProjectEditorVO item : projects) {
                        if (item.getEditorId().intValue() == pmphUserId.intValue()) {
                            posotion += (posotion == null) ? "项目编辑" : ",项目编辑";
                            break;
                        }
                    }
                }
                if (textbook.getPlanningEditor().intValue() == pmphUserId.intValue()) {
                    posotion += (posotion == null) ? "策划编辑" : ",策划编辑";
                }
                pmphUserManagerVO.setPosition(posotion == null ? "无" : posotion);
            }
        }
    }
    // 设置职位 end
    return pageResult;
}
Also used : Material(com.bc.pmpheep.back.po.Material) PageResult(com.bc.pmpheep.back.plugin.PageResult) MaterialProjectEditorVO(com.bc.pmpheep.back.vo.MaterialProjectEditorVO) PmphGroup(com.bc.pmpheep.back.po.PmphGroup) Textbook(com.bc.pmpheep.back.po.Textbook) PmphUserManagerVO(com.bc.pmpheep.back.vo.PmphUserManagerVO) PmphRoleVO(com.bc.pmpheep.back.vo.PmphRoleVO)

Aggregations

PageResult (com.bc.pmpheep.back.plugin.PageResult)1 Material (com.bc.pmpheep.back.po.Material)1 PmphGroup (com.bc.pmpheep.back.po.PmphGroup)1 Textbook (com.bc.pmpheep.back.po.Textbook)1 MaterialProjectEditorVO (com.bc.pmpheep.back.vo.MaterialProjectEditorVO)1 PmphRoleVO (com.bc.pmpheep.back.vo.PmphRoleVO)1 PmphUserManagerVO (com.bc.pmpheep.back.vo.PmphUserManagerVO)1