use of com.akaxin.site.business.impl.notice.GroupNotice in project openzaly by akaxincom.
the class UserGroupDao method createGroup.
// 创建群
public GroupProfileBean createGroup(String createUserId, String groupName, List<String> userIds) {
GroupProfileBean bean = new GroupProfileBean();
try {
bean.setCreateTime(System.currentTimeMillis());
bean.setGroupName(groupName);
bean.setCreateUserId(createUserId);
// 群头像使用默认
// bean.setGroupPhoto(GROUP_DEFAULT_ICON);
bean.setGroupStatus(GroupProto.GroupStatus.GROUP_NORMAL_VALUE);
// 1.创建群资料
bean = groupDao.addGroupProfile(bean);
// 2.添加群成员入库
for (String memberId : userIds) {
int status = GroupProto.GroupMemberRole.MEMBER_VALUE;
if (createUserId.equals(memberId)) {
status = GroupProto.GroupMemberRole.OWNER_VALUE;
}
groupDao.addGroupMember(memberId, bean.getGroupId(), status);
}
// 3.群消息中发送通知
new GroupNotice().newGroupMemberNotice(createUserId, bean.getGroupId(), userIds);
} catch (Exception e) {
logger.error("create group error.", e);
}
return bean;
}
use of com.akaxin.site.business.impl.notice.GroupNotice in project openzaly by akaxincom.
the class UserGroupDao method addGroupMember.
public boolean addGroupMember(String siteUserId, String groupId, List<String> userIdList) {
try {
// 1.获取当前,群消息最大游标
long maxPointer = messageDao.queryMaxGroupPointer(groupId);
// 3.增加群成员
for (String memberId : userIdList) {
messageDao.updateGroupPointer(groupId, memberId, null, maxPointer);
int status = GroupProto.GroupMemberRole.MEMBER_VALUE;
groupDao.addGroupMember(memberId, groupId, status);
}
return true;
} catch (Exception e) {
logger.error("add group member error.", e);
} finally {
// 添加完用户,向群消息中添加GroupMsgNotice
new GroupNotice().newGroupMemberNotice(siteUserId, groupId, userIdList);
}
return false;
}
Aggregations