| | |
| | | import com.ruoyi.sales.excel.InvoiceLedgerExcelDto; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerFileMapper; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerMapper; |
| | | import com.ruoyi.sales.mapper.ReceiptPaymentMapper; |
| | | import com.ruoyi.sales.pojo.InvoiceLedger; |
| | | import com.ruoyi.sales.pojo.InvoiceLedgerFile; |
| | | import com.ruoyi.sales.pojo.ReceiptPayment; |
| | | import com.ruoyi.sales.service.InvoiceLedgerService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | |
| | | |
| | | @Autowired |
| | | private InvoiceLedgerFileMapper invoiceLedgerFileMapper; |
| | | |
| | | @Autowired |
| | | private ReceiptPaymentMapper receiptPaymentMapper; |
| | | |
| | | /** |
| | | * 开票台账新增 |
| | |
| | | return invoiceLedgerMapper.invoiceLedgerList(invoiceLedgerDto); |
| | | } |
| | | |
| | | /** |
| | | * 客户销售记录 |
| | | * @param page |
| | | * @param invoiceLedgerDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<InvoiceLedgerDto> invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | IPage<InvoiceLedgerDto> invoiceLedgerDtoIPage = invoiceLedgerMapper.invoiceLedgerSalesAccount(page, invoiceLedgerDto); |
| | | for (InvoiceLedgerDto record : invoiceLedgerDtoIPage.getRecords()) { |
| | | QueryWrapper<ReceiptPayment> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("customer_id", record.getCustomerId()); |
| | | List<ReceiptPayment> receiptPaymentList = receiptPaymentMapper.selectList(queryWrapper); |
| | | BigDecimal totalAmount = BigDecimal.ZERO; |
| | | if(!CollectionUtils.isEmpty(receiptPaymentList)){ |
| | | for (ReceiptPayment receiptPayment : receiptPaymentList) { |
| | | totalAmount = totalAmount.add(receiptPayment.getInvoiceAmount()); |
| | | } |
| | | } |
| | | BigDecimal unReceiptPaymentAmount = record.getInvoiceAmount().subtract(totalAmount); |
| | | record.setReceiptPaymentAmount(totalAmount); |
| | | record.setUnReceiptPaymentAmount(unReceiptPaymentAmount); |
| | | } |
| | | return invoiceLedgerDtoIPage; |
| | | } |
| | | |
| | | } |