From 726f9fd86e790386732906769c4ee5f9c3e3087b Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期三, 14 一月 2026 11:08:15 +0800
Subject: [PATCH] yys 付款,回款改为绑定台账,产品

---
 src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java |   10 ++++++----
 src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java                      |    5 +++++
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml                      |    1 +
 src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java                    |    3 +--
 src/main/resources/mapper/quality/QualityTestStandardParamMapper.xml              |    2 +-
 5 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java b/src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java
index 5e69409..803d600 100644
--- a/src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java
+++ b/src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java
@@ -39,7 +39,7 @@
     /**
      * 閲囪喘璁㈠崟浜у搧id
      */
-    private Long saleLedgerProductId;
+    private Long salesLedgerProductId;
 
     /**
      * 渚涘簲鍟唅d
@@ -71,7 +71,6 @@
     /**
      * 鐧昏浜�
      */
-    @TableField(fill = FieldFill.INSERT)
     private Long registrantId;
 
     // 绉熸埛id
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
index dd3a341..91ec8a5 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
@@ -98,6 +98,7 @@
      */
     @Override
     public int insertPaymentRegistration(List<PaymentRegistration> paymentRegistrationList) {
+        Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
         for (PaymentRegistration paymentRegistration : paymentRegistrationList) {
             PaymentRegistration byId = paymentRegistration;
             if (!ObjectUtils.isEmpty(paymentRegistration.getId())){
@@ -106,15 +107,16 @@
             PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(paymentRegistration.getPurchaseLedgerId());
             if(null==purchaseLedger) throw new RuntimeException("鏈壘鍒伴噰璐崟");
             // 宸插洖娆鹃噾棰�
-            SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(paymentRegistration.getSaleLedgerProductId());
+            SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(paymentRegistration.getSalesLedgerProductId());
             if(null==salesLedgerProduct) throw new RuntimeException("鏈壘鍒伴噰璐崟浜у搧");
-            if (salesLedgerProduct.getPendingInvoiceTotal().compareTo(paymentRegistration.getCurrentPaymentAmount())<0){
+            if (salesLedgerProduct.getPendingTicketsTotal().compareTo(paymentRegistration.getCurrentPaymentAmount())<0){
                 throw new RuntimeException("鏈鍥炴閲戦涓嶈兘澶т簬寰呭洖娆鹃噾棰�");
             }
             paymentRegistration.setCreateTime(DateUtils.getNowDate());
             paymentRegistration.setUpdateTime(DateUtils.getNowDate());
-            salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().add(paymentRegistration.getCurrentPaymentAmount()));
-            salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal()));
+            paymentRegistration.setRegistrantId(userId);
+            salesLedgerProduct.setTicketsTotal(salesLedgerProduct.getTicketsTotal().add(paymentRegistration.getCurrentPaymentAmount()));
+            salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getTicketsTotal()));
             paymentRegistrationMapper.insert(paymentRegistration);
             salesLedgerProductMapper.updateById(salesLedgerProduct);
         }
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java
index ea22453..3da8364 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java
@@ -50,4 +50,9 @@
     @Excel(name = "渚涘簲鍟嗗悕绉�")
     private String supplierName;
 
+    /**
+     * 渚涘簲鍟唅d
+     */
+    private Long supplierId;
+
 }
diff --git a/src/main/resources/mapper/quality/QualityTestStandardParamMapper.xml b/src/main/resources/mapper/quality/QualityTestStandardParamMapper.xml
index 80adb27..837bc26 100644
--- a/src/main/resources/mapper/quality/QualityTestStandardParamMapper.xml
+++ b/src/main/resources/mapper/quality/QualityTestStandardParamMapper.xml
@@ -21,7 +21,7 @@
         select t1.* from quality_test_standard_param t1
         left join quality_test_standard t2 on t1.test_standard_id = t2.id
         left join quality_test_standard_binding t3 on t2.id = t3.test_standard_id
-        where product_id = #{productId}
+        where t3.product_id = #{productId}
     </select>
 
 </mapper>
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 626c5a2..a74033f 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -68,6 +68,7 @@
         select slp.*,
         sl.project_name,
         sl.supplier_name,
+        sl.supplier_id,
         sl.sales_contract_no,
         sl.purchase_contract_number
         from sales_ledger_product slp

--
Gitblit v1.9.3