Java Code Examples for com.akaxin.proto.core.GroupProto#GroupProfile
The following examples show how to use
com.akaxin.proto.core.GroupProto#GroupProfile .
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: HttpGroupService.java From wind-im with Apache License 2.0 | 5 votes |
/** * /hai/group/profile : 获取群组资料 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { HaiGroupProfileProto.HaiGroupProfileRequest request = HaiGroupProfileProto.HaiGroupProfileRequest .parseFrom(command.getParams()); String groupId = request.getGroupId(); LogUtils.requestDebugLog(logger, command, request.toString()); GroupProfileBean groupBean = UserGroupDao.getInstance().getGroupProfile(groupId); if (groupBean != null && StringUtils.isNotBlank(groupBean.getGroupId())) { GroupProto.GroupProfile groupProfile = GroupProto.GroupProfile.newBuilder() .setId(groupBean.getGroupId()).setName(String.valueOf(groupBean.getGroupName())) .setIcon(String.valueOf(groupBean.getGroupPhoto())).build(); HaiGroupProfileProto.HaiGroupProfileResponse.Builder responseBuilder = HaiGroupProfileProto.HaiGroupProfileResponse .newBuilder(); responseBuilder.setProfile(groupProfile); commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 2
Source File: HttpGroupService.java From openzaly with Apache License 2.0 | 5 votes |
/** * /hai/group/profile : 获取群组资料 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { HaiGroupProfileProto.HaiGroupProfileRequest request = HaiGroupProfileProto.HaiGroupProfileRequest .parseFrom(command.getParams()); String groupId = request.getGroupId(); LogUtils.requestDebugLog(logger, command, request.toString()); GroupProfileBean groupBean = UserGroupDao.getInstance().getGroupProfile(groupId); if (groupBean != null && StringUtils.isNotBlank(groupBean.getGroupId())) { GroupProto.GroupProfile groupProfile = GroupProto.GroupProfile.newBuilder() .setId(groupBean.getGroupId()).setName(String.valueOf(groupBean.getGroupName())) .setIcon(String.valueOf(groupBean.getGroupPhoto())).build(); HaiGroupProfileProto.HaiGroupProfileResponse.Builder responseBuilder = HaiGroupProfileProto.HaiGroupProfileResponse .newBuilder(); responseBuilder.setProfile(groupProfile); commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 3
Source File: HttpGroupService.java From openzaly with Apache License 2.0 | 5 votes |
/** * /hai/group/profile : 获取群组资料 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { HaiGroupProfileProto.HaiGroupProfileRequest request = HaiGroupProfileProto.HaiGroupProfileRequest .parseFrom(command.getParams()); String groupId = request.getGroupId(); LogUtils.requestDebugLog(logger, command, request.toString()); GroupProfileBean groupBean = UserGroupDao.getInstance().getGroupProfile(groupId); if (groupBean != null && StringUtils.isNotBlank(groupBean.getGroupId())) { GroupProto.GroupProfile groupProfile = GroupProto.GroupProfile.newBuilder() .setId(groupBean.getGroupId()).setName(String.valueOf(groupBean.getGroupName())) .setIcon(String.valueOf(groupBean.getGroupPhoto())).build(); HaiGroupProfileProto.HaiGroupProfileResponse.Builder responseBuilder = HaiGroupProfileProto.HaiGroupProfileResponse .newBuilder(); responseBuilder.setProfile(groupProfile); commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 4
Source File: ApiGroupService.java From wind-im with Apache License 2.0 | 4 votes |
/** * 获取群资料信息,一般由以下几部分组成 <br> * 1.群资料GroupProfile <br> * 2.群主基本资料GroupMaster,群主通过GroupProfile获取 <br> * 3.群成员人数以及排在最前列的四位用户 <br> * 4.无权限限制 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); IErrorCode errCode = ErrorCode2.ERROR; try { ApiGroupProfileProto.ApiGroupProfileRequest request = ApiGroupProfileProto.ApiGroupProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String groupId = request.getGroupId(); int pageNum = 1; int pageSize = GroupConfig.GROUP_MIN_MEMBER_COUNT; LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAnyEmpty(siteUserId, groupId)) { throw new ZalyException(ErrorCode2.ERROR_PARAMETER); } if (!checkGroupStatus(groupId)) { throw new ZalyException(ErrorCode2.ERROR_GROUP_DELETED); } GroupProfileBean groupBean = UserGroupDao.getInstance().getGroupProfile(groupId); if (groupBean == null || StringUtils.isEmpty(groupBean.getGroupId())) { throw new ZalyException(ErrorCode2.ERROR_GROUP_QUERY_PROFILE); } SimpleUserBean ownerProfileBean = UserProfileDao.getInstance() .getSimpleProfileById(groupBean.getCreateUserId()); logger.debug("get groupId={},groupOwner={}", groupId, ownerProfileBean.toString()); int groupMembersCount = UserGroupDao.getInstance().getGroupMemberCount(groupId); logger.debug("get groupId={},groupMembers={}", groupId, groupMembersCount); List<GroupMemberBean> groupMemberList = UserGroupDao.getInstance().getGroupMemberList(groupId, pageNum, pageSize); UserProto.UserProfile ownerProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(String.valueOf(ownerProfileBean.getUserId())) .setUserPhoto(String.valueOf(ownerProfileBean.getUserPhoto())) .setUserName(String.valueOf(ownerProfileBean.getUserName())).build(); GroupProto.GroupProfile groupProfile = GroupProto.GroupProfile.newBuilder().setId(groupBean.getGroupId()) .setName(String.valueOf(groupBean.getGroupName())) .setIcon(String.valueOf(groupBean.getGroupPhoto())).build(); ApiGroupProfileProto.ApiGroupProfileResponse.Builder responseBuilder = ApiGroupProfileProto.ApiGroupProfileResponse .newBuilder(); responseBuilder.setOwner(ownerProfile); responseBuilder.setProfile(groupProfile); responseBuilder.setGroupMemberCount(groupMembersCount); for (GroupMemberBean memberBean : groupMemberList) { UserProto.UserProfile memberProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(String.valueOf(memberBean.getUserId())) .setUserPhoto(String.valueOf(memberBean.getUserPhoto())) .setUserName(String.valueOf(memberBean.getUserName())).build(); GroupProto.GroupMemberProfile groupMemberProfile = GroupProto.GroupMemberProfile.newBuilder() .setProfile(memberProfile).build(); responseBuilder.addGroupLastestMember(groupMemberProfile); } // 是否可以邀请群聊(除了群主以外) responseBuilder.setCloseInviteGroupChat(groupBean.isCloseInviteGroupChat()); ApiGroupProfileProto.ApiGroupProfileResponse response = responseBuilder.build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } catch (Exception e) { if (e instanceof ZalyException) { errCode = ((ZalyException) e).getErrCode(); } else { errCode = ErrorCode2.ERROR_SYSTEMERROR; } LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode(errCode); }
Example 5
Source File: ApiGroupService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 获取群资料信息,一般由以下几部分组成 <br> * 1.群资料GroupProfile <br> * 2.群主基本资料GroupMaster,群主通过GroupProfile获取 <br> * 3.群成员人数以及排在最前列的四位用户 <br> * 4.无权限限制 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); IErrorCode errCode = ErrorCode2.ERROR; try { ApiGroupProfileProto.ApiGroupProfileRequest request = ApiGroupProfileProto.ApiGroupProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String groupId = request.getGroupId(); int pageNum = 1; int pageSize = GroupConfig.GROUP_MIN_MEMBER_COUNT; LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAnyEmpty(siteUserId, groupId)) { throw new ZalyException(ErrorCode2.ERROR_PARAMETER); } if (!checkGroupStatus(groupId)) { throw new ZalyException(ErrorCode2.ERROR_GROUP_DELETED); } GroupProfileBean groupBean = UserGroupDao.getInstance().getGroupProfile(groupId); if (groupBean == null || StringUtils.isEmpty(groupBean.getGroupId())) { throw new ZalyException(ErrorCode2.ERROR_GROUP_QUERY_PROFILE); } SimpleUserBean ownerProfileBean = UserProfileDao.getInstance() .getSimpleProfileById(groupBean.getCreateUserId()); logger.debug("get groupId={},groupOwner={}", groupId, ownerProfileBean.toString()); int groupMembersCount = UserGroupDao.getInstance().getGroupMemberCount(groupId); logger.debug("get groupId={},groupMembers={}", groupId, groupMembersCount); List<GroupMemberBean> groupMemberList = UserGroupDao.getInstance().getGroupMemberList(groupId, pageNum, pageSize); UserProto.UserProfile ownerProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(String.valueOf(ownerProfileBean.getUserId())) .setUserPhoto(String.valueOf(ownerProfileBean.getUserPhoto())) .setUserName(String.valueOf(ownerProfileBean.getUserName())).build(); GroupProto.GroupProfile groupProfile = GroupProto.GroupProfile.newBuilder().setId(groupBean.getGroupId()) .setName(String.valueOf(groupBean.getGroupName())) .setIcon(String.valueOf(groupBean.getGroupPhoto())).build(); ApiGroupProfileProto.ApiGroupProfileResponse.Builder responseBuilder = ApiGroupProfileProto.ApiGroupProfileResponse .newBuilder(); responseBuilder.setOwner(ownerProfile); responseBuilder.setProfile(groupProfile); responseBuilder.setGroupMemberCount(groupMembersCount); for (GroupMemberBean memberBean : groupMemberList) { UserProto.UserProfile memberProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(String.valueOf(memberBean.getUserId())) .setUserPhoto(String.valueOf(memberBean.getUserPhoto())) .setUserName(String.valueOf(memberBean.getUserName())).build(); GroupProto.GroupMemberProfile groupMemberProfile = GroupProto.GroupMemberProfile.newBuilder() .setProfile(memberProfile).build(); responseBuilder.addGroupLastestMember(groupMemberProfile); } // 是否可以邀请群聊(除了群主以外) responseBuilder.setCloseInviteGroupChat(groupBean.isCloseInviteGroupChat()); ApiGroupProfileProto.ApiGroupProfileResponse response = responseBuilder.build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } catch (Exception e) { if (e instanceof ZalyException) { errCode = ((ZalyException) e).getErrCode(); } else { errCode = ErrorCode2.ERROR_SYSTEMERROR; } LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode(errCode); }
Example 6
Source File: ApiGroupService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 获取群资料信息,一般由以下几部分组成 <br> * 1.群资料GroupProfile <br> * 2.群主基本资料GroupMaster,群主通过GroupProfile获取 <br> * 3.群成员人数以及排在最前列的四位用户 <br> * 4.无权限限制 * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); IErrorCode errCode = ErrorCode2.ERROR; try { ApiGroupProfileProto.ApiGroupProfileRequest request = ApiGroupProfileProto.ApiGroupProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String groupId = request.getGroupId(); int pageNum = 1; int pageSize = GroupConfig.GROUP_MIN_MEMBER_COUNT; LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAnyEmpty(siteUserId, groupId)) { throw new ZalyException(ErrorCode2.ERROR_PARAMETER); } if (!checkGroupStatus(groupId)) { throw new ZalyException(ErrorCode2.ERROR_GROUP_DELETED); } GroupProfileBean groupBean = UserGroupDao.getInstance().getGroupProfile(groupId); if (groupBean == null || StringUtils.isEmpty(groupBean.getGroupId())) { throw new ZalyException(ErrorCode2.ERROR_GROUP_QUERY_PROFILE); } SimpleUserBean ownerProfileBean = UserProfileDao.getInstance() .getSimpleProfileById(groupBean.getCreateUserId()); logger.debug("get groupId={},groupOwner={}", groupId, ownerProfileBean.toString()); int groupMembersCount = UserGroupDao.getInstance().getGroupMemberCount(groupId); logger.debug("get groupId={},groupMembers={}", groupId, groupMembersCount); List<GroupMemberBean> groupMemberList = UserGroupDao.getInstance().getGroupMemberList(groupId, pageNum, pageSize); UserProto.UserProfile ownerProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(String.valueOf(ownerProfileBean.getUserId())) .setUserPhoto(String.valueOf(ownerProfileBean.getUserPhoto())) .setUserName(String.valueOf(ownerProfileBean.getUserName())).build(); GroupProto.GroupProfile groupProfile = GroupProto.GroupProfile.newBuilder().setId(groupBean.getGroupId()) .setName(String.valueOf(groupBean.getGroupName())) .setIcon(String.valueOf(groupBean.getGroupPhoto())).build(); ApiGroupProfileProto.ApiGroupProfileResponse.Builder responseBuilder = ApiGroupProfileProto.ApiGroupProfileResponse .newBuilder(); responseBuilder.setOwner(ownerProfile); responseBuilder.setProfile(groupProfile); responseBuilder.setGroupMemberCount(groupMembersCount); for (GroupMemberBean memberBean : groupMemberList) { UserProto.UserProfile memberProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(String.valueOf(memberBean.getUserId())) .setUserPhoto(String.valueOf(memberBean.getUserPhoto())) .setUserName(String.valueOf(memberBean.getUserName())).build(); GroupProto.GroupMemberProfile groupMemberProfile = GroupProto.GroupMemberProfile.newBuilder() .setProfile(memberProfile).build(); responseBuilder.addGroupLastestMember(groupMemberProfile); } // 是否可以邀请群聊(除了群主以外) responseBuilder.setCloseInviteGroupChat(groupBean.isCloseInviteGroupChat()); ApiGroupProfileProto.ApiGroupProfileResponse response = responseBuilder.build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } catch (Exception e) { if (e instanceof ZalyException) { errCode = ((ZalyException) e).getErrCode(); } else { errCode = ErrorCode2.ERROR_SYSTEMERROR; } LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode(errCode); }