chenrui
3 天以前 3e03f3d957c44ff2e4909b9fb4fff8621d466d10
src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java
@@ -12,6 +12,7 @@
import com.ruoyi.sales.excel.InvoiceLedgerExcelDto;
import com.ruoyi.sales.mapper.InvoiceLedgerFileMapper;
import com.ruoyi.sales.mapper.InvoiceLedgerMapper;
import com.ruoyi.sales.mapper.InvoiceRegistrationMapper;
import com.ruoyi.sales.mapper.InvoiceRegistrationProductMapper;
import com.ruoyi.sales.pojo.InvoiceLedger;
import com.ruoyi.sales.pojo.InvoiceLedgerFile;
@@ -49,6 +50,9 @@
    @Autowired
    private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
    @Autowired
    private InvoiceRegistrationMapper invoiceRegistrationMapper;
    /**
     * 开票台账新增
@@ -158,13 +162,13 @@
    /**
     * 附件下载
     * @param response
     * @param invoiceLedgerDto
     * @param invoiceRegistrationProductDto
     * @return
     */
    @Override
    public void invoiceLedgerExport(HttpServletResponse response, InvoiceLedgerDto invoiceLedgerDto) {
        List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoiceLedgerList(invoiceLedgerDto);
        List<InvoiceLedgerExcelDto> invoiceLedgerExcelDtoList = invoiceLedgerDtoList.stream().map(item -> {
    public void invoiceLedgerExport(HttpServletResponse response, InvoiceRegistrationProductDto invoiceRegistrationProductDto) {
        List<InvoiceRegistrationProductDto> invoiceRegistrationProductList = invoiceRegistrationProductMapper.invoiceRegistrationProductList(invoiceRegistrationProductDto);
        List<InvoiceLedgerExcelDto> invoiceLedgerExcelDtoList = invoiceRegistrationProductList.stream().map(item -> {
            InvoiceLedgerExcelDto invoiceLedgerExcelDto = new InvoiceLedgerExcelDto();
            BeanUtils.copyProperties(item, invoiceLedgerExcelDto);
            return invoiceLedgerExcelDto;
@@ -210,11 +214,17 @@
        if(CollectionUtils.isEmpty(invoiceLedgerDto.getFileList())){
            throw new RuntimeException("缺少文件信息");
        }
        QueryWrapper<InvoiceLedger> ledgerQueryWrapper = new QueryWrapper<>();
        ledgerQueryWrapper.eq("invoice_registration_product_id", invoiceLedgerDto.getId());
        InvoiceLedger invoiceLedger = invoiceLedgerMapper.selectOne(ledgerQueryWrapper);
        if(ObjectUtils.isEmpty(invoiceLedger)){
            throw new RuntimeException("开票台账未登记");
        }
        List<FileVo> fileList = invoiceLedgerDto.getFileList();
        fileList.forEach(fileVo -> {
            InvoiceLedgerFile invoiceLedgerFile = new InvoiceLedgerFile();
            BeanUtils.copyProperties(fileVo, invoiceLedgerFile);
            invoiceLedgerFile.setInvoiceLedgerId(invoiceLedgerDto.getId());
            invoiceLedgerFile.setInvoiceLedgerId(invoiceLedger.getId());
            invoiceLedgerFileMapper.insert(invoiceLedgerFile);
        });
    }