Browse Source

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Lijy 10 months ago
parent
commit
aaa7bb7def

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

@@ -299,7 +299,22 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
         custom1.setTasks(tasks);
         custom1.setTasks(tasks);
         custom1.setActionLogs(actionLogs);
         custom1.setActionLogs(actionLogs);
         //联系人
         //联系人
-        custom1.setContacts(contactsMapper.selectList((new QueryWrapper<Contacts>().eq("custom_id", custom1.getId()))));
+        List<Contacts> contacts = contactsMapper.selectList((new QueryWrapper<Contacts>().eq("custom_id", custom1.getId())));
+        if (contacts.size() > 0){
+            List<String> ids = contacts.stream()
+                    .flatMap(contact -> Stream.of(contact.getOwnerId(), contact.getCreatorId()))
+                    .filter(Objects::nonNull)
+                    .distinct()
+                    .collect(Collectors.toList());
+            List<User> users = userMapper.selectList(new QueryWrapper<User>().in("id", ids));
+            Map<String, String> map = users.stream()
+                    .collect(Collectors.toMap(User::getId,User::getName));
+            for (Contacts contact : contacts) {
+                contact.setOwnerName(map.get(contact.getOwnerName()));
+                contact.setCreatorName(map.get(contact.getCreatorId()));
+            }
+        }
+        custom1.setContacts(contacts);
         //订单
         //订单
         List<SalesOrder> orders = salesOrderMapper.selectList((new QueryWrapper<SalesOrder>().eq("custom_id", custom1.getId())));
         List<SalesOrder> orders = salesOrderMapper.selectList((new QueryWrapper<SalesOrder>().eq("custom_id", custom1.getId())));
         if (orders.size() > 0 ){
         if (orders.size() > 0 ){

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/CustomMapper.xml

@@ -81,7 +81,7 @@
         <if test="email != null and email != '' ">
         <if test="email != null and email != '' ">
             and c.email LIKE CONCAT('%', #{email}, '%')
             and c.email LIKE CONCAT('%', #{email}, '%')
         </if>
         </if>
-        <if test="companyPhone != null ">
+        <if test="companyPhone != null and companyPhone != '' ">
             and c.company_phone = #{companyPhone}
             and c.company_phone = #{companyPhone}
         </if>
         </if>
         <if test="customerLevelId != null ">
         <if test="customerLevelId != null ">