com.akaxin.proto.site.ApiFriendProfileProto Java Examples
The following examples show how to use
com.akaxin.proto.site.ApiFriendProfileProto.
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: 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 #2
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 #3
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); }