Guo1B0 10 ماه پیش
والد
کامیت
682dd4a301

+ 12 - 10
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/CustomServiceImpl.java

@@ -39,6 +39,7 @@ import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URLEncoder;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -226,16 +227,17 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
         //商机列表
         custom1.setBusinessOpportunitys(businessOpportunityMapper.selectList(new QueryWrapper<BusinessOpportunity>().eq("customer_id",custom1.getId())));
         //操作记录
-        custom1.setActionLogs(actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("code","custom").eq("item_id",custom1.getId())));
-//        List<CustomItemContacts> contacts = customItemContactsMapper.selectList(new QueryWrapper<CustomItemContacts>().eq("contacts_id", custom1.getId()));
-//        List<Integer> ids = new ArrayList<>();
-//        for (CustomItemContacts contact : contacts) {
-//            ids.add(contact.getCustomId());
-//        }
-//        if (ids.size() > 0){
-//            List<Contacts> cs = contactsMapper.selectListByIds(ids);
-//            custom1.setContactsList(cs);
-//        }
+        List<ActionLog> actionLogs = actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("code", "custom").eq("item_id", custom1.getId()));
+        List<String> userIds = actionLogs.stream().map(ActionLog::getUserId).collect(Collectors.toList());
+        List<User> ids = userMapper.selectList(new QueryWrapper<User>().in("id", userIds));
+        for (ActionLog actionLog : actionLogs) {
+            for (User id : ids) {
+                if(actionLog.getUserId().equals(id)){
+                    actionLog.setUserName(id.getName());
+                }
+            }
+        }
+        custom1.setActionLogs(actionLogs);
         //联系人
         custom1.setContacts(contactsMapper.selectList((new QueryWrapper<Contacts>().eq("custom_id",custom1.getId()))));
         //订单