com.akaxin.proto.site.ApiGroupListProto Java Examples

The following examples show how to use com.akaxin.proto.site.ApiGroupListProto. 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 5 votes vote down vote up
/**
 * 获取用户群列表 <br>
 * 无权限限制
 *
 * @param command
 * @return
 */
public CommandResponse list(Command command) {
	CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
	IErrorCode errCode = ErrorCode2.ERROR;
	try {
		ApiGroupListProto.ApiGroupListRequest request = ApiGroupListProto.ApiGroupListRequest
				.parseFrom(command.getParams());
		String siteUserId = command.getSiteUserId();
		LogUtils.requestDebugLog(logger, command, request.toString());

		if (StringUtils.isNotBlank(siteUserId) && siteUserId.equals(siteUserId)) {
			List<SimpleGroupBean> groupBeanList = UserGroupDao.getInstance().getUserGroupList(siteUserId);
			ApiGroupListProto.ApiGroupListResponse.Builder responseBuilder = ApiGroupListProto.ApiGroupListResponse
					.newBuilder();
			for (SimpleGroupBean groupBean : groupBeanList) {
				GroupProto.SimpleGroupProfile.Builder groupProfileBuilder = GroupProto.SimpleGroupProfile
						.newBuilder();
				groupProfileBuilder.setGroupId(groupBean.getGroupId());
				if (StringUtils.isNotEmpty(groupBean.getGroupName())) {
					groupProfileBuilder.setGroupName(groupBean.getGroupName());
				}
				if (StringUtils.isNotEmpty(groupBean.getGroupPhoto())) {
					groupProfileBuilder.setGroupIcon(groupBean.getGroupPhoto());
				}
				responseBuilder.addList(groupProfileBuilder.build());
			}
			ApiGroupListProto.ApiGroupListResponse response = responseBuilder.build();
			commandResponse.setParams(response.toByteArray());
			errCode = ErrorCode2.SUCCESS;
		} else {
			errCode = ErrorCode2.ERROR_PARAMETER;
		}
	} catch (Exception e) {
		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 5 votes vote down vote up
/**
 * 获取用户群列表 <br>
 * 无权限限制
 *
 * @param command
 * @return
 */
public CommandResponse list(Command command) {
	CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
	IErrorCode errCode = ErrorCode2.ERROR;
	try {
		ApiGroupListProto.ApiGroupListRequest request = ApiGroupListProto.ApiGroupListRequest
				.parseFrom(command.getParams());
		String siteUserId = command.getSiteUserId();
		LogUtils.requestDebugLog(logger, command, request.toString());

		if (StringUtils.isNotBlank(siteUserId) && siteUserId.equals(siteUserId)) {
			List<SimpleGroupBean> groupBeanList = UserGroupDao.getInstance().getUserGroupList(siteUserId);
			ApiGroupListProto.ApiGroupListResponse.Builder responseBuilder = ApiGroupListProto.ApiGroupListResponse
					.newBuilder();
			for (SimpleGroupBean groupBean : groupBeanList) {
				GroupProto.SimpleGroupProfile.Builder groupProfileBuilder = GroupProto.SimpleGroupProfile
						.newBuilder();
				groupProfileBuilder.setGroupId(groupBean.getGroupId());
				if (StringUtils.isNotEmpty(groupBean.getGroupName())) {
					groupProfileBuilder.setGroupName(groupBean.getGroupName());
				}
				if (StringUtils.isNotEmpty(groupBean.getGroupPhoto())) {
					groupProfileBuilder.setGroupIcon(groupBean.getGroupPhoto());
				}
				responseBuilder.addList(groupProfileBuilder.build());
			}
			ApiGroupListProto.ApiGroupListResponse response = responseBuilder.build();
			commandResponse.setParams(response.toByteArray());
			errCode = ErrorCode2.SUCCESS;
		} else {
			errCode = ErrorCode2.ERROR_PARAMETER;
		}
	} catch (Exception e) {
		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 5 votes vote down vote up
/**
 * 获取用户群列表 <br>
 * 无权限限制
 *
 * @param command
 * @return
 */
public CommandResponse list(Command command) {
	CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
	IErrorCode errCode = ErrorCode2.ERROR;
	try {
		ApiGroupListProto.ApiGroupListRequest request = ApiGroupListProto.ApiGroupListRequest
				.parseFrom(command.getParams());
		String siteUserId = command.getSiteUserId();
		LogUtils.requestDebugLog(logger, command, request.toString());

		if (StringUtils.isNotBlank(siteUserId) && siteUserId.equals(siteUserId)) {
			List<SimpleGroupBean> groupBeanList = UserGroupDao.getInstance().getUserGroupList(siteUserId);
			ApiGroupListProto.ApiGroupListResponse.Builder responseBuilder = ApiGroupListProto.ApiGroupListResponse
					.newBuilder();
			for (SimpleGroupBean groupBean : groupBeanList) {
				GroupProto.SimpleGroupProfile.Builder groupProfileBuilder = GroupProto.SimpleGroupProfile
						.newBuilder();
				groupProfileBuilder.setGroupId(groupBean.getGroupId());
				if (StringUtils.isNotEmpty(groupBean.getGroupName())) {
					groupProfileBuilder.setGroupName(groupBean.getGroupName());
				}
				if (StringUtils.isNotEmpty(groupBean.getGroupPhoto())) {
					groupProfileBuilder.setGroupIcon(groupBean.getGroupPhoto());
				}
				responseBuilder.addList(groupProfileBuilder.build());
			}
			ApiGroupListProto.ApiGroupListResponse response = responseBuilder.build();
			commandResponse.setParams(response.toByteArray());
			errCode = ErrorCode2.SUCCESS;
		} else {
			errCode = ErrorCode2.ERROR_PARAMETER;
		}
	} catch (Exception e) {
		errCode = ErrorCode2.ERROR_SYSTEMERROR;
		LogUtils.requestErrorLog(logger, command, e);
	}
	return commandResponse.setErrCode(errCode);
}