com.akaxin.proto.site.ApiGroupMembersProto Java Examples
The following examples show how to use
com.akaxin.proto.site.ApiGroupMembersProto.
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: ApiGroupService.java From wind-im with Apache License 2.0 | 4 votes |
/** * 获取群成员 <br> * 无权限控制 * * @param command * @return */ public CommandResponse members(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); IErrorCode errCode = ErrorCode2.ERROR; try { ApiGroupMembersProto.ApiGroupMembersRequest request = ApiGroupMembersProto.ApiGroupMembersRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String siteGroupId = request.getGroupId(); int pageNum = 1; int pageSize = GroupConfig.GROUP_MAX_MEMBER_COUNT; LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAnyEmpty(siteUserId, siteGroupId)) { throw new ZalyException(ErrorCode2.ERROR_PARAMETER); } if (!checkGroupStatus(siteGroupId)) { throw new ZalyException(ErrorCode2.ERROR_GROUP_DELETED); } List<GroupMemberBean> memberList = UserGroupDao.getInstance().getGroupMemberList(siteGroupId, pageNum, pageSize); ApiGroupMembersProto.ApiGroupMembersResponse.Builder responseBuilder = ApiGroupMembersProto.ApiGroupMembersResponse .newBuilder(); for (GroupMemberBean member : memberList) { GroupProto.GroupMemberRole memberRole = GroupProto.GroupMemberRole.forNumber(member.getUserRole()); UserProto.UserProfile memberProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(member.getUserId()).setUserName(String.valueOf(member.getUserName())) .setUserPhoto(String.valueOf(member.getUserPhoto())).build(); GroupProto.GroupMemberProfile groupMember = GroupProto.GroupMemberProfile.newBuilder() .setRole(memberRole).setProfile(memberProfile).build(); responseBuilder.addList(groupMember); } commandResponse.setParams(responseBuilder.build().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 #2
Source File: ApiGroupService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 获取群成员 <br> * 无权限控制 * * @param command * @return */ public CommandResponse members(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); IErrorCode errCode = ErrorCode2.ERROR; try { ApiGroupMembersProto.ApiGroupMembersRequest request = ApiGroupMembersProto.ApiGroupMembersRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String siteGroupId = request.getGroupId(); int pageNum = 1; int pageSize = GroupConfig.GROUP_MAX_MEMBER_COUNT; LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAnyEmpty(siteUserId, siteGroupId)) { throw new ZalyException(ErrorCode2.ERROR_PARAMETER); } if (!checkGroupStatus(siteGroupId)) { throw new ZalyException(ErrorCode2.ERROR_GROUP_DELETED); } List<GroupMemberBean> memberList = UserGroupDao.getInstance().getGroupMemberList(siteGroupId, pageNum, pageSize); ApiGroupMembersProto.ApiGroupMembersResponse.Builder responseBuilder = ApiGroupMembersProto.ApiGroupMembersResponse .newBuilder(); for (GroupMemberBean member : memberList) { GroupProto.GroupMemberRole memberRole = GroupProto.GroupMemberRole.forNumber(member.getUserRole()); UserProto.UserProfile memberProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(member.getUserId()).setUserName(String.valueOf(member.getUserName())) .setUserPhoto(String.valueOf(member.getUserPhoto())).build(); GroupProto.GroupMemberProfile groupMember = GroupProto.GroupMemberProfile.newBuilder() .setRole(memberRole).setProfile(memberProfile).build(); responseBuilder.addList(groupMember); } commandResponse.setParams(responseBuilder.build().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 #3
Source File: ApiGroupService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 获取群成员 <br> * 无权限控制 * * @param command * @return */ public CommandResponse members(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); IErrorCode errCode = ErrorCode2.ERROR; try { ApiGroupMembersProto.ApiGroupMembersRequest request = ApiGroupMembersProto.ApiGroupMembersRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String siteGroupId = request.getGroupId(); int pageNum = 1; int pageSize = GroupConfig.GROUP_MAX_MEMBER_COUNT; LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isAnyEmpty(siteUserId, siteGroupId)) { throw new ZalyException(ErrorCode2.ERROR_PARAMETER); } if (!checkGroupStatus(siteGroupId)) { throw new ZalyException(ErrorCode2.ERROR_GROUP_DELETED); } List<GroupMemberBean> memberList = UserGroupDao.getInstance().getGroupMemberList(siteGroupId, pageNum, pageSize); ApiGroupMembersProto.ApiGroupMembersResponse.Builder responseBuilder = ApiGroupMembersProto.ApiGroupMembersResponse .newBuilder(); for (GroupMemberBean member : memberList) { GroupProto.GroupMemberRole memberRole = GroupProto.GroupMemberRole.forNumber(member.getUserRole()); UserProto.UserProfile memberProfile = UserProto.UserProfile.newBuilder() .setSiteUserId(member.getUserId()).setUserName(String.valueOf(member.getUserName())) .setUserPhoto(String.valueOf(member.getUserPhoto())).build(); GroupProto.GroupMemberProfile groupMember = GroupProto.GroupMemberProfile.newBuilder() .setRole(memberRole).setProfile(memberProfile).build(); responseBuilder.addList(groupMember); } commandResponse.setParams(responseBuilder.build().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); }