|  | @@ -45,6 +45,7 @@ import java.util.HashMap;
 | 
	
		
			
				|  |  |  import java.util.HashSet;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.Optional;
 | 
	
		
			
				|  |  |  import java.util.Set;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -367,9 +368,10 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
 | 
	
		
			
				|  |  |                  continue;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              String imGroupId = groupBy.get(detail.getTenantGroupId());
 | 
	
		
			
				|  |  | +            ImGroup imGroup = imGroupService.getById(Optional.ofNullable(imGroupId).orElse("-1"));
 | 
	
		
			
				|  |  |              if (toTeacher != null) {
 | 
	
		
			
				|  |  |                  // 更换群主
 | 
	
		
			
				|  |  | -                if (!StringUtils.isEmpty(imGroupId)) {
 | 
	
		
			
				|  |  | +                if (imGroup != null) {
 | 
	
		
			
				|  |  |                      // 新负责人加入群
 | 
	
		
			
				|  |  |                      try {
 | 
	
		
			
				|  |  |                          SysUser newTeacher = sysUserService.getByUserId(toTeacher);
 | 
	
	
		
			
				|  | @@ -400,11 +402,12 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  this.lambdaUpdate()
 | 
	
		
			
				|  |  |                          .set(TenantGroup::getAdminId, toTeacher)
 | 
	
		
			
				|  |  | +                        .set(imGroup == null, TenantGroup::getImGroupId, "-1")
 | 
	
		
			
				|  |  |                          .eq(TenantGroup::getId, detail.getTenantGroupId())
 | 
	
		
			
				|  |  |                          .update();
 | 
	
		
			
				|  |  |              } else if (Boolean.TRUE.equals(detail.getDismiss())) {
 | 
	
		
			
				|  |  |                  // 解散群
 | 
	
		
			
				|  |  | -                if (!StringUtils.isEmpty(imGroupId)) {
 | 
	
		
			
				|  |  | +                if (imGroup != null) {
 | 
	
		
			
				|  |  |                      try {
 | 
	
		
			
				|  |  |                          imGroupCoreService.groupDismiss(imGroupId);
 | 
	
		
			
				|  |  |                      } catch (Exception e) {
 |