| | |
| | | /** |
| | | * CRM 客户 API 实现类 |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @Service |
| | | public class CrmCustomerApiImpl implements CrmCustomerApi { |
| | |
| | | |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | 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))); |
| | |
| | | return new ArrayList<>(permittedIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<CrmCustomerRespDTO> getCustomerSimpleList() { |
| | | List<CrmCustomerDO> customers = customerService.getCustomerList(); |
| | | return BeanUtils.toBean(customers, CrmCustomerRespDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * 过滤掉用户没有权限的客户 |
| | | * <p> |