From 00083c26fde57c0165427ae4cc712d24596fdbc6 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 21 五月 2026 11:09:46 +0800
Subject: [PATCH] refactor(purchase): 删除payment_registration 付款登记 invoice_purchase 发票信息 ticket_registration 来票登记 receipt_payment 回款登记 product_record 采购台账开票记录
---
src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java | 68 ++++++++++++----------------------
1 files changed, 24 insertions(+), 44 deletions(-)
diff --git a/src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java b/src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java
index 17b6868..c25aeed 100644
--- a/src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java
+++ b/src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java
@@ -5,12 +5,8 @@
import com.ruoyi.ai.context.AiSessionUserContext;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.purchase.mapper.InvoicePurchaseMapper;
-import com.ruoyi.purchase.mapper.PaymentRegistrationMapper;
import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
-import com.ruoyi.purchase.pojo.InvoicePurchase;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
import com.ruoyi.procurementrecord.mapper.InboundManagementMapper;
@@ -27,7 +23,6 @@
import java.math.BigDecimal;
import java.time.LocalDate;
-import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
@@ -46,8 +41,6 @@
private static final int MAX_LIMIT = 30;
private final PurchaseLedgerMapper purchaseLedgerMapper;
- private final PaymentRegistrationMapper paymentRegistrationMapper;
- private final InvoicePurchaseMapper invoicePurchaseMapper;
private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
private final SalesLedgerProductMapper salesLedgerProductMapper;
private final ProcurementRecordMapper procurementRecordMapper;
@@ -55,16 +48,12 @@
private final AiSessionUserContext aiSessionUserContext;
public PurchaseAgentTools(PurchaseLedgerMapper purchaseLedgerMapper,
- PaymentRegistrationMapper paymentRegistrationMapper,
- InvoicePurchaseMapper invoicePurchaseMapper,
PurchaseReturnOrdersMapper purchaseReturnOrdersMapper,
SalesLedgerProductMapper salesLedgerProductMapper,
ProcurementRecordMapper procurementRecordMapper,
InboundManagementMapper inboundManagementMapper,
AiSessionUserContext aiSessionUserContext) {
this.purchaseLedgerMapper = purchaseLedgerMapper;
- this.paymentRegistrationMapper = paymentRegistrationMapper;
- this.invoicePurchaseMapper = invoicePurchaseMapper;
this.purchaseReturnOrdersMapper = purchaseReturnOrdersMapper;
this.salesLedgerProductMapper = salesLedgerProductMapper;
this.procurementRecordMapper = procurementRecordMapper;
@@ -130,22 +119,24 @@
DateRange range = resolveDateRange(startDate, endDate, timeRange);
List<PurchaseLedger> ledgers = queryLedgers(loginUser, range);
- List<PaymentRegistration> payments = queryPayments(loginUser, range);
- List<InvoicePurchase> invoices = queryInvoices(loginUser, range);
+// List<PaymentRegistration> payments = queryPayments(loginUser, range);
+// List<InvoicePurchase> invoices = queryInvoices(loginUser, range);
List<PurchaseReturnOrders> returns = queryReturns(loginUser, range);
BigDecimal contractAmount = ledgers.stream()
.map(PurchaseLedger::getContractAmount)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
- BigDecimal paymentAmount = payments.stream()
- .map(PaymentRegistration::getCurrentPaymentAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- BigDecimal invoiceAmount = invoices.stream()
- .map(InvoicePurchase::getInvoiceAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal paymentAmount = BigDecimal.ZERO;
+// BigDecimal paymentAmount = payments.stream()
+// .map(PaymentRegistration::getCurrentPaymentAmount)
+// .filter(Objects::nonNull)
+// .reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal invoiceAmount = BigDecimal.ZERO;
+// BigDecimal invoiceAmount = invoices.stream()
+// .map(InvoicePurchase::getInvoiceAmount)
+// .filter(Objects::nonNull)
+// .reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal returnAmount = returns.stream()
.map(PurchaseReturnOrders::getTotalAmount)
.filter(Objects::nonNull)
@@ -156,8 +147,10 @@
summary.put("startDate", range.start().toString());
summary.put("endDate", range.end().toString());
summary.put("ledgerCount", ledgers.size());
- summary.put("paymentCount", payments.size());
- summary.put("invoiceCount", invoices.size());
+ summary.put("paymentCount", 0);
+// summary.put("paymentCount", payments.size());
+// summary.put("invoiceCount", invoices.size());
+ summary.put("invoiceCount", 0);
summary.put("returnCount", returns.size());
summary.put("contractAmount", contractAmount);
summary.put("paymentAmount", paymentAmount);
@@ -420,13 +413,14 @@
}
private BigDecimal sumPaymentAmount(LoginUser loginUser, Long purchaseLedgerId) {
- LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>();
- applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId);
- wrapper.eq(PaymentRegistration::getPurchaseLedgerId, purchaseLedgerId);
- return defaultList(paymentRegistrationMapper.selectList(wrapper)).stream()
- .map(PaymentRegistration::getCurrentPaymentAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
+// LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>();
+// applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId);
+// wrapper.eq(PaymentRegistration::getPurchaseLedgerId, purchaseLedgerId);
+// return defaultList(paymentRegistrationMapper.selectList(wrapper)).stream()
+// .map(PaymentRegistration::getCurrentPaymentAmount)
+// .filter(Objects::nonNull)
+// .reduce(BigDecimal.ZERO, BigDecimal::add);
+ return BigDecimal.ZERO;
}
private Map<String, Object> toReturnItem(PurchaseReturnOrders item) {
@@ -446,21 +440,7 @@
return value == null ? BigDecimal.ZERO : value;
}
- private List<PaymentRegistration> queryPayments(LoginUser loginUser, DateRange range) {
- LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>();
- applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId);
- wrapper.ge(PaymentRegistration::getPaymentDate, toDate(range.start()))
- .lt(PaymentRegistration::getPaymentDate, toExclusiveEndDate(range.end()));
- return defaultList(paymentRegistrationMapper.selectList(wrapper));
- }
- private List<InvoicePurchase> queryInvoices(LoginUser loginUser, DateRange range) {
- LambdaQueryWrapper<InvoicePurchase> wrapper = new LambdaQueryWrapper<>();
- applyTenantFilter(wrapper, loginUser.getTenantId(), InvoicePurchase::getTenantId);
- wrapper.ge(InvoicePurchase::getIssueDate, range.start())
- .le(InvoicePurchase::getIssueDate, range.end());
- return defaultList(invoicePurchaseMapper.selectList(wrapper));
- }
private List<PurchaseReturnOrders> queryReturns(LoginUser loginUser, DateRange range) {
LambdaQueryWrapper<PurchaseReturnOrders> wrapper = new LambdaQueryWrapper<>();
--
Gitblit v1.9.3