liyong
18 小时以前 e1b5e5a884384d2b2058c9e02efe626e4f9675b4
src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
@@ -138,7 +138,9 @@
     */
    @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()));
@@ -431,6 +433,37 @@
        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<>();