Java Code Examples for com.akaxin.proto.core.DeviceProto#SimpleDeviceProfile
The following examples show how to use
com.akaxin.proto.core.DeviceProto#SimpleDeviceProfile .
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: ApiDeviceService.java From wind-im with Apache License 2.0 | 5 votes |
public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceProfileProto.ApiDeviceProfileRequest request = ApiDeviceProfileProto.ApiDeviceProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String deviceId = request.getDeviceId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteUserId) && StringUtils.isNotBlank(deviceId)) { UserDeviceBean deviceBean = UserDeviceDao.getInstance().getDeviceDetails(siteUserId, deviceId); DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(deviceBean.getDeviceId())) .setDeviceName(String.valueOf(deviceBean.getDeviceName())) .setLastLoginTime(deviceBean.getLoginTime()).build(); ApiDeviceProfileProto.ApiDeviceProfileResponse response = ApiDeviceProfileProto.ApiDeviceProfileResponse .newBuilder().setDeviceProfile(deviceProfile) .setLoginIp(String.valueOf(deviceBean.getDeviceIp())) .setLastActiveTime(deviceBean.getActiveTime()).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.setErrCode2(errCode); }
Example 2
Source File: ApiDeviceService.java From wind-im with Apache License 2.0 | 5 votes |
public CommandResponse list(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceListProto.DeviceListInfoRequest request = ApiDeviceListProto.DeviceListInfoRequest .parseFrom(command.getParams()); String siteFriendId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteFriendId)) { ApiDeviceListProto.DeviceListInfoResponse.Builder responseBuilder = ApiDeviceListProto.DeviceListInfoResponse .newBuilder(); List<UserDeviceBean> deviceList = UserDeviceDao.getInstance().getActiveDeviceList(siteFriendId); for (UserDeviceBean device : deviceList) { DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(device.getDeviceId())) .setDeviceName(String.valueOf(device.getDeviceName())) .setUserDevicePubk(String.valueOf(device.getUserDevicePubk())) // 这里使用活跃时间,上次活跃时间 .setLastLoginTime(device.getActiveTime()).build(); responseBuilder.addList(deviceProfile); } commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 3
Source File: ApiDeviceService.java From wind-im with Apache License 2.0 | 5 votes |
/** * 获取用户在该站点所有关联设备号 * * @param command * @return */ public CommandResponse boundList(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceBoundListProto.ApiDeviceBoundListRequest request = ApiDeviceBoundListProto.ApiDeviceBoundListRequest .parseFrom(command.getParams()); String currentUserId = command.getSiteUserId(); String siteUserId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(currentUserId) && currentUserId.equals(siteUserId)) { ApiDeviceBoundListProto.ApiDeviceBoundListResponse.Builder responseBuilder = ApiDeviceBoundListProto.ApiDeviceBoundListResponse .newBuilder(); List<UserDeviceBean> deviceList = UserDeviceDao.getInstance().getBoundDevices(siteUserId); for (UserDeviceBean device : deviceList) { DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(device.getDeviceId())) .setDeviceName(String.valueOf(device.getDeviceName())) .setLastLoginTime(device.getActiveTime()).build(); responseBuilder.addList(deviceProfile); } commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 4
Source File: ApiDeviceService.java From openzaly with Apache License 2.0 | 5 votes |
public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceProfileProto.ApiDeviceProfileRequest request = ApiDeviceProfileProto.ApiDeviceProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String deviceId = request.getDeviceId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteUserId) && StringUtils.isNotBlank(deviceId)) { UserDeviceBean deviceBean = UserDeviceDao.getInstance().getDeviceDetails(siteUserId, deviceId); DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(deviceBean.getDeviceId())) .setDeviceName(String.valueOf(deviceBean.getDeviceName())) .setLastLoginTime(deviceBean.getLoginTime()).build(); ApiDeviceProfileProto.ApiDeviceProfileResponse response = ApiDeviceProfileProto.ApiDeviceProfileResponse .newBuilder().setDeviceProfile(deviceProfile) .setLoginIp(String.valueOf(deviceBean.getDeviceIp())) .setLastActiveTime(deviceBean.getActiveTime()).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.setErrCode2(errCode); }
Example 5
Source File: ApiDeviceService.java From openzaly with Apache License 2.0 | 5 votes |
public CommandResponse list(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceListProto.DeviceListInfoRequest request = ApiDeviceListProto.DeviceListInfoRequest .parseFrom(command.getParams()); String siteFriendId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteFriendId)) { ApiDeviceListProto.DeviceListInfoResponse.Builder responseBuilder = ApiDeviceListProto.DeviceListInfoResponse .newBuilder(); List<UserDeviceBean> deviceList = UserDeviceDao.getInstance().getActiveDeviceList(siteFriendId); for (UserDeviceBean device : deviceList) { DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(device.getDeviceId())) .setDeviceName(String.valueOf(device.getDeviceName())) .setUserDevicePubk(String.valueOf(device.getUserDevicePubk())) // 这里使用活跃时间,上次活跃时间 .setLastLoginTime(device.getActiveTime()).build(); responseBuilder.addList(deviceProfile); } commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 6
Source File: ApiDeviceService.java From openzaly with Apache License 2.0 | 5 votes |
/** * 获取用户在该站点所有关联设备号 * * @param command * @return */ public CommandResponse boundList(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceBoundListProto.ApiDeviceBoundListRequest request = ApiDeviceBoundListProto.ApiDeviceBoundListRequest .parseFrom(command.getParams()); String currentUserId = command.getSiteUserId(); String siteUserId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(currentUserId) && currentUserId.equals(siteUserId)) { ApiDeviceBoundListProto.ApiDeviceBoundListResponse.Builder responseBuilder = ApiDeviceBoundListProto.ApiDeviceBoundListResponse .newBuilder(); List<UserDeviceBean> deviceList = UserDeviceDao.getInstance().getBoundDevices(siteUserId); for (UserDeviceBean device : deviceList) { DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(device.getDeviceId())) .setDeviceName(String.valueOf(device.getDeviceName())) .setLastLoginTime(device.getActiveTime()).build(); responseBuilder.addList(deviceProfile); } commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 7
Source File: ApiDeviceService.java From openzaly with Apache License 2.0 | 5 votes |
public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceProfileProto.ApiDeviceProfileRequest request = ApiDeviceProfileProto.ApiDeviceProfileRequest .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String deviceId = request.getDeviceId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteUserId) && StringUtils.isNotBlank(deviceId)) { UserDeviceBean deviceBean = UserDeviceDao.getInstance().getDeviceDetails(siteUserId, deviceId); DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(deviceBean.getDeviceId())) .setDeviceName(String.valueOf(deviceBean.getDeviceName())) .setLastLoginTime(deviceBean.getLoginTime()).build(); ApiDeviceProfileProto.ApiDeviceProfileResponse response = ApiDeviceProfileProto.ApiDeviceProfileResponse .newBuilder().setDeviceProfile(deviceProfile) .setLoginIp(String.valueOf(deviceBean.getDeviceIp())) .setLastActiveTime(deviceBean.getActiveTime()).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.setErrCode2(errCode); }
Example 8
Source File: ApiDeviceService.java From openzaly with Apache License 2.0 | 5 votes |
public CommandResponse list(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceListProto.DeviceListInfoRequest request = ApiDeviceListProto.DeviceListInfoRequest .parseFrom(command.getParams()); String siteFriendId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteFriendId)) { ApiDeviceListProto.DeviceListInfoResponse.Builder responseBuilder = ApiDeviceListProto.DeviceListInfoResponse .newBuilder(); List<UserDeviceBean> deviceList = UserDeviceDao.getInstance().getActiveDeviceList(siteFriendId); for (UserDeviceBean device : deviceList) { DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(device.getDeviceId())) .setDeviceName(String.valueOf(device.getDeviceName())) .setUserDevicePubk(String.valueOf(device.getUserDevicePubk())) // 这里使用活跃时间,上次活跃时间 .setLastLoginTime(device.getActiveTime()).build(); responseBuilder.addList(deviceProfile); } commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 9
Source File: ApiDeviceService.java From openzaly with Apache License 2.0 | 5 votes |
/** * 获取用户在该站点所有关联设备号 * * @param command * @return */ public CommandResponse boundList(Command command) { CommandResponse commandResponse = new CommandResponse(); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiDeviceBoundListProto.ApiDeviceBoundListRequest request = ApiDeviceBoundListProto.ApiDeviceBoundListRequest .parseFrom(command.getParams()); String currentUserId = command.getSiteUserId(); String siteUserId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(currentUserId) && currentUserId.equals(siteUserId)) { ApiDeviceBoundListProto.ApiDeviceBoundListResponse.Builder responseBuilder = ApiDeviceBoundListProto.ApiDeviceBoundListResponse .newBuilder(); List<UserDeviceBean> deviceList = UserDeviceDao.getInstance().getBoundDevices(siteUserId); for (UserDeviceBean device : deviceList) { DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(String.valueOf(device.getDeviceId())) .setDeviceName(String.valueOf(device.getDeviceName())) .setLastLoginTime(device.getActiveTime()).build(); responseBuilder.addList(deviceProfile); } commandResponse.setParams(responseBuilder.build().toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 10
Source File: ApiSecretChatService.java From wind-im with Apache License 2.0 | 4 votes |
/** * 申请二人密聊 * * @param command * @return */ public CommandResponse applyU2(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Request request = ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Request .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String siteFriendId = request.getSiteFriendId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNoneBlank(siteUserId, siteFriendId) && !siteUserId.equals(siteFriendId)) { ConfigProto.U2EncryptionConfig status = SiteConfig.getU2EncryStatusConfig(); logger.debug("siteUserId={} apply encryption chat to siteFriendId={} status={}", siteUserId, siteFriendId, status); if (ConfigProto.U2EncryptionConfig.U2_OPEN == status) { UserDeviceBean deviceBean = userDeviceDao.getLatestDevice(siteFriendId); logger.debug("get siteUserId:{} deviceInfo:{}", siteFriendId, deviceBean.toString()); DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(deviceBean.getDeviceId()) .setDeviceName(String.valueOf(deviceBean.getDeviceName())) .setUserDevicePubk(deviceBean.getUserDevicePubk()) .setLastLoginTime(deviceBean.getActiveTime()).build(); ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Response response = ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Response .newBuilder().setDeviceProfile(deviceProfile).build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR2_SECRETCHAT_CLOSE; } } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 11
Source File: ApiSecretChatService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 申请二人密聊 * * @param command * @return */ public CommandResponse applyU2(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Request request = ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Request .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String siteFriendId = request.getSiteFriendId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNoneBlank(siteUserId, siteFriendId) && !siteUserId.equals(siteFriendId)) { ConfigProto.U2EncryptionConfig status = SiteConfig.getU2EncryStatusConfig(); logger.debug("siteUserId={} apply encryption chat to siteFriendId={} status={}", siteUserId, siteFriendId, status); if (ConfigProto.U2EncryptionConfig.U2_OPEN == status) { UserDeviceBean deviceBean = userDeviceDao.getLatestDevice(siteFriendId); logger.debug("get siteUserId:{} deviceInfo:{}", siteFriendId, deviceBean.toString()); DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(deviceBean.getDeviceId()) .setDeviceName(String.valueOf(deviceBean.getDeviceName())) .setUserDevicePubk(deviceBean.getUserDevicePubk()) .setLastLoginTime(deviceBean.getActiveTime()).build(); ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Response response = ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Response .newBuilder().setDeviceProfile(deviceProfile).build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR2_SECRETCHAT_CLOSE; } } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }
Example 12
Source File: ApiSecretChatService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 申请二人密聊 * * @param command * @return */ public CommandResponse applyU2(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errCode = ErrorCode2.ERROR; try { ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Request request = ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Request .parseFrom(command.getParams()); String siteUserId = command.getSiteUserId(); String siteFriendId = request.getSiteFriendId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNoneBlank(siteUserId, siteFriendId) && !siteUserId.equals(siteFriendId)) { ConfigProto.U2EncryptionConfig status = SiteConfig.getU2EncryStatusConfig(); logger.debug("siteUserId={} apply encryption chat to siteFriendId={} status={}", siteUserId, siteFriendId, status); if (ConfigProto.U2EncryptionConfig.U2_OPEN == status) { UserDeviceBean deviceBean = userDeviceDao.getLatestDevice(siteFriendId); logger.debug("get siteUserId:{} deviceInfo:{}", siteFriendId, deviceBean.toString()); DeviceProto.SimpleDeviceProfile deviceProfile = DeviceProto.SimpleDeviceProfile.newBuilder() .setDeviceId(deviceBean.getDeviceId()) .setDeviceName(String.valueOf(deviceBean.getDeviceName())) .setUserDevicePubk(deviceBean.getUserDevicePubk()) .setLastLoginTime(deviceBean.getActiveTime()).build(); ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Response response = ApiSecretChatApplyU2Proto.ApiSecretChatApplyU2Response .newBuilder().setDeviceProfile(deviceProfile).build(); commandResponse.setParams(response.toByteArray()); errCode = ErrorCode2.SUCCESS; } else { errCode = ErrorCode2.ERROR2_SECRETCHAT_CLOSE; } } else { errCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errCode); }