Search in sources :

Example 11 with BussinessLog

use of com.zyd.blog.business.annotation.BussinessLog in project OneBlog by zhangyd-c.

the class RestNoticeController method release.

@RequiresPermissions("notice:release")
@PostMapping("/release/{id}")
@BussinessLog("发布公告通知")
public ResponseVO release(@PathVariable Long id) {
    try {
        Notice notice = new Notice();
        notice.setId(id);
        notice.setStatus(NoticeStatusEnum.RELEASE.toString());
        noticeService.updateSelective(notice);
    } catch (Exception e) {
        e.printStackTrace();
        return ResultUtil.error("通知发布失败,状态不变!");
    }
    return ResultUtil.success("该通知已发布,可去前台页面查看效果!");
}
Also used : Notice(com.zyd.blog.business.entity.Notice) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) PostMapping(org.springframework.web.bind.annotation.PostMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Example 12 with BussinessLog

use of com.zyd.blog.business.annotation.BussinessLog in project OneBlog by zhangyd-c.

the class RestNoticeController method add.

@RequiresPermissions("notice:add")
@PostMapping(value = "/add")
@BussinessLog("添加公告通知")
public ResponseVO add(Notice notice) {
    User user = SessionUtil.getUser();
    if (null != user) {
        notice.setUserId(user.getId());
    }
    noticeService.insert(notice);
    return ResultUtil.success("系统通知添加成功");
}
Also used : User(com.zyd.blog.business.entity.User) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) PostMapping(org.springframework.web.bind.annotation.PostMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Example 13 with BussinessLog

use of com.zyd.blog.business.annotation.BussinessLog in project OneBlog by zhangyd-c.

the class RestNoticeController method withdraw.

@RequiresPermissions("notice:withdraw")
@PostMapping("/withdraw/{id}")
@BussinessLog("撤回公告通知")
public ResponseVO withdraw(@PathVariable Long id) {
    try {
        Notice notice = new Notice();
        notice.setId(id);
        notice.setStatus(NoticeStatusEnum.NOT_RELEASE.toString());
        noticeService.updateSelective(notice);
    } catch (Exception e) {
        e.printStackTrace();
        return ResultUtil.error("通知撤回失败,状态不变!");
    }
    return ResultUtil.success("该通知已撤回,可修改后重新发布!");
}
Also used : Notice(com.zyd.blog.business.entity.Notice) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) PostMapping(org.springframework.web.bind.annotation.PostMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Example 14 with BussinessLog

use of com.zyd.blog.business.annotation.BussinessLog in project OneBlog by zhangyd-c.

the class RenderController method tag.

/**
 * 标签列表
 *
 * @param tagId
 * @param model
 * @return
 */
@GetMapping("/tag/{tagId}")
@BussinessLog(value = "进入文章标签[{1}]列表页", platform = PlatformEnum.WEB)
public ModelAndView tag(@PathVariable("tagId") Long tagId, Model model) {
    ArticleConditionVO vo = new ArticleConditionVO();
    vo.setTagId(tagId);
    model.addAttribute("url", "tag/" + tagId);
    loadIndexPage(vo, model);
    return ResultUtil.view(INDEX_URL);
}
Also used : ArticleConditionVO(com.zyd.blog.business.vo.ArticleConditionVO) GetMapping(org.springframework.web.bind.annotation.GetMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Example 15 with BussinessLog

use of com.zyd.blog.business.annotation.BussinessLog in project OneBlog by zhangyd-c.

the class RenderController method tag.

/**
 * 标签列表(分页)
 *
 * @param tagId
 * @param pageNumber
 * @param model
 * @return
 */
@GetMapping("/tag/{tagId}/{pageNumber}")
@BussinessLog(value = "进入文章标签[{1}]列表第{2}页", platform = PlatformEnum.WEB)
public ModelAndView tag(@PathVariable("tagId") Long tagId, @PathVariable("pageNumber") Integer pageNumber, Model model) {
    ArticleConditionVO vo = new ArticleConditionVO();
    vo.setTagId(tagId);
    vo.setPageNumber(pageNumber);
    model.addAttribute("url", "tag/" + tagId);
    loadIndexPage(vo, model);
    return ResultUtil.view(INDEX_URL);
}
Also used : ArticleConditionVO(com.zyd.blog.business.vo.ArticleConditionVO) GetMapping(org.springframework.web.bind.annotation.GetMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Aggregations

BussinessLog (com.zyd.blog.business.annotation.BussinessLog)18 RequiresPermissions (org.apache.shiro.authz.annotation.RequiresPermissions)9 PostMapping (org.springframework.web.bind.annotation.PostMapping)9 GetMapping (org.springframework.web.bind.annotation.GetMapping)7 ArticleConditionVO (com.zyd.blog.business.vo.ArticleConditionVO)4 User (com.zyd.blog.business.entity.User)3 HashMap (java.util.HashMap)3 JSONObject (com.alibaba.fastjson.JSONObject)2 Article (com.zyd.blog.business.entity.Article)2 Notice (com.zyd.blog.business.entity.Notice)2 FileUploader (com.zyd.blog.file.FileUploader)2 VirtualFile (com.zyd.blog.file.entity.VirtualFile)2 ZhydCommentException (com.zyd.blog.framework.exception.ZhydCommentException)2 GlobalFileUploader (com.zyd.blog.plugin.file.GlobalFileUploader)2 JSONArray (com.alibaba.fastjson.JSONArray)1 Comment (com.zyd.blog.business.entity.Comment)1 Template (com.zyd.blog.business.entity.Template)1 PlatformEnum (com.zyd.blog.business.enums.PlatformEnum)1 ZhydArticleException (com.zyd.blog.framework.exception.ZhydArticleException)1 ZhydException (com.zyd.blog.framework.exception.ZhydException)1