| | |
| | | public List<PaymentHistoryRecordVo> getPaymentRecordList(Long supplierId) { |
| | | List<PaymentHistoryRecordVo> paymentRecordList = paymentRegistrationMapper.getPaymentRecordList(supplierId); |
| | | List<PaymentHistoryRecordVo> result = new ArrayList<>(); |
| | | List<PaymentHistoryRecordVo> newResult = new ArrayList<>(); |
| | | // 应付总金额金额计算 |
| | | BigDecimal amountTotal = BigDecimal.ZERO; |
| | | if(CollectionUtils.isNotEmpty(paymentRecordList)) { |
| | |
| | | result.add(paymentHistoryRecordVo); |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < result.size(); i++) { |
| | | PaymentHistoryRecordVo paymentHistoryRecordVo = result.get(i); |
| | | if (i == 0) { |
| | | paymentHistoryRecordVo.setPayableAmount(paymentHistoryRecordVo.getInvoiceAmount().subtract(paymentHistoryRecordVo.getCurrentPaymentAmount())); |
| | | }else { |
| | | PaymentHistoryRecordVo paymentHistoryRecordVo1 = result.get(i-1); |
| | | paymentHistoryRecordVo.setPayableAmount(paymentHistoryRecordVo1.getPayableAmount() |
| | | .add(paymentHistoryRecordVo.getInvoiceAmount()).subtract(paymentHistoryRecordVo.getCurrentPaymentAmount())); |
| | | } |
| | | newResult.add(paymentHistoryRecordVo); |
| | | } |
| | | } |
| | | return result; |
| | | return newResult; |
| | | } |
| | | |
| | | /** |
| | |
| | | return paymentRegistrationMapper.paymentHistoryListPage(page, paymentRegistrationDto); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean delete(Long[] ids) { |
| | | for (Long id : ids) { |
| | | List<ProductRecord> productRecords = productRecordMapper.selectList(new QueryWrapper<ProductRecord>().lambda().eq(ProductRecord::getTicketRegistrationId, id)); |
| | | for (ProductRecord productRecord : productRecords) { |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecord.getSaleLedgerProjectId()); |
| | | salesLedgerProduct.setTicketsNum(salesLedgerProduct.getTicketsNum().subtract(productRecord.getTicketsNum())); |
| | | salesLedgerProduct.setTicketsAmount(salesLedgerProduct.getTicketsAmount().subtract(productRecord.getTicketsAmount())); |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getFutureTickets().add(productRecord.getTicketsNum())); |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getFutureTicketsAmount().add(productRecord.getTicketsAmount())); |
| | | salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | } |
| | | ticketRegistrationMapper.delete(new QueryWrapper<TicketRegistration>().lambda().eq(TicketRegistration::getId, id)); |
| | | productRecordMapper.delete(new QueryWrapper<ProductRecord>().lambda().eq(ProductRecord::getTicketRegistrationId, id)); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // 批量查询采购台账(当月) |
| | | private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) { |
| | | LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>(); |