use of com.duan.blogos.dto.blog.BlogStatisticsCountDTO in project BlogSystem by DuanJiaNing.
the class BlogStatisticsServiceImpl method getBlogStatisticsCount.
@Override
public ResultBean<BlogStatisticsCountDTO> getBlogStatisticsCount(int blogId) {
BlogStatistics statistics = statisticsDao.getStatistics(blogId);
if (statistics == null)
return null;
BlogStatisticsCountDTO dto = dataFillingManager.blogStatisticsCountToDTO(statistics);
return new ResultBean<>(dto);
}
use of com.duan.blogos.dto.blog.BlogStatisticsCountDTO in project BlogSystem by DuanJiaNing.
the class BlogReadPageController method page.
@RequestMapping
public ModelAndView page(HttpServletRequest request, @PathVariable String bloggerName, @PathVariable String blogName) {
ModelAndView mv = new ModelAndView();
// 博文作者博主账户
BloggerAccount account = accountService.getAccount(bloggerName);
if (account == null) {
mv.setViewName("error/error");
mv.addObject("code", 6);
mv.addObject(bloggerProperties.getSessionNameOfErrorMsg(), "博主不存在!");
return mv;
}
int blogId = blogService.getBlogId(account.getId(), blogName);
if (blogId == -1) {
mv.setViewName("error/error");
mv.addObject("code", 5);
mv.addObject(bloggerProperties.getSessionNameOfErrorMsg(), "博文不存在!");
return mv;
}
// 博文浏览次数自增1
statisticsService.updateBlogViewCountPlus(blogId);
ResultBean<BlogMainContentDTO> mainContent = blogBrowseService.getBlogMainContent(blogId);
ResultBean<BlogStatisticsCountDTO> statistics = statisticsService.getBlogStatisticsCount(blogId);
mv.addObject("blogOwnerBloggerId", account.getId());
mv.addObject("main", mainContent.getData());
mv.addObject("stat", statistics.getData());
// 登陆博主 id
int loginBloggerId = sessionManager.getLoginBloggerId(request);
ResultBean<BloggerStatisticsDTO> loginBgStat = bloggerStatisticsService.getBloggerStatistics(loginBloggerId);
mv.addObject("loginBgStat", loginBgStat.getData());
if (loginBloggerId != -1) {
if (likeService.getLikeState(loginBloggerId, blogId))
mv.addObject("likeState", true);
if (collectBlogService.getCollectState(loginBloggerId, blogId))
mv.addObject("collectState", true);
}
mv.setViewName("blogger/read_blog");
return mv;
}
Aggregations