Commit 1bc2f213 by 徐高华

parent 85243ab8
......@@ -44,6 +44,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.chat.TabChatNotice;
import com.gic.haoban.manage.service.entity.chat.TabGroupChat;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatOwner;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatOwnerHistory;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;
import com.gic.haoban.manage.service.pojo.bo.chat.GroupChatBO;
import com.gic.haoban.manage.service.service.SecretSettingService;
......@@ -394,10 +395,14 @@ public class GroupChatServiceImpl implements GroupChatService {
// 处理群主
String owner = detail.getOwner();
TabHaobanStaff staff = this.staffMapper.selectByUserIdAndEnterpriseId(owner, wxEnterpriseId);
String newStaffId = null;
String oldStaffId = chat.getStaffId();
if (null != staff) {
// 更新staff
newStaffId = staff.getStaffId();
chat.setStaffId(staff.getStaffId());
} else {
chat.setStaffId(null);
logger.info("群主未关联好办,不同步群成员,userid={}", owner);
}
if (StringUtils.isBlank(enterpriseId) && null != staff) {
......@@ -418,6 +423,9 @@ public class GroupChatServiceImpl implements GroupChatService {
if (StringUtils.isNotEmpty(chat.getEnterpriseId())) {
chat.setGicFlag(1);
}
// 判断是否更新群主
this.saveOwnerHistory(wxEnterpriseId, groupChatId, newStaffId, oldStaffId);
chat.setOriginalStaffId(oldStaffId);
this.groupChatMapper.update(chat);
if (null == staff) {
logger.info("不同步群成员信息,群主未关联好办,owner={}", owner);
......@@ -487,6 +495,27 @@ public class GroupChatServiceImpl implements GroupChatService {
// this.groupChatMapper.updateData();
}
private void saveOwnerHistory(String wxEnterpriseId, Long groupChatId, String newStaffId, String oldStaffId) {
if (null == newStaffId && null == oldStaffId) {
return;
}
if (null != newStaffId && null != oldStaffId && newStaffId.equals(oldStaffId)) {
return;
}
if (null != newStaffId) {
TabGroupChatOwnerHistory entity = new TabGroupChatOwnerHistory();
entity.setOwnerHistoryId(UniqueIdUtils.uniqueLong());
entity.setWxEnterpriseId(wxEnterpriseId);
entity.setGroupChatId(groupChatId);
entity.setStaffId(newStaffId);
entity.setCreateTime(new Date());
this.groupChatOwnerHistoryMapper.insert(entity);
}
if (null != oldStaffId) {
this.groupChatOwnerHistoryMapper.updateOwnerEnd(groupChatId, oldStaffId);
}
}
// 初始化群信息-不包括群状态
private void updateGroupChatDetail(WxEnterpriseQwDTO qwDTO, Long groupChatId, boolean syncMember) {
TabGroupChat chat = this.groupChatMapper.selectById(groupChatId);
......
......@@ -74,7 +74,7 @@
quit_count,
quit_member_count,
enterprise_id,
gic_flag , init_flag , original_staff_id ,
gic_flag , init_flag , original_staff_id
)VALUES(
#{groupChatId},
#{wxEnterpriseId},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment