Search in sources :

Example 1 with TopicEditorVO

use of com.bc.pmpheep.back.vo.TopicEditorVO 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;
}
Also used : PmphUser(com.bc.pmpheep.back.po.PmphUser) TopicEditorVO(com.bc.pmpheep.back.vo.TopicEditorVO) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) PageResult(com.bc.pmpheep.back.plugin.PageResult)

Example 2 with TopicEditorVO

use of com.bc.pmpheep.back.vo.TopicEditorVO in project pmph by BCSquad.

the class TopicController method listEditor.

/**
 * Description:后台部门编辑查看可操作的申报选题
 *
 * @author:lyc
 * @date:2017年12月22日下午3:10:12
 * @param request
 * @param pageSize
 *            当前页条数
 * @param pageNumber
 *            当前页数
 * @param bookname
 *            选题名称
 * @param submitTime
 *            提交时间
 * @return ResponseBean
 */
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "部门编辑查看可操作的申报选题")
@RequestMapping(value = "/listEditor", method = RequestMethod.GET)
public ResponseBean listEditor(HttpServletRequest request, Integer pageSize, Integer pageNumber, String bookname, String submitTime) {
    PageParameter<TopicEditorVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
    TopicEditorVO topicEditorVO = new TopicEditorVO();
    topicEditorVO.setBookname(bookname);
    if (StringUtil.isEmpty(submitTime)) {
        topicEditorVO.setSubmitTime(null);
    } else {
        topicEditorVO.setSubmitTime(DateUtil.str2Timestam(submitTime));
    }
    String sessionId = CookiesUtil.getSessionId(request);
    pageParameter.setParameter(topicEditorVO);
    return new ResponseBean(topicService.listTopicEditorVOs(sessionId, pageParameter));
}
Also used : TopicEditorVO(com.bc.pmpheep.back.vo.TopicEditorVO) PageParameter(com.bc.pmpheep.back.plugin.PageParameter) ResponseBean(com.bc.pmpheep.controller.bean.ResponseBean) LogDetail(com.bc.pmpheep.annotation.LogDetail) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

TopicEditorVO (com.bc.pmpheep.back.vo.TopicEditorVO)2 LogDetail (com.bc.pmpheep.annotation.LogDetail)1 PageParameter (com.bc.pmpheep.back.plugin.PageParameter)1 PageResult (com.bc.pmpheep.back.plugin.PageResult)1 PmphUser (com.bc.pmpheep.back.po.PmphUser)1 ResponseBean (com.bc.pmpheep.controller.bean.ResponseBean)1 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1