/** * WEB我发布的说说 */ public List myReleaseSays(String userid, Integer pageNo, Integer pageSize) { if (pageNo == null) pageNo = 1; if (pageSize == null) pageSize = 10; List<IpavsayEntity> saylist = new ArrayList<IpavsayEntity>(); IpavuserEntity user = userService.queryUserId(userid); Map<String, Object> sqlMap = new HashMap<String, Object>(); sqlMap.put("companyid", user.getCompanyid()); sqlMap.put("orgid", user.getOrgid()); sqlMap.put("userid", userid); sqlMap.put("pageNo", (pageNo - 1) * pageSize); sqlMap.put("pageSize", pageSize); saylist = sayMapper.querymyReleaseSays(sqlMap); for (IpavsayEntity say : saylist) { IpavuserEntity userr = userService.queryUserId(say.getSayuserid()); if (userr != null) { say.setSayuserimg( ContentUtil.IMAGE_ROOT + ContentUtil.IMAGEPATHS.get("user") + userr.getPicpath()); } Map map = new HashMap<String, Object>(); map.put("actiontype", 1); map.put("actionid", say.getSayid()); List<String> sayimages = sayImageMapper.queryActionfileUrlList(map); List<String> newsayimages = new ArrayList<String>(); for (String simg : sayimages) { newsayimages.add(ContentUtil.IMAGE_ROOT + ContentUtil.IMAGEPATHS.get("say") + simg); } say.setImages(newsayimages); } return SayListToMap(saylist, userid); }
/** 将说说集合转换成前台需要的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; }
/** 删除说说 */ public String delSay(Long sid, String userid) { IpavsayEntity say = sayMapper.querySayById(sid); if (userid.equals(say.getSayuserid())) { int count = sayMapper.deleteSay(sid); if (count == 1) { return "success"; } else { return "error"; } } else { return "您没有此权限"; } }