/** * 好友分享 * * @param ctuser * @param ly * @param ep * @return */ public JSONObject recommendSharing(IpavuserEntity ctuser, String ly, String ep) { JSONObject rtn = new JSONObject(); Pattern p = Pattern.compile("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\\.([a-zA-Z0-9_-])+)+$"); Matcher m = p.matcher(ep); boolean b = m.matches(); if (b) { try { messageUtil.sendrecommendMail(ctuser.getUsername(), ep, ly); } catch (Exception e) { rtn.put("msg", e.getMessage()); return rtn; } rtn.put("msg", "分享成功"); } else { p = Pattern.compile("^((170)|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"); m = p.matcher(ep); b = m.matches(); if (b == true) { try { messageUtil.sendrecommendPhone(ctuser.getUsername(), ep, ly); } catch (Exception e) { rtn.put("msg", e.getMessage()); return rtn; } rtn.put("msg", "分享成功"); } else { rtn.put("msg", "邮箱或手机号码有误"); } } return rtn; }
/** * 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); }
/** * 得到所有说说赞的人的信息 * * @param actionid * @param actiontype * @return */ public List searchPraiseUser( Long actionid, Integer actiontype, Integer pageNo, Integer pageSize, Integer tip) { List<Map> listMap = new ArrayList<Map>(); // 根据说说id得到所有赞过的人id List<IpavuserEntity> list = publicSearchPraiseUser(actionid, actiontype, pageNo, pageSize, tip); for (IpavuserEntity user : list) { if (user != null) { Map map = new HashMap<String, Object>(); map.put("userid", user.getUserid()); map.put("username", user.getUsername()); map.put( "userImageUrl", ContentUtil.IMAGE_ROOT + ContentUtil.IMAGEPATHS.get("user") + user.getPicpath()); listMap.add(map); } } return listMap; }
/** * 邀请同事发送邮件或者短信 * * @throws Exception */ public Map invitationFriend(String username, String name, String mailOrphone) throws Exception { Map map = new HashMap<String, String>(); IpavuserEntity user = new IpavuserEntity(); user.setUsername(name); Pattern p = Pattern.compile("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\\.([a-zA-Z0-9_-])+)+$"); Matcher m = p.matcher(mailOrphone); boolean b = m.matches(); if (b == true) { user.setEmail(mailOrphone); user.setRegtype(ContentUtil.REGIST_TYPE_EMIAL); Map usersqlmap = new HashMap<String, Object>(); usersqlmap.put("email", mailOrphone); usersqlmap.put("regtype", "E"); IpavuserEntity sqluser = userMapper.getUserByUniKey(usersqlmap); if (sqluser != null) { map.put("msg", "您邀请的好友已经存在快捷管家系统中"); return map; } Map remap = new HashMap<String, Object>(); remap.put("user", user); remap.put("iname", username); userService.regist(remap); map.put("msg", "success"); } else { p = Pattern.compile("^((170)|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"); m = p.matcher(mailOrphone); b = m.matches(); if (b == true) { Map usersqlmap = new HashMap<String, Object>(); usersqlmap.put("mobile", mailOrphone); usersqlmap.put("regtype", "M"); IpavuserEntity sqluser = userMapper.getUserByUniKey(usersqlmap); if (sqluser != null) { map.put("msg", "您邀请的好友已经存在贵公司"); return map; } user.setMobile(mailOrphone); user.setRegtype(ContentUtil.REGIST_TYPE_MOBILE); Map remap = new HashMap<String, Object>(); remap.put("user", user); remap.put("iname", username); userService.regist(remap); map.put("msg", "success"); } else { map.put("msg", "您的邮箱或者号码有误."); } } return map; }