use of com.bc.pmpheep.back.vo.MyMessageVO in project pmph by BCSquad.
the class UserMessageServiceTest method testListMyMessage.
@Test
@Rollback(Const.ISROLLBACK)
public void testListMyMessage() {
MyMessageVO myMessageVO = new MyMessageVO();
myMessageVO.setUserId(1L);
myMessageVO.setUserType(1);
PageParameter pageParameter = new PageParameter<>();
PageResult pageResult = new PageResult<>();
pageParameter.setParameter(myMessageVO);
pageResult = userMessageService.listMyMessage(pageParameter);
Assert.assertNotNull("查询成功了", pageResult);
}
use of com.bc.pmpheep.back.vo.MyMessageVO in project pmph by BCSquad.
the class UserMessageServiceTest method testListMyMessageOfIcon.
@Test
@Rollback(Const.ISROLLBACK)
public void testListMyMessageOfIcon() {
MyMessageVO myMessageVO = new MyMessageVO();
myMessageVO.setUserId(1L);
myMessageVO.setUserType(1);
PageParameter pageParameter = new PageParameter<>();
PageResult pageResult = new PageResult<>();
pageParameter.setParameter(myMessageVO);
pageResult = userMessageService.listMyMessageOfIcon(pageParameter);
Assert.assertNotNull("查询成功了", pageResult);
}
use of com.bc.pmpheep.back.vo.MyMessageVO in project pmph by BCSquad.
the class UserMessageServiceImpl method listMyMessageOfIcon.
@Override
public PageResult<MyMessageVO> listMyMessageOfIcon(PageParameter<MyMessageVO> pageParameter) throws CheckedServiceException {
if (ObjectUtil.isNull(pageParameter.getParameter().getUserId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户id为空!");
}
if (ObjectUtil.isNull(pageParameter.getParameter().getUserType())) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户类型为空!");
}
PageResult<MyMessageVO> pageResult = new PageResult<MyMessageVO>();
Integer total = userMessageDao.listMyMessageTotal(pageParameter);
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
if (total > 0) {
List<MyMessageVO> list = userMessageDao.listMyMessage(pageParameter);
for (MyMessageVO myMessageVO : list) {
switch(myMessageVO.getSenderType()) {
case 0:
myMessageVO.setSenderName("系统");
break;
case 1:
PmphUser pmphUser = pmphUserService.get(myMessageVO.getSenderId());
myMessageVO.setSenderAvatar(pmphUser.getAvatar());
myMessageVO.setSenderName(pmphUser.getRealname());
break;
case 2:
WriterUser writerUser = writerUserService.get(myMessageVO.getSenderId());
myMessageVO.setSenderAvatar(writerUser.getAvatar());
myMessageVO.setSenderName(writerUser.getRealname());
break;
case 3:
// 现在没有机构用户
break;
default:
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "发送者类型不正确!");
}
Message message = messageService.get(myMessageVO.getMsgId());
if (ObjectUtil.isNull(message)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "没有获取到内容!");
}
myMessageVO.setContent(message.getContent());
}
pageResult.setRows(list);
}
pageResult.setTotal(total);
return pageResult;
}
use of com.bc.pmpheep.back.vo.MyMessageVO in project pmph by BCSquad.
the class UserMessageServiceImpl method listMyMessage.
@Override
public PageResult<MyMessageVO> listMyMessage(PageParameter<MyMessageVO> pageParameter) throws CheckedServiceException {
if (ObjectUtil.isNull(pageParameter.getParameter().getUserId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户id为空!");
}
if (ObjectUtil.isNull(pageParameter.getParameter().getUserType())) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户类型为空!");
}
PageResult<MyMessageVO> pageResult = new PageResult<MyMessageVO>();
Integer total = userMessageDao.listMyMessageTotal(pageParameter);
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
if (total > 0) {
List<MyMessageVO> list = userMessageDao.listMyMessage(pageParameter);
for (MyMessageVO myMessageVO : list) {
switch(myMessageVO.getSenderType()) {
case 0:
myMessageVO.setSenderName("系统");
break;
case 1:
PmphUser pmphUser = pmphUserService.get(myMessageVO.getSenderId());
myMessageVO.setSenderAvatar(pmphUser.getAvatar());
myMessageVO.setSenderName(pmphUser.getRealname());
break;
case 2:
WriterUser writerUser = writerUserService.get(myMessageVO.getSenderId());
myMessageVO.setSenderAvatar(writerUser.getAvatar());
myMessageVO.setSenderName(writerUser.getRealname());
break;
case 3:
// 现在没有机构用户
break;
default:
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "发送者类型不正确!");
}
}
pageResult.setRows(list);
}
pageResult.setTotal(total);
return pageResult;
}
use of com.bc.pmpheep.back.vo.MyMessageVO in project pmph by BCSquad.
the class UserMessageServiceImpl method updateMyMessageDetail.
@Override
public MyMessageVO updateMyMessageDetail(Long id) throws CheckedServiceException {
if (ObjectUtil.isNull(id)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "消息id为空!");
}
MyMessageVO myMessageVO = userMessageDao.getMyMessageDetail(id);
switch(myMessageVO.getSenderType()) {
case 0:
myMessageVO.setSenderName("系统");
break;
case 1:
PmphUser pmphUser = pmphUserService.get(myMessageVO.getSenderId());
myMessageVO.setSenderAvatar(pmphUser.getAvatar());
myMessageVO.setSenderName(pmphUser.getRealname());
break;
case 2:
WriterUser writerUser = writerUserService.get(myMessageVO.getSenderId());
myMessageVO.setSenderAvatar(writerUser.getAvatar());
myMessageVO.setSenderName(writerUser.getRealname());
break;
case 3:
// 现在没有机构用户
break;
default:
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "发送者类型不正确!");
}
Message message = messageService.get(myMessageVO.getMsgId());
if (ObjectUtil.isNull(message)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "没有获取到消息详情");
}
myMessageVO.setContent(message.getContent());
List<MessageAttachment> messageAttachments = messageAttachmentService.getMessageAttachmentByMsgId(myMessageVO.getMsgId());
for (MessageAttachment messageAttachment : messageAttachments) {
messageAttachment.setAttachment(RouteUtil.MONGODB_FILE + messageAttachment.getAttachment());
}
myMessageVO.setMessageAttachments(messageAttachments);
UserMessage userMessage = new UserMessage();
userMessage.setId(id);
userMessage.setIsRead(true);
userMessageDao.updateUserMessage(userMessage);
return myMessageVO;
}
Aggregations