Example #1
0
 /** * 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);
 }
Example #2
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;
 }
Example #3
0
 /** 删除说说 */
 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 "您没有此权限";
   }
 }
Example #4
0
 /**
  * * 添加说说
  *
  * @param say
  * @param filedata
  */
 public void addSay(
     IpavsayEntity say, MultipartFile[] filedatas, String[] sayusers, Integer fileSize)
     throws Exception {
   String currentdate = FormatUtil.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
   say.setSaydate(currentdate);
   sayMapper.insertSay(say);
   Long sayid = say.getSayid();
   if (filedatas != null && filedatas.length > 0) {
     int i = -1;
     for (MultipartFile filedata : filedatas) {
       i++;
       if (filedata != null && !filedata.isEmpty()) {
         String imagepath = "";
         IpavActionFileEntity sayimage = new IpavActionFileEntity();
         if (fileSize != 0 && filedatas.length - i == fileSize) {
           sayimage.setActiontype(5);
           sayimage.setFilename(filedata.getOriginalFilename());
           imagepath = ImageUtil.saveImage(filedata, ContentUtil.IMAGEPATHS.get("files"));
         } else {
           imagepath = ImageUtil.saveImage(filedata, ContentUtil.IMAGEPATHS.get("say"));
           sayimage.setActiontype(1);
           sayimage.setFilename(filedata.getOriginalFilename());
         }
         sayimage.setFilepath(imagepath);
         sayimage.setActionid(sayid.toString());
         sayimage.setCreatedate(currentdate);
         sayImageMapper.insertActionfile(sayimage);
       }
     }
   }
   // 按指定发表说说,添加指定人
   if (say.getPermission() == 2) {
     if (sayusers != null) {
       for (String userid : sayusers) {
         Map parm = new HashMap();
         parm.put("sayid", sayid);
         parm.put("userid", userid);
         sayMapper.insertSayUsers(parm);
       }
     }
   }
 }