|
@@ -64,11 +64,10 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
Map<String, List<SysWechatCustomerDeptVo>> parentGroup = deptVos.stream()
|
|
Map<String, List<SysWechatCustomerDeptVo>> parentGroup = deptVos.stream()
|
|
|
.collect(Collectors.groupingBy(SysWechatCustomerDeptVo::getParentId));
|
|
.collect(Collectors.groupingBy(SysWechatCustomerDeptVo::getParentId));
|
|
|
- Set<String> strings = parentGroup.keySet();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ List<String> collect = deptVos.stream().map(SysWechatCustomerDeptVo::getDeptId).collect(Collectors.toList());
|
|
|
deptVos.forEach(node -> node.setChildDept(parentGroup.getOrDefault(node.getDeptId(), Collections.emptyList())));
|
|
deptVos.forEach(node -> node.setChildDept(parentGroup.getOrDefault(node.getDeptId(), Collections.emptyList())));
|
|
|
return deptVos.stream()
|
|
return deptVos.stream()
|
|
|
- .filter(node -> node.getParentId() != null && strings.contains(node.getDeptId()))
|
|
|
|
|
|
|
+ .filter(node -> node.getParentId() != null && !collect.contains(node.getParentId()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -241,13 +240,16 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String getWeChatCustomer(SysUser user) throws WxErrorException {
|
|
public String getWeChatCustomer(SysUser user) throws WxErrorException {
|
|
|
- SysWechatCustomer sysWechatCustomer = sysWechatCustomerService.getByUserId(user.getLeaderId());
|
|
|
|
|
- List<SysWechatCustomer> sysWechatCustomerList = sysWechatCustomerService.list();
|
|
|
|
|
- List<Long> sysWechatCustomerIdList = sysWechatCustomerList.stream()
|
|
|
|
|
- .map(SysWechatCustomer::getId)
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
|
+ SysWechatCustomer sysWechatCustomer = null;
|
|
|
|
|
+ if(!ObjectUtils.isEmpty(user)){
|
|
|
|
|
+ sysWechatCustomer = sysWechatCustomerService.getByUserId(user.getLeaderId());
|
|
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(sysWechatCustomer)) {
|
|
if (ObjectUtils.isEmpty(sysWechatCustomer)) {
|
|
|
// 获取最近一次的客服记录
|
|
// 获取最近一次的客服记录
|
|
|
|
|
+ List<SysWechatCustomer> sysWechatCustomerList = sysWechatCustomerService.list();
|
|
|
|
|
+ List<Long> sysWechatCustomerIdList = sysWechatCustomerList.stream()
|
|
|
|
|
+ .map(SysWechatCustomer::getId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
SysWechatCustomerRecording sysWechatCustomerRecording = sysWechatCustomerRecordingService.lambdaQuery()
|
|
SysWechatCustomerRecording sysWechatCustomerRecording = sysWechatCustomerRecordingService.lambdaQuery()
|
|
|
.in(!sysWechatCustomerIdList.isEmpty(), SysWechatCustomerRecording::getCustomerId, sysWechatCustomerIdList)
|
|
.in(!sysWechatCustomerIdList.isEmpty(), SysWechatCustomerRecording::getCustomerId, sysWechatCustomerIdList)
|
|
|
.eq(SysWechatCustomerRecording::getUserId, user.getId())
|
|
.eq(SysWechatCustomerRecording::getUserId, user.getId())
|
|
@@ -255,14 +257,14 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
.last("limit 1")
|
|
.last("limit 1")
|
|
|
.one();
|
|
.one();
|
|
|
if (ObjectUtils.isEmpty(sysWechatCustomerRecording)) {
|
|
if (ObjectUtils.isEmpty(sysWechatCustomerRecording)) {
|
|
|
- sysWechatCustomerService.getCacheCustomerId(sysWechatCustomer);
|
|
|
|
|
|
|
+ sysWechatCustomer = sysWechatCustomerService.getCacheCustomerId(sysWechatCustomer);
|
|
|
} else {
|
|
} else {
|
|
|
// 使用上一次的客服
|
|
// 使用上一次的客服
|
|
|
sysWechatCustomer = sysWechatCustomerService.lambdaQuery()
|
|
sysWechatCustomer = sysWechatCustomerService.lambdaQuery()
|
|
|
.eq(SysWechatCustomer::getId, sysWechatCustomerRecording.getCustomerId())
|
|
.eq(SysWechatCustomer::getId, sysWechatCustomerRecording.getCustomerId())
|
|
|
.one();
|
|
.one();
|
|
|
if (ObjectUtils.isEmpty(sysWechatCustomer)) {
|
|
if (ObjectUtils.isEmpty(sysWechatCustomer)) {
|
|
|
- sysWechatCustomerService.getCacheCustomerId(sysWechatCustomer);
|
|
|
|
|
|
|
+ sysWechatCustomer = sysWechatCustomerService.getCacheCustomerId(sysWechatCustomer);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
SysWechatCustomerRecording customerRecording = new SysWechatCustomerRecording();
|
|
SysWechatCustomerRecording customerRecording = new SysWechatCustomerRecording();
|