use of com.akaxin.site.storage.bean.UserFriendBean in project openzaly by akaxincom.
the class SQLiteUserFriendDao method queryMute.
public boolean queryMute(String siteUserId, String siteFriendId) throws SQLException {
long startTime = System.currentTimeMillis();
String sql = "SELECT mute FROM " + USER_FRIEND_TABLE + " WHERE site_user_id=? AND site_friend_id=?;";
UserFriendBean bean = null;
PreparedStatement preState = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preState.setString(1, siteUserId);
preState.setString(2, siteFriendId);
ResultSet rs = preState.executeQuery();
if (rs.next()) {
return rs.getBoolean(1);
}
long endTime = System.currentTimeMillis();
LogUtils.dbDebugLog(logger, startTime, bean, sql + siteUserId + "," + siteFriendId);
return true;
}
use of com.akaxin.site.storage.bean.UserFriendBean in project openzaly by akaxincom.
the class SQLiteUserFriendDao method queryUserFriendSetting.
public UserFriendBean queryUserFriendSetting(String siteUserId, String siteFriendId) throws SQLException {
long startTime = System.currentTimeMillis();
String sql = "SELECT mute FROM " + USER_FRIEND_TABLE + " WHERE site_user_id=? AND site_friend_id=?;";
UserFriendBean bean = null;
PreparedStatement preState = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preState.setString(1, siteUserId);
preState.setString(2, siteFriendId);
ResultSet rs = preState.executeQuery();
if (rs.next()) {
bean = new UserFriendBean();
bean.setMute(rs.getBoolean(1));
}
LogUtils.dbDebugLog(logger, startTime, bean, sql, siteUserId, siteFriendId);
return bean;
}
use of com.akaxin.site.storage.bean.UserFriendBean in project openzaly by akaxincom.
the class ApiFriendService method updateSetting.
/**
* 对用户设置消息免打扰功能
*
* @param command
* @return
*/
public CommandResponse updateSetting(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiFriendUpdateSettingProto.ApiFriendUpdateSettingRequest request = ApiFriendUpdateSettingProto.ApiFriendUpdateSettingRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String siteFriendId = request.getSiteFriendId();
boolean messageMute = request.getMessageMute();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNoneBlank(siteUserId, siteFriendId)) {
UserFriendBean friendBean = new UserFriendBean();
friendBean.setSiteUserId(siteFriendId);
friendBean.setMute(messageMute);
if (UserFriendDao.getInstance().updateFriendSetting(siteUserId, friendBean)) {
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.UserFriendBean in project openzaly by akaxincom.
the class ApiFriendService method setting.
/**
* 获取好友的设置信息
*
* @param command
* @return
*/
public CommandResponse setting(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiFriendSettingProto.ApiFriendSettingRequest request = ApiFriendSettingProto.ApiFriendSettingRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String siteFriendId = request.getSiteFriendId();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNoneEmpty(siteUserId, siteFriendId)) {
UserFriendBean bean = UserFriendDao.getInstance().getFriendSetting(siteUserId, siteFriendId);
if (bean != null) {
ApiFriendSettingProto.ApiFriendSettingResponse response = ApiFriendSettingProto.ApiFriendSettingResponse.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.UserFriendBean in project openzaly by akaxincom.
the class UserFriendDao method getFriendSetting.
public UserFriendBean getFriendSetting(String siteUserId, String siteFriendId) {
try {
UserFriendBean bean = userFriendDao.getFriendSetting(siteUserId, siteFriendId);
if (bean == null) {
bean = new UserFriendBean();
bean.setMute(false);
}
return bean;
} catch (SQLException e) {
logger.error("get friend setting error", e);
}
return null;
}
Aggregations