yzc před 1 rokem
rodič
revize
93a160b306

+ 10 - 3
hx-mail/src/main/java/com/fjhx/mail/service/message/impl/InfoServiceImpl.java

@@ -332,15 +332,22 @@ public class InfoServiceImpl implements InfoService {
 
         List<String> eMailList = records.stream().map(MessageVo::getFromEmail).distinct().collect(Collectors.toList());
         if (ObjectUtil.isNotEmpty(eMailList)) {
-            List<Long> customerIds = customerUserService.listObject(CustomerUser::getCustomerId, q -> q.in(CustomerUser::getEmail, eMailList));
-            if (ObjectUtil.isEmpty(customerIds)) {
+            List<CustomerUser> customerUserList = customerUserService.list(q -> q.in(CustomerUser::getEmail, eMailList));
+            if (ObjectUtil.isEmpty(customerUserList)) {
                 return R.ok(page);
             }
+            List<Long> customerIds = customerUserList.stream().map(CustomerUser::getCustomerId).collect(Collectors.toList());
+
             //赋值客户信息
             List<CustomerVo> customerInfoByIds = customerService.getCustomerInfoByIds(customerIds);
+            Map<String, CustomerUser> customerUserMap = customerUserList.stream().collect(Collectors.toMap(CustomerUser::getEmail, Function.identity()));
             Map<Long, CustomerVo> customerInfoMap = customerInfoByIds.stream().collect(Collectors.toMap(CustomerVo::getId, Function.identity()));
             for (MessageVo record : records) {
-                record.setCustomerInfo(customerInfoMap.get(record.getCustomerId()));
+                CustomerUser customerUser = customerUserMap.get(record.getFromEmail());
+                if (ObjectUtil.isEmpty(customerUser)) {
+                    continue;
+                }
+                record.setCustomerInfo(customerInfoMap.get(customerUser.getCustomerId()));
             }
         }