com.akaxin.proto.site.ApiUserProfileProto Java Examples
The following examples show how to use
com.akaxin.proto.site.ApiUserProfileProto.
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: ApiUserService.java From wind-im with Apache License 2.0 | 4 votes |
/** * 获取用户个人资料信息,支持使用globalUserid与siteUserId * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errorCode = ErrorCode2.ERROR; try { ApiUserProfileProto.ApiUserProfileRequest request = ApiUserProfileProto.ApiUserProfileRequest .parseFrom(command.getParams()); String currentUserId = command.getSiteUserId(); String siteUserId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteUserId) && siteUserId.equals(currentUserId)) { UserProfileBean userBean = UserProfileDao.getInstance().getUserProfileById(siteUserId); if (null == userBean) { // 理论不会执行到这一步 userBean = UserProfileDao.getInstance().getUserProfileByGlobalUserId(siteUserId); } if (userBean != null && StringUtils.isNotBlank(userBean.getSiteUserId())) { UserProto.UserProfile.Builder userProfileBuilder = UserProto.UserProfile.newBuilder(); userProfileBuilder.setSiteUserId(userBean.getSiteUserId()); if (StringUtils.isNotEmpty(userBean.getUserName())) { userProfileBuilder.setUserName(userBean.getUserName()); } if (StringUtils.isNotEmpty(userBean.getSiteLoginId())) { userProfileBuilder.setSiteLoginId(userBean.getSiteLoginId()); } if (StringUtils.isNotEmpty(userBean.getUserPhoto())) { userProfileBuilder.setUserPhoto(userBean.getUserPhoto()); } if (StringUtils.isNotEmpty(userBean.getSelfIntroduce())) { userProfileBuilder.setSelfIntroduce(userBean.getSelfIntroduce()); } userProfileBuilder.setUserStatusValue(userBean.getUserStatus()); ApiUserProfileProto.ApiUserProfileResponse response = ApiUserProfileProto.ApiUserProfileResponse .newBuilder().setUserProfile(userProfileBuilder.build()).build(); commandResponse.setParams(response.toByteArray()); errorCode = ErrorCode2.SUCCESS; } } else { errorCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errorCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errorCode); }
Example #2
Source File: ApiUserService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 获取用户个人资料信息,支持使用globalUserid与siteUserId * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errorCode = ErrorCode2.ERROR; try { ApiUserProfileProto.ApiUserProfileRequest request = ApiUserProfileProto.ApiUserProfileRequest .parseFrom(command.getParams()); String currentUserId = command.getSiteUserId(); String siteUserId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteUserId) && siteUserId.equals(currentUserId)) { UserProfileBean userBean = UserProfileDao.getInstance().getUserProfileById(siteUserId); if (null == userBean) { // 理论不会执行到这一步 userBean = UserProfileDao.getInstance().getUserProfileByGlobalUserId(siteUserId); } if (userBean != null && StringUtils.isNotBlank(userBean.getSiteUserId())) { UserProto.UserProfile.Builder userProfileBuilder = UserProto.UserProfile.newBuilder(); userProfileBuilder.setSiteUserId(userBean.getSiteUserId()); if (StringUtils.isNotEmpty(userBean.getUserName())) { userProfileBuilder.setUserName(userBean.getUserName()); } if (StringUtils.isNotEmpty(userBean.getSiteLoginId())) { userProfileBuilder.setSiteLoginId(userBean.getSiteLoginId()); } if (StringUtils.isNotEmpty(userBean.getUserPhoto())) { userProfileBuilder.setUserPhoto(userBean.getUserPhoto()); } if (StringUtils.isNotEmpty(userBean.getSelfIntroduce())) { userProfileBuilder.setSelfIntroduce(userBean.getSelfIntroduce()); } userProfileBuilder.setUserStatusValue(userBean.getUserStatus()); ApiUserProfileProto.ApiUserProfileResponse response = ApiUserProfileProto.ApiUserProfileResponse .newBuilder().setUserProfile(userProfileBuilder.build()).build(); commandResponse.setParams(response.toByteArray()); errorCode = ErrorCode2.SUCCESS; } } else { errorCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errorCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errorCode); }
Example #3
Source File: ApiUserService.java From openzaly with Apache License 2.0 | 4 votes |
/** * 获取用户个人资料信息,支持使用globalUserid与siteUserId * * @param command * @return */ public CommandResponse profile(Command command) { CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES); ErrorCode2 errorCode = ErrorCode2.ERROR; try { ApiUserProfileProto.ApiUserProfileRequest request = ApiUserProfileProto.ApiUserProfileRequest .parseFrom(command.getParams()); String currentUserId = command.getSiteUserId(); String siteUserId = request.getSiteUserId(); LogUtils.requestDebugLog(logger, command, request.toString()); if (StringUtils.isNotBlank(siteUserId) && siteUserId.equals(currentUserId)) { UserProfileBean userBean = UserProfileDao.getInstance().getUserProfileById(siteUserId); if (null == userBean) { // 理论不会执行到这一步 userBean = UserProfileDao.getInstance().getUserProfileByGlobalUserId(siteUserId); } if (userBean != null && StringUtils.isNotBlank(userBean.getSiteUserId())) { UserProto.UserProfile.Builder userProfileBuilder = UserProto.UserProfile.newBuilder(); userProfileBuilder.setSiteUserId(userBean.getSiteUserId()); if (StringUtils.isNotEmpty(userBean.getUserName())) { userProfileBuilder.setUserName(userBean.getUserName()); } if (StringUtils.isNotEmpty(userBean.getSiteLoginId())) { userProfileBuilder.setSiteLoginId(userBean.getSiteLoginId()); } if (StringUtils.isNotEmpty(userBean.getUserPhoto())) { userProfileBuilder.setUserPhoto(userBean.getUserPhoto()); } if (StringUtils.isNotEmpty(userBean.getSelfIntroduce())) { userProfileBuilder.setSelfIntroduce(userBean.getSelfIntroduce()); } userProfileBuilder.setUserStatusValue(userBean.getUserStatus()); ApiUserProfileProto.ApiUserProfileResponse response = ApiUserProfileProto.ApiUserProfileResponse .newBuilder().setUserProfile(userProfileBuilder.build()).build(); commandResponse.setParams(response.toByteArray()); errorCode = ErrorCode2.SUCCESS; } } else { errorCode = ErrorCode2.ERROR_PARAMETER; } } catch (Exception e) { errorCode = ErrorCode2.ERROR_SYSTEMERROR; LogUtils.requestErrorLog(logger, command, e); } return commandResponse.setErrCode2(errorCode); }