Search in sources :

Example 6 with Comment

use of com.zyd.blog.business.entity.Comment in project OneBlog by zhangyd-c.

the class RestCommentController method audit.

@RequiresPermissions("comment:audit")
@PostMapping("/audit")
@BussinessLog("审核评论")
public ResponseVO audit(Comment comment, String contentText, Boolean sendEmail) {
    try {
        commentService.updateSelective(comment);
        if (!StringUtils.isEmpty(contentText)) {
            comment.setContent(contentText);
            commentService.commentForAdmin(comment);
        }
        if (null != sendEmail && sendEmail) {
            Comment commentDB = commentService.getByPrimaryKey(comment.getId());
            mailService.send(commentDB, TemplateKeyEnum.TM_COMMENT_AUDIT, true);
        }
    } catch (Exception e) {
        e.printStackTrace();
        return ResultUtil.error("评论审核失败!");
    }
    return ResultUtil.success(ResponseStatus.SUCCESS);
}
Also used : Comment(com.zyd.blog.business.entity.Comment) ZhydCommentException(com.zyd.blog.framework.exception.ZhydCommentException) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) PostMapping(org.springframework.web.bind.annotation.PostMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Aggregations

Comment (com.zyd.blog.business.entity.Comment)6 BizComment (com.zyd.blog.persistence.beans.BizComment)4 ZhydCommentException (com.zyd.blog.framework.exception.ZhydCommentException)2 PageInfo (com.github.pagehelper.PageInfo)1 BaseJunitTest (com.zyd.blog.BaseJunitTest)1 BussinessLog (com.zyd.blog.business.annotation.BussinessLog)1 BizCommentDTO (com.zyd.blog.business.dto.BizCommentDTO)1 RequiresPermissions (org.apache.shiro.authz.annotation.RequiresPermissions)1 Test (org.junit.Test)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1