use of com.akaxin.site.storage.bean.UserGroupBean in project openzaly by akaxincom.
the class ApiGroupService method setting.
/**
* 获取个人对群的设置
*
* @param command
* @return
*/
public CommandResponse setting(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiGroupSettingProto.ApiGroupSettingRequest request = ApiGroupSettingProto.ApiGroupSettingRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String groupId = request.getGroupId();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNoneEmpty(siteUserId, groupId)) {
UserGroupBean bean = UserGroupDao.getInstance().getUserGroupSetting(siteUserId, groupId);
if (bean != null) {
ApiGroupSettingProto.ApiGroupSettingResponse response = ApiGroupSettingProto.ApiGroupSettingResponse.newBuilder().setMessageMute(bean.isMute()).build();
commandResponse.setParams(response.toByteArray());
errCode = ErrorCode2.SUCCESS;
} else {
errCode = ErrorCode2.ERROR_DATABASE_EXECUTE;
}
} 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.site.storage.bean.UserGroupBean in project openzaly by akaxincom.
the class ApiGroupService method updateMute.
/**
* 个人更新群设置信息
*
* @param command
* @return
*/
public CommandResponse updateMute(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiGroupUpdateSettingProto.ApiGroupUpdateSettingRequest request = ApiGroupUpdateSettingProto.ApiGroupUpdateSettingRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String groupId = request.getGroupId();
boolean isMute = request.getMessageMute();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNoneEmpty(siteUserId, groupId)) {
UserGroupBean bean = new UserGroupBean();
bean.setSiteGroupId(groupId);
bean.setMute(isMute);
if (UserGroupDao.getInstance().updateUserGroupSetting(siteUserId, bean)) {
errCode = ErrorCode2.SUCCESS;
} else {
errCode = ErrorCode2.ERROR_DATABASE_EXECUTE;
}
} 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.site.storage.bean.UserGroupBean in project openzaly by akaxincom.
the class ApiGroupService method updateSetting.
/**
* 个人更新群设置信息
*
* @param command
* @return
*/
public CommandResponse updateSetting(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiGroupUpdateSettingProto.ApiGroupUpdateSettingRequest request = ApiGroupUpdateSettingProto.ApiGroupUpdateSettingRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String groupId = request.getGroupId();
boolean isMute = request.getMessageMute();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNoneEmpty(siteUserId, groupId)) {
UserGroupBean bean = new UserGroupBean();
bean.setSiteGroupId(groupId);
bean.setMute(isMute);
if (UserGroupDao.getInstance().updateUserGroupSetting(siteUserId, bean)) {
errCode = ErrorCode2.SUCCESS;
} else {
errCode = ErrorCode2.ERROR_DATABASE_EXECUTE;
}
} 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.site.storage.bean.UserGroupBean in project openzaly by akaxincom.
the class UserGroupDao method getUserGroupSetting.
public UserGroupBean getUserGroupSetting(String siteUserId, String siteGroupId) {
try {
UserGroupBean bean = userGroupDao.getUserGroupSetting(siteUserId, siteGroupId);
if (bean == null) {
bean = new UserGroupBean();
bean.setMute(false);
}
return bean;
} catch (SQLException e) {
logger.error("get user group setting error", e);
}
return null;
}
use of com.akaxin.site.storage.bean.UserGroupBean in project openzaly by akaxincom.
the class ApiGroupService method mute.
public CommandResponse mute(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiGroupMuteProto.ApiGroupMuteRequest request = ApiGroupMuteProto.ApiGroupMuteRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String siteGroupId = request.getSiteGroupId();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNoneEmpty(siteGroupId, siteUserId)) {
UserGroupBean bean = UserGroupDao.getInstance().getUserGroupSetting(siteUserId, siteGroupId);
if (bean != null) {
ApiGroupSettingProto.ApiGroupSettingResponse response = ApiGroupSettingProto.ApiGroupSettingResponse.newBuilder().setMessageMute(bean.isMute()).build();
commandResponse.setParams(response.toByteArray());
errCode = ErrorCode2.SUCCESS;
} else {
errCode = ErrorCode2.ERROR_DATABASE_EXECUTE;
}
} else {
errCode = ErrorCode2.ERROR_PARAMETER;
}
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
Aggregations