| | |
| | | LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); |
| | | productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId()); |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper); |
| | | // 查询未开票金额/未开票数 |
| | | if (CollectionUtils.isNotEmpty(products)) { |
| | | QueryWrapper<InvoiceRegistrationProduct> productQueryWrapper = new QueryWrapper<>(); |
| | | List<Long> productIds = products.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList()); |
| | | productQueryWrapper.in("sales_ledger_product_id", productIds); |
| | | List<InvoiceRegistrationProduct> invoiceRegistrationProductList = invoiceRegistrationProductMapper.selectList(productQueryWrapper); |
| | | if(CollectionUtils.isNotEmpty(invoiceRegistrationProductList)){ |
| | | for (SalesLedgerProduct product : products) { |
| | | for (InvoiceRegistrationProduct invoiceRegistrationProduct : invoiceRegistrationProductList) { |
| | | Integer salesLedgerProductId = invoiceRegistrationProduct.getSalesLedgerProductId(); |
| | | Long id = product.getId(); |
| | | if( null != id && null != salesLedgerProductId && id == salesLedgerProductId.longValue()){ |
| | | product.setFutureTickets(Long.valueOf(invoiceRegistrationProduct.getNoInvoiceNum())); |
| | | product.setFutureTicketsAmount(invoiceRegistrationProduct.getNoInvoiceAmount()); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | for (SalesLedgerProduct product : products) { |
| | | product.setFutureTickets(product.getQuantity().longValue()); |
| | | product.setFutureTicketsAmount(product.getTaxInclusiveTotalPrice()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 3.查询上传文件 |
| | | LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | if (!insertList.isEmpty()) { |
| | | for (SalesLedgerProduct salesLedgerProduct : insertList) { |
| | | salesLedgerProduct.setType(type); |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity().intValue()); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | } |
| | | } |