Search in sources :

Example 26 with ResponseBean

use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.

the class WriterPointLogController method list.

@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页查询用户积分获取记录列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ResponseBean list(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNumber") Integer pageNumber, @RequestParam("userId") Long userId, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
    PageParameter<WriterPointLogVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
    WriterPointLogVO writerPointLogVO = new WriterPointLogVO();
    writerPointLogVO.setUserId(userId);
    writerPointLogVO.setStartTime(startTime);
    writerPointLogVO.setEndTime(endTime);
    pageParameter.setParameter(writerPointLogVO);
    return new ResponseBean(writerPointLogService.getListWriterPointLog(pageParameter));
}
Also used : WriterPointLogVO(com.bc.pmpheep.back.vo.WriterPointLogVO) 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)

Example 27 with ResponseBean

use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.

the class WriterPointRuleController method list.

/**
 * 分页查询积分规则列表
 * @param pageSize
 * @param pageNumber
 * @param ruleCode
 * @param ruleName
 * @return
 */
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页查询积分规则列表")
@RequestMapping(value = "/pointrule/list", method = RequestMethod.GET)
public ResponseBean list(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNumber") Integer pageNumber, @RequestParam("ruleCode") String ruleCode, @RequestParam("ruleName") String ruleName) {
    PageParameter<WriterPointRuleVO> pageParameter = new PageParameter<WriterPointRuleVO>(pageNumber, pageSize);
    WriterPointRuleVO writerPointRuleVO = new WriterPointRuleVO();
    writerPointRuleVO.setRuleName(ruleName);
    writerPointRuleVO.setRuleCode(ruleCode);
    pageParameter.setParameter(writerPointRuleVO);
    return new ResponseBean(writerPointRuleService.getListWriterPointRule(pageParameter));
}
Also used : WriterPointRuleVO(com.bc.pmpheep.back.vo.WriterPointRuleVO) 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)

Example 28 with ResponseBean

use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.

the class ImageController method avatar.

/**
 * 图片显示
 *
 * @param id 图片在MongoDB中的id
 * @param response 服务响应
 */
@SuppressWarnings({ "rawtypes" })
@RequestMapping(value = "/image/{id}", method = RequestMethod.GET)
public ResponseBean avatar(@PathVariable("id") String id, HttpServletResponse response) {
    response.setContentType("image/png");
    GridFSDBFile file = fileService.get(id);
    if (null == file) {
        // logger.warn("未找到id为'{}'的图片文件", id);
        return new ResponseBean(new CheckedServiceException(CheckedExceptionBusiness.FILE, CheckedExceptionResult.NULL_PARAM, "未找到id为" + id + "的图片文件"));
    }
    try (OutputStream out = response.getOutputStream()) {
        file.writeTo(out);
        out.flush();
        out.close();
    } catch (IOException ex) {
        return new ResponseBean(ex);
    // logger.error("文件下载时出现IO异常:{}", ex.getMessage());
    } catch (Exception ex) {
        logger.warn("图片查看时出现异常:{}", ex.getMessage());
        throw new CheckedServiceException(CheckedExceptionBusiness.TEACHER_CHECK, CheckedExceptionResult.OBJECT_NOT_FOUND, "图片不存在");
    // ResponseBean responseBean = new ResponseBean(ex);
    // responseBean.setMsg("图片不存在");
    // responseBean.setCode(ResponseBean.MONGO_EXCEPTION);
    // return responseBean;
    }
    return new ResponseBean();
}
Also used : GridFSDBFile(com.mongodb.gridfs.GridFSDBFile) OutputStream(java.io.OutputStream) ResponseBean(com.bc.pmpheep.controller.bean.ResponseBean) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) IOException(java.io.IOException) IOException(java.io.IOException) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 29 with ResponseBean

use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.

the class BookController method list.

/**
 * 功能描述:初始化/条件查询书籍信息
 *
 * @param pageSize
 *            当页条数
 * @param pageNumber
 *            当前页数
 * @param type
 *            书籍类别
 * @param name
 *            书籍名称/ISBN
 * @param isOnSale
 *            是否上架
 * @param isNew
 *            是否新书
 * @param isPromote
 *            是否推荐
 * @param path
 *            书籍类别根路径
 * @return
 */
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "初始化/条件查询书籍信息")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ResponseBean list(Integer pageSize, Integer pageNumber, Long type, String name, Boolean isOnSale, Boolean isNew, Boolean isPromote, String path) {
    PageParameter<BookVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
    BookVO bookVO = new BookVO();
    bookVO.setName(name);
    bookVO.setIsNew(isNew);
    bookVO.setPath(path);
    bookVO.setType(type);
    bookVO.setIsOnSale(isOnSale);
    bookVO.setIsPromote(isPromote);
    pageParameter.setParameter(bookVO);
    return new ResponseBean(bookService.listBookVO(pageParameter));
}
Also used : BookVO(com.bc.pmpheep.back.vo.BookVO) 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)

Example 30 with ResponseBean

use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.

the class BookVideoController method audit.

/**
 * 审核视频
 *
 * @introduction
 * @author Mryang
 * @createDate 2018年2月6日 下午5:34:12
 * @return
 */
@ResponseBody
@RequestMapping(value = "/audit", method = RequestMethod.PUT)
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "微视频审核")
public ResponseBean<Integer> audit(HttpServletRequest request, Long id, Boolean isAuth) {
    if (ObjectUtil.isNull(id)) {
        return new ResponseBean(new CheckedServiceException(CheckedExceptionBusiness.BOOK_VEDIO, CheckedExceptionResult.NULL_PARAM, "微视频id不能为空"));
    }
    if (ObjectUtil.isNull(isAuth)) {
        return new ResponseBean(new CheckedServiceException(CheckedExceptionBusiness.BOOK_VEDIO, CheckedExceptionResult.NULL_PARAM, "审核参数不能为空"));
    }
    String sessionId = CookiesUtil.getSessionId(request);
    if (StringUtil.isEmpty(sessionId)) {
        return new ResponseBean(new CheckedServiceException(CheckedExceptionBusiness.BOOK_VEDIO, CheckedExceptionResult.USER_SESSION, "尚未登录或session已过期"));
    }
    BookVideo bookVideo = new BookVideo();
    bookVideo.setId(id).setAuthDate(new Date()).setAuthUserId(SessionUtil.getPmphUserBySessionId(sessionId).getId()).setIsAuth(isAuth);
    return new ResponseBean(bookVideoService.updateBookVideo(bookVideo));
}
Also used : ResponseBean(com.bc.pmpheep.controller.bean.ResponseBean) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) BookVideo(com.bc.pmpheep.back.po.BookVideo) Date(java.util.Date) LogDetail(com.bc.pmpheep.annotation.LogDetail) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ResponseBean (com.bc.pmpheep.controller.bean.ResponseBean)67 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)67 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)65 LogDetail (com.bc.pmpheep.annotation.LogDetail)61 PageParameter (com.bc.pmpheep.back.plugin.PageParameter)37 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)11 IOException (java.io.IOException)11 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 TopicLog (com.bc.pmpheep.back.po.TopicLog)5 DesRun (com.bc.pmpheep.back.util.DesRun)4 Properties (java.util.Properties)4 BookVideo (com.bc.pmpheep.back.po.BookVideo)3 PmphGroupMember (com.bc.pmpheep.back.po.PmphGroupMember)3 PmphUser (com.bc.pmpheep.back.po.PmphUser)3 Topic (com.bc.pmpheep.back.po.Topic)3 PmphGroup (com.bc.pmpheep.back.po.PmphGroup)2 PmphRole (com.bc.pmpheep.back.po.PmphRole)2 WriterUser (com.bc.pmpheep.back.po.WriterUser)2 DeclarationResultSchoolVO (com.bc.pmpheep.back.vo.DeclarationResultSchoolVO)2