Search in sources :

Example 96 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project topcom-cloud by 545314690.

the class ServiceController method verifyCode.

@RequestMapping(method = RequestMethod.GET, value = "verifyCode")
@ResponseBody
public String verifyCode(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // 设置响应头信息,告诉浏览器不要缓存此内容
    response.setHeader("Pragma", "No-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expire", 0);
    /**
     * 加上这个前台ajax才能获得自定义的header
     * response.setHeader("Access-Control-Expose-Headers", "custom header");
     * response.setHeader("costum header", "custom header value");
     */
    response.setHeader("Access-Control-Expose-Headers", codeHeader);
    String code = UUID.randomUUID().toString();
    response.setHeader(codeHeader, code);
    RandomVerifyCode randomVerifyCode = new RandomVerifyCode();
    try {
        // 输出图片方法
        RandomVerifyCode.VerifyCode verifyCode = randomVerifyCode.getBase64Randcode();
        if (verifyCode != null) {
            SubjectUtil.setCaptcha(code, verifyCode.code);
            return verifyCode.image;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : RandomVerifyCode(com.topcom.cms.utils.RandomVerifyCode) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 97 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project topcom-cloud by 545314690.

the class CollectionController method isCollected.

/**
 * 根据输入,返回分页结果中的当前页,包括当前页信息和其中的实体对象集合
 *
 * @param request
 * @param response
 * @return
 */
@RequestMapping(value = "/isCollected.json", method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public boolean isCollected(HttpServletRequest request, HttpServletResponse response, String oId) {
    boolean isCollected = false;
    Collection collection = this.collectionManager.findByOId(oId);
    if (collection != null) {
        isCollected = true;
    }
    return isCollected;
}
Also used : Collection(com.topcom.cms.yuqing.domain.Collection) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 98 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project pmph by BCSquad.

the class BookUserCommentController method list.

/**
 * 功能描述:分页初始化/模糊查询图书评论
 *
 * @param pageSize
 *            当页的数据条数
 * @param pageNumber
 *            当前页码
 * @param name
 *            数据名称/isbn
 * @param isAuth
 *            是否通过审核
 * @return
 */
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页初始化/模糊查询图书评论")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ResponseBean list(Integer pageSize, Integer pageNumber, String name, Integer isAuth, Boolean isLong) {
    PageParameter<BookUserCommentVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
    BookUserCommentVO bookUserCommentVO = new BookUserCommentVO();
    bookUserCommentVO.setIsAuth(isAuth);
    // 去除空格
    bookUserCommentVO.setName(name.replaceAll(" ", ""));
    bookUserCommentVO.setIsLong(isLong);
    pageParameter.setParameter(bookUserCommentVO);
    return new ResponseBean(bookUserCommentService.listBookUserComment(pageParameter));
}
Also used : BookUserCommentVO(com.bc.pmpheep.back.vo.BookUserCommentVO) 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 99 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project pmph by BCSquad.

the class BookVideoController method addVideo.

@ResponseBody
@RequestMapping(value = "/addVideo", method = RequestMethod.POST)
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "保存微视频信息")
public ResponseBean<Integer> addVideo(Long userId, Long bookId, String title, String origPath, String origFileName, Long origFileSize, String path, String fileName, Long fileSize, @RequestParam("cover") MultipartFile cover) throws IOException {
    BookVideo bookVideo = new BookVideo();
    bookVideo.setBookId(bookId);
    bookVideo.setTitle(title);
    bookVideo.setOrigPath(origPath);
    bookVideo.setOrigFileName(origFileName);
    bookVideo.setOrigFileSize(origFileSize);
    bookVideo.setPath(path);
    bookVideo.setFileName(fileName);
    bookVideo.setFileSize(fileSize);
    return new ResponseBean(bookVideoService.addBookVideoFront(userId, bookVideo, cover));
}
Also used : ResponseBean(com.bc.pmpheep.controller.bean.ResponseBean) BookVideo(com.bc.pmpheep.back.po.BookVideo) LogDetail(com.bc.pmpheep.annotation.LogDetail) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 100 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project pmph by BCSquad.

the class BookVideoController method addBookVideo.

/**
 * 保存视频
 *
 * @param request
 * @param cover
 * @throws java.io.IOException
 * @introduction
 * @author Mryang
 * @createDate 2018年2月10日 下午5:34:12
 * @return
 */
@ResponseBody
@RequestMapping(value = "/addBookVideo", method = RequestMethod.POST)
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "保存微视频信息")
public ResponseBean<Integer> addBookVideo(HttpServletRequest request, Long bookId, String title, String origPath, String origFileName, Long origFileSize, String path, String fileName, Long fileSize, @RequestParam("cover") MultipartFile cover) throws IOException {
    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.setBookId(bookId);
    bookVideo.setTitle(title);
    bookVideo.setOrigPath(origPath);
    bookVideo.setOrigFileName(origFileName);
    bookVideo.setOrigFileSize(origFileSize);
    bookVideo.setPath(path);
    bookVideo.setFileName(fileName);
    bookVideo.setFileSize(fileSize);
    return new ResponseBean(bookVideoService.addBookVideo(sessionId, bookVideo, cover));
}
Also used : ResponseBean(com.bc.pmpheep.controller.bean.ResponseBean) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) BookVideo(com.bc.pmpheep.back.po.BookVideo) LogDetail(com.bc.pmpheep.annotation.LogDetail) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1991 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1700 HashMap (java.util.HashMap)458 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)212 IOException (java.io.IOException)207 JSONObject (com.alibaba.fastjson.JSONObject)200 Map (java.util.Map)172 ApiOperation (io.swagger.annotations.ApiOperation)170 ArrayList (java.util.ArrayList)169 GetMapping (org.springframework.web.bind.annotation.GetMapping)112 ResponseEntity (org.springframework.http.ResponseEntity)102 ApiRest (build.dream.common.api.ApiRest)101 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)101 AuthPassport (com.ngtesting.platform.util.AuthPassport)99 PostMapping (org.springframework.web.bind.annotation.PostMapping)94 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)87 Date (java.util.Date)81 UserVo (com.ngtesting.platform.vo.UserVo)78 LogDetail (com.bc.pmpheep.annotation.LogDetail)71 ResponseBean (com.bc.pmpheep.controller.bean.ResponseBean)65