Eric 2 年之前
父节点
当前提交
6135547615

+ 11 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CustomerServiceBatchSendingServiceImpl.java

@@ -55,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;
 
@@ -160,16 +161,23 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
         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));
+        Map<Long, SysUser> senderMap = sysUsers.stream()
+                .collect(Collectors.toMap(SysUser::getId, Function.identity(), (o, n) -> n));
 
         // 发送群体,发送声部
+        SysUser sysUser;
         for (CustomerServiceBatchSendingWrapper.CustomerServiceBatchSending item : sendings) {
 
             // 创建用户
-            item.sender(mobileMap.getOrDefault(item.getSenderId(), ""))
+            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());
 

+ 7 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/im/CustomerServiceBatchSendingWrapper.java

@@ -165,6 +165,8 @@ public class CustomerServiceBatchSendingWrapper {
 
         @ApiModelProperty("客服人员")
         private String sender;
+        @ApiModelProperty("客服联系方式")
+        private String mobile;
         
         public String jsonString() {
             return JSON.toJSONString(this);
@@ -194,6 +196,11 @@ public class CustomerServiceBatchSendingWrapper {
             this.sender = sender;
             return this;
         }
+
+        public CustomerServiceBatchSending mobile(String mobile) {
+            this.mobile = mobile;
+            return this;
+        }
     }
 
 }