hsy
2026-08-28 a8e4132c3e2e9c3b3fcb0360901b35571b6464ea
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -29,6 +29,7 @@
import com.ruoyi.sales.pojo.SalesQuotation;
import com.ruoyi.sales.vo.CustomerTransactionsDetailsVo;
import com.ruoyi.sales.vo.CustomerTransactionsVo;
import com.ruoyi.sales.vo.ProjectTransactionsVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -310,18 +311,26 @@
    @Override
    public List<Map<String, Object>> customerList(Customer customer) {
        LambdaQueryWrapper<Customer> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.select(Customer::getId, Customer::getCustomerName, Customer::getTaxpayerIdentificationNumber);
        LoginUser loginUser = SecurityUtils.getLoginUser();
        Long loginUserId = loginUser.getUserId();
        CustomerDto query = new CustomerDto();
        if (customer != null) {
            BeanUtils.copyProperties(customer, query);
        }
        // 获取原始查询结果
        List<Map<String, Object>> result = customerMapper.selectMaps(queryWrapper);
        // 复用客户列表的可见性规则,避免把别人的私海客户暴露给当前账号
        List<CustomerVo> visibleCustomers = customerMapper.list(query, loginUserId);
        if (CollectionUtils.isEmpty(visibleCustomers)) {
            return Collections.emptyList();
        }
        // 将下划线命名转换为驼峰命名
        return result.stream().map(map -> map.entrySet().stream()
                .collect(Collectors.toMap(
                        entry -> underlineToCamel(entry.getKey()),
                        Map.Entry::getValue))
        ).collect(Collectors.toList());
        return visibleCustomers.stream().map(item -> {
            Map<String, Object> map = new LinkedHashMap<>();
            map.put("id", item.getId());
            map.put("customerName", item.getCustomerName());
            map.put("taxpayerIdentificationNumber", item.getTaxpayerIdentificationNumber());
            return map;
        }).collect(Collectors.toList());
    }
    // 分配公海客户给私海
@@ -444,13 +453,23 @@
    }
    @Override
    public IPage<CustomerTransactionsVo> customewTransactions(Page page, String customerName) {
        return customerMapper.customewTransactions(page, customerName);
    public IPage<ProjectTransactionsVo> projectTransactions(Page page, String projectName, String customerName, String contractName) {
        return customerMapper.projectTransactions(page, projectName, customerName, contractName);
    }
    @Override
    public IPage<CustomerTransactionsDetailsVo> customewTransactionsDetails(Page page, Long customerId) {
        return customerMapper.customewTransactionsDetails(page, customerId);
    public IPage<CustomerTransactionsVo> customewTransactions(Page page, Long projectId, String customerName, String contractName) {
        return customerMapper.customewTransactions(page, projectId, customerName, contractName);
    }
    @Override
    public IPage<CustomerTransactionsDetailsVo> customewTransactionsDetails(Page page, Long projectId, Long customerId, String contractName) {
        return customerMapper.customewTransactionsDetails(page, projectId, customerId, contractName);
    }
    @Override
    public Map<String, Object> transactionsSummary() {
        return customerMapper.transactionsSummary();
    }
    /**