| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | |
| | | @Autowired |
| | | private InvoiceRegistrationMapper invoiceRegistrationMapper; |
| | | |
| | | /** |
| | | * 开票台账新增 |
| | |
| | | /** |
| | | * 附件下载 |
| | | * @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; |
| | |
| | | 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); |
| | | }); |
| | | } |