| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | return iPage; |
| | | } |
| | | for (SalesLedger salesLedger : iPage.getRecords()) { |
| | | boolean existFlag = false; |
| | | BigDecimal noInvoiceAmountTotal = BigDecimal.ZERO; |
| | | BigDecimal invoiceTotal = BigDecimal.ZERO; |
| | | for (InvoiceLedgerDto invoiceLedgerDto : invoiceLedgerDtoList) { |
| | | if (salesLedger.getId().intValue() == invoiceLedgerDto.getSalesLedgerId()) { |
| | | BigDecimal noInvoiceAmountTotal = salesLedger.getContractAmount().subtract(invoiceLedgerDto.getInvoiceTotal()); |
| | | salesLedger.setNoInvoiceAmountTotal(noInvoiceAmountTotal); |
| | | noInvoiceAmountTotal = salesLedger.getContractAmount().subtract(invoiceLedgerDto.getInvoiceTotal()); |
| | | invoiceTotal = invoiceLedgerDto.getInvoiceTotal(); |
| | | existFlag = true; |
| | | break; |
| | | } |
| | | } |
| | | if(existFlag){ |
| | | salesLedger.setNoInvoiceAmountTotal(noInvoiceAmountTotal); |
| | | }else { |
| | | salesLedger.setNoInvoiceAmountTotal(salesLedger.getContractAmount()); |
| | | } |
| | | salesLedger.setInvoiceTotal(invoiceTotal); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(salesLedgerDto.getStatus())) { |
| | | if (salesLedgerDto.getStatus()) { |
| | | iPage.getRecords().removeIf(salesLedger -> Objects.equals(salesLedger.getNoInvoiceAmountTotal(), new BigDecimal("0.00"))); |
| | | } |
| | | } |
| | | return iPage; |
| | | } |