From e595e12fa1ec230ec866dadbe13779765ae6d075 Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期一, 09 六月 2025 17:24:10 +0800 Subject: [PATCH] 开票台账删除 --- src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java | 58 ++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 40 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java index 8d40b1c..0d6cf08 100644 --- a/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java +++ b/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java @@ -10,13 +10,9 @@ import com.ruoyi.sales.dto.InvoiceLedgerDto; import com.ruoyi.sales.dto.InvoiceRegistrationProductDto; import com.ruoyi.sales.excel.InvoiceLedgerExcelDto; -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.mapper.*; 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; @@ -33,7 +29,6 @@ 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; @@ -53,6 +48,9 @@ @Autowired private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; + + @Autowired + private ReceiptPaymentMapper receiptPaymentMapper; /** * 寮�绁ㄥ彴璐︽柊澧� @@ -162,13 +160,13 @@ /** * 闄勪欢涓嬭浇 * @param response - * @param invoiceLedgerDto + * @param invoiceRegistrationProductDto * @return */ @Override - public void invoiceLedgerExport(HttpServletResponse response, InvoiceLedgerDto invoiceLedgerDto) { - List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoiceLedgerList(invoiceLedgerDto); - List<InvoiceLedgerExcelDto> invoiceLedgerExcelDtoList = invoiceLedgerDtoList.stream().map(item -> { + public void invoiceLedgerExport(HttpServletResponse response, InvoiceRegistrationProductDto invoiceRegistrationProductDto) { + List<InvoiceRegistrationProductDto> invoiceRegistrationProductList = invoiceRegistrationProductMapper.invoiceRegistrationProductList(invoiceRegistrationProductDto); + List<InvoiceLedgerExcelDto> invoiceLedgerExcelDtoList = invoiceRegistrationProductList.stream().map(item -> { InvoiceLedgerExcelDto invoiceLedgerExcelDto = new InvoiceLedgerExcelDto(); BeanUtils.copyProperties(item, invoiceLedgerExcelDto); return invoiceLedgerExcelDto; @@ -214,11 +212,17 @@ 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); }); } @@ -258,13 +262,12 @@ // 鎵ц鏌ヨ骞惰绠楁�诲拰 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; } /** @@ -302,4 +305,23 @@ return invoiceRegistrationProductDto; } + /** + * 寮�绁ㄥ彴璐﹀垹闄� + * @param invoiceRegistrationProductId + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void delInvoiceLedger(Integer invoiceRegistrationProductId) { + // 鍒ゆ柇鏄惁鏈夊洖娆捐褰� + List<ReceiptPayment> receiptPaymentList = receiptPaymentMapper.receiptPaymentListByProdRegId(invoiceRegistrationProductId); + if(!CollectionUtils.isEmpty(receiptPaymentList)){ + throw new RuntimeException("璇峰厛鍒犻櫎鍥炴璁板綍"); + } + // 鍒犻櫎寮�绁ㄥ彴璐� + + // 鍒犻櫎寮�绁ㄧ櫥璁� + // 鍥炴粴宸插紑绁ㄦ暟閲� + } + } -- Gitblit v1.9.3