Search in sources :

Example 1 with PmphGroupListVO

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

the class PmphGroupServiceImpl method listPmphGroupFile.

@Override
public List<PmphGroupListVO> listPmphGroupFile(PmphGroup pmphGroup, String sessionId) throws CheckedServiceException {
    if (null == pmphGroup) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "参数对象为空");
    }
    // session PmphUser用户验证
    PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
    if (null == pmphUser || null == pmphUser.getId()) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "用户为空");
    }
    List<PmphGroupListVO> list = new ArrayList<>();
    list = pmphGroupDao.getList(pmphGroup, pmphUser.getId());
    for (PmphGroupListVO pmphGroupListVO : list) {
        pmphGroupListVO.setGroupImage(RouteUtil.groupImage(pmphGroupListVO.getGroupImage()));
    }
    return list;
}
Also used : PmphUser(com.bc.pmpheep.back.po.PmphUser) ArrayList(java.util.ArrayList) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) PmphGroupListVO(com.bc.pmpheep.back.vo.PmphGroupListVO)

Example 2 with PmphGroupListVO

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

the class PmphGroupServiceImpl method getlistPmphGroup.

@Override
public PageResult<PmphGroupListVO> getlistPmphGroup(PageParameter<PmphGroupListVO> pageParameter, String sessionId) throws CheckedServiceException {
    if (null == pageParameter) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "参数对象为空");
    }
    // session PmphUser用户验证
    PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
    if (null == pmphUser || null == pmphUser.getId()) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "用户为空");
    }
    List<PmphGroupListVO> list = new ArrayList<>();
    PageResult<PmphGroupListVO> pageResult = new PageResult<>();
    PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
    Integer total = 0;
    if (pmphUser.getIsAdmin()) {
        total = pmphGroupDao.getAdminCount();
        list = pmphGroupDao.getPmphGroupList(pageParameter);
        for (PmphGroupListVO pmphGroupListVO : list) {
            pmphGroupListVO.setGroupImage(RouteUtil.groupImage(pmphGroupListVO.getGroupImage()));
        }
        pageResult.setRows(list);
        pageResult.setTotal(total);
    } else {
        PmphGroup pmphGroup = new PmphGroup();
        List<PmphGroupListVO> groupListVOs = pmphGroupDao.getList(pmphGroup, pmphUser.getId());
        for (PmphGroupListVO pmphGroupListVO : groupListVOs) {
            pmphGroupListVO.setGroupImage(RouteUtil.groupImage(pmphGroupListVO.getGroupImage()));
        }
        if (groupListVOs.size() > 0) {
            pageResult.setRows(groupListVOs);
            pageResult.setTotal(groupListVOs.size());
        }
    }
    return pageResult;
}
Also used : PmphUser(com.bc.pmpheep.back.po.PmphUser) ArrayList(java.util.ArrayList) PmphGroup(com.bc.pmpheep.back.po.PmphGroup) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) PmphGroupListVO(com.bc.pmpheep.back.vo.PmphGroupListVO) PageResult(com.bc.pmpheep.back.plugin.PageResult)

Example 3 with PmphGroupListVO

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

the class PmphGroupServiceImpl method listPmphGroup.

/**
 * @introduction 根据小组名称模糊查询获取当前用户的小组
 * @author Mryang
 * @createDate 2017年9月20日 下午4:45:48
 * @param pmphGroup
 * @return List<PmphGroupListVO>
 * @throws CheckedServiceException
 */
@Override
public List<PmphGroupListVO> listPmphGroup(PmphGroup pmphGroup, String sessionId) throws CheckedServiceException {
    if (null == pmphGroup) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "参数对象为空");
    }
    // session PmphUser用户验证
    PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
    if (null == pmphUser || null == pmphUser.getId()) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "用户为空");
    }
    List<PmphGroupListVO> list = new ArrayList<>();
    if (pmphUser.getIsAdmin()) {
        list = pmphGroupDao.listPmphGroup(pmphGroup.getGroupName());
        for (PmphGroupListVO pmphGroupListVO : list) {
            pmphGroupListVO.setGroupImage(RouteUtil.groupImage(pmphGroupListVO.getGroupImage()));
        }
    } else {
        list = pmphGroupDao.getList(pmphGroup, pmphUser.getId());
        for (PmphGroupListVO pmphGroupListVO : list) {
            pmphGroupListVO.setGroupImage(RouteUtil.groupImage(pmphGroupListVO.getGroupImage()));
        }
    }
    for (PmphGroupListVO pmphGroupListVO : list) {
        PmphGroupMemberVO user = pmphGroupMemberService.getPmphGroupMemberByMemberId(pmphGroupListVO.getId(), pmphUser.getId(), false);
        if (ObjectUtil.isNull(user)) {
            pmphGroupListVO.setIsMember(false);
        } else {
            pmphGroupListVO.setIsMember(true);
        }
    }
    return list;
}
Also used : PmphUser(com.bc.pmpheep.back.po.PmphUser) PmphGroupMemberVO(com.bc.pmpheep.back.vo.PmphGroupMemberVO) ArrayList(java.util.ArrayList) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) PmphGroupListVO(com.bc.pmpheep.back.vo.PmphGroupListVO)

Example 4 with PmphGroupListVO

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

the class PmphGroupMemberServiceImpl method listPmphGroupMember.

@Override
public List<PmphGroupMemberVO> listPmphGroupMember(Long groupId, String sessionId) throws CheckedServiceException {
    if (null == groupId || groupId == 0) {
        List<PmphGroupListVO> myPmphGroupListVOList = pmphGroupService.listPmphGroup(new PmphGroup(), sessionId);
        if (null == myPmphGroupListVOList || myPmphGroupListVOList.size() == 0) {
            throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "你没有小组!");
        }
        // 初始化页面时没有参数传入则直接调用初始化时小组排序的第一个小组id
        groupId = myPmphGroupListVOList.get(0).getId();
    }
    List<PmphGroupMemberVO> list = pmphGroupMemberDao.listPmphGroupMember(groupId);
    for (PmphGroupMemberVO pmphGroupMemberVO : list) {
        if (pmphGroupMemberVO.getIsWriter()) {
            WriterUser writerUser = writerUserService.get(pmphGroupMemberVO.getUserId());
            pmphGroupMemberVO.setAvatar(RouteUtil.userAvatar(writerUser.getAvatar()));
            pmphGroupMemberVO.setAvatarInfo("用户名: " + (StringUtil.isEmpty(writerUser.getUsername()) ? "-" : writerUser.getUsername()) + "<br/>" + "电话: " + (StringUtil.isEmpty(writerUser.getHandphone()) ? "-" : writerUser.getHandphone()) + "<br/>" + "邮箱: " + (StringUtil.isEmpty(writerUser.getEmail()) ? "-" : writerUser.getEmail()));
            pmphGroupMemberVO.setUserType(Const.SENDER_TYPE_2);
        } else {
            PmphUser pmphUser = pmphUserService.get(pmphGroupMemberVO.getUserId());
            pmphGroupMemberVO.setAvatar(RouteUtil.userAvatar(pmphUser.getAvatar()));
            pmphGroupMemberVO.setUserType(Const.SENDER_TYPE_1);
            pmphGroupMemberVO.setAvatarInfo("用户名: " + (StringUtil.isEmpty(pmphUser.getUsername()) ? "-" : pmphUser.getUsername()) + "<br/>" + "电话: " + (StringUtil.isEmpty(pmphUser.getHandphone()) ? "-" : pmphUser.getHandphone()) + "<br/>" + "邮箱: " + (StringUtil.isEmpty(pmphUser.getEmail()) ? "-" : pmphUser.getEmail()));
        }
    }
    return list;
}
Also used : PmphUser(com.bc.pmpheep.back.po.PmphUser) PmphGroupMemberVO(com.bc.pmpheep.back.vo.PmphGroupMemberVO) PmphGroup(com.bc.pmpheep.back.po.PmphGroup) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) WriterUser(com.bc.pmpheep.back.po.WriterUser) PmphGroupListVO(com.bc.pmpheep.back.vo.PmphGroupListVO)

Aggregations

PmphUser (com.bc.pmpheep.back.po.PmphUser)4 PmphGroupListVO (com.bc.pmpheep.back.vo.PmphGroupListVO)4 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)4 ArrayList (java.util.ArrayList)3 PmphGroup (com.bc.pmpheep.back.po.PmphGroup)2 PmphGroupMemberVO (com.bc.pmpheep.back.vo.PmphGroupMemberVO)2 PageResult (com.bc.pmpheep.back.plugin.PageResult)1 WriterUser (com.bc.pmpheep.back.po.WriterUser)1