From 13fd47c5aa585b74bfc8b77722bde3f7a2399587 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 21 五月 2026 10:26:42 +0800
Subject: [PATCH] refactor(invoice): 删除invoice_registration invoice_registration_product invoice_ledger invoice_ledger_file
---
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java | 52 +---------------------------------------------------
1 files changed, 1 insertions(+), 51 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
index ceb3702..603fd22 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -13,9 +13,7 @@
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
import com.ruoyi.sales.dto.SalesLedgerDto;
-import com.ruoyi.sales.mapper.InvoiceLedgerMapper;
import com.ruoyi.sales.mapper.ReceiptPaymentMapper;
import com.ruoyi.sales.pojo.ReceiptPayment;
import com.ruoyi.sales.pojo.SalesLedger;
@@ -57,7 +55,6 @@
private ISalesLedgerService salesLedgerService;
private ICommonFileService commonFileService;
- private InvoiceLedgerMapper invoiceLedgerMapper;
private ReceiptPaymentMapper receiptPaymentMapper;
private final FileUtil fileUtil;
@@ -122,20 +119,6 @@
if(CollectionUtils.isEmpty(list)){
return getDataTable(list);
}
- List<Long> salesLedgerIds = list.stream().map(SalesLedger::getId).collect(Collectors.toList());
- List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoicedTotal(salesLedgerIds);
- if(CollectionUtils.isEmpty(invoiceLedgerDtoList)){
- return getDataTable(list);
- }
- for (SalesLedger salesLedger : list) {
- for (InvoiceLedgerDto invoiceLedgerDto : invoiceLedgerDtoList) {
- if (salesLedger.getId().intValue() == invoiceLedgerDto.getSalesLedgerId()) {
- BigDecimal noInvoiceAmountTotal = salesLedger.getContractAmount().subtract(invoiceLedgerDto.getInvoiceTotal());
- salesLedger.setNoInvoiceAmountTotal(noInvoiceAmountTotal);
- }
- }
- }
-
return getDataTable(list);
}
@@ -267,20 +250,6 @@
// 鑾峰彇褰撳墠椤垫墍鏈夊彴璐﹁褰曠殑 ID 闆嗗悎
List<Long> salesLedgerIds = iPage.getRecords().stream().map(SalesLedger::getId).collect(Collectors.toList());
- // 鏌ヨ鍙戠エ淇℃伅鐨勫凡寮�绁ㄩ噾棰�
- List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoicedTotal(salesLedgerIds);
- if (CollectionUtils.isEmpty(invoiceLedgerDtoList)) {
- invoiceLedgerDtoList = Collections.emptyList();
- }
-
- // 杞崲鍙戠エ鏁版嵁, key 涓哄彴璐D, value 涓鸿鍙拌处鐨勬�诲紑绁ㄩ噾棰�
- Map<Long, BigDecimal> invoiceTotals = invoiceLedgerDtoList.stream()
- .filter(dto -> dto.getSalesLedgerId() != null && dto.getInvoiceTotal() != null)
- .collect(Collectors.toMap(
- dto -> dto.getSalesLedgerId().longValue(),
- InvoiceLedgerDto::getInvoiceTotal,
- BigDecimal::add // 瀛樺湪閲嶅ID鎵ц绱姞
- ));
// 鏌ヨ鍥炴/浠樻璁板綍
List<ReceiptPayment> receiptPayments = Collections.emptyList();
@@ -305,30 +274,11 @@
// 鍚堝悓鎬婚噾棰�
BigDecimal contractAmount = salesLedgerVo.getContractAmount() == null ? BigDecimal.ZERO : salesLedgerVo.getContractAmount();
// 寮�绁ㄦ�婚鍜屽洖娆炬�婚
- BigDecimal invoiceTotal = invoiceTotals.getOrDefault(ledgerId, BigDecimal.ZERO);
BigDecimal receiptPaymentAmountTotal = receiptTotals.getOrDefault(ledgerId, BigDecimal.ZERO);
- // 鏈紑绁ㄩ噾棰� = 鍚堝悓閲戦 - 宸插紑绁ㄩ噾棰�
- BigDecimal noInvoiceAmountTotal = contractAmount.subtract(invoiceTotal);
- if (noInvoiceAmountTotal.compareTo(BigDecimal.ZERO) < 0) {
- noInvoiceAmountTotal = BigDecimal.ZERO;
- }
-
- // 寰呭洖娆鹃噾棰� = 宸插紑绁ㄩ噾棰� - 宸插洖娆鹃噾棰�
- BigDecimal noReceiptPaymentAmountTotal = invoiceTotal.subtract(receiptPaymentAmountTotal);
- if (noReceiptPaymentAmountTotal.compareTo(BigDecimal.ZERO) < 0) {
- noReceiptPaymentAmountTotal = BigDecimal.ZERO;
- }
-
- salesLedgerVo.setNoInvoiceAmountTotal(noInvoiceAmountTotal);
- salesLedgerVo.setInvoiceTotal(invoiceTotal);
- salesLedgerVo.setReceiptPaymentAmountTotal(receiptPaymentAmountTotal);
- salesLedgerVo.setNoReceiptAmount(noReceiptPaymentAmountTotal);
-
// 濡傛灉宸茬粡鏈夎繃寮�绁ㄦ垨鍥炴鎿嶄綔,鍒欎笉鍏佽缂栬緫
- boolean hasInvoiceOperation = invoiceTotal.compareTo(BigDecimal.ZERO) > 0;
boolean hasReceiptOperation = receiptPaymentAmountTotal.compareTo(BigDecimal.ZERO) > 0;
- salesLedgerVo.setIsEdit(!(hasInvoiceOperation || hasReceiptOperation));
+ salesLedgerVo.setIsEdit(hasReceiptOperation);
salesLedgerVo.setStorageBlobVOs(fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.FILE, RecordTypeEnum.SALES_LEDGER, ledgerId));
}
--
Gitblit v1.9.3