|  | @@ -12,6 +12,7 @@ import com.yonge.cooleshow.biz.dal.entity.CustomerServiceBatchSending;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.CustomerServiceReceive;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.Subject;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.SysUser;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.entity.Teacher;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.MK;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.im.EImReceiveType;
 | 
	
	
		
			
				|  | @@ -22,6 +23,7 @@ import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.CustomerServiceBatchSendingService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.CustomerServiceReceiveService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.SubjectService;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.service.TeacherService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.wrapper.im.CustomerService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.wrapper.im.CustomerServiceBatchSendingWrapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.wrapper.im.CustomerServiceReceiveWrapper;
 | 
	
	
		
			
				|  | @@ -74,6 +76,8 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
 | 
	
		
			
				|  |  |      private SysUserMapper sysUserMapper;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private RedissonClient redissonClient;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TeacherService teacherService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |       * 查询详情
 | 
	
	
		
			
				|  | @@ -148,17 +152,23 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 创建用户
 | 
	
		
			
				|  |  |          List<Long> userIds = sendings.stream()
 | 
	
		
			
				|  |  | -                .map(CustomerServiceBatchSendingWrapper.CustomerServiceBatchSending::getCreateBy)
 | 
	
		
			
				|  |  | +                .flatMap(x -> Lists.newArrayList(x.getCreateBy(), x.getSenderId()).stream())
 | 
	
		
			
				|  |  |                  .filter(Objects::nonNull).distinct().collect(Collectors.toList());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Map<Long, String> usernameMap = sysUserMapper.selectBatchIds(userIds).stream()
 | 
	
		
			
				|  |  | +        List<SysUser> sysUsers = sysUserMapper.selectBatchIds(userIds);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Map<Long, String> usernameMap = sysUsers.stream()
 | 
	
		
			
				|  |  |                  .collect(Collectors.toMap(SysUser::getId, SysUser::getUsername, (o, n) -> n));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        Map<Long, String> mobileMap = sysUsers.stream()
 | 
	
		
			
				|  |  | +                .collect(Collectors.toMap(SysUser::getId, SysUser::getPhone, (o, n) -> n));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          // 发送群体,发送声部
 | 
	
		
			
				|  |  |          for (CustomerServiceBatchSendingWrapper.CustomerServiceBatchSending item : sendings) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              // 创建用户
 | 
	
		
			
				|  |  | -            item.setCreateUser(usernameMap.getOrDefault(item.getCreateBy(), ""));
 | 
	
		
			
				|  |  | +            item.sender(mobileMap.getOrDefault(item.getSenderId(), ""))
 | 
	
		
			
				|  |  | +                    .setCreateUser(usernameMap.getOrDefault(item.getCreateBy(), ""));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              List<Long> collect = Arrays.stream(Optional.ofNullable(item.getSendSubject()).orElse("").split(","))
 | 
	
		
			
				|  |  |                      .map(Long::parseLong).distinct().collect(Collectors.toList());
 | 
	
	
		
			
				|  | @@ -208,6 +218,12 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
 | 
	
		
			
				|  |  |                  throw new BizException("未匹配到客服人员");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              info.setSenderId(senderUser.getId());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            Teacher teacher = teacherService.getOne(Wrappers.<Teacher>lambdaQuery()
 | 
	
		
			
				|  |  | +                    .eq(Teacher::getUserId, info.getSenderId()));
 | 
	
		
			
				|  |  | +            if (Objects.isNull(teacher)) {
 | 
	
		
			
				|  |  | +                throw new BizException("当前帐号未注册老师帐号");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 推送消息
 |