|
@@ -103,7 +103,7 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
|
|
|
List<String> imGroupId = records.stream().map(TenantGroupWrapper.TenantGroup::getImGroupId)
|
|
|
.filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
List<String> existImgGroupIds = new ArrayList<>();
|
|
|
- if (imGroupId.isEmpty()) {
|
|
|
+ if (!imGroupId.isEmpty()) {
|
|
|
List<String> imgGroupIds = imGroupService.lambdaQuery()
|
|
|
.in(ImGroup::getId, imGroupId)
|
|
|
.list().stream().map(ImGroup::getId).collect(Collectors.toList());
|
|
@@ -161,12 +161,16 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
|
|
|
log.error("加入机构小组群失败", e);
|
|
|
throw new BizException("加入机构小组群失败");
|
|
|
}
|
|
|
- studentDao.update(null, Wrappers.<Student>lambdaUpdate()
|
|
|
- .in(Student::getUserId, userIds)
|
|
|
- .eq(Student::getTenantId, tenantGroup.getTenantId())
|
|
|
- .set(Student::getTenantGroupId, entity.getId()));
|
|
|
}
|
|
|
}
|
|
|
+ // 加群成员
|
|
|
+ List<Long> userIds = tenantGroup.getUserIds();
|
|
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
+ studentDao.update(null, Wrappers.<Student>lambdaUpdate()
|
|
|
+ .in(Student::getUserId, userIds)
|
|
|
+ .eq(Student::getTenantId, tenantGroup.getTenantId())
|
|
|
+ .set(Student::getTenantGroupId, entity.getId()));
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -198,8 +202,7 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
|
|
|
ImGroup imGroup = imGroupService.getById(oldImGroupId);
|
|
|
// 群被删除过,并且需要重新建群
|
|
|
if (imGroup == null) {
|
|
|
- SysUser sysUser = sysUserService.getByUserId(entity.getAdminId());
|
|
|
- String imGroupId = createImGroup(entity.getAdminId(), sysUser.getUsername());
|
|
|
+ String imGroupId = createImGroup(entity.getAdminId(), tenantGroup.getName());
|
|
|
entity.setImGroupId(imGroupId);
|
|
|
|
|
|
// 添加群成员
|
|
@@ -399,6 +402,9 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
|
|
|
String.valueOf(teacherId));
|
|
|
imGroupCoreService.groupQuit(teacherId, ClientEnum.TEACHER.getCode(),
|
|
|
imGroupId, true);
|
|
|
+ imGroupService.lambdaUpdate()
|
|
|
+ .set(ImGroup::getCreateBy, toTeacher)
|
|
|
+ .eq(ImGroup::getId, imGroupId);
|
|
|
} catch (Exception e) {
|
|
|
log.error("移交负责人失败", e);
|
|
|
throw new BizException("移交负责人失败");
|
|
@@ -432,13 +438,13 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public String createImGroup(Long groupAdmin, String userName) {
|
|
|
+ public String createImGroup(Long groupAdmin, String groupName) {
|
|
|
try {
|
|
|
ImGroupWrapper.ImGroup imGroup = new ImGroupWrapper.ImGroup();
|
|
|
imGroup.setId(IdWorker.getId());
|
|
|
imGroup.setCreateBy(groupAdmin);
|
|
|
imGroup.setType(ImGroupType.ORG.getCode());
|
|
|
- imGroup.setName(userName);
|
|
|
+ imGroup.setName(groupName);
|
|
|
return imGroupService.create(imGroup);
|
|
|
} catch (Exception e) {
|
|
|
log.error("创建机构小组群失败", e);
|
|
@@ -491,6 +497,9 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
|
|
|
String.valueOf(oldGroup.getAdminId()));
|
|
|
imGroupCoreService.groupQuit(oldGroup.getAdminId(), ClientEnum.TEACHER.getCode(),
|
|
|
oldGroup.getImGroupId(), true);
|
|
|
+ imGroupService.lambdaUpdate()
|
|
|
+ .set(ImGroup::getCreateBy, tenantGroup.getAdminId())
|
|
|
+ .eq(ImGroup::getId, imGroupId);
|
|
|
} catch (Exception e) {
|
|
|
log.error("更换群主失败", e);
|
|
|
throw new BizException("更换群主失败");
|