liyong
18 小时以前 b2089cc76bdf959a2e9ff71142dc3fcf0bd9b80b
src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
@@ -4,10 +4,12 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.sales.dto.CustomerInteractionDto;
import com.ruoyi.sales.dto.InvoiceLedgerDto;
import com.ruoyi.sales.dto.ReceiptPaymentDto;
import com.ruoyi.sales.dto.ReceiptPaymentExeclDto;
import com.ruoyi.sales.mapper.ReceiptPaymentMapper;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.pojo.ReceiptPayment;
@@ -245,7 +247,19 @@
            customerInteractionDto.setUnReceiptAmount(amountTotal);
            result.add(customerInteractionDto);
        }
        return result;
        ArrayList<CustomerInteractionDto> newResult = new ArrayList<>();
        for (int i = 0; i < result.size(); i++) {
            CustomerInteractionDto customerInteractionDto = result.get(i);
            if (i == 0) {
                customerInteractionDto.setUnReceiptAmount(customerInteractionDto.getInvoiceAmount().subtract(customerInteractionDto.getReceiptAmount()));
            }else {
                CustomerInteractionDto customerInteractionDto1 = result.get(i-1);
                customerInteractionDto.setUnReceiptAmount(customerInteractionDto1.getUnReceiptAmount()
                        .add(customerInteractionDto.getInvoiceAmount()).subtract(customerInteractionDto.getReceiptAmount()));
            }
            newResult.add(customerInteractionDto);
        }
        return newResult;
    }
    /**
@@ -264,9 +278,16 @@
    }
    @Override
    public void exportPaymentList(HttpServletResponse response, ArrayList<Long> ids) {
        List<ReceiptPaymentDto> receiptPaymentDtoList =  receiptPaymentMapper.bindInvoiceNoRegListByIds(ids);
        ExcelUtil<ReceiptPaymentDto> util = new ExcelUtil<ReceiptPaymentDto>(ReceiptPaymentDto.class);
        util.exportExcel(response, receiptPaymentDtoList, "回款登记");
    public void exportPaymentList(HttpServletResponse response, List<Long> ids) {
        if (ids == null) {
            List<ReceiptPaymentExeclDto> receiptPaymentDtoList =  receiptPaymentMapper.bindInvoiceNoRegListByIds(new ArrayList<>(), SecurityUtils.getLoginUser().getTenantId());
            ExcelUtil<ReceiptPaymentExeclDto> util = new ExcelUtil<ReceiptPaymentExeclDto>(ReceiptPaymentExeclDto.class);
            util.exportExcel(response, receiptPaymentDtoList, "回款登记");
        }else {
            List<ReceiptPaymentExeclDto> receiptPaymentDtoList =  receiptPaymentMapper.bindInvoiceNoRegListByIds(ids,SecurityUtils.getLoginUser().getTenantId());
            ExcelUtil<ReceiptPaymentExeclDto> util = new ExcelUtil<ReceiptPaymentExeclDto>(ReceiptPaymentExeclDto.class);
            util.exportExcel(response, receiptPaymentDtoList, "回款登记");
        }
    }
}