use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class CmsContentServiceImpl method listCmsContent.
@Override
public PageResult<CmsContentVO> listCmsContent(PageParameter<CmsContentVO> pageParameter, String sessionId) throws CheckedServiceException {
// 获取当前登陆用户
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (ObjectUtil.isNull(pmphUser) || ObjectUtil.isNull(pmphUser.getId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.CMS, CheckedExceptionResult.NULL_PARAM, "用户为空");
}
if (Const.CMS_CATEGORY_ID_1.longValue() == pageParameter.getParameter().getCategoryId()) {
pageParameter.getParameter().setIsAdmin(true);
} else {
pageParameter.getParameter().setIsAdmin(pmphUser.getIsAdmin());
}
pageParameter.getParameter().setAuthorId(pmphUser.getId());
PageResult<CmsContentVO> pageResult = new PageResult<CmsContentVO>();
// 将页面大小和页面页码拷贝
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// if(cmsContentDao.getCmsContentByAuthorId(pageParameter.getParameter().getAuthorId()).size()>0){
// 包含数据总条数的数据集
List<CmsContentVO> cmsContentList = cmsContentDao.listCmsContent(pageParameter);
if (CollectionUtil.isNotEmpty(cmsContentList)) {
Integer count = cmsContentList.get(0).getCount();
pageResult.setTotal(count);
pageResult.setRows(cmsContentList);
}
// }
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class CmsManualServiceImpl method listCmsManual.
@Override
public PageResult<CmsManualVO> listCmsManual(PageParameter<CmsManualVO> pageParameter, String sessionId) throws CheckedServiceException {
// 获取当前登陆用户
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (ObjectUtil.isNull(pmphUser) || ObjectUtil.isNull(pmphUser.getId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.CMS, CheckedExceptionResult.NULL_PARAM, "用户为空");
}
PageResult<CmsManualVO> pageResult = new PageResult<CmsManualVO>();
// 将页面大小和页面页码拷贝
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// 包含数据总条数的数据集
List<CmsManualVO> cmsManualVOs = cmsManualDao.listCmsManual(pageParameter);
if (CollectionUtil.isNotEmpty(cmsManualVOs)) {
Integer count = cmsManualVOs.get(0).getCount();
pageResult.setTotal(count);
pageResult.setRows(cmsManualVOs);
}
return pageResult;
}
use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.
the class DecPositionServiceImpl method listPresetDeclarationSituationSchoolResultVOs.
@Override
public PageResult<DeclarationSituationSchoolResultVO> listPresetDeclarationSituationSchoolResultVOs(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) {
List<DeclarationSituationSchoolResultVO> presets = decPositionDao.getSchoolResultPreset(pageParameter);
List<DeclarationSituationSchoolResultVO> chosens = decPositionDao.getSchoolResultChosen(pageParameter);
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(2);
list.add(preset);
}
pageResult.setRows(list);
pageResult.setTotal(total);
return pageResult;
}
for (DeclarationSituationSchoolResultVO preset : presets) {
for (DeclarationSituationSchoolResultVO chosen : chosens) {
if (chosen.getOrgId().equals(preset.getOrgId())) {
preset.setChosenPositionEditor(chosen.getChosenPositionEditor());
preset.setChosenPositionSubeditor(chosen.getChosenPositionSubeditor());
preset.setChosenPositionEditorial(chosen.getChosenPositionEditorial());
preset.setIsDigitalEditor(chosen.getIsDigitalEditor());
break;
}
}
// 计算申报人数
Integer presetPersons = preset.getPresetPositionEditor() + preset.getPresetPositionSubeditor() + preset.getPresetPositionEditorial() + preset.getPresetDigitalEditor();
// 计算当选人数
Integer chosenPersons = preset.getChosenPositionEditor() + preset.getChosenPositionSubeditor() + preset.getChosenPositionEditorial() + preset.getIsDigitalEditor();
preset.setPresetPersons(presetPersons);
preset.setChosenPersons(chosenPersons);
preset.setState(2);
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 DecPositionServiceImpl method listDeclarationSituationBookResultVOs.
@Override
public PageResult<DeclarationSituationBookResultVO> listDeclarationSituationBookResultVOs(PageParameter<DeclarationSituationBookResultVO> 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<DeclarationSituationBookResultVO> pageResult = new PageResult<DeclarationSituationBookResultVO>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
int total = decPositionDao.getBooks(pageParameter.getParameter().getMaterialId());
if (total > 0) {
List<DeclarationSituationBookResultVO> books = decPositionDao.getBookListOne(pageParameter);
List<DeclarationSituationBookResultVO> presets = decPositionDao.getBookResultPreset(pageParameter);
List<DeclarationSituationBookResultVO> chosens = decPositionDao.getBookResultChosen(pageParameter);
List<DeclarationSituationBookResultVO> middle = new ArrayList<>();
List<DeclarationSituationBookResultVO> list = new ArrayList<>();
if (null == presets || presets.isEmpty()) {
for (DeclarationSituationBookResultVO book : books) {
// 计算申报人数
Integer presetPersons = book.getPresetPositionEditor() + book.getPresetPositionSubeditor() + book.getPresetPositionEditorial() + book.getPresetDigitalEditor();
book.setPresetPersons(presetPersons);
list.add(book);
}
pageResult.setRows(list);
pageResult.setTotal(total);
return pageResult;
}
for (DeclarationSituationBookResultVO book : books) {
for (DeclarationSituationBookResultVO preset : presets) {
if (preset.getId().equals(book.getId())) {
book.setPresetPositionEditor(preset.getPresetPositionEditor());
book.setPresetPositionSubeditor(preset.getPresetPositionSubeditor());
book.setPresetPositionEditorial(preset.getPresetPositionEditorial());
book.setPresetDigitalEditor(preset.getPresetDigitalEditor());
break;
}
}
// 计算申报人数
Integer presetPersons = book.getPresetPositionEditor() + book.getPresetPositionSubeditor() + book.getPresetPositionEditorial() + book.getPresetDigitalEditor();
book.setPresetPersons(presetPersons);
middle.add(book);
}
if (null == chosens || chosens.isEmpty()) {
pageResult.setRows(middle);
pageResult.setTotal(total);
return pageResult;
}
for (DeclarationSituationBookResultVO book : middle) {
for (DeclarationSituationBookResultVO chosen : chosens) {
if (chosen.getId().equals(book.getId())) {
book.setChosenPositionEditor(chosen.getChosenPositionEditor());
book.setChosenPositionSubeditor(chosen.getChosenPositionSubeditor());
book.setChosenPositionEditorial(chosen.getChosenPositionEditorial());
book.setIsDigitalEditor(chosen.getIsDigitalEditor());
break;
}
}
// 计算当选人数
Integer chosenPersons = book.getChosenPositionEditor() + book.getChosenPositionSubeditor() + book.getChosenPositionEditorial() + book.getIsDigitalEditor();
book.setChosenPersons(chosenPersons);
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 DeclarationServiceImpl method pageDeclaration.
@Override
public PageResult<DeclarationListVO> pageDeclaration(Integer pageNumber, Integer pageSize, Long materialId, String textBookids, String realname, String position, String title, String orgName, Long orgId, String unitName, Integer positionType, Integer onlineProgress, Integer offlineProgress, Boolean haveFile) throws CheckedServiceException {
if (null == materialId) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "教材为空");
}
Gson gson = new Gson();
List<Long> bookIds = gson.fromJson(textBookids, new TypeToken<ArrayList<Long>>() {
}.getType());
// 拼装复合参数
Map<String, Object> map = new HashMap<String, Object>();
map.put("materialId", materialId);
if (null != bookIds && bookIds.size() > 0) {
// 书籍ids
map.put("bookIds", bookIds);
}
if (StringUtil.notEmpty(realname)) {
// 账号或者姓名
map.put("realname", StringUtil.toAllCheck(realname));
}
if (StringUtil.notEmpty(position)) {
// 职务
map.put("position", StringUtil.toAllCheck(position));
}
if (StringUtil.notEmpty(title)) {
// 职称
map.put("title", StringUtil.toAllCheck(title));
}
if (StringUtil.notEmpty(orgName)) {
// 工作单位
map.put("orgName", StringUtil.toAllCheck(orgName));
}
if (null != orgId) {
// 申报单位
map.put("orgId", orgId);
}
if (StringUtil.notEmpty(unitName)) {
// 申报单位
map.put("unitName", StringUtil.toAllCheck(unitName));
}
if (null != positionType && positionType != 0) {
// 申报职位
map.put("positionType", positionType);
}
if (null != onlineProgress && onlineProgress != 0) {
// 学校审核进度
map.put("onlineProgress", onlineProgress);
}
if (null != offlineProgress) {
// 0 未收到 // 2 已收到
// 纸质表进度
map.put("offlineProgress", offlineProgress);
}
if (null != haveFile) {
// 有无教材大纲
map.put("haveFile", haveFile);
}
// 包装参数实体
PageParameter<Map<String, Object>> pageParameter = new PageParameter<Map<String, Object>>(pageNumber, pageSize, map);
// 返回实体
PageResult<DeclarationListVO> pageResult = new PageResult<>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// 获取总数
Integer total = declarationDao.listDeclarationTotal(pageParameter);
if (null != total && total > 0) {
List<DeclarationListVO> rows = declarationDao.listDeclaration(pageParameter);
pageResult.setRows(rows);
}
pageResult.setTotal(total);
return pageResult;
}
Aggregations