示例#1
0
 /**
  * * 查询回复根据评论id
  *
  * @param comment
  */
 public Map queryCommentByCommentid(Integer commentid, Integer pageSize) {
   Integer pageNo = 0;
   if (pageSize == null) {
     pageSize = 5;
   }
   int replySize = commReplyService.queryReplyCount(commentid.longValue());
   ;
   if (pageSize == -1) {
     pageNo = null;
     pageSize = null;
   } else if (replySize > pageSize) {
     pageNo = replySize - pageSize;
   }
   Map map = new HashMap<String, Object>();
   IpavcommentEntity comment =
       commReplyService.queryCommentByCommentid(commentid.longValue(), pageNo, pageSize);
   Integer surplusSize = null;
   if ((pageNo == null || pageNo != 0) && comment.getReplys() != null) {
     surplusSize = replySize - comment.getReplys().size();
   }
   map.put("surplusSize", surplusSize);
   List<IpavcommentEntity> comments = new ArrayList<IpavcommentEntity>();
   comments.add(comment);
   map.put("comment", comments);
   return map;
 }
示例#2
0
 /** 根据说说id得到它的评论 */
 public Map queryCommentBySid(Long sid, Integer pageSize) {
   Map<String, Object> rtnMap = new HashMap<String, Object>();
   Integer pageNo = null;
   int size = commReplyService.queryPraiseOrCommentCount(1, sid, 1);
   if (pageSize == null) {
     pageSize = 10;
   }
   if (pageSize == -1) {
     pageSize = null;
   } else {
     if (size > pageSize) pageNo = size - pageSize + 1;
     else pageNo = 0;
   }
   List<IpavcommentEntity> list = commReplyService.queryCommentById(1, sid, 1, pageNo, pageSize);
   List<Map> mapList = new ArrayList<Map>();
   for (IpavcommentEntity comment : list) {
     Map map = new HashMap<String, Object>();
     map.put("commuserimg", comment.getCommuserimg());
     map.put("commcontent", comment.getCommcontent());
     map.put("commusername", comment.getCommusername());
     map.put("commuserid", comment.getCommuserid());
     map.put("commentid", comment.getCommentid());
     map.put("replys", comment.getReplys());
     mapList.add(map);
   }
   rtnMap.put("commList", mapList);
   rtnMap.put("sid", sid);
   Integer surplusSize = null;
   if ((pageNo == null || pageNo != 0) && list != null) {
     surplusSize = size - list.size();
   }
   rtnMap.put("surplusSize", surplusSize);
   rtnMap.put("size", size);
   return rtnMap;
 }
示例#3
0
 /** 将说说集合转换成前台需要的map */
 private List SayListToMap(List<IpavsayEntity> saylist, String userid) {
   List<Map> rtnList = new ArrayList<Map>();
   for (IpavsayEntity say : saylist) {
     say.setSaydate(IpavcommReplyService.DateToString(say.getSaydate()));
     Map map = new HashMap<String, Object>();
     if (say.getSayuserid().equals(userid)) {
       map.put("isMyTopic", "Y");
     } else {
       map.put("isMyTopic", "N");
     }
     Map filemap = new HashMap<String, Object>();
     filemap.put("actionid", say.getSayid());
     filemap.put("actiontype", 5);
     IpavActionFileEntity file = sayImageMapper.queryActionfileByAction(filemap);
     if (file != null) {
       Map fmap = new HashMap<String, Object>();
       fmap.put("name", file.getFilename());
       fmap.put("path", file.getFilepath());
       map.put("fmap", fmap);
     }
     Map commentMap = queryCommentBySid(say.getSayid(), 10);
     map.put("commentMap", commentMap);
     map.put("say", say);
     map.put("praisSize", commReplyService.queryPraiseOrCommentCount(1, say.getSayid(), 0));
     map.put("isPrais", commReplyService.queryIsPraiseOrComment(1, say.getSayid(), 0, userid, 0));
     map.put("CommentSize", commReplyService.queryPraiseOrCommentCount(1, say.getSayid(), 1));
     List<Map> userPraises = searchPraiseUser(say.getSayid(), 1, null, null, 1);
     map.put("userPraises", userPraises);
     rtnList.add(map);
   }
   return rtnList;
 }
示例#4
0
 /** 说说点赞/取消赞 */
 public Map praiseOrCancel(IpavcommentEntity comment) {
   addSayComment(comment);
   Map rtn = new HashMap<String, Object>();
   List<Map> listMap =
       searchPraiseUser(comment.getActionid(), comment.getActiontype(), null, null, 1);
   rtn.put("userList", listMap);
   rtn.put("size", commReplyService.queryPraiseOrCommentCount(1, comment.getActionid(), 0));
   return rtn;
 }
示例#5
0
 /** 得到赞的用户信息 */
 public List publicSearchPraiseUser(
     Long actionid, Integer actiontype, Integer pageNo, Integer pageSize, Integer tip) {
   List<String> list =
       commReplyService.queryUserListByActionId(actionid, actiontype, pageNo, pageSize, tip);
   List<IpavuserEntity> rtnList = new ArrayList<IpavuserEntity>();
   for (String i : list) {
     Map map = new HashMap<String, Object>();
     map.put("userid", i);
     map.put("delflg", "delflg");
     IpavuserEntity user = userMapper.getUserByUniKey(map);
     rtnList.add(user);
   }
   return rtnList;
 }
示例#6
0
 /**
  * * 添加说说回复
  *
  * @param comment
  */
 public void addSayReply(IpavreplyEntity reply) {
   commReplyService.addReply(reply);
 }
示例#7
0
 /**
  * * 添加说说评论
  *
  * @param comment
  */
 public void addSayComment(IpavcommentEntity comment) {
   commReplyService.addComment(comment);
 }
示例#8
0
  /**
   * * 查询所有与当前用户发表的说说相关的动态列表
   *
   * @param userid
   */
  public List getUserSayList(String userid, Integer pageNo, Integer pageSize) {
    List<Map> rtnList = new ArrayList<Map>();
    if (pageNo == null) pageNo = 1;
    if (pageSize == null) pageSize = 10;
    List<Map<String, Object>> saylist = new ArrayList<Map<String, Object>>();
    Map sqlmap = new HashMap<String, Object>();
    sqlmap.put("userid", userid);
    sqlmap.put("pageNo", (pageNo - 1) * pageSize);
    sqlmap.put("pageSize", pageSize);
    saylist = sayMapper.queryUserSayList(sqlmap);
    for (int s = 0; s < saylist.size(); s++) {
      Map say = saylist.get(s);
      say.put(
          "sayuserimg",
          ContentUtil.IMAGE_ROOT + ContentUtil.IMAGEPATHS.get("user") + say.get("sayuserimg"));
      Long sayid = (Long) say.get("sayid");

      pageSize = 5;
      Long commentid = (Long) say.get("commentid");
      int replySize = commReplyService.queryReplyCount(commentid);
      if (replySize > pageSize) {
        pageNo = replySize - pageSize;
      } else {
        pageNo = 0;
      }
      Map map = new HashMap<String, Object>();
      Map sqlmap1 = new HashMap<String, Object>();
      sqlmap1.put("actiontype", 1);
      sqlmap1.put("actionid", sayid);
      List<String> sayimages = sayImageMapper.queryActionfileUrlList(sqlmap1);
      List<String> newsayimages = new ArrayList<String>();
      for (String simg : sayimages) {
        newsayimages.add(ContentUtil.IMAGE_ROOT + ContentUtil.IMAGEPATHS.get("say") + simg);
      }
      say.put("images", newsayimages);
      IpavcommentEntity comment =
          commReplyService.queryCommentByCommentid(commentid, pageNo, pageSize);
      List<IpavcommentEntity> comments = new ArrayList<IpavcommentEntity>();
      comments.add(comment);
      say.put("comments", comments);
      if (comment.getReplys() != null && comment.getReplys().size() > 0) {
        IpavcommentEntity comment1 =
            commReplyService.queryCommentByCommentid(commentid, null, null);
        // String date=comment1.getReplys().get(comment1.getReplys().size()-1).getReplydate();
        // say.put("saydate",(IpavcommReplyService.DateToString(date)));
        for (int i = comment1.getReplys().size() - 1; i >= 0; i--) {
          if (comment1.getReplys().get(i).getBereplyid().equals(userid)
              && !comment1.getReplys().get(i).getReplyuserid().equals(userid)) {
            map.put("uname", comment1.getReplys().get(i).getReplyusername());
            map.put("img", comment1.getReplys().get(i).getReplyuserimg());
            map.put("uid", comment1.getReplys().get(i).getReplyuserid());
            break;
          }
        }
        map.put("type", "回复了");

      } else if (comment.getCommtype() == 0) {
        // map.put("uname",comment.getCommusername());
        map.put("type", "赞了");
      } else {
        // map.put("uname",comment.getCommusername());
        map.put("type", "评论了");
      }

      if (!map.containsKey("img") || comment.getCommtype() == 0) {
        map.put("uname", comment.getCommusername());
        map.put("img", comment.getCommuserimg());
        map.put("uid", comment.getCommuserid());
      }
      say.put("saydate", (IpavcommReplyService.DateToString((String) say.get("saydate"))));
      if (say.get("sayuserid").equals(userid)) {
        map.put("isMyTopic", "Y");
      } else {
        map.put("isMyTopic", "N");
      }
      Map filemap = new HashMap<String, Object>();
      filemap.put("actionid", say.get("sayid"));
      filemap.put("actiontype", 5);
      IpavActionFileEntity file = sayImageMapper.queryActionfileByAction(filemap);
      if (file != null) {
        Map fmap = new HashMap<String, Object>();
        fmap.put("name", file.getFilename());
        fmap.put("path", file.getFilepath());
        map.put("fmap", fmap);
      }
      map.put("say", say);
      map.put("praisSize", commReplyService.queryPraiseOrCommentCount(1, sayid, 0));
      map.put("isPrais", commReplyService.queryIsPraiseOrComment(1, sayid, 0, userid, 0));
      map.put("CommentSize", commReplyService.queryPraiseOrCommentCount(1, sayid, 1));
      Integer surplusSize = null;
      if ((pageNo == null || pageNo != 0) && comment.getReplys() != null) {
        surplusSize = replySize - comment.getReplys().size();
      }
      map.put("surplusSize", surplusSize);
      List<Map> userPraises = searchPraiseUser(sayid, 1, null, null, 1);
      map.put("userPraises", userPraises);
      rtnList.add(map);
    }
    return rtnList;
  }