use of com.bc.pmpheep.back.vo.PmphGroupMessageVO in project pmph by BCSquad.
the class PmphGroupMessageServiceImpl method listPmphGroupMessage.
@Override
public PageResult<PmphGroupMessageVO> listPmphGroupMessage(PageParameter<PmphGroupMessageVO> pageParameter) throws CheckedServiceException {
if (null == pageParameter.getParameter().getGroupId()) {
throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "小组id为空");
}
if (null == pageParameter.getParameter().getGmtCreate()) {
throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "进入小组时间为空");
}
PageResult<PmphGroupMessageVO> pageResult = new PageResult<>();
int total = pmphGroupMessageDao.getPmphGroupMessageTotal(pageParameter);
if (total > 0) {
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
List<PmphGroupMessageVO> list = pmphGroupMessageDao.listPmphGroupMessage(pageParameter);
Collections.reverse(list);
for (PmphGroupMessageVO pmphGroupMessageVO : list) {
if (0 != pmphGroupMessageVO.getMemberId()) {
if (null == pmphGroupMessageVO.getIsWriter()) {
pmphGroupMessageVO.setAvatar(RouteUtil.DEFAULT_USER_AVATAR);
pmphGroupMessageVO.setMemberName("该人员已经退出小组");
} else {
if (pmphGroupMessageVO.getIsWriter()) {
pmphGroupMessageVO.setUserType(Const.SENDER_TYPE_2);
pmphGroupMessageVO.setAvatar(RouteUtil.userAvatar(writerUserService.get(pmphGroupMessageVO.getUserId()).getAvatar()));
} else {
pmphGroupMessageVO.setAvatar(RouteUtil.userAvatar(pmphUserService.get(pmphGroupMessageVO.getUserId()).getAvatar()));
pmphGroupMessageVO.setUserType(Const.SENDER_TYPE_1);
}
}
} else {
pmphGroupMessageVO.setUserId(0L);
pmphGroupMessageVO.setUserType(Const.SENDER_TYPE_0);
}
}
pageResult.setRows(list);
}
pageResult.setTotal(total);
return pageResult;
}
use of com.bc.pmpheep.back.vo.PmphGroupMessageVO in project pmph by BCSquad.
the class GroupController method message.
/**
* 功能描述:进入小组的时候获取历史消息
*
* @param pageSize
* 获取的条数
* @param pageNumber
* 当前第几页
* @param groupId
* 小组id
* @param nowTime
* 进入小组的时间节点
* @return 消息结果集
*/
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "获取历史消息")
@RequestMapping(value = "/list/message", method = RequestMethod.GET)
public ResponseBean message(Integer pageSize, Integer pageNumber, Long groupId, Long baseTime) {
PageParameter<PmphGroupMessageVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
PmphGroupMessageVO pmphGroupMessageVO = new PmphGroupMessageVO();
pmphGroupMessageVO.setGmtCreate(new Timestamp(baseTime));
pmphGroupMessageVO.setGroupId(groupId);
pageParameter.setParameter(pmphGroupMessageVO);
return new ResponseBean(pmphGroupMessageService.listPmphGroupMessage(pageParameter));
}
use of com.bc.pmpheep.back.vo.PmphGroupMessageVO in project pmph by BCSquad.
the class PmphGroupMessageServiceTest method testListPmphGroupMessage.
@Test
public void testListPmphGroupMessage() {
pmphGroupMessageService.addPmphGroupMessage(pmphGroupMessage);
PageParameter<PmphGroupMessageVO> pageParameter = new PageParameter<>(1, 20);
PmphGroupMessageVO pmphGroupMessageVO = new PmphGroupMessageVO();
pmphGroupMessageVO.setGmtCreate(DateUtil.getCurrentTime());
pmphGroupMessageVO.setGroupId(pmphGroupMessage.getGroupId());
pageParameter.setParameter(pmphGroupMessageVO);
Assert.assertNotNull("获取数据失败", pmphGroupMessageService.listPmphGroupMessage(pageParameter));
}
Aggregations