use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.
the class ApiUserService method mute.
public CommandResponse mute(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
String siteUserId = command.getSiteUserId();
boolean mute = UserProfileDao.getInstance().getUserMute(siteUserId);
LogUtils.requestDebugLog(logger, command, "");
ApiUserMuteProto.ApiUserMuteResponse response = ApiUserMuteProto.ApiUserMuteResponse.newBuilder().setMute(mute).build();
commandResponse.setParams(response.toByteArray());
errCode = ErrorCode2.SUCCESS;
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.
the class ApiUserService method updateMute.
public CommandResponse updateMute(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiUserUpdateMuteProto.ApiUserUpdateMuteRequest request = ApiUserUpdateMuteProto.ApiUserUpdateMuteRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
boolean mute = request.getMute();
LogUtils.requestDebugLog(logger, command, request.toString());
if (UserProfileDao.getInstance().updateUserMute(siteUserId, mute)) {
errCode = ErrorCode2.SUCCESS;
} else {
errCode = ErrorCode2.ERROR_DATABASE_EXECUTE;
}
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.
the class ApiUserService method updateProfile.
/**
* 更新用户个人信息
*
* @param command
* @return
*/
public CommandResponse updateProfile(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiUserUpdateProfileProto.ApiUserUpdateProfileRequest request = ApiUserUpdateProfileProto.ApiUserUpdateProfileRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String userName = request.getUserProfile().getUserName();
String userPhoto = request.getUserProfile().getUserPhoto();
String introduce = request.getUserProfile().getSelfIntroduce();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNoneEmpty(siteUserId, userName, userPhoto)) {
UserProfileBean userBean = new UserProfileBean();
userBean.setSiteUserId(siteUserId);
userBean.setUserName(userName);
userBean.setUserPhoto(userPhoto);
userBean.setSelfIntroduce(introduce);
if (UserProfileDao.getInstance().updateUserProfile(userBean)) {
errCode = ErrorCode2.SUCCESS;
} else {
errCode = ErrorCode2.ERROR2_USER_UPDATE_PROFILE;
}
} else {
errCode = ErrorCode2.ERROR_PARAMETER;
}
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.
the class HttpGroupService method nonmembers.
public CommandResponse nonmembers(Command command) {
CommandResponse commandResponse = new CommandResponse();
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
HaiGroupNonmembersProto.HaiGroupNonmembersRequest request = HaiGroupNonmembersProto.HaiGroupNonmembersRequest.parseFrom(command.getParams());
String groupId = request.getGroupId();
int pageNum = request.getPageNumber();
int pageSize = request.getPageSize();
LogUtils.requestDebugLog(logger, command, request.toString());
List<GroupMemberBean> memberList = UserGroupDao.getInstance().getNonGroupMemberList(groupId, pageNum, pageSize);
HaiGroupNonmembersProto.HaiGroupNonmembersResponse.Builder responseBuilder = HaiGroupNonmembersProto.HaiGroupNonmembersResponse.newBuilder();
for (GroupMemberBean member : memberList) {
GroupProto.GroupMemberRole memberRole = GroupProto.GroupMemberRole.NONMEMBER;
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.addGroupMember(groupMember);
}
commandResponse.setParams(responseBuilder.build().toByteArray());
errCode = ErrorCode2.SUCCESS;
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.
the class HttpGroupService method members.
/**
* 获取群成员列表
*
* @param command
* @return
*/
public CommandResponse members(Command command) {
CommandResponse commandResponse = new CommandResponse();
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
HaiGroupMembersProto.HaiGroupMembersRequest request = HaiGroupMembersProto.HaiGroupMembersRequest.parseFrom(command.getParams());
String groupId = request.getGroupId();
int pageNum = request.getPageNumber();
int pageSize = request.getPageSize();
if (pageNum == 0 && pageSize == 0) {
pageNum = 1;
pageSize = GroupConfig.GROUP_MAX_MEMBER_COUNT;
}
LogUtils.requestDebugLog(logger, command, request.toString());
List<GroupMemberBean> memberList = UserGroupDao.getInstance().getGroupMemberList(groupId, pageNum, pageSize);
HaiGroupMembersProto.HaiGroupMembersResponse.Builder responseBuilder = HaiGroupMembersProto.HaiGroupMembersResponse.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.addGroupMember(groupMember);
}
commandResponse.setParams(responseBuilder.build().toByteArray());
errCode = ErrorCode2.SUCCESS;
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
Aggregations