|
@@ -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;
|
|
@@ -53,6 +55,7 @@ import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Optional;
|
|
|
import java.util.Random;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.IntStream;
|
|
|
|
|
@@ -74,6 +77,8 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
|
|
|
private SysUserMapper sysUserMapper;
|
|
|
@Autowired
|
|
|
private RedissonClient redissonClient;
|
|
|
+ @Autowired
|
|
|
+ private TeacherService teacherService;
|
|
|
|
|
|
/**
|
|
|
* 查询详情
|
|
@@ -148,17 +153,30 @@ 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, SysUser> senderMap = sysUsers.stream()
|
|
|
+ .collect(Collectors.toMap(SysUser::getId, Function.identity(), (o, n) -> n));
|
|
|
+
|
|
|
// 发送群体,发送声部
|
|
|
+ SysUser sysUser;
|
|
|
for (CustomerServiceBatchSendingWrapper.CustomerServiceBatchSending item : sendings) {
|
|
|
|
|
|
// 创建用户
|
|
|
- item.setCreateUser(usernameMap.getOrDefault(item.getCreateBy(), ""));
|
|
|
+ item.sender("").mobile("")
|
|
|
+ .setCreateUser(usernameMap.getOrDefault(item.getCreateBy(), ""));
|
|
|
+
|
|
|
+ if (senderMap.containsKey(item.getSenderId())) {
|
|
|
+ sysUser = senderMap.get(item.getSenderId());
|
|
|
+
|
|
|
+ item.sender(sysUser.getUsername()).mobile(sysUser.getPhone());
|
|
|
+ }
|
|
|
|
|
|
List<Long> collect = Arrays.stream(Optional.ofNullable(item.getSendSubject()).orElse("").split(","))
|
|
|
.map(Long::parseLong).distinct().collect(Collectors.toList());
|
|
@@ -190,7 +208,10 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
|
|
|
public Boolean add(CustomerServiceBatchSendingWrapper.CustomerServiceBatchSending info) {
|
|
|
|
|
|
// 发送客服ID
|
|
|
- String customerService = customerServiceConfig.getCustomerService();
|
|
|
+ String customerService = info.getMobile();
|
|
|
+ if (StringUtils.isBlank(customerService)) {
|
|
|
+ customerService = customerServiceConfig.getCustomerService();
|
|
|
+ }
|
|
|
if (StringUtils.isNotEmpty(customerService)) {
|
|
|
|
|
|
List<String> collect = Arrays.stream(customerService.split(",")).collect(Collectors.toList());
|
|
@@ -205,6 +226,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("当前帐号未注册老师帐号");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 推送消息
|