/** * 邀请同事发送邮件或者短信 * * @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; }
/** * 添加用户与角色的映射关系 * * @param userids * @param rolenos */ @Transactional public void addUserRole(String[] userids, String[] rolenos) { if (userids != null && rolenos != null) { for (int i = 0; i < userids.length; i++) { String userid = userids[i]; Map parm = new HashMap(); parm.put("userid", userid); userMapper.delUserRole(userid); for (int j = 0; j < rolenos.length; j++) { String roleno = rolenos[j]; parm.put("roleno", roleno); userMapper.addUserRole(parm); } } } }
/** * TODO 龚严华 员工授权页面去掉自己的信息 * * @param userids * @param rolenos */ public List queryRoleUserDelMy(Map map, String userid) { List<Map> list = userMapper.queryRoleUser(map); for (int i = 0; i < list.size(); i++) { Map mapp = list.get(i); if (mapp.get("userid").equals(userid)) { list.remove(i); } } return list; }
/** 得到赞的用户信息 */ 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; }
// add by zhuyx 20150310 public int queryRoleUserCount(Map map) { return userMapper.queryRoleUserCount(map); }
/** * 查询当前角色的用户集合 * * @param map * @return */ public List queryRoleUser(Map map) { return userMapper.queryRoleUser(map); }