use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class WriterUserServiceImpl method listGroupMemberWriterUsers.
@Override
public PageResult<GroupMemberWriterUserVO> listGroupMemberWriterUsers(PageParameter<GroupMemberWriterUserVO> pageParameter) throws CheckedServiceException {
String bookName = pageParameter.getParameter().getBookname();
if (StringUtil.notEmpty(bookName)) {
pageParameter.getParameter().setBookname(bookName);
}
String name = pageParameter.getParameter().getName();
if (StringUtil.notEmpty(name)) {
pageParameter.getParameter().setRealname(name);
}
PageResult<GroupMemberWriterUserVO> pageResult = new PageResult<>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
int total = writerUserDao.getGroupMemberWriterUserTotal(pageParameter);
if (total > 0) {
List<GroupMemberWriterUserVO> list = writerUserDao.listGroupMemberWriterUserVOs(pageParameter);
for (GroupMemberWriterUserVO vo : list) {
switch(vo.getChosenPosition()) {
case 0:
vo.setChosenPositionName("无职位");
break;
case 1:
vo.setChosenPositionName("主编");
break;
case 2:
vo.setChosenPositionName("副主编");
break;
case 3:
vo.setChosenPositionName("编委");
break;
default:
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.ILLEGAL_PARAM, "该用户没有身份");
}
}
pageResult.setRows(list);
}
pageResult.setTotal(total);
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class WriterUserServiceImpl method getListWriterUser.
/**
* 功能描述:分页查询作家用户
*
* @param page
* 传入的查询数据
* @return 需要的Page对象
*/
@Override
public PageResult<WriterUserManagerVO> getListWriterUser(PageParameter<WriterUserManagerVO> pageParameter, Long groupId) throws CheckedServiceException {
String name = pageParameter.getParameter().getName();
if (StringUtil.notEmpty(name)) {
pageParameter.getParameter().setName(name);
}
String orgName = pageParameter.getParameter().getOrgName();
if (StringUtil.notEmpty(orgName)) {
pageParameter.getParameter().setOrgName(orgName);
}
PageResult<WriterUserManagerVO> pageResult = new PageResult<>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// 当rank为1的时候 查询教师用户
int total = 0;
if (pageParameter.getParameter().getRank() == null || pageParameter.getParameter().getRank() != 1) {
// 当rank不为1的时候
total = writerUserDao.getListWriterUserTotal(pageParameter);
if (total > 0) {
List<WriterUserManagerVO> list = writerUserDao.getListWriterUser(pageParameter);
for (WriterUserManagerVO vo : list) {
switch(vo.getRank()) {
case 0:
vo.setRankName("普通用户");
break;
case 1:
vo.setRankName("教师用户");
break;
case 2:
vo.setRankName("作家用户");
break;
case 3:
vo.setRankName("专家用户");
break;
default:
throw new CheckedServiceException(CheckedExceptionBusiness.WRITER_USER_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "该用户没有身份");
}
}
pageResult.setRows(list);
}
pageResult.setTotal(total);
} else {
total = writerUserDao.getLsitisTeacherTotal(pageParameter);
if (total > 0) {
List<WriterUserManagerVO> list = writerUserDao.getLsitisTeacher(pageParameter);
for (WriterUserManagerVO vo : list) {
switch(vo.getRank()) {
case 0:
vo.setRankName("普通用户");
break;
case 1:
vo.setRankName("教师用户");
break;
case 2:
vo.setRankName("作家用户");
break;
case 3:
vo.setRankName("专家用户");
break;
default:
throw new CheckedServiceException(CheckedExceptionBusiness.WRITER_USER_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "该用户没有身份");
}
}
pageResult.setRows(list);
}
pageResult.setTotal(total);
}
// 设置职位
if (null != pageResult.getRows() && pageResult.getRows().size() > 0 && null != groupId) {
// 清空职位
for (WriterUserManagerVO writerUserManagerVO : pageResult.getRows()) {
writerUserManagerVO.setPosition("无");
}
// 设置职位
PmphGroup pmphGroup = pmphGroupService.getPmphGroupById(groupId);
Long bookId = pmphGroup.getBookId();
if (null != bookId && bookId.intValue() > 0) {
// 查询这本书的发布职位
List<DecPositionPublished> publisheds = decPositionPublishedService.getDecPositionPublishedListByBookId(bookId);
if (null != publisheds && publisheds.size() > 0) {
Map<Long, String> userIdsAndPostions = new HashMap<Long, String>();
for (DecPositionPublished published : publisheds) {
Declaration declaration = declarationService.getDeclarationById(published.getDeclarationId());
String postiton = "无";
if (published.getChosenPosition().intValue() == 4 && null != published.getRank() && published.getRank() == 1) {
postiton = "主编(第一主编)";
} else if (published.getChosenPosition().intValue() == 4) {
postiton = "主编";
} else if (published.getChosenPosition().intValue() == 12 && null != published.getRank() && published.getRank() == 1) {
postiton = "主编(第一主编),数字编委";
} else if (published.getChosenPosition().intValue() == 12) {
postiton = "主编,数字编委";
} else if (published.getChosenPosition().intValue() == 2) {
postiton = "副主编";
} else if (published.getChosenPosition().intValue() == 10) {
postiton = "副主编,数字编委";
} else if (published.getChosenPosition().intValue() == 1) {
postiton = "编委";
} else if (published.getChosenPosition().intValue() == 9) {
postiton = "编委,数字编委";
}
userIdsAndPostions.put(declaration.getUserId(), postiton);
}
for (WriterUserManagerVO writerUserManagerVO : pageResult.getRows()) {
String postion = userIdsAndPostions.get(writerUserManagerVO.getId());
if (null != postion) {
writerUserManagerVO.setPosition(postion);
}
}
}
}
}
// 设置职位 end
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class PmphGroupServiceImpl method getlistPmphGroup.
@Override
public PageResult<PmphGroupListVO> getlistPmphGroup(PageParameter<PmphGroupListVO> pageParameter, String sessionId) throws CheckedServiceException {
if (null == pageParameter) {
throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "参数对象为空");
}
// session PmphUser用户验证
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (null == pmphUser || null == pmphUser.getId()) {
throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "用户为空");
}
List<PmphGroupListVO> list = new ArrayList<>();
PageResult<PmphGroupListVO> pageResult = new PageResult<>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
Integer total = 0;
if (pmphUser.getIsAdmin()) {
total = pmphGroupDao.getAdminCount();
list = pmphGroupDao.getPmphGroupList(pageParameter);
for (PmphGroupListVO pmphGroupListVO : list) {
pmphGroupListVO.setGroupImage(RouteUtil.groupImage(pmphGroupListVO.getGroupImage()));
}
pageResult.setRows(list);
pageResult.setTotal(total);
} else {
PmphGroup pmphGroup = new PmphGroup();
List<PmphGroupListVO> groupListVOs = pmphGroupDao.getList(pmphGroup, pmphUser.getId());
for (PmphGroupListVO pmphGroupListVO : groupListVOs) {
pmphGroupListVO.setGroupImage(RouteUtil.groupImage(pmphGroupListVO.getGroupImage()));
}
if (groupListVOs.size() > 0) {
pageResult.setRows(groupListVOs);
pageResult.setTotal(groupListVOs.size());
}
}
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class PmphUserServiceImpl method getPersonalCenter.
@Override
public Map<String, Object> getPersonalCenter(HttpServletRequest request, String state, String materialName, String groupName, String title, String bookname, String name, String authProgress, String topicBookname) {
String sessionId = CookiesUtil.getSessionId(request);
PmphUser sessionPmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (null == sessionPmphUser) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "请求用户不存在");
}
// 获取用户角色
List<PmphRole> rolelist = roleService.getPmphRoleByUserId(sessionPmphUser.getId());
// 用于装所有的数据map
Map<String, Object> map = new HashMap<>();
// 教师认证总数量
Integer writerUserCount = writerUserService.getCount();
// 机构认证数量orgList
Integer orgerCount = orgUserService.getCount();
// 小组
PmphGroupListVO pmphGroup = new PmphGroupListVO();
PageParameter<PmphGroupListVO> pageParameterPmphGroup = new PageParameter<>();
pageParameterPmphGroup.setParameter(pmphGroup);
// 小组结果
PageResult<PmphGroupListVO> pageResultPmphGroup = pmphGroupService.getlistPmphGroup(pageParameterPmphGroup, sessionId);
// 教材申报
PageParameter<MaterialListVO> pageParameter2 = new PageParameter<>();
MaterialListVO materialListVO = new MaterialListVO();
materialListVO.setState(state);
materialListVO.setMaterialName(materialName);
pageParameter2.setParameter(materialListVO);
// 教材申报的结果
PageResult<MaterialListVO> pageResultMaterialListVO = materialService.listMaterials(pageParameter2, sessionId);
// 文章审核
PageParameter<CmsContentVO> pageParameter1 = new PageParameter<>();
CmsContentVO cmsContentVO = new CmsContentVO();
cmsContentVO.setTitle(title);
cmsContentVO.setCategoryId(Const.CMS_CATEGORY_ID_1);
pageParameter1.setParameter(cmsContentVO);
// 文章审核的结果
PageResult<CmsContentVO> pageResultCmsContentVO = cmsContentService.listCmsContent(pageParameter1, sessionId);
map.put("cmsContent", pageResultCmsContentVO);
// 图书纠错审核
PageResult<BookCorrectionAuditVO> pageResultBookCorrectionAuditVO = bookCorrectionService.listBookCorrectionAudit(request, Const.PAGE_NUMBER, Const.PAGE_SIZE, bookname, null, null);
map.put("bookCorrectionAudit", pageResultBookCorrectionAuditVO);
// 图书评论审核
PageParameter<BookUserCommentVO> pageParameter = new PageParameter<>();
BookUserCommentVO bookUserCommentVO = new BookUserCommentVO();
// 去除空格
bookUserCommentVO.setName(name.replaceAll(" ", ""));
pageParameter.setParameter(bookUserCommentVO);
PageResult<BookUserCommentVO> pageResultBookUserCommentVO = bookUserCommentService.listBookUserCommentAdmin(pageParameter);
map.put("bookUserComment", pageResultBookUserCommentVO);
// 选题申报
PageParameter<TopicDeclarationVO> pageParameter3 = new PageParameter<>();
// 选题申报当前用户角色
PmphIdentity pmphIdentity = pmphUserService.identity(sessionId);
TopicDeclarationVO topicDeclarationVO = new TopicDeclarationVO();
// 是否由主任受理
if (pmphIdentity.getIsDirector()) {
topicDeclarationVO.setIsDirectorHandling(true);
}
// 是否由运维人员受理
if (pmphIdentity.getIsOpts()) {
topicDeclarationVO.setIsOptsHandling(true);
}
// 是否由编辑受理
if (pmphIdentity.getIsEditor()) {
topicDeclarationVO.setIsEditorHandling(true);
}
for (PmphRole pmphRole : rolelist) {
// 编辑
if (2 == pmphRole.getId()) {
topicDeclarationVO.setIsEditorHandling(true);
}
// 主任
if (9 == pmphRole.getId()) {
topicDeclarationVO.setIsDirectorHandling(true);
}
}
String[] strs = authProgress.split(",");
List<Long> progress = new ArrayList<>();
for (String str : strs) {
progress.add(Long.valueOf(str));
}
topicDeclarationVO.setBookname(topicBookname);
pageParameter3.setParameter(topicDeclarationVO);
//
if (sessionPmphUser.getIsAdmin()) {
PageResult<TopicDeclarationVO> pageResultTopicDeclarationVO = topicService.listMyTopic(progress, pageParameter3, null);
// topicService.listCheckTopic(progress, pageParameter3);
map.put("topicList", pageResultTopicDeclarationVO);
} else {
if (2 == rolelist.get(0).getId() || 9 == rolelist.get(0).getId() || 1 == rolelist.get(0).getId()) {
PageResult<TopicDeclarationVO> pageResultTopicDeclarationVO = topicService.listMyTopic(progress, pageParameter3, sessionPmphUser.getId());
// topicService.listCheckTopic(progress, pageParameter3);
map.put("topicList", pageResultTopicDeclarationVO);
} else {
PageResult<TopicDeclarationVO> pageResultTopicDeclarationVO = new PageResult<>();
List<TopicDeclarationVO> list = new ArrayList<>();
pageResultTopicDeclarationVO.setPageNumber(0);
pageResultTopicDeclarationVO.setRows(list);
pageResultTopicDeclarationVO.setPageTotal(0);
pageResultTopicDeclarationVO.setStart(0);
pageResultTopicDeclarationVO.setTotal(0);
;
map.put("topicList", pageResultTopicDeclarationVO);
}
}
// 获取用户上次登录时间
List<SysOperation> listSysOperation = sysOperationService.getSysOperation(sessionPmphUser.getId());
Timestamp loginTime = DateUtil.getCurrentTime();
if (!listSysOperation.isEmpty()) {
loginTime = listSysOperation.get(0).getOperateDate();
}
// 把其他模块的数据都装入map中返回给前端
map.put("materialList", pageResultMaterialListVO);
map.put("pmphGroup", pageResultPmphGroup);
map.put("writerUserCount", writerUserCount);
map.put("orgUserCount", orgerCount);
// 把用户信息存入map
map.put("pmphUser", sessionPmphUser);
// 把用户角色存入map
map.put("pmphRole", rolelist);
// 把选题申报的当前身份存入map
map.put("pmphIdentity", pmphIdentity);
// 存入用户上次操作时间
map.put("loginTime", loginTime);
return map;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class TextbookServiceImpl method listBookPosition.
@Override
public PageResult<BookPositionVO> listBookPosition(Integer pageNumber, Integer pageSize, Integer state, String textBookIds, String bookName, Long materialId, String sessionId) {
// 验证用户
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (null == pmphUser || null == pmphUser.getId()) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "用户为空");
}
// 教材权限的检查
List<PmphRole> pmphRoles = pmphUserService.getListUserRole(pmphUser.getId());
Integer power = null;
// 系统管理员权限检查
for (PmphRole pmphRole : pmphRoles) {
if (null != pmphRole && null != pmphRole.getRoleName() && "系统管理员".equals(pmphRole.getRoleName())) {
// 我是系统管理原
power = 1;
}
}
// 教材主任检查
Material material = materialService.getMaterialById(materialId);
if (null == power) {
if (null != material && null != material.getDirector() && pmphUser.getId().equals(material.getDirector())) {
// 我是教材的主任
power = 2;
}
}
// 教材项目编辑检查
if (null == power) {
List<MaterialProjectEditorVO> materialProjectEditors = materialProjectEditorService.listMaterialProjectEditors(materialId);
if (null != materialProjectEditors && materialProjectEditors.size() > 0) {
for (MaterialProjectEditorVO materialProjectEditor : materialProjectEditors) {
if (null != materialProjectEditor && null != materialProjectEditor.getEditorId() && materialProjectEditor.getEditorId().equals(pmphUser.getId())) {
// 我是教材的项目编辑
power = 3;
}
}
}
}
// 教材策划编辑检查
if (null == power) {
Integer num = materialService.getPlanningEditorSum(materialId, pmphUser.getId());
if (null != num && num > 0) {
// 我是教材的策划编辑编辑
power = 4;
}
}
if (null == power) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "该教材您没操作权限");
}
// 拼装复合参数
Map<String, Object> map = new HashMap<String, Object>();
// 教材id
map.put("materialId", materialId);
if (StringUtil.notEmpty(textBookIds)) {
Gson gson = new Gson();
List<Long> bookIds = gson.fromJson(textBookIds, new TypeToken<ArrayList<Long>>() {
}.getType());
if (null != bookIds && bookIds.size() > 0) {
// 书籍id
map.put("list", bookIds);
}
}
if (null != state && !state.equals(0)) {
// 书籍状态
map.put("state", state);
}
String bookNameTemp = StringUtil.toAllCheck(bookName);
if (null != bookNameTemp) {
// 书籍名称
map.put("bookName", bookNameTemp);
}
// 用户id
map.put("pmphUserId", pmphUser.getId());
// 用户id
map.put("power", power);
PageParameter<Map<String, Object>> pageParameter = new PageParameter<Map<String, Object>>(pageNumber, pageSize, map);
PageResult<BookPositionVO> pageResult = new PageResult<>();
// 获取总数
Integer total = textbookDao.listBookPositionTotal(pageParameter);
if (null != total && total > 0) {
List<BookPositionVO> rows = textbookDao.listBookPosition(pageParameter);
// 下面进行授权
for (BookPositionVO row : rows) {
String rowpower = "000000";
if (power == 1 || power == 2) {
// 管理员或者主任
rowpower = "11111111";
} else if (power == 3) {
// 教材项目编辑
// 因为项目编辑的权限不是全部 ,因此要检查我是不是这本书的策划编辑,如果是 ,这本书我的权利就是项目编辑+策划编辑的权利
Integer tempProjectPermission = material.getProjectPermission();
if (null != row && null != row.getPlanningEditor() && null != pmphUser.getId() && row.getPlanningEditor().intValue() == pmphUser.getId().intValue()) {
// 我又是策划编辑
tempProjectPermission = (tempProjectPermission | material.getPlanPermission());
}
rowpower = StringUtil.tentToBinary(tempProjectPermission);
} else if (power == 4) {
// 教材策划编辑
rowpower = StringUtil.tentToBinary(material.getPlanPermission());
}
// 把权限拿出来一个个判断
// 分配策划编辑的权限
String s1 = rowpower.substring(0, 1);
String s2 = rowpower.substring(1, 2);
String s3 = rowpower.substring(2, 3);
String s4 = rowpower.substring(3, 4);
String s5 = rowpower.substring(4, 5);
String s6 = rowpower.substring(5, 6);
String s7 = rowpower.substring(6, 7);
// qiangzhijiesu
String s8 = rowpower.substring(7, 8);
if (material.getIsForceEnd() || material.getIsAllTextbookPublished()) {
// 教材结束或者强制结束
s2 = "0";
s3 = "0";
s4 = "0";
s5 = "0";
s6 = "0";
} else if (row.getIsLocked() || row.getIsPublished()) {
// 书籍已经发布了或者确认了名单
s2 = (power == 1 || power == 2) ? s2 : "0";
s3 = (power == 1 || power == 2) ? s3 : "0";
s4 = (power == 1 || power == 2) ? s4 : "0";
s5 = "0";
}
rowpower = s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8;
row.setMyPower(rowpower);
}
pageResult.setRows(rows);
}
pageResult.setTotal(total);
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
return pageResult;
}
Aggregations