use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class PmphUserServiceImpl method getListPmphUser.
@Override
public PageResult<PmphUserManagerVO> getListPmphUser(PageParameter<PmphUserManagerVO> pageParameter, Long groupId) throws CheckedServiceException {
String name = pageParameter.getParameter().getName();
if (StringUtil.notEmpty(name)) {
pageParameter.getParameter().setName(name);
}
String path = pageParameter.getParameter().getPath();
Long departmentId = pageParameter.getParameter().getDepartmentId();
if (StringUtil.notEmpty(path) && ObjectUtil.notNull(departmentId)) {
pageParameter.getParameter().setPath(path + "-" + java.lang.String.valueOf(departmentId) + '-');
}
PageResult<PmphUserManagerVO> pageResult = new PageResult<>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
int total = pmphUserDao.getListPmphUserTotal(pageParameter);
if (total > 0) {
List<PmphUserManagerVO> list = pmphUserDao.getListPmphUser(pageParameter);
for (PmphUserManagerVO pmphUserManagerVO : list) {
List<PmphRoleVO> pmphRoles = pmphRoleDao.listPmphUserRoleByUserId(pmphUserManagerVO.getId());
pmphUserManagerVO.setPmphRoles(pmphRoles);
}
pageResult.setRows(list);
}
pageResult.setTotal(total);
// 设置职位
if (null != pageResult.getRows() && pageResult.getRows().size() > 0 && null != groupId) {
// 清空职位
for (PmphUserManagerVO pmphUserManagerVO : pageResult.getRows()) {
pmphUserManagerVO.setPosition("无");
}
PmphGroup pmphGroup = pmphGroupService.getPmphGroupById(groupId);
Long bookId = pmphGroup.getBookId();
if (null != bookId && bookId.intValue() > 0) {
Textbook textbook = textbookService.getTextbookById(bookId);
Material material = materialService.getMaterialById(textbook.getMaterialId());
List<MaterialProjectEditorVO> projects = materialProjectEditorService.listMaterialProjectEditors(textbook.getMaterialId());
for (PmphUserManagerVO pmphUserManagerVO : pageResult.getRows()) {
Long pmphUserId = pmphUserManagerVO.getId();
String posotion = null;
if (material.getDirector().intValue() == pmphUserId.intValue()) {
posotion = "主任";
}
if (null != projects && projects.size() > 0) {
for (MaterialProjectEditorVO item : projects) {
if (item.getEditorId().intValue() == pmphUserId.intValue()) {
posotion += (posotion == null) ? "项目编辑" : ",项目编辑";
break;
}
}
}
if (textbook.getPlanningEditor().intValue() == pmphUserId.intValue()) {
posotion += (posotion == null) ? "策划编辑" : ",策划编辑";
}
pmphUserManagerVO.setPosition(posotion == null ? "无" : posotion);
}
}
}
// 设置职位 end
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class SysOperationServiceImpl method getListSysOperation.
@Override
public PageResult<SysOperation> getListSysOperation(PageParameter<SysOperation> pageParameter) throws CheckedServiceException {
PageResult<SysOperation> pageResult = new PageResult<SysOperation>();
String startTime = pageParameter.getParameter().getStartTime();
String endTime = pageParameter.getParameter().getEndTime();
// 查询近一个月操作日志
String startDate = DateUtil.date2Str(new Date());
String endDate = DateUtil.getAfterDayDate("-30");
if (StringUtil.isEmpty(startTime) && StringUtil.isEmpty(endTime)) {
pageParameter.getParameter().setStartTime(endDate);
pageParameter.getParameter().setEndTime(startDate);
} else {
if (StringUtil.isEmpty(startTime)) {
pageParameter.getParameter().setStartTime(DateUtil.date2Str(DateUtil.getDateBefore(DateUtil.str2Date(endTime), 30)));
pageParameter.getParameter().setEndTime(endTime);
}
if (StringUtil.isEmpty(endTime)) {
pageParameter.getParameter().setStartTime(startTime);
pageParameter.getParameter().setEndTime(DateUtil.date2Str(DateUtil.getDateBefore(DateUtil.str2Date(startTime), -30)));
}
}
// 将页面大小和页面页码拷贝
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// 包含数据总条数的数据集
List<SysOperation> sysOperations = sysOperationDao.getListSysOperation(pageParameter);
if (CollectionUtil.isNotEmpty(sysOperations)) {
Integer count = sysOperations.get(0).getCount();
pageResult.setTotal(count);
pageResult.setRows(sysOperations);
}
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class TextbookLogServiceImpl method listTextbookLogByTextBookId.
@Override
public PageResult<TextbookLogVO> listTextbookLogByTextBookId(Long textbookId, Integer pageSize, Integer pageNumber, String updaterName) throws CheckedServiceException {
if (null == textbookId) {
throw new CheckedServiceException(CheckedExceptionBusiness.TEXTBOOK_LOG, CheckedExceptionResult.NULL_PARAM, "书籍为空!");
}
Map<String, Object> map = new HashMap<String, Object>(2);
map.put("textbookId", textbookId);
updaterName = StringUtil.toAllCheck(updaterName);
if (null != updaterName) {
map.put("updaterName", updaterName);
}
// 包装参数实体
PageParameter<Map<String, Object>> pageParameter = new PageParameter<Map<String, Object>>(pageNumber, pageSize, map);
// 返回实体
PageResult<TextbookLogVO> pageResult = new PageResult<TextbookLogVO>();
// 参数拷贝
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// 获取总数
Integer total = textbookLogDao.listTotalTextbookLogByTextBookId(pageParameter);
if (null != total && total > 0) {
List<TextbookLog> rows = textbookLogDao.listTextbookLogByTextBookId(pageParameter);
List<TextbookLogVO> newRows = new ArrayList<TextbookLogVO>(rows.size());
for (TextbookLog textbookLog : rows) {
Long id = textbookLog.getId();
String detail = textbookLog.getDetail();
Timestamp gmtCreate = textbookLog.getGmtCreate();
detail = detail.replace("{gmt_create}", DateUtil.format(gmtCreate));
newRows.add(new TextbookLogVO(id, detail));
}
pageResult.setRows(newRows);
}
pageResult.setTotal(total);
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class TopicServiceImpl method listOpts.
@Override
public PageResult<TopicOPtsManagerVO> listOpts(String sessionId, PageParameter<TopicOPtsManagerVO> pageParameter) throws CheckedServiceException {
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (ObjectUtil.isNull(pmphUser)) {
throw new CheckedServiceException(CheckedExceptionBusiness.TOPIC, CheckedExceptionResult.NULL_PARAM, "用户为空!");
}
PageResult<TopicOPtsManagerVO> 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.listTotal(pageParameter.getParameter().getBookname(), submitTime);
if (total > 0) {
List<TopicOPtsManagerVO> list = topicDao.list(pageParameter.getParameter().getBookname(), submitTime, pageParameter.getStart(), pageParameter.getPageSize());
list = addTypeName(list);
pageResult.setRows(list);
}
} else {
total = topicDao.listOptsTotal(pmphUser.getId(), pageParameter.getParameter().getBookname(), submitTime);
if (total > 0) {
List<TopicOPtsManagerVO> list = topicDao.listOpts(pmphUser.getId(), pageParameter.getParameter().getBookname(), submitTime, pageParameter.getStart(), pageParameter.getPageSize());
list = addTypeName(list);
pageResult.setRows(list);
}
}
pageResult.setTotal(total);
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class TopicServiceImpl method listTopicEditorVOs.
@Override
public PageResult<TopicEditorVO> listTopicEditorVOs(String sessionId, PageParameter<TopicEditorVO> pageParameter) throws CheckedServiceException {
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (ObjectUtil.isNull(pmphUser)) {
throw new CheckedServiceException(CheckedExceptionBusiness.TOPIC, CheckedExceptionResult.NULL_PARAM, "用户为空");
}
PageResult<TopicEditorVO> 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.totalEditorView(pageParameter.getParameter().getBookname(), submitTime);
if (total > 0) {
List<TopicEditorVO> list = topicDao.listEditorView(pageParameter.getParameter().getBookname(), submitTime, pageParameter.getStart(), pageParameter.getPageSize());
list = addTypeNameEditor(list);
pageResult.setRows(list);
}
} else {
total = topicDao.totalTopicEditorVOs(pmphUser.getId(), pageParameter.getParameter().getBookname(), submitTime);
if (total > 0) {
List<TopicEditorVO> list = topicDao.listTopicEditorVOs(pmphUser.getId(), pageParameter.getParameter().getBookname(), submitTime, pageParameter.getStart(), pageParameter.getPageSize());
list = addTypeNameEditor(list);
pageResult.setRows(list);
}
}
pageResult.setTotal(total);
return pageResult;
}
Aggregations