From 1a70e2bd4bdd39070b9a0d845fc15eae7f3ee517 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 13 二月 2026 14:29:02 +0800
Subject: [PATCH] 新增回款后,收入类型为回款收入;收入金额为回款金额

---
 src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
index 7f9b4cd..b667be2 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
@@ -69,8 +69,8 @@
             // 宸插洖娆鹃噾棰�
             SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(receiptPayment.getSalesLedgerProductId());
             if(null==salesLedgerProduct) throw new RuntimeException("鏈壘鍒伴攢鍞崟浜у搧");
-            if (salesLedgerProduct.getPendingInvoiceTotal().compareTo(receiptPayment.getReceiptPaymentAmount())<0){
-                throw new RuntimeException("鏈鍥炴閲戦涓嶈兘澶т簬寰呭洖娆鹃噾棰�");
+            if (salesLedgerProduct.getPendingInvoiceTotal().add(receiptPayment.getReceiptPaymentAmount()).compareTo(byId.getReceiptPaymentAmount())<0){
+                throw new RuntimeException("鏈鍥炴閲戦涓嶈兘澶т簬寰呭洖娆鹃噾棰�+鍥炴閲戦");
             }
             if(null==receiptPayment.getId()){
                 salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().add(receiptPayment.getReceiptPaymentAmount()));
@@ -79,9 +79,9 @@
                 // 澧炲姞璐㈠姟鏀跺叆璁板綍
                 AccountIncome accountIncome = new AccountIncome();
                 accountIncome.setIncomeDate(salesLedger.getEntryDate());
-                accountIncome.setIncomeType("0");
+                accountIncome.setIncomeType("3");
                 accountIncome.setCustomerName(salesLedger.getCustomerName());
-                accountIncome.setIncomeMoney(salesLedger.getContractAmount());
+                accountIncome.setIncomeMoney(receiptPayment.getReceiptPaymentAmount());
                 accountIncome.setIncomeMethod("0");
                 accountIncome.setInputTime(new Date());
                 accountIncome.setInputUser(salesLedger.getEntryPerson());
@@ -90,7 +90,7 @@
                 accountIncome.setBusinessType(1);
                 accountIncomeService.save(accountIncome);
             }else {
-                BigDecimal subtract = receiptPayment.getReceiptPaymentAmount().subtract(byId.getReceiptPaymentAmount());
+                BigDecimal subtract = byId.getReceiptPaymentAmount().subtract(receiptPayment.getReceiptPaymentAmount());
                 salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().add(subtract));
                 salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal()));
                 receiptPayment.setReceiptPaymentAmount(byId.getReceiptPaymentAmount());

--
Gitblit v1.9.3