/**
   * 显示详细内容
   *
   * @param session
   * @param model
   * @param docid
   * @return
   */
  @RequestMapping(params = "method=show", method = RequestMethod.GET)
  public String show(HttpSession session, Model model, int docid, Pager<Comment> paraPage) {
    User user = (User) session.getAttribute("user");
    if (user != null) {
      Document document = documentService.getById(docid);
      if (document != null) {
        if (paraPage == null) paraPage = new Pager<Comment>();
        int totleCount = commentService.getAllCount(docid);

        Pager<Comment> page =
            new Pager<Comment>(totleCount, paraPage.getCurPage(), paraPage.getCountPerPage());
        List<Comment> commentList =
            commentService.getByPage(page.getStartCount(), page.getCountPerPage(), docid);
        if (commentList.isEmpty()) model.addAttribute("msg", "当前还没人翻译,译一下");
        else {
          // 为comment设置User字段
          for (Comment comment : commentList) {
            comment.setUser(userService.getByKey(comment.getUserid()));
            comment.setLikeTime(loveService.CountByComment(comment.getComid()));
            // 如果当前session与该评论的user相同,则可以删除
            if (comment.getUserid().equals(user.getUserid())) comment.setCanDel("1");
          }

          Comment comment = commentService.getByDocAndAc(document.getDocid());
          // 还没接受则可以接受
          if (comment == null) {
            // 如果当前session与此篇文档的用户相同,则可以进行接受操作
            if (document.getUserid().equals(user.getUserid())) model.addAttribute("canAcc", "1");
          } else {
            comment.setUser(userService.getByKey(comment.getUserid()));
            comment.setLikeTime(loveService.CountByComment(comment.getComid()));
            if (comment.getUserid().equals(user.getUserid())) comment.setCanDel("1");
            model.addAttribute("accComment", comment);
          }

          page.settList(commentList);
          model.addAttribute("msg", "已有翻译");
        }
        model.addAttribute("page", page);
        User author = userService.getByKey(document.getUserid());
        model.addAttribute("user", user);
        model.addAttribute("document", document);
        model.addAttribute("author", author);
        model.addAttribute("wantCount", wantService.countByDoc(docid));
        return "document/show";
      }
    }
    return "error";
  }
 /**
  * 添加文档 转发
  *
  * @param session
  * @param model
  * @return
  */
 @RequestMapping(params = "method=add", method = RequestMethod.GET)
 public String add(HttpSession session, Model model) {
   User user = (User) session.getAttribute("user");
   if (user != null) {
     List<Friend> friendList = friendService.getByPrimId(user.getUserid());
     for (Friend friend : friendList) {
       friend.setGuestUser(userService.getByKey(friend.getGuestid()));
     }
     model.addAttribute("followList", friendList);
     model.addAttribute("user", userService.getByKey(user.getUserid()));
     return "document/add";
   } else {
     model.addAttribute("msg", "请登录!");
     return "error";
   }
 }