use of com.akaxin.site.storage.bean.SimpleUserBean in project openzaly by akaxincom.
the class GroupNotice method newGroupMemberNotice.
/**
* 新用户加入了群聊 <br>
* eg:群聊天界面中,<张三 加入了群聊天>
*/
public void newGroupMemberNotice(String siteUserId, String groupId, List<String> userIdList) {
if (StringUtils.isAnyEmpty(siteUserId, groupId) || userIdList == null || userIdList.size() == 0) {
return;
}
StringBuilder noticeText = new StringBuilder();
try {
// 移除群主,群创建者
userIdList.remove(siteUserId);
// 查询群主信息
SimpleUserBean bean = UserProfileDao.getInstance().getSimpleProfileById(siteUserId);
if (bean != null && StringUtils.isNotEmpty(bean.getUserName())) {
noticeText.append(bean.getUserName());
noticeText.append(" 邀请了 ");
}
int num = 0;
for (String userId : userIdList) {
SimpleUserBean memberBean = UserProfileDao.getInstance().getSimpleProfileById(userId);
if (memberBean != null && StringUtils.isNotEmpty(memberBean.getUserName())) {
noticeText.append(memberBean.getUserName());
if (num++ < (userIdList.size() - 1)) {
noticeText.append(",");
}
}
}
noticeText.append(NoticeText.USER_ADD_GROUP);
this.groupMsgNotice(siteUserId, groupId, noticeText.toString());
} catch (Exception e) {
logger.error("new group member notice error. notice=" + noticeText.toString(), e);
}
}
use of com.akaxin.site.storage.bean.SimpleUserBean in project openzaly by akaxincom.
the class SQLiteUserGroupDao method queryUserFriendNonGroupMemberList.
/**
* 查询用户好友中非群成员用户
*
* @param groupId
* @param pageNum
* @param pageSize
* @return
* @throws SQLException
*/
public List<SimpleUserBean> queryUserFriendNonGroupMemberList(String siteUserId, String groupId, int pageNum, int pageSize) throws SQLException {
long startTime = System.currentTimeMillis();
List<SimpleUserBean> userList = new ArrayList<SimpleUserBean>();
int startNum = (pageNum - 1) * pageSize;
String sql = "SELECT a.site_friend_id,b.user_name,b.user_photo FROM " + SQLConst.SITE_USER_FRIEND + " AS a LEFT JOIN " + SQLConst.SITE_USER_PROFILE + " AS b WHERE a.site_friend_id=b.site_user_id AND a.site_user_id=? AND a.site_friend_id NOT IN (SELECT DISTINCT site_user_id FROM " + SQLConst.SITE_USER_GROUP + " WHERE site_group_id=?) LIMIT ?,?;";
PreparedStatement preStatement = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preStatement.setString(1, siteUserId);
preStatement.setString(2, groupId);
preStatement.setInt(3, startNum);
preStatement.setInt(4, pageSize);
ResultSet rs = preStatement.executeQuery();
while (rs.next()) {
SimpleUserBean userBean = new SimpleUserBean();
userBean.setUserId(rs.getString(1));
userBean.setUserName(rs.getString(2));
userBean.setUserPhoto(rs.getString(3));
userList.add(userBean);
}
long endTime = System.currentTimeMillis();
LogUtils.dbDebugLog(logger, startTime, userList.toString(), sql + "," + groupId + "," + startNum + "," + pageSize);
return userList;
}
use of com.akaxin.site.storage.bean.SimpleUserBean in project openzaly by akaxincom.
the class SQLiteUserProfileDao method querySimpleProfileById.
public SimpleUserBean querySimpleProfileById(String siteUserId) throws SQLException {
long startTime = System.currentTimeMillis();
String sql = "SELECT site_user_id,user_name,user_photo,user_status FROM " + USER_PROFILE_TABLE + " WHERE site_user_id=?;";
PreparedStatement preStatement = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preStatement.setString(1, siteUserId);
ResultSet rs = preStatement.executeQuery();
SimpleUserBean userBean = null;
if (rs.next()) {
userBean = new SimpleUserBean();
userBean.setUserId(rs.getString(1));
userBean.setUserName(rs.getString(2));
userBean.setUserPhoto(rs.getString(3));
userBean.setUserStatus(rs.getInt(4));
}
LogUtils.dbDebugLog(logger, startTime, userBean, sql, siteUserId);
return userBean;
}
use of com.akaxin.site.storage.bean.SimpleUserBean in project openzaly by akaxincom.
the class SQLiteUserProfileDao method querySimpleProfileByGlobalUserId.
public SimpleUserBean querySimpleProfileByGlobalUserId(String globalUserId) throws SQLException {
long startTime = System.currentTimeMillis();
SimpleUserBean userBean = new SimpleUserBean();
String sql = "SELECT site_user_id,user_name,user_photo,user_status FROM " + USER_PROFILE_TABLE + " WHERE global_user_id=?;";
PreparedStatement preStatement = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preStatement.setString(1, globalUserId);
ResultSet rs = preStatement.executeQuery();
if (rs.next()) {
userBean.setUserId(rs.getString(1));
userBean.setUserName(rs.getString(2));
userBean.setUserPhoto(rs.getString(3));
userBean.setUserStatus(rs.getInt(4));
}
LogUtils.dbDebugLog(logger, startTime, userBean.toString(), sql, globalUserId);
return userBean;
}
Aggregations