Search in sources :

Example 1 with MessageStateVO

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

the class UserMessageServiceImpl method listMessageState.

@Override
public PageResult<MessageStateVO> listMessageState(PageParameter<MessageStateVO> pageParameter, String sessionId) throws CheckedServiceException {
    PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
    if (ObjectUtil.isNull(pmphUser)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户为空");
    }
    if (ObjectUtil.isNull(pmphUser.getId())) {
        throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户为空");
    }
    if (StringUtil.isEmpty(pageParameter.getParameter().getMsgId()) && ObjectUtil.isNull(pageParameter.getParameter().getMaterialId())) {
        throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "消息为空");
    }
    // 搜索条件,按收件人或单位搜索
    String orgNameOrReceiver = pageParameter.getParameter().getName();
    // 防止输入空格查询,如果为" "
    if (StringUtil.isEmpty(orgNameOrReceiver)) {
        pageParameter.getParameter().setName(null);
    } else {
        pageParameter.getParameter().setName(orgNameOrReceiver.replaceAll(" ", ""));
    }
    if (Const.FALSE.booleanValue() == pmphUser.getIsAdmin().booleanValue()) {
        pageParameter.getParameter().setSenderId(pmphUser.getId());
    }
    PageResult<MessageStateVO> pageResult = new PageResult<MessageStateVO>();
    // 将页面大小和页面页码拷贝
    PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
    // 包含数据总条数的数据集
    List<MessageStateVO> messageStateList = userMessageDao.listMessageState(pageParameter);
    if (!messageStateList.isEmpty() && messageStateList.size() > 0) {
        Integer count = messageStateList.get(0).getCount();
        pageResult.setTotal(count);
        pageResult.setRows(messageStateList);
    }
    return pageResult;
}
Also used : PmphUser(com.bc.pmpheep.back.po.PmphUser) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) MessageStateVO(com.bc.pmpheep.back.vo.MessageStateVO) PageResult(com.bc.pmpheep.back.plugin.PageResult)

Aggregations

PageResult (com.bc.pmpheep.back.plugin.PageResult)1 PmphUser (com.bc.pmpheep.back.po.PmphUser)1 MessageStateVO (com.bc.pmpheep.back.vo.MessageStateVO)1 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)1