| | |
| | | */ |
| | | @Override |
| | | public int updatePaymentRegistration(PaymentRegistration paymentRegistration) { |
| | | TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(paymentRegistration.getTicketRegistrationId()); |
| | | PaymentRegistration paymentRegistration1 = paymentRegistrationMapper.selectById(paymentRegistration.getId()); |
| | | |
| | | TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(paymentRegistration.getTicketRegistrationId()==null?paymentRegistration1.getTicketRegistrationId():paymentRegistration.getTicketRegistrationId()); |
| | | |
| | | List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectList(new QueryWrapper<PaymentRegistration>() |
| | | .eq("ticket_registration_id", paymentRegistration.getTicketRegistrationId()).ne("id", paymentRegistration.getId())); |
| | |
| | | new QueryWrapper<SalesLedgerProduct>().eq("sales_ledger_id", id).eq("type",2) |
| | | ).stream()) |
| | | .collect(Collectors.toList()); |
| | | payableAmount = salesLedgerProducts.stream() |
| | | .map(SalesLedgerProduct::getTaxInclusiveTotalPrice) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // payableAmount = salesLedgerProducts.stream() |
| | | // .map(SalesLedgerProduct::getTaxInclusiveTotalPrice) |
| | | // .filter(Objects::nonNull) |
| | | // .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // 来票金额计算 |
| | | List<TicketRegistration> ticketRegistrations = purchaseLedgers.stream() |
| | |
| | | .map(PaymentRegistration::getCurrentPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // 核心过滤逻辑:当paymentAmount和invoiceAmount同时为0时,跳过该记录 |
| | | if (BigDecimal.ZERO.compareTo(paymentAmount) == 0 && BigDecimal.ZERO.compareTo(invoiceAmount) == 0) { |
| | | continue; // 跳过当前供应商,不加入结果集 |
| | | } |
| | | |
| | | // 详情分页处理 |
| | | detailPageNum = detailPageNum != null ? detailPageNum : 1; |
| | |
| | | result.add(res); |
| | | } |
| | | |
| | | // 修正总条数:过滤后需要重新计算总条数 |
| | | resultPage.setTotal(result.size()); |
| | | resultPage.setRecords(result); |
| | | return resultPage; |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | | @Override |
| | | public int delPaymentRegistration(Long id) { |
| | | // PaymentRegistration paymentRegistration = paymentRegistrationMapper.selectById(id); |
| | | // TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(paymentRegistration.getTicketRegistrationId()); |
| | | // if (ticketRegistration != null) { |
| | | // ticketRegistration.setPaymentAmountTotal(ticketRegistration.getPaymentAmountTotal().subtract(paymentRegistration.getCurrentPaymentAmount())); |
| | | // ticketRegistration.setUnPaymentAmountTotal(ticketRegistration.getUnPaymentAmountTotal().add(paymentRegistration.getCurrentPaymentAmount())); |
| | | // ticketRegistrationMapper.updateById(ticketRegistration); |
| | | // } |
| | | |
| | | return paymentRegistrationMapper.deleteById(id); |
| | | } |
| | | |
| | | // 批量查询采购台账(当月) |
| | | private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) { |
| | | LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>(); |