use of com.bc.pmpheep.back.plugin.PageResult 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.plugin.PageResult 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.plugin.PageResult in project pmph by BCSquad.
the class WriterPointLogServiceImpl method getListWriterPointLog.
@Override
public PageResult<WriterPointLogVO> getListWriterPointLog(PageParameter<WriterPointLogVO> pageParameter) throws CheckedServiceException {
PageResult<WriterPointLogVO> pageResult = new PageResult<WriterPointLogVO>();
// 开始时间
String startTime = pageParameter.getParameter().getStartTime();
// 结束时间
String endTime = pageParameter.getParameter().getEndTime();
Long userId = pageParameter.getParameter().getUserId();
WriterPointLogVO writerPointLogVO = new WriterPointLogVO();
if (StringUtil.isEmpty(startTime) && StringUtil.isEmpty(endTime)) {
writerPointLogVO.setStartTime(null);
writerPointLogVO.setEndTime(null);
} else {
writerPointLogVO.setStartTime(startTime + " 00:00:00");
writerPointLogVO.setEndTime(endTime + " 23:59:59");
}
if (StringUtil.isEmpty(startTime) && StringUtil.notEmpty(endTime)) {
writerPointLogVO.setStartTime(endTime + " 00:00:00");
writerPointLogVO.setEndTime(endTime + " 23:59:59");
} else if (StringUtil.isEmpty(endTime) && StringUtil.notEmpty(startTime)) {
writerPointLogVO.setStartTime(startTime + " 00:00:00");
writerPointLogVO.setEndTime(startTime + " 23:59:59");
}
if (ObjectUtil.notNull(userId)) {
writerPointLogVO.setUserId(userId);
} else {
throw new CheckedServiceException(CheckedExceptionBusiness.WRITER_POINT_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "参数为空");
}
pageParameter.setParameter(writerPointLogVO);
// 将页面大小和页面页码拷贝
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// 包含数据总条数的数据集
List<WriterPointLogVO> writerPointLogVOs = writerPointLogDao.listWriterPointLogVO(pageParameter);
if (CollectionUtil.isNotEmpty(writerPointLogVOs)) {
Integer count = writerPointLogVOs.get(0).getCount();
pageResult.setTotal(count);
pageResult.setRows(writerPointLogVOs);
}
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult 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.plugin.PageResult in project pmph by BCSquad.
the class PmphUserServiceImpl method getListByUsernameAndRealname.
@Override
public PageResult<PmphUserManagerVO> getListByUsernameAndRealname(String name, int number, int size) throws CheckedServiceException {
if (null == name || "".equals(name)) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "模糊查询条件为空");
}
List<PmphUser> pmphUsers = pmphUserDao.getListByUsernameAndRealname(name, (number - 1) * size, size);
PageResult<PmphUserManagerVO> page = new PageResult<>();
page.setFirst(true);
page.setLast(true);
page.setPageNumber(number);
page.setPageSize(size);
if (!pmphUsers.isEmpty()) {
List<PmphUserManagerVO> list = new ArrayList<>();
for (PmphUser user : pmphUsers) {
PmphUserManagerVO userVO = new PmphUserManagerVO();
PmphDepartment department = pmphDepartmentDao.getPmphDepartmentById(user.getDepartmentId());
if (null != department) {
userVO.setDepartmentName(department.getDpName());
}
try {
BeanUtils.copyProperties(userVO, user);
} catch (BeansException ex) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.VO_CONVERSION_FAILED, ex.getMessage());
}
list.add(userVO);
}
page.setRows(list);
}
return page;
}
Aggregations