| | |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerFileMapper; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerMapper; |
| | | import com.ruoyi.sales.mapper.InvoiceRegistrationProductMapper; |
| | | import com.ruoyi.sales.mapper.ReceiptPaymentMapper; |
| | | import com.ruoyi.sales.pojo.InvoiceLedger; |
| | | import com.ruoyi.sales.pojo.InvoiceLedgerFile; |
| | | import com.ruoyi.sales.pojo.InvoiceRegistrationProduct; |
| | | import com.ruoyi.sales.pojo.ReceiptPayment; |
| | | import com.ruoyi.sales.service.InvoiceLedgerService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.YearMonth; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | |
| | | if(CollectionUtils.isEmpty(invoiceLedgerDto.getFileList())){ |
| | | throw new RuntimeException("缺少文件信息"); |
| | | } |
| | | QueryWrapper<InvoiceLedger> ledgerQueryWrapper = new QueryWrapper<>(); |
| | | ledgerQueryWrapper.eq("invoice_registration_product_id", invoiceLedgerDto.getId()); |
| | | InvoiceLedger invoiceLedger = invoiceLedgerMapper.selectOne(ledgerQueryWrapper); |
| | | if(ObjectUtils.isEmpty(invoiceLedger)){ |
| | | throw new RuntimeException("开票台账未登记"); |
| | | } |
| | | List<FileVo> fileList = invoiceLedgerDto.getFileList(); |
| | | fileList.forEach(fileVo -> { |
| | | InvoiceLedgerFile invoiceLedgerFile = new InvoiceLedgerFile(); |
| | | BeanUtils.copyProperties(fileVo, invoiceLedgerFile); |
| | | invoiceLedgerFile.setInvoiceLedgerId(invoiceLedgerDto.getId()); |
| | | invoiceLedgerFile.setInvoiceLedgerId(invoiceLedger.getId()); |
| | | invoiceLedgerFileMapper.insert(invoiceLedgerFile); |
| | | }); |
| | | } |
| | |
| | | @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; |
| | | } |
| | | |
| | |
| | | // 执行查询并计算总和 |
| | | List<InvoiceLedger> invoiceLedgers = invoiceLedgerMapper.selectList(queryWrapper); |
| | | |
| | | // BigDecimal totalContractAmount = invoiceLedgers.stream() |
| | | // .map(InvoiceLedger::getInvoiceAmount) |
| | | // .filter(Objects::nonNull) |
| | | // .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // |
| | | // return totalContractAmount; |
| | | return null; |
| | | BigDecimal totalContractAmount = invoiceLedgers.stream() |
| | | .map(InvoiceLedger::getInvoiceTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | return totalContractAmount; |
| | | } |
| | | |
| | | /** |