|  | @@ -1,41 +1,6 @@
 | 
	
		
			
				|  |  |  package com.yonge.cooleshow.biz.dal.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | -import com.google.common.collect.ImmutableList;
 | 
	
		
			
				|  |  | -import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.*;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.enums.ImGroupType;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMapper;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumRefMapper;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.mapper.TenantUnbindHistoryMapper;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.mapper.TenantUnbindRecordMapper;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.queryInfo.TeacherQueryInfo;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.*;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.vo.MusicSheetUploadCountVo;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.wrapper.teacher.TeacherWrapper;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.common.enums.ESettlementFrom;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.common.enums.ETenantUnBindAuditStatus;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.common.enums.UserFirstTimeTypeEnum;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.base.exception.BizException;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.base.util.StringUtil;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.thirdparty.user.realname.RealnameAuthenticationPlugin;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.utils.date.DateUtil;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.utils.idcard.IdcardInfoExtractor;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.utils.string.ValueUtil;
 | 
	
		
			
				|  |  | -import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | -import org.redisson.api.RMap;
 | 
	
		
			
				|  |  | -import org.redisson.api.RedissonClient;
 | 
	
		
			
				|  |  | -import org.slf4j.Logger;
 | 
	
		
			
				|  |  | -import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | -import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | -import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
	
		
			
				|  |  | -import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | -import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
	
	
		
			
				|  | @@ -50,20 +15,7 @@ import com.yonge.cooleshow.biz.dal.dao.TeacherDao;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.TeacherDto;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.req.TeacherSubmitReq;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.search.TeacherSearch;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.ImGroup;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.Student;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.StudentStar;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.Subject;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.Teacher;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.TeacherAuthMusicianRecord;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.TeacherTotal;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.TenantAlbum;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.TenantAlbumRef;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.TenantUnbindHistory;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.TenantUnbindRecord;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.UserAccount;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.entity.*;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.ImGroupType;
 | 
	
	
		
			
				|  | @@ -75,24 +27,7 @@ import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumRefMapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.mapper.TenantUnbindHistoryMapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.mapper.TenantUnbindRecordMapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.queryInfo.TeacherQueryInfo;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.ImGroupMemberService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.SmsCodeService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.StudentService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.StudentStarService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.SubjectService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.SysConfigService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.SysMessageService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.TeacherAuthEntryRecordService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.TeacherAuthMusicianRecordService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.TeacherService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.TeacherStyleVideoService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.TeacherTotalService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.UserAccountService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.UserFirstTimeService;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.service.*;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.im.ImGroupCoreService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.HotTeacherVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.MusicSheetUploadCountVo;
 | 
	
	
		
			
				|  | @@ -129,6 +64,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import javax.annotation.Resource;
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.Arrays;
 | 
	
		
			
				|  |  |  import java.util.Date;
 | 
	
	
		
			
				|  | @@ -150,13 +86,13 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private TeacherStyleVideoService teacherStyleVideoService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  |      private SysUserFeignService userFeignService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private TeacherAuthEntryRecordService entryRecordService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private TeacherAuthMusicianRecordService musicianRecordService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  |      private EmployeeDao employeeDao;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private RedissonClient redissonClient;
 | 
	
	
		
			
				|  | @@ -216,10 +152,11 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 | 
	
		
			
				|  |  |      private SmsCodeService smsCodeService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | -    private ImGroupCoreService imGroupCoreService;
 | 
	
		
			
				|  |  | +    private RealnameAuthenticationPlugin realnameAuthenticationPlugin;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | -    private RealnameAuthenticationPlugin realnameAuthenticationPlugin;
 | 
	
		
			
				|  |  | +    private ImGroupCoreService imGroupCoreService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public TeacherVo detail(Long userId) {
 | 
	
	
		
			
				|  | @@ -474,6 +411,16 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 | 
	
		
			
				|  |  |          //新增修改老师表
 | 
	
		
			
				|  |  |          Teacher teacher = insertOrUpdateTeacher(teacherSubmitReq);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        // 机构老师与学生互加好友关系
 | 
	
		
			
				|  |  | +        if (Optional.ofNullable(teacher.getTenantId()).orElse(-1L) > 0) {
 | 
	
		
			
				|  |  | +            // 自动与机构老师成为好友
 | 
	
		
			
				|  |  | +            Set<Long> collect = studentService.lambdaQuery()
 | 
	
		
			
				|  |  | +                    .eq(Student::getTenantId, teacher.getTenantId()).list().stream()
 | 
	
		
			
				|  |  | +                    .map(Student::getUserId).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            imUserFriendService.saveUserFriend(teacher.getUserId(), collect);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          return HttpResponseResult.succeed(true);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -581,7 +528,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 | 
	
		
			
				|  |  |                  TeacherWrapper.UpdateTenant updateTenant = new TeacherWrapper.UpdateTenant();
 | 
	
		
			
				|  |  |                  updateTenant.setTeacherId(teacher.getUserId());
 | 
	
		
			
				|  |  |                  updateTenant.setTenantId(teacherSubmitReq.getTenantId());
 | 
	
		
			
				|  |  | -                updateTenant(updateTenant);
 | 
	
		
			
				|  |  | +                updateTenant(updateTenant, teacherSubmitReq.getUpdateBy());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              teacher.setUpdateTime(new Date());
 | 
	
	
		
			
				|  | @@ -1032,7 +979,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //    @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public void updateTenant(TeacherWrapper.UpdateTenant updateTenant) {
 | 
	
		
			
				|  |  | +    public void updateTenant(TeacherWrapper.UpdateTenant updateTenant,Long userId) {
 | 
	
		
			
				|  |  |          Teacher teacher = this.getById(updateTenant.getTeacherId());
 | 
	
		
			
				|  |  |          if (teacher.getTenantId().equals(updateTenant.getTenantId())) {
 | 
	
		
			
				|  |  |              return;
 | 
	
	
		
			
				|  | @@ -1085,6 +1032,8 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 | 
	
		
			
				|  |  |              TenantUnbindRecord tenantUnbindRecord = first.get();
 | 
	
		
			
				|  |  |              tenantUnbindRecord.setStatus(ETenantUnBindAuditStatus.CLOSE);
 | 
	
		
			
				|  |  |              tenantUnbindRecord.setReason("机构发生变更,关闭申请");
 | 
	
		
			
				|  |  | +            tenantUnbindRecord.setVerifyUserId(userId);
 | 
	
		
			
				|  |  | +            tenantUnbindRecord.setInterveneTime(new Date());
 | 
	
		
			
				|  |  |              tenantUnbindRecordMapper.updateById(tenantUnbindRecord);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              TenantUnbindHistory history = JSON.parseObject(JSON.toJSONString(tenantUnbindRecord),
 |