use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class DecPositionServiceImpl method listDeclarationResultBookVOs.
@Override
public PageResult<DeclarationResultBookVO> listDeclarationResultBookVOs(PageParameter<DeclarationResultBookVO> pageParameter) throws CheckedServiceException {
if (ObjectUtil.isNull(pageParameter.getParameter().getMaterialId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "教材id不能为空");
}
String bookName = pageParameter.getParameter().getBookName();
if (StringUtil.notEmpty(bookName)) {
pageParameter.getParameter().setBookName(bookName);
}
PageResult<DeclarationResultBookVO> pageResult = new PageResult<DeclarationResultBookVO>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
int total = decPositionDao.getBooks(pageParameter.getParameter().getMaterialId());
if (total > 0) {
List<DeclarationResultBookVO> books = decPositionDao.getBookListTwo(pageParameter);
List<DeclarationResultBookVO> VOs = decPositionDao.getBookChosenList(pageParameter);
List<DeclarationResultBookVO> list = new ArrayList<>();
if (null == VOs || VOs.isEmpty()) {
pageResult.setRows(books);
pageResult.setTotal(total);
return pageResult;
}
for (DeclarationResultBookVO book : books) {
for (DeclarationResultBookVO vo : VOs) {
if (vo.getId().equals(book.getId())) {
book.setEditorList(vo.getEditorList());
book.setSubEditorList(vo.getSubEditorList());
book.setEditorialList(vo.getEditorialList());
book.setIsDigitalEditorList(vo.getIsDigitalEditorList());
if (StringUtil.isEmpty(book.getEditorList())) {
book.setEditorList("-");
}
if (StringUtil.isEmpty(book.getSubEditorList())) {
book.setSubEditorList("-");
}
if (StringUtil.isEmpty(book.getEditorialList())) {
book.setEditorialList("-");
}
if (StringUtil.isEmpty(book.getIsDigitalEditorList())) {
book.setIsDigitalEditorList("-");
}
break;
}
}
list.add(book);
}
pageResult.setRows(list);
pageResult.setTotal(total);
}
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class DecPositionServiceImpl method listChosenDeclarationSituationSchoolResultVOs.
@Override
public PageResult<DeclarationSituationSchoolResultVO> listChosenDeclarationSituationSchoolResultVOs(PageParameter<DeclarationSituationSchoolResultVO> pageParameter) throws CheckedServiceException {
if (ObjectUtil.isNull(pageParameter.getParameter().getMaterialId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "教材id不能为空");
}
// 如果机构名称不为空,则为模糊查询
String schoolName = pageParameter.getParameter().getSchoolName();
if (StringUtil.notEmpty(schoolName)) {
pageParameter.getParameter().setSchoolName(schoolName);
}
PageResult<DeclarationSituationSchoolResultVO> pageResult = new PageResult<DeclarationSituationSchoolResultVO>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// 得到申报单位的总数
int total = decPositionDao.getSchoolCount(pageParameter.getParameter().getMaterialId());
if (total > 0) {
boolean flag = false;
List<DeclarationSituationSchoolResultVO> chosens = decPositionDao.getSchoolResultChosenPage(pageParameter);
List<DeclarationSituationSchoolResultVO> presets = decPositionDao.getSchoolResultPresetChosen(pageParameter);
List<DeclarationSituationSchoolResultVO> delList = new ArrayList<>();
List<DeclarationSituationSchoolResultVO> list = new ArrayList<>();
if (null == chosens || chosens.isEmpty()) {
for (DeclarationSituationSchoolResultVO preset : presets) {
// 计算申报人数
Integer presetPersons = preset.getPresetPositionEditor() + preset.getPresetPositionSubeditor() + preset.getPresetPositionEditorial() + preset.getPresetDigitalEditor();
preset.setPresetPersons(presetPersons);
preset.setState(1);
list.add(preset);
}
pageResult.setRows(list);
pageResult.setTotal(total);
return pageResult;
}
if (chosens.size() < presets.size()) {
flag = true;
}
for (DeclarationSituationSchoolResultVO chosen : chosens) {
for (DeclarationSituationSchoolResultVO preset : presets) {
if (preset.getOrgId().equals(chosen.getOrgId())) {
delList.add(preset);
chosen.setPresetPositionEditor(preset.getPresetPositionEditor());
chosen.setPresetPositionSubeditor(preset.getPresetPositionSubeditor());
chosen.setPresetPositionEditorial(preset.getPresetPositionEditorial());
chosen.setPresetDigitalEditor(preset.getPresetDigitalEditor());
break;
}
}
// 计算申报人数
Integer presetPersons = chosen.getPresetPositionEditor() + chosen.getPresetPositionSubeditor() + chosen.getPresetPositionEditorial() + chosen.getPresetDigitalEditor();
// 计算当选人数
Integer chosenPersons = chosen.getChosenPositionEditor() + chosen.getChosenPositionSubeditor() + chosen.getChosenPositionEditorial() + chosen.getIsDigitalEditor();
chosen.setPresetPersons(presetPersons);
chosen.setChosenPersons(chosenPersons);
chosen.setState(1);
list.add(chosen);
}
if (flag) {
presets.removeAll(delList);
for (DeclarationSituationSchoolResultVO preset : presets) {
// 计算申报人数
Integer presetPersons = preset.getPresetPositionEditor() + preset.getPresetPositionSubeditor() + preset.getPresetPositionEditorial() + preset.getPresetDigitalEditor();
preset.setPresetPersons(presetPersons);
preset.setState(1);
list.add(preset);
}
}
pageResult.setRows(list);
pageResult.setTotal(total);
}
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class MaterialServiceImpl method listMaterials.
@Override
public PageResult<MaterialListVO> listMaterials(PageParameter<MaterialListVO> pageParameter, String sessionId) throws CheckedServiceException {
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (ObjectUtil.isNull(pmphUser)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "用户为空");
}
if (ObjectUtil.isNull(pageParameter)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "参数为空");
}
PageResult<MaterialListVO> pageResult = new PageResult<>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
List<MaterialListVO> list = new ArrayList<>();
if (pmphUser.getIsAdmin()) {
pageParameter.getParameter().setIsMy(null);
}
if (null != pageParameter.getParameter().getIsMy() && !pageParameter.getParameter().getIsMy()) {
pageParameter.getParameter().setIsMy(null);
}
if (!ObjectUtil.isNull(pageParameter.getParameter().getIsMy()) && pageParameter.getParameter().getIsMy()) {
pageParameter.getParameter().setUserId(pmphUser.getId());
}
Integer total = 0;
String state = pageParameter.getParameter().getState();
if ("已结束".equals(state)) {
pageParameter.getParameter().setIsAllTextbookPublished(true);
pageParameter.getParameter().setIsForceEnd(true);
pageParameter.getParameter().setIsPublished(true);
total = materialDao.listMaterialEndTotal(pageParameter);
if (total > 0) {
list = materialDao.listMaterialEnd(pageParameter);
}
} else {
if (!StringUtil.isEmpty(state)) {
switch(state) {
case "未发布":
pageParameter.getParameter().setIsAllTextbookPublished(false);
pageParameter.getParameter().setIsForceEnd(false);
pageParameter.getParameter().setIsPublished(false);
break;
case "已发布":
pageParameter.getParameter().setIsAllTextbookPublished(false);
pageParameter.getParameter().setIsForceEnd(false);
pageParameter.getParameter().setIsPublished(true);
break;
case "未结束":
pageParameter.getParameter().setIsAllTextbookPublished(false);
pageParameter.getParameter().setIsForceEnd(false);
pageParameter.getParameter().setIsPublished(null);
break;
default:
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.ILLEGAL_PARAM, "教材状态错误");
}
}
total = materialDao.listMaterialTotal(pageParameter);
if (total > 0) {
list = materialDao.listMaterial(pageParameter);
}
}
list = addMaterialContact(list, sessionId);
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 getListWriterPointLogExchange.
@Override
public PageResult<WriterPointLogVO> getListWriterPointLogExchange(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.listWriterPointLogVOExchange(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 WriterUserServiceImpl method getTeacherCheckList.
@Override
public PageResult<WriterUserManagerVO> getTeacherCheckList(PageParameter<WriterUserManagerVO> pageParameter) throws CheckedServiceException {
PageResult<WriterUserManagerVO> pageResult = new PageResult<WriterUserManagerVO>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
List<WriterUserManagerVO> writerUserManagerVOList = writerUserDao.getTeacherCheckList(pageParameter);
for (WriterUserManagerVO writerUserManagerVO : writerUserManagerVOList) {
switch(writerUserManagerVO.getRank()) {
case 0:
writerUserManagerVO.setRankName("普通用户");
break;
case 1:
writerUserManagerVO.setRankName("教师用户");
break;
case 2:
writerUserManagerVO.setRankName("作家用户");
break;
case 3:
writerUserManagerVO.setRankName("专家用户");
break;
default:
throw new CheckedServiceException(CheckedExceptionBusiness.WRITER_USER_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "该用户没有身份");
}
}
if (CollectionUtil.isNotEmpty(writerUserManagerVOList)) {
Integer count = writerUserManagerVOList.get(0).getCount();
pageResult.setTotal(count);
pageResult.setRows(writerUserManagerVOList);
}
return pageResult;
}
Aggregations