云
8 小时以前 d17024670efca145ff97bc26913bfd9b0fef2cd0
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/api/customer/CrmCustomerApiImpl.java
@@ -38,7 +38,8 @@
    @Override
    public CrmCustomerRespDTO getCustomer(Long id) {
        CrmCustomerDO customer = customerService.getCustomer(id);
        List<CrmCustomerDO> customers = customerService.getCustomerList(Collections.singleton(id));
        CrmCustomerDO customer = CollUtil.isEmpty(customers) ? null : customers.get(0);
        return BeanUtils.toBean(customer, CrmCustomerRespDTO.class);
    }
@@ -48,9 +49,10 @@
            return Collections.emptyList();
        }
        List<CrmCustomerDO> customers = customerService.getCustomerList(ids);
        // 过滤掉用户没有权限的客户
        List<CrmCustomerDO> filteredCustomers = filterCustomersByPermission(customers);
        return BeanUtils.toBean(filteredCustomers, CrmCustomerRespDTO.class);
        // 这是供 MES、ERP、售后等业务模块解析关联客户的跨模块 API。
        // 营销管理自身的列表权限由 CrmCustomerMapper 分页查询统一控制,不能在这里再次按当前用户过滤,
        // 否则其他模块查看已有业务单据时会丢失非本人客户名称。
        return BeanUtils.toBean(customers, CrmCustomerRespDTO.class);
    }
    @Override
@@ -59,9 +61,7 @@
            return Collections.emptyMap();
        }
        List<CrmCustomerDO> customers = customerService.getCustomerList(ids);
        // 过滤掉用户没有权限的客户
        List<CrmCustomerDO> filteredCustomers = filterCustomersByPermission(customers);
        return filteredCustomers.stream()
        return customers.stream()
                .collect(Collectors.toMap(
                        CrmCustomerDO::getId,
                        customer -> BeanUtils.toBean(customer, CrmCustomerRespDTO.class)));