use of com.duan.blogos.entity.blogger.BloggerProfile in project BlogSystem by DuanJiaNing.
the class BloggerPageController method mainPage.
@RequestMapping("/archives")
public ModelAndView mainPage(HttpServletRequest request, @PathVariable String bloggerName) {
ModelAndView mv = new ModelAndView();
mv.setViewName("blogger/main");
BloggerAccount account = accountService.getAccount(bloggerName);
if (account == null) {
request.setAttribute("code", UnknownBloggerException.code);
mv.setViewName("/blogger/register");
return mv;
}
mv.addObject(bloggerProperties.getNameOfPageOwnerBloggerId(), account.getId());
mv.addObject(bloggerProperties.getNameOfPageOwnerBloggerName(), account.getUsername());
int ownerId = account.getId();
BloggerProfile profile = bloggerProfileService.getBloggerProfile(ownerId);
mv.addObject("blogName", profile.getIntro());
mv.addObject("aboutMe", profile.getAboutMe());
mv.addObject("avatarId", Optional.ofNullable(profile.getAvatarId()).orElse(bloggerPictureService.getDefaultPicture(BloggerPictureCategoryEnum.DEFAULT_BLOGGER_AVATAR).getId()));
ResultBean<BloggerStatisticsDTO> ownerBgStat = statisticsService.getBloggerStatistics(ownerId);
mv.addObject("ownerBgStat", ownerBgStat.getData());
int loginBgId;
if ((loginBgId = sessionManager.getLoginBloggerId(request)) != -1) {
ResultBean<BloggerStatisticsDTO> loginBgStat = statisticsService.getBloggerStatistics(loginBgId);
mv.addObject("loginBgStat", loginBgStat.getData());
}
BloggerSetting setting = settingService.getSetting(ownerId);
mv.addObject("setting", setting);
return mv;
}
use of com.duan.blogos.entity.blogger.BloggerProfile in project BlogSystem by DuanJiaNing.
the class BloggerProfileController method get.
/**
* 获取资料
*/
@RequestMapping(method = RequestMethod.GET)
public ResultBean<BloggerProfile> get(HttpServletRequest request, @PathVariable Integer bloggerId) {
handleAccountCheck(request, bloggerId);
BloggerProfile profile = bloggerProfileService.getBloggerProfile(bloggerId);
if (profile == null)
handlerEmptyResult(request);
return new ResultBean<>(profile);
}
Aggregations