use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class TopicServiceImpl method listTopicDirectorVOs.
public PageResult<TopicDirectorVO> listTopicDirectorVOs(String sessionId, PageParameter<TopicDirectorVO> pageParameter) throws CheckedServiceException {
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (ObjectUtil.isNull(pmphUser)) {
throw new CheckedServiceException(CheckedExceptionBusiness.TOPIC, CheckedExceptionResult.NULL_PARAM, "用户为空");
}
PageResult<TopicDirectorVO> pageResult = new PageResult<>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
Integer total = 0;
String submitTime = DateUtil.date2Str(pageParameter.getParameter().getSubmitTime(), "yyyy-MM-dd");
if (pmphUser.getIsAdmin()) {
total = topicDao.totalDirectorView(pageParameter.getParameter().getBookname(), submitTime);
if (total > 0) {
List<TopicDirectorVO> list = topicDao.listDirectorView(pageParameter.getParameter().getBookname(), submitTime, pageParameter.getStart(), pageParameter.getPageSize());
list = addTypeNameDirector(list);
pageResult.setRows(list);
}
} else {
total = topicDao.totalTopicDirectorVOs(pmphUser.getId(), pageParameter.getParameter().getBookname(), submitTime);
if (total > 0) {
List<TopicDirectorVO> list = topicDao.listTopicDirectorVOs(pmphUser.getId(), pageParameter.getParameter().getBookname(), submitTime, pageParameter.getStart(), pageParameter.getPageSize());
list = addTypeNameDirector(list);
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 listMessage.
@Override
public PageResult<UserMessageVO> listMessage(PageParameter<UserMessageVO> 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 (Const.FALSE == pmphUser.getIsAdmin()) {
List<Long> ids = new ArrayList<Long>();
// 如果是主任,获取主任所在部门下的所有用户
if (Const.TRUE == pmphUser.getIsDirector()) {
// 社内部门父级节点ID
Long parentId = 1L;
PmphDepartment pmphDepartment = pmphDepartmentService.getPmphDepartmentById(pmphUser.getDepartmentId());
// 如果是父级部门主任,则可以查看子级部门下的所有用户发送的消息
if (parentId.longValue() == pmphDepartment.getParentId().longValue()) {
PageParameter<PmphUserManagerVO> parameter = new PageParameter<>(1, 2000);
PmphUserManagerVO pmphUserManagerVO = new PmphUserManagerVO();
pmphUserManagerVO.setPath(pmphDepartment.getPath());
pmphUserManagerVO.setDepartmentId(pmphDepartment.getId());
parameter.setParameter(pmphUserManagerVO);
PageResult<PmphUserManagerVO> listPageResult = pmphUserService.getListPmphUser(parameter, null);
List<PmphUserManagerVO> listPmphUserManagerVOs = listPageResult.getRows();
for (PmphUserManagerVO pmManagerVO : listPmphUserManagerVOs) {
ids.add(pmManagerVO.getId());
}
} else {
// 如果是子级部门主任,则只可以查看子级部门下的用户发送的消息
List<PmphUser> pmphUsers = pmphUserService.listPmphUserByDepartmentId(pmphUser.getDepartmentId());
if (CollectionUtil.isNotEmpty(pmphUsers)) {
for (PmphUser user : pmphUsers) {
ids.add(user.getId());
}
}
}
} else {
ids.add(pmphUser.getId());
}
pageParameter.getParameter().setSenderIds(ids);
}
PageResult<UserMessageVO> pageResult = new PageResult<>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
Integer total = userMessageDao.getMessageTotal(pageParameter);
if (total > 0) {
List<UserMessageVO> list = userMessageDao.listMessage(pageParameter);
Message message;
for (UserMessageVO userMessageVO : list) {
message = messageService.get(userMessageVO.getMsgId());
if (ObjectUtil.notNull(message)) {
userMessageVO.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 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;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class OrgSeviceTest method testListOrg.
@Test
public void testListOrg() {
OrgVO orgVO = new OrgVO();
orgVO.getOrgName();
PageResult<OrgVO> page = new PageResult<OrgVO>();
PageParameter<OrgVO> pageParameter = new PageParameter<OrgVO>();
pageParameter.setParameter(orgVO);
page = orgService.listOrg(pageParameter);
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class OrgSeviceTest method testGetSchoolAdminCheckList.
@Test
public void testGetSchoolAdminCheckList() {
PageParameter pageParameter = new PageParameter<>();
PageResult<OrgVO> pageResult = new PageResult<OrgVO>();
OrgVO orgVO = new OrgVO();
orgVO.setOrgName(null);
orgVO.setAreaId(null);
orgVO.setRealname(null);
pageParameter.setPageNumber(1);
pageParameter.setPageSize(20);
pageParameter.setParameter(orgVO);
pageResult = orgService.getSchoolAdminCheckList(pageParameter);
Assert.assertNotNull("获取学校管理员审核列表失败", pageResult);
}
Aggregations