Java Code Examples for com.akaxin.proto.core.UserProto#UserRelation
The following examples show how to use
com.akaxin.proto.core.UserProto#UserRelation .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserFriendDao.java From wind-im with Apache License 2.0 | 6 votes |
public UserProto.UserRelation getUserRelation(String siteUserId, String siteFriendId) { int relation = 0; try { relation = userFriendDao.queryRelation(siteUserId, siteFriendId); if (relation == RELATION_NUMBERo) { relation = userFriendDao.queryRelation(siteFriendId, siteUserId); if (relation == RELATION_NUMBERo) { return UserProto.UserRelation.RELATION_FRIEND; } return UserProto.UserRelation.RELATION_CARE; } else { relation = userFriendDao.queryRelation(siteFriendId, siteUserId); if (relation == RELATION_NUMBERo) { return UserProto.UserRelation.RELATION_FANS; } } } catch (SQLException e) { logger.error("get user relation error.siteUserId={} siteFriendId={}", e); } return UserProto.UserRelation.RELATION_NONE; }
Example 2
Source File: UserFriendDao.java From openzaly with Apache License 2.0 | 6 votes |
public UserProto.UserRelation getUserRelation(String siteUserId, String siteFriendId) { int relation = 0; try { relation = userFriendDao.queryRelation(siteUserId, siteFriendId); if (relation == RELATION_NUMBERo) { relation = userFriendDao.queryRelation(siteFriendId, siteUserId); if (relation == RELATION_NUMBERo) { return UserProto.UserRelation.RELATION_FRIEND; } return UserProto.UserRelation.RELATION_CARE; } else { relation = userFriendDao.queryRelation(siteFriendId, siteUserId); if (relation == RELATION_NUMBERo) { return UserProto.UserRelation.RELATION_FANS; } } } catch (SQLException e) { logger.error("get user relation error.siteUserId={} siteFriendId={}", e); } return UserProto.UserRelation.RELATION_NONE; }
Example 3
Source File: UserFriendDao.java From openzaly with Apache License 2.0 | 6 votes |
public UserProto.UserRelation getUserRelation(String siteUserId, String siteFriendId) { int relation = 0; try { relation = userFriendDao.queryRelation(siteUserId, siteFriendId); if (relation == RELATION_NUMBERo) { relation = userFriendDao.queryRelation(siteFriendId, siteUserId); if (relation == RELATION_NUMBERo) { return UserProto.UserRelation.RELATION_FRIEND; } return UserProto.UserRelation.RELATION_CARE; } else { relation = userFriendDao.queryRelation(siteFriendId, siteUserId); if (relation == RELATION_NUMBERo) { return UserProto.UserRelation.RELATION_FANS; } } } catch (SQLException e) { logger.error("get user relation error.siteUserId={} siteFriendId={}", e); } return UserProto.UserRelation.RELATION_NONE; }
Example 4
Source File: UserSquareController.java From wind-im with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @RequestMapping(method = RequestMethod.POST, value = "/pullMemberList") @ResponseBody public Map<String, Object> getMemberList(HttpServletRequest request, @RequestBody byte[] bodyParam) { Map<String, Object> results = new HashMap<String, Object>(); boolean nodata = true; int pageSize = 20; try { PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam); Map<Integer, String> headerMap = pluginPackage.getPluginHeaderMap(); String siteUserId = headerMap.get(PluginProto.PluginHeaderKey.CLIENT_SITE_USER_ID_VALUE); Map<String, String> ReqMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class); int pageNum = Integer.valueOf(ReqMap.get("pageNum")); List<SimpleUserBean> userList = userService.getUserList(pageNum, pageSize); List<Map<String, String>> data = new ArrayList<Map<String, String>>(); if (userList != null && userList.size() > 0) { nodata = false; for (SimpleUserBean bean : userList) { Map<String, String> memberMap = new HashMap<String, String>(); if (siteUserId != bean.getUserId()) { memberMap.put("site_user_id", bean.getUserId()); memberMap.put("site_user_name", bean.getUserName()); memberMap.put("site_user_photo", bean.getUserPhoto()); UserProto.UserRelation userRelation = UserFriendDao.getInstance().getUserRelation(siteUserId, bean.getUserId()); memberMap.put("site_user_relation", String.valueOf(userRelation.getNumber())); } data.add(memberMap); } } results.put("Data", data); } catch (Exception e) { logger.error("get Member list error", e); } results.put("loading", nodata); return results; }
Example 5
Source File: UserSquareController.java From openzaly with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @RequestMapping(method = RequestMethod.POST, value = "/pullMemberList") @ResponseBody public Map<String, Object> getMemberList(HttpServletRequest request, @RequestBody byte[] bodyParam) { Map<String, Object> results = new HashMap<String, Object>(); boolean nodata = true; int pageSize = 20; try { PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam); Map<Integer, String> headerMap = pluginPackage.getPluginHeaderMap(); String siteUserId = headerMap.get(PluginProto.PluginHeaderKey.CLIENT_SITE_USER_ID_VALUE); Map<String, String> ReqMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class); int pageNum = Integer.valueOf(ReqMap.get("pageNum")); List<SimpleUserBean> userList = userService.getUserList(pageNum, pageSize); List<Map<String, String>> data = new ArrayList<Map<String, String>>(); if (userList != null && userList.size() > 0) { nodata = false; for (SimpleUserBean bean : userList) { Map<String, String> memberMap = new HashMap<String, String>(); if (siteUserId != bean.getUserId()) { memberMap.put("site_user_id", bean.getUserId()); memberMap.put("site_user_name", bean.getUserName()); memberMap.put("site_user_photo", bean.getUserPhoto()); UserProto.UserRelation userRelation = UserFriendDao.getInstance().getUserRelation(siteUserId, bean.getUserId()); memberMap.put("site_user_relation", String.valueOf(userRelation.getNumber())); } data.add(memberMap); } } results.put("Data", data); } catch (Exception e) { logger.error("get Member list error", e); } results.put("loading", nodata); return results; }
Example 6
Source File: UserSquareController.java From openzaly with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @RequestMapping(method = RequestMethod.POST, value = "/pullMemberList") @ResponseBody public Map<String, Object> getMemberList(HttpServletRequest request, @RequestBody byte[] bodyParam) { Map<String, Object> results = new HashMap<String, Object>(); boolean nodata = true; try { PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam); Map<Integer, String> headerMap = pluginPackage.getPluginHeaderMap(); String siteUserId = headerMap.get(PluginProto.PluginHeaderKey.CLIENT_SITE_USER_ID_VALUE); Map<String, String> ReqMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class); int pageNum = Integer.valueOf(ReqMap.get("page")); List<SimpleUserBean> userList = userService.getUserList(pageNum, 20); List<Map<String, String>> data = new ArrayList<Map<String, String>>(); if (userList != null && userList.size() > 0) { if (20 == userList.size()) { nodata = false; } for (SimpleUserBean bean : userList) { Map<String, String> memberMap = new HashMap<String, String>(); if (siteUserId != bean.getUserId()) { memberMap.put("site_user_id", bean.getUserId()); memberMap.put("site_user_name", bean.getUserName()); UserProto.UserRelation userRelation = UserFriendDao.getInstance().getUserRelation(siteUserId, bean.getUserId()); memberMap.put("site_user_relation", String.valueOf(userRelation.getNumber())); } data.add(memberMap); } } results.put("Data", data); } catch (Exception e) { logger.error("get Member list error", e); } results.put("loading", nodata); return results; }
Example 7
Source File: ApiFriendService.java From wind-im with Apache License 2.0 | 4 votes |
/** * 查询好友的资料信息,点击好友头像查看使用 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiFriendProfileProto.ApiFriendProfileRequest request = ApiFriendProfileProto.ApiFriendProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String globalOrSiteFriendId = request.getSiteUserId();// 等待查询的站点用户ID || globalUserId String userIdPubk = request.getUserIdPubk(); // 等待查询的用户公钥,优先级高 LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAllEmpty(userIdPubk, globalOrSiteFriendId)) { errCode = ErrorCode2.ERROR_PARAMETER; return commandResponse.setErrCode2(errCode); } // 1.如果是siteUserId UserFriendBean userBean = UserProfileDao.getInstance().getFriendProfileById(siteUserId, globalOrSiteFriendId); // 2.如果不是则认为是globalUserId if (null == userBean || StringUtils.isNotEmpty(userBean.getSiteUserId())) { String siteFriendId = UserProfileDao.getInstance().getSiteUserIdByGlobalUserId(globalOrSiteFriendId); if (StringUtils.isNotEmpty(siteFriendId)) { userBean = UserProfileDao.getInstance().getFriendProfileById(siteUserId, siteFriendId); } } if (userBean != null && StringUtils.isNotBlank(userBean.getSiteUserId())) { UserProto.UserProfile.Builder friendProfileBuilder = UserProto.UserProfile.newBuilder(); friendProfileBuilder.setSiteUserId(userBean.getSiteUserId()); friendProfileBuilder.setUserIdPubk(userBean.getUserIdPubk()); if (StringUtils.isNotEmpty(userBean.getAliasName())) { friendProfileBuilder.setUserName(userBean.getAliasName()); if (StringUtils.isNotEmpty(userBean.getUserName())) { friendProfileBuilder.setNickName(userBean.getUserName()); } } else { if (StringUtils.isNotEmpty(userBean.getUserName())) { friendProfileBuilder.setUserName(userBean.getUserName()); friendProfileBuilder.setNickName(userBean.getUserName()); } } if (StringUtils.isNotEmpty(userBean.getSiteLoginId())) { friendProfileBuilder.setSiteLoginId(userBean.getSiteLoginId()); } if (StringUtils.isNotEmpty(userBean.getUserPhoto())) { friendProfileBuilder.setUserPhoto(userBean.getUserPhoto()); } friendProfileBuilder.setUserStatusValue(userBean.getUserStatus()); UserProto.UserProfile friendProfile = friendProfileBuilder.build(); // 查关系 UserProto.UserRelation userRelation = UserFriendDao.getInstance().getUserRelation(siteUserId, userBean.getSiteUserId()); ApiFriendProfileProto.ApiFriendProfileResponse response = ApiFriendProfileProto.ApiFriendProfileResponse .newBuilder().setProfile(friendProfile).setRelation(userRelation) .setUserIdPubk(userBean.getUserIdPubk()).build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 8
Source File: ApiFriendService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 查询好友的资料信息,点击好友头像查看使用 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiFriendProfileProto.ApiFriendProfileRequest request = ApiFriendProfileProto.ApiFriendProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String globalOrSiteFriendId = request.getSiteUserId();// 等待查询的站点用户ID || globalUserId String userIdPubk = request.getUserIdPubk(); // 等待查询的用户公钥,优先级高 LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAllEmpty(userIdPubk, globalOrSiteFriendId)) { errCode = ErrorCode2.ERROR_PARAMETER; return commandResponse.setErrCode2(errCode); } // 1.如果是siteUserId UserFriendBean userBean = UserProfileDao.getInstance().getFriendProfileById(siteUserId, globalOrSiteFriendId); // 2.如果不是则认为是globalUserId if (null == userBean || StringUtils.isNotEmpty(userBean.getSiteUserId())) { String siteFriendId = UserProfileDao.getInstance().getSiteUserIdByGlobalUserId(globalOrSiteFriendId); if (StringUtils.isNotEmpty(siteFriendId)) { userBean = UserProfileDao.getInstance().getFriendProfileById(siteUserId, siteFriendId); } } if (userBean != null && StringUtils.isNotBlank(userBean.getSiteUserId())) { UserProto.UserProfile.Builder friendProfileBuilder = UserProto.UserProfile.newBuilder(); friendProfileBuilder.setSiteUserId(userBean.getSiteUserId()); friendProfileBuilder.setUserIdPubk(userBean.getUserIdPubk()); if (StringUtils.isNotEmpty(userBean.getAliasName())) { friendProfileBuilder.setUserName(userBean.getAliasName()); if (StringUtils.isNotEmpty(userBean.getUserName())) { friendProfileBuilder.setNickName(userBean.getUserName()); } } else { if (StringUtils.isNotEmpty(userBean.getUserName())) { friendProfileBuilder.setUserName(userBean.getUserName()); friendProfileBuilder.setNickName(userBean.getUserName()); } } if (StringUtils.isNotEmpty(userBean.getSiteLoginId())) { friendProfileBuilder.setSiteLoginId(userBean.getSiteLoginId()); } if (StringUtils.isNotEmpty(userBean.getUserPhoto())) { friendProfileBuilder.setUserPhoto(userBean.getUserPhoto()); } friendProfileBuilder.setUserStatusValue(userBean.getUserStatus()); UserProto.UserProfile friendProfile = friendProfileBuilder.build(); // 查关系 UserProto.UserRelation userRelation = UserFriendDao.getInstance().getUserRelation(siteUserId, userBean.getSiteUserId()); ApiFriendProfileProto.ApiFriendProfileResponse response = ApiFriendProfileProto.ApiFriendProfileResponse .newBuilder().setProfile(friendProfile).setRelation(userRelation) .setUserIdPubk(userBean.getUserIdPubk()).build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 9
Source File: ApiFriendService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 查询好友的资料信息,点击好友头像查看使用 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiFriendProfileProto.ApiFriendProfileRequest request = ApiFriendProfileProto.ApiFriendProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String globalOrSiteFriendId = request.getSiteUserId();// 等待查询的站点用户ID || globalUserId String userIdPubk = request.getUserIdPubk(); // 等待查询的用户公钥,优先级高 LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAllEmpty(userIdPubk, globalOrSiteFriendId)) { errCode = ErrorCode2.ERROR_PARAMETER; return commandResponse.setErrCode2(errCode); } // 1.如果是siteUserId UserFriendBean userBean = UserProfileDao.getInstance().getFriendProfileById(siteUserId, globalOrSiteFriendId); // 2.如果不是则认为是globalUserId if (null == userBean || StringUtils.isNotEmpty(userBean.getSiteUserId())) { String siteFriendId = UserProfileDao.getInstance().getSiteUserIdByGlobalUserId(globalOrSiteFriendId); if (StringUtils.isNotEmpty(siteFriendId)) { userBean = UserProfileDao.getInstance().getFriendProfileById(siteUserId, siteFriendId); } } if (userBean != null && StringUtils.isNotBlank(userBean.getSiteUserId())) { UserProto.UserProfile.Builder friendProfileBuilder = UserProto.UserProfile.newBuilder(); friendProfileBuilder.setSiteUserId(userBean.getSiteUserId()); friendProfileBuilder.setUserIdPubk(userBean.getUserIdPubk()); if (StringUtils.isNotEmpty(userBean.getAliasName())) { friendProfileBuilder.setUserName(userBean.getAliasName()); if (StringUtils.isNotEmpty(userBean.getUserName())) { friendProfileBuilder.setNickName(userBean.getUserName()); } } else { if (StringUtils.isNotEmpty(userBean.getUserName())) { friendProfileBuilder.setUserName(userBean.getUserName()); friendProfileBuilder.setNickName(userBean.getUserName()); } } if (StringUtils.isNotEmpty(userBean.getSiteLoginId())) { friendProfileBuilder.setSiteLoginId(userBean.getSiteLoginId()); } if (StringUtils.isNotEmpty(userBean.getUserPhoto())) { friendProfileBuilder.setUserPhoto(userBean.getUserPhoto()); } friendProfileBuilder.setUserStatusValue(userBean.getUserStatus()); UserProto.UserProfile friendProfile = friendProfileBuilder.build(); // 查关系 UserProto.UserRelation userRelation = UserFriendDao.getInstance().getUserRelation(siteUserId, userBean.getSiteUserId()); ApiFriendProfileProto.ApiFriendProfileResponse response = ApiFriendProfileProto.ApiFriendProfileResponse .newBuilder().setProfile(friendProfile).setRelation(userRelation) .setUserIdPubk(userBean.getUserIdPubk()).build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }